Refactors code to produce fim service inundation sublayers that now include the "model_version" field #949
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refs #824
Additions
Removals
Core/LAMBDA/viz_functions/viz_publish_service/services/catfim
folder (this was an R&D effort that has been abandonded)Core/LAMBDA/viz_functions/viz_stage_based_catfim
folder (this was an R&D effort that has been abandonded)Changes
Core/EC2/RDSBastion/main.tf
fim_version
variableCore/main.tf
hand_version
(read from Terraform environment file) as variable to viz-functions module (i.e. Core/LAMBDA/viz_functions/main.tf)Core/LAMBDA/layers/viz_lambda_shared_funcs/python/viz_classes.py
run_sql_file_in_db
toexecute_sql
for required use inCore/LAMBDA/viz_functions/viz_fim_data_prep/lambda_function.py (see below)
run_sql_in_db
tosql_to_dataframe
because I've always wanted to for clarity's sake, so why not now when I had to refactor the other related function aboveCore/LAMBDA/layers/viz_lambda_shared_funcs/python/viz_lambda_shared_funcs.py
Core/LAMBDA/rnr_functions/rnr_domain_generator/lambda_function.py
run_sql_in_db
tosql_to_dataframe
Core/LAMBDA/viz_functions/main.tf
hand_version
variable to viz_db_postprocess Lambda (i.e. Core/LAMBDA/viz_functions/viz_db_postprocess_sql/lambda_function.py) and image_based LAMBDAS module (i.e. Core/LAMBDA/viz_functions/image_based/main.tf).Core/LAMBDA/viz_functions/image_based/main.tf
hand_version
in addition to originally acceptingfim_version
and dissemenates it to viz_hand_fim_processing Lambda (i.e. Core/LAMBDA/viz_functions/image_based/viz_hand_fim_processing/lambda_function.py) asHAND_PREFIX
(renamed fromFIM_PREFIX
to be more clear) andFIM_VERSION
environment variables.FIM_BUCKET
envrionment variable of the viz_hand_fim_processing Lambda was also renamed toHAND_BUCKET
for clarity.Core/LAMBDA/viz_functions/image_based/viz_hand_fim_processing/lambda_function.py
FIM_*
variables toHAND_*
for clarity.hand_version
in addition tofim_version
to final pandas dataframe that gets uploaded to the product's {db_fim_table}.Core/LAMBDA/viz_functions/viz_db_postprocess_sql/lambda_function.py
FIM_VERSION
from environment (as passed along fromCore/LAMBDA/viz_functions/main.tf
) and injects it into fim_caching_template SQL files.Core/LAMBDA/viz_functions/viz_db_postprocess_sql/viz_db_postprocess_sql/fim_caching_templates
:0_create_or_truncate_tables.sql
model_version
to column schema of {db_fim_table}fim_version
andreference_time
columns tovarchar
2a_query_fim_cache-ras2fim.sql
fim_version
is now passed in from template variable, rather than pulling from table2b_query_fim_cache-hand.sql
fim_version
is now passed in from template variable, rather than pulling from tablefim_cache
schema will be renamed tohandfim_cache
3_add_any_processed_hand_fim_back_to_cache.sql
GROUP BY
query modified to useDISTINCT
for clarity and optimizationfim_cache
schema will be renamed tohandfim_cache
fim_version
will be renamed tomodel_version
inhandfim_cache.hydrotable_cached_max
table4_create_fim_config_publish_table.sql
model_version
column added to query that produces {db_publish_table}5_dummy_rows_for_wpod_service_monitor.sql
model_version
is now included in dummy row populationCore/LAMBDA/viz_functions/viz_db_postprocess_sql/fim_configs/rfc_based_5day_max_inundation.sql
model_version
added to query that produced publish.rfc_based_5day_max_inundation tableCore/LAMBDA/viz_functions/viz_fim_data_prep/lambda_function.py
FIM_VERSION
environment variablerun_sql_file_in_db
toexecute_sql
(refactored to allow for template variable injection)Core/LAMBDA/viz_functions/viz_fim_data_prep/reference_preprocessing_sql/rf_*_inundation.sql
fim_version
from as template variable (passed down from Terraform)Core/LAMBDA/viz_functions/viz_publish_service/services/*/*.mapx
model_version
into relevant service sublayers, from including it in the "sqlQuery" and adding entries for it in both thefeatureTable
->fieldDescriptions
andqueryFields
lists.length
property in thequeryFields
list entries for both thefim_version
andmodel_version
fields across all.mapx
files. Uses 12 forfim_version
and 20 formodel_version
External Dependencies
The following dependencies are maintained by us, the HydroVIS team, but are maintained external to this code base. Thus, these constitute additional manual work that will need to be performed before the code in this PR will run appropriately.
fim_version
andhand_version
must be provided as Terraform deployment environment variables (as stored in the owp-cloud-aws-hydrovis repository). Thehand_version
variable will now store whatfim_version
previously stored (since "fim_version" previously was an alias for "hand_version"). Thefim_version
now represent a composite or package FIM version, one number to account for both the HAND version and Ras2FIM version.fim_cache
schema needs to be renamed tohandfim_cache
. This change is to clearly distinguish it from ras2fim (since both are fim)fim_version column of the
hydrotable_cached_maxtable needs to be renamed to
model_version`