Skip to content

Commit

Permalink
Merge pull request #162 from OpenDRR/update_social_fabric_jan2022
Browse files Browse the repository at this point in the history
Update social fabric jan2022
  • Loading branch information
wkhchow authored Jan 28, 2022
2 parents 645d4da + 0cb477e commit 26a90b8
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions python/add_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ read_github_token() {
# from the OpenDRR/model-factory repository
get_model_factory_scripts() {
# TODO: Make this more robust
curl -L -o model-factory.tar.gz https://github.com/OpenDRR/model-factory/archive/refs/tags/v1.3.0.tar.gz
curl -L -o model-factory.tar.gz https://github.com/OpenDRR/model-factory/archive/refs/tags/v1.3.1.tar.gz
tar -xf model-factory.tar.gz

# Copy model-factory scripts to working directory
# TODO: Find ways to keep these scripts in their place without copying them all to WORKDIR
RUN cp model-factory-1.3.0/scripts/*.* .
RUN cp model-factory-1.3.1/scripts/*.* .
#rm -rf model-factory
}

Expand Down Expand Up @@ -550,16 +550,19 @@ import_census_data() {
import_sovi() {
LOG "## Importing Sovi"
# Need to source tables
# RUN fetch_csv openquake-inputs \
# social-vulnerability/social-vulnerability-census.csv
# RUN fetch_csv openquake-inputs \
# social-vulnerability/social-vulnerability-index.csv
# RUN fetch_csv openquake-inputs \
# social-vulnerability/sovi_thresholds_2021.csv
RUN fetch_csv openquake-inputs \
social-vulnerability/social-vulnerability-census.csv
RUN fetch_csv openquake-inputs \
social-vulnerability/social-vulnerability-index.csv
RUN fetch_csv openquake-inputs \
social-vulnerability/sovi_thresholds_2021.csv
social-vulnerability/sovi_sauid_nov2021.csv

RUN run_psql Create_table_sovi_index_canada_v2.sql
RUN run_psql Create_table_sovi_census_canada.sql
RUN run_psql Create_table_sovi_thresholds.sql
# RUN run_psql Create_table_sovi_index_canada_v2.sql
# RUN run_psql Create_table_sovi_census_canada.sql
# RUN run_psql Create_table_sovi_thresholds.sql
RUN run_psql Create_table_sovi_sauid.sql
}

import_luts() {
Expand Down Expand Up @@ -847,6 +850,11 @@ create_scenario_risk_master_tables() {
RUN run_psql Create_scenario_risk_master_tables.sql
}

create_database_check() {
LOG "## Create table to check row counts for each table/view"
RUN run_psql Database_check.sql
}

############################################################################################
############ Define "Import Data from PostGIS to Elasticsearch" functions ############
############################################################################################
Expand Down Expand Up @@ -1020,6 +1028,7 @@ main() {
RUN import_shakemap
RUN import_rupture_model
RUN create_scenario_risk_master_tables
RUN create_database_check


LOG "# Import data from PostGIS to Elasticsearch"
Expand Down

0 comments on commit 26a90b8

Please sign in to comment.