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

CensusSAHIE #1118

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions statvar_imports/CensusSAHIE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CensusSAHIE

- source: https://www.census.gov/data/datasets/time-series/demo/sahie/estimates-acs.html

- how to download data: Manually download from source based on filter - `CensusSAHIE`.

- type of place: Country

- statvars: Demographics

- years: 2008 to 2022

- place_resolution: By PVmap.

### How to run:

`python3 stat_var_processor.py --input_data=<input_file>.csv --pv_map=statvar_imports/CensusSHIE/pvmap.csv --config=statvar_imports/CensusSHIE//metadata.csv --output_path=<filepath/filename>`

#### Example
`python3 stat_var_processor.py --input_data=statvar_imports/CensusSHIE/test_data/sample_input/sahie.csv --pv_map=statvar_imports/CensusSHIE/pvmap.csv --config=statvar_imports/CensusSHIE/metadata.csv --output_path=statvar_imports/CensusSHIE/test_data/sample_output/sahie`
18 changes: 18 additions & 0 deletions statvar_imports/CensusSAHIE/metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameter,value
url,sahie
description,Small Area Health Insurance Estimates (SAHIE)
#place_type,Country
#places_within,
start_date,2008
end_date,2022
release_frequency,1Year
process,
comments,
output_columns,"observationAbout, observationDate, value, variableMeasured,observationPeriod, measurementMethod"
#places_resolved_csv,
mapped_rows,1
mapped_columns,9
header_rows,1
drop_statvars_without_svobs,0
debug,1
#input_rows,5
43 changes: 43 additions & 0 deletions statvar_imports/CensusSAHIE/pvmap.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
key,p1,v1,p2,v2,p3,v3,p4,v4,p5,v5,p6,v6,p7,v7
,,,,,,,,,,,,,,
state_name,#observationAbout,{Data},,,,,,,,,,,,
county_name,,,,,,,,,,,,,,
year,observationDate,{Number},observationPeriod,P1Y,,,,,,,,,,
version,#Eval,Fips=StateFips + CountyFips if GeoCat == '50' else StateFips,,,,,,,,,,,,
statefips,#Format,StateFips={Number:02d},,,,,,,,,,,,
countyfips,#Format,CountyFips={Number:03d},,,,,,,,,,,,
geocat,GeoCat,{Number},,,,,,,,,,,,
sexcat:1,gender,Male,,,,,,,,,,,,
sexcat:2,gender,Female,,,,,,,,,,,,
NIPR,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,,,,,,,
nipr_moe,measuredProperty,count,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,,,
agecat:0,age,[- 64 Years],,,,,,,,,,,,
agecat:1,age,[18 64 Years],,,,,,,,,,,,
agecat:2,age,[40 64 Years],,,,,,,,,,,,
agecat:3,age,[50 64 Years],,,,,,,,,,,,
agecat:4,age,[- 18 Years],,,,,,,,,,,,
agecat:5,age,[21 64 Years],,,,,,,,,,,,
racecat:1,race,WhiteAlone,,,,,,,,,,,,
racecat:2,race,BlackOrAfricanAmericanAlone,,,,,,,,,,,,
racecat:3,race,HispanicOrLatino,,,,,,,,,,,,
racecat:4,race,AmericanIndianAndAlaskaNativeAlone,,,,,,,,,,,,
racecat:5,race,AsianAlone,,,,,,,,,,,,
racecat:6,race,NativeHawaiianAndOtherPacificIslanderAlone,,,,,,,,,,,,
racecat:7,race,TwoOrMoreRaces,,,,,,,,,,,,
iprcat:1,familyIncome,[- 2 RatioToPovertyLine],measurementMethod,USCensusPovertyThreshold,,,,,,,,,,
iprcat:2,familyIncome,[- 2.5 RatioToPovertyLine],measurementMethod,USCensusPovertyThreshold,,,,,,,,,,
iprcat:3,familyIncome,[- 1.38 RatioToPovertyLine],measurementMethod,USCensusPovertyThreshold,,,,,,,,,,
iprcat:4,familyIncome,[- 4 RatioToPovertyLine],measurementMethod,USCensusPovertyThreshold,,,,,,,,,,
iprcat:5,familyIncome,[1.38 4 RatioToPovertyLine],measurementMethod,USCensusPovertyThreshold,,,,,,,,,,
NUI,measuredProperty,count,healthInsurance,NoHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
nui_moe,measuredProperty,count,healthInsurance,NoHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
NIC,measuredProperty,count,healthInsurance,WithHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
nic_moe,measuredProperty,count,healthInsurance,WithHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
PCTUI,measuredProperty,percent,healthInsurance,NoHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
pctui_moe,measuredProperty,percent,healthInsurance,NoHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
PCTIC,measuredProperty,percent,healthInsurance,WithHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
pctic_moe,measuredProperty,percent,healthInsurance,WithHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},,
#PCTELIG,measuredProperty,percent,healthInsurance,NoHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},familyIncome,""""""
#pctelig_moe,measuredProperty,percent,healthInsurance,NoHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},familyIncome,""""""
#PCTLIIC,measuredProperty,percent,healthInsurance,WithHealthInsurance,statType,measuredValue,value,{Number},populationType,Person,observationAbout,geoId/{Fips},familyIncome,""""""
#pctliic_moe,measuredProperty,percent,healthInsurance,WithHealthInsurance,statType,marginOfError,value,{Number},populationType,Person,observationAbout,geoId/{Fips},familyIncome,""""""
21 changes: 21 additions & 0 deletions statvar_imports/CensusSAHIE/test_data/sample_input/sahie.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
year,version,statefips,countyfips,geocat,agecat,racecat,sexcat,iprcat,NIPR,nipr_moe,NUI,nui_moe,NIC,nic_moe,PCTUI,pctui_moe,PCTIC,pctic_moe,PCTELIG,pctelig_moe,PCTLIIC,pctliic_moe,state_name,county_name
2022, ,17,61,50,5,0,2,5,1430,85,107,26,1323,83,7.5,1.8,92.5,1.8,3.4,0.8,42.4,2.7,Illinois ,Greene County
2022, ,16,0,40,0,1,0,3,196732,5684,23685,2288,173047,5465,12,1.1,88,1.1,1.9,0.2,14.1,0.4,Idaho ,
2022, ,37,189,50,1,0,0,1,11714,557,2603,463,9111,637,22.2,3.8,77.8,3.8,8.2,1.5,28.6,2.0,North Carolina ,Watauga County
2022, ,20,155,50,2,0,1,0,8959,0,940,217,8019,217,10.5,2.4,89.5,2.4,10.5,2.4,89.5,2.4,Kansas ,Reno County
2022, ,31,79,50,1,0,2,2,7081,375,1184,295,5897,427,16.7,4.1,83.3,4.1,7.0,1.7,34.7,2.5,Nebraska ,Hall County
2022, ,8,31,50,5,0,1,0,244004,0,24944,2833,219060,2833,10.2,1.2,89.8,1.2,10.2,1.2,89.8,1.2,Colorado ,Denver County
2022, ,16,85,50,1,0,2,0,3388,0,365,82,3023,82,10.8,2.4,89.2,2.4,10.8,2.4,89.2,2.4,Idaho ,Valley County
2022, ,45,67,50,3,0,0,5,2379,174,281,73,2098,173,11.8,3.0,88.2,3.0,5.2,1.4,39.0,3.2,South Carolina ,Marion County
2022, ,31,153,50,5,0,2,3,5424,568,632,189,4792,543,11.7,3.3,88.3,3.3,1.1,0.3,8.6,1.0,Nebraska ,Sarpy County
2022, ,41,25,50,3,0,2,3,192,44,18,12,174,41,9.4,5.4,90.6,5.4,2.3,1.5,22.3,5.3,Oregon ,Harney County
2022, ,36,83,50,2,0,0,1,9142,546,866,223,8276,529,9.5,2.3,90.5,2.3,1.7,0.4,16.3,1.0,New York ,Rensselaer County
2022, ,25,1,50,5,0,2,4,25245,1008,1075,294,24170,1007,4.3,1.2,95.7,1.2,1.8,0.5,40.7,1.7,Massachusetts ,Barnstable County
2022, ,17,1,50,3,0,1,3,723,123,74,40,649,116,10.2,5.2,89.8,5.2,1.2,0.6,10.5,1.9,Illinois ,Adams County
2022, ,5,31,50,0,0,0,4,64905,1135,8180,1103,56725,1413,12.6,1.7,87.4,1.7,8.7,1.2,60.4,1.5,Arkansas ,Craighead County
2022, ,21,115,50,1,0,0,5,5348,228,432,70,4916,221,8.1,1.3,91.9,1.3,3.4,0.5,38.2,1.7,Kentucky ,Johnson County
2022, ,54,15,50,5,0,1,3,629,71,83,30,546,66,13.2,4.3,86.8,4.3,4.1,1.5,27.0,3.3,West Virginia ,Clay County
2022, ,51,15,50,1,0,1,1,4171,355,692,183,3479,339,16.6,4.1,83.4,4.1,3.2,0.8,15.9,1.5,Virginia ,Augusta County
2022, ,12,133,50,0,0,0,1,8108,271,1572,231,6536,301,19.4,2.7,80.6,2.7,8.4,1.2,35,1.6,Florida ,Washington County
2022, ,17,17,50,4,0,0,0,3191,0,127,38,3064,38,4.0,1.2,96.0,1.2,4.0,1.2,96.0,1.2,Illinois ,Cass County
2022, ,24,31,50,5,0,0,2,120860,3556,29701,2744,91159,3763,24.6,2.2,75.4,2.2,5.0,0.5,15.3,0.6,Maryland ,Montgomery County
Loading
Loading