Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BACKEND: Adds CDC_WISQARS_YOUTH dataset #2865

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions airflow/dags/cdc_wisqars_youth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Ignore the Airflow module, it is installed in both dev and prod
from airflow import DAG # type: ignore
from airflow.utils.dates import days_ago # type: ignore
import util

_CDC_WISQARS_YOUTH_WORKFLOW_ID = "CDC_WISQARS_YOUTH_DATA"
_CDC_WISQARS_YOUTH_DATASET_NAME = "cdc_wisqars_youth_data"

default_args = {
'start_date': days_ago(0),
}

data_ingestion_dag = DAG(
'cdc_wisqars_youth_ingestion_dag',
default_args=default_args,
schedule_interval=None,
description='Ingestion configuration for CDC_WISQARS Youth',
)

# RACE NATIONAL
cdc_wisqars_youth_bq_payload_race_national = util.generate_bq_payload(
_CDC_WISQARS_YOUTH_WORKFLOW_ID,
_CDC_WISQARS_YOUTH_DATASET_NAME,
demographic='race_and_ethnicity',
geographic='national',
)
cdc_wisqars_youth_bq_operator_race_national = util.create_bq_ingest_operator(
'cdc_wisqars_youth_to_bq_race_national',
cdc_wisqars_youth_bq_payload_race_national,
data_ingestion_dag,
)

# RACE STATE
cdc_wisqars_youth_bq_payload_race_state = util.generate_bq_payload(
_CDC_WISQARS_YOUTH_WORKFLOW_ID,
_CDC_WISQARS_YOUTH_DATASET_NAME,
demographic='race_and_ethnicity',
geographic='state',
)
cdc_wisqars_youth_bq_operator_race_state = util.create_bq_ingest_operator(
'cdc_wisqars_youth_to_bq_race_state',
cdc_wisqars_youth_bq_payload_race_state,
data_ingestion_dag,
)

# Exporters
payload_race = {
'dataset_name': _CDC_WISQARS_YOUTH_DATASET_NAME,
'demographic': "race_and_ethnicity",
}
cdc_wisqars_youth_exporter_operator_race = util.create_exporter_operator(
'cdc_wisqars_youth_exporter_race', payload_race, data_ingestion_dag
)

# Ingestion DAG
(
cdc_wisqars_youth_bq_operator_race_national
>> cdc_wisqars_youth_bq_operator_race_state
>> cdc_wisqars_youth_exporter_operator_race
)
7 changes: 7 additions & 0 deletions config/data_sources/cdc_wisqars_youth_data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Resources and routines for CDC WISQARS Youth Data ingestion.

# Create a BigQuery dataset for CDC WISQARS Youth data.
resource "google_bigquery_dataset" "cdc_wisqars_youth" {
dataset_id = "cdc_wisqars_youth_data"
location = "US"
}
21 changes: 21 additions & 0 deletions data/cdc_wisqars/fatal_gun_injuries_youth-national-all.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"Year","Deaths","Population","Crude Rate","Age-Adjusted Rate","Years of Potential Life Lost"
"2021","12,130","107,964,479","11.24","12.62","545,759"
"2020","11,366","108,684,026","10.46","11.96","510,105"
"2019","8,843","107,866,580","8.20","9.19","396,309"
"2018","8,852","108,381,107","8.17","9.15","396,349"
"Total","41,191","432,896,192","9.52","--","1,848,522"
"","","","","",""
"Injury Outcome: Fatal","","","","",""
"Injury Type: All Injury","","","","",""
"Data Years: 2018 to 2021","","","","",""
"Geography: United States","","","","",""
"Intent: All Intents","","","","",""
"Mechanism: Firearm","","","","",""
"Age: <1 to 25","","","","",""
"Sex: Both Sexes","","","","",""
"Race: All Races","","","","",""
"Ethnicity: Non-Hispanic, Hispanic, Unknown","","","","",""
"Metro / Non-Metro Indicator: None Selected","","","","",""
"YPLL Age: 65","","","","",""
"Year and Race Options: 2018 - 2021 by Single Race","","","","",""
"Produced by: National Center for Injury Prevention and Control, CDC.","","","","",""
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"Year","Race","Ethnicity","Deaths","Population","Crude Rate","Age-Adjusted Rate","Years of Potential Life Lost"
"2021","White","Non-Hispanic","3,608","54,482,236","6.62","7.17","162,281"
"2021","White","Hispanic","1,888","22,893,710","8.25","9.49","84,710"
"2021","White","Unknown","--","--","--","--","--"
"2021","Black","Non-Hispanic","5,833","14,921,868","39.09","43.91","262,685"
"2021","Black","Hispanic","117","1,547,205","7.56","10.88","5,262"
"2021","Black","Unknown","--","--","--","--","--"
"2021","American Indian / Alaska Native","Non-Hispanic","129","882,778","14.61","18.02","5,788"
"2021","American Indian / Alaska Native","Hispanic","24","889,137","2.70","3.99","1,057"
"2021","Asian","Non-Hispanic","166","5,940,330","2.79","2.65","7,451"
"2021","Asian","Hispanic","19**","323,284","5.88**","8.62**","835"
"2021","HI Native / Pacific Islander","Non-Hispanic","24","226,770","10.58","13.23","1,058"
"2021","HI Native / Pacific Islander","Hispanic","--","112,336","--","--","--"
"2021","More than One Race","Non-Hispanic","262","4,594,493","5.70","7.85","11,937"
"2021","More than One Race","Hispanic","43","1,150,332","3.74","5.67","1,930"
"2020","White","Non-Hispanic","3,561","55,131,583","6.46","7.29","160,085"
"2020","White","Hispanic","1,733","22,927,088","7.56","8.52","77,825"
"2020","White","Unknown","--","--","--","--","--"
"2020","Black","Non-Hispanic","5,413","15,040,394","35.99","40.49","242,445"
"2020","Black","Hispanic","63","1,521,459","4.14","5.37","2,855"
"2020","Black","Unknown","--","--","--","--","--"
"2020","American Indian / Alaska Native","Non-Hispanic","145","892,800","16.24","18.99","6,551"
"2020","American Indian / Alaska Native","Hispanic","21","874,062","2.40","3.23","956"
"2020","Asian","Non-Hispanic","141","5,979,200","2.36","2.62","6,293"
"2020","Asian","Hispanic","--","317,120","--","--","--"
"2020","HI Native / Pacific Islander","Non-Hispanic","21","226,930","9.25","11.92","930"
"2020","HI Native / Pacific Islander","Hispanic","--","110,279","--","--","--"
"2020","More than One Race","Non-Hispanic","197","4,531,068","4.35","6.64","8,875"
"2020","More than One Race","Hispanic","49","1,132,043","4.33","5.86","2,280"
"2019","White","Non-Hispanic","3,080","55,034,095","5.60","6.14","138,103"
"2019","White","Hispanic","1,319","22,595,765","5.84","6.71","59,167"
"2019","White","Unknown","--","--","--","--","--"
"2019","Black","Non-Hispanic","3,904","14,975,586","26.07","28.59","174,576"
"2019","Black","Hispanic","52","1,475,284","3.53","4.45","2,339"
"2019","Black","Unknown","--","--","--","--","--"
"2019","American Indian / Alaska Native","Non-Hispanic","98","894,649","10.95","9.99","4,438"
"2019","American Indian / Alaska Native","Hispanic","12**","849,102","1.41**","1.81**","550"
"2019","Asian","Non-Hispanic","129","5,899,807","2.19","2.58","5,760"
"2019","Asian","Hispanic","--","307,413","--","--","--"
"2019","HI Native / Pacific Islander","Non-Hispanic","20**","223,938","8.93**","8.07**","953"
"2019","HI Native / Pacific Islander","Hispanic","--","107,133","--","--","--"
"2019","More than One Race","Non-Hispanic","172","4,404,582","3.91","4.66","7,826"
"2019","More than One Race","Hispanic","34","1,099,226","3.09","4.32","1,589"
"2018","White","Non-Hispanic","3,296","55,660,282","5.92","6.30","148,162"
"2018","White","Hispanic","1,341","22,540,189","5.95","6.75","60,086"
"2018","White","Unknown","11**","--","0.00**","0.00**","471"
"2018","Black","Non-Hispanic","3,667","15,095,909","24.29","27.05","163,398"
"2018","Black","Hispanic","58","1,448,517","4.00","4.92","2,623"
"2018","Black","Unknown","10**","--","0.00**","0.00**","442"
"2018","American Indian / Alaska Native","Non-Hispanic","103","906,420","11.36","12.34","4,584"
"2018","American Indian / Alaska Native","Hispanic","14**","833,968","1.68**","3.29**","609"
"2018","American Indian / Alaska Native","Unknown","--","--","--","--","--"
"2018","Asian","Non-Hispanic","124","5,864,953","2.11","2.41","5,657"
"2018","Asian","Hispanic","--","300,727","--","--","--"
"2018","HI Native / Pacific Islander","Non-Hispanic","20**","223,071","8.97**","10.05**","898"
"2018","HI Native / Pacific Islander","Hispanic","--","104,956","--","--","--"
"2018","More than One Race","Non-Hispanic","157","4,325,731","3.63","4.95","7,117"
"2018","More than One Race","Hispanic","44","1,076,384","4.09","6.73","1,981"
"Total","","","41,191","432,896,192","9.52","--","1,848,522"
"","","","","","","",""
"Injury Outcome: Fatal","","","","","","",""
"Injury Type: All Injury","","","","","","",""
"Data Years: 2018 to 2021","","","","","","",""
"Geography: United States","","","","","","",""
"Intent: All Intents","","","","","","",""
"Mechanism: Firearm","","","","","","",""
"Age: <1 to 25","","","","","","",""
"Sex: Both Sexes","","","","","","",""
"Race: All Races","","","","","","",""
"Ethnicity: Non-Hispanic, Hispanic, Unknown","","","","","","",""
"Metro / Non-Metro Indicator: None Selected","","","","","","",""
"YPLL Age: 65","","","","","","",""
"Year and Race Options: 2018 - 2021 by Single Race","","","","","","",""
"Produced by: National Center for Injury Prevention and Control, CDC.","","","","","","",""
Loading
Loading