Skip to content
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
888 changes: 0 additions & 888 deletions _delphi_utils_python/data_proc/geomap/consistency_checks.ipynb

This file was deleted.

31 changes: 14 additions & 17 deletions _delphi_utils_python/data_proc/geomap/geo_data_proc.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
FIPS_MSA_URL = "https://www2.census.gov/programs-surveys/metro-micro/geographies/reference-files/2018/delineation-files/list1_Sep_2018.xls"
JHU_FIPS_URL = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/UID_ISO_FIPS_LookUp_Table.csv"
STATE_CODES_URL = "http://www2.census.gov/geo/docs/reference/state.txt?#"
FIPS_POPULATION_URL = "https://www2.census.gov/programs-surveys/popest/datasets/2010-2019/counties/totals/co-est2019-alldata.csv"
FIPS_POPULATION_URL = "https://www2.census.gov/programs-surveys/popest/datasets/2010-2020/counties/totals/co-est2020-alldata.csv"
FIPS_PUERTO_RICO_POPULATION_URL = (
"https://www2.census.gov/geo/docs/maps-data/data/rel/zcta_county_rel_10.txt?"
)
Expand Down Expand Up @@ -358,34 +358,31 @@ def create_fips_population_table():
census_pop["fips"] = census_pop.apply(
lambda x: f"{x['STATE']:02d}{x['COUNTY']:03d}", axis=1
)
census_pop["pop"] = census_pop["POPESTIMATE2019"]
census_pop["pop"] = census_pop["POPESTIMATE2020"]
census_pop = census_pop[["fips", "pop"]]

# Set population for Dukes and Nantucket combo county
dukes_pop = int(census_pop.loc[census_pop["fips"] == "25007", "pop"])
nantu_pop = int(census_pop.loc[census_pop["fips"] == "25019", "pop"])
census_pop = pd.concat(
[
census_pop,
pd.DataFrame(
{
"fips": ["70002", "70003"],
"pop": [0, 0],
"fips": [
"70002", # Dukes and Nantucket combo county
"70003" # Kansas City
],
"pop": [
dukes_pop + nantu_pop,
491918 # via Google
],
}
),
]
)
census_pop = census_pop.reset_index(drop=True)

# Set population for Dukes and Nantucket
dn_fips = "70002"
dukes_fips = "25007"
nantu_fips = "25019"

census_pop.loc[census_pop["fips"] == dn_fips, "pop"] = (
census_pop.loc[census_pop["fips"] == dukes_fips, "pop"].values
+ census_pop.loc[census_pop["fips"] == nantu_fips, "pop"].values
)

# Set population for Kansas City
census_pop.loc[census_pop["fips"] == "70003", "pop"] = 491918 # via Google

# Get the file with Puerto Rico populations
df_pr = pd.read_csv(FIPS_PUERTO_RICO_POPULATION_URL)
df_pr["fips"] = df_pr["STATE"].astype(str).str.zfill(2) + df_pr["COUNTY"].astype(
Expand Down

Large diffs are not rendered by default.

89 changes: 45 additions & 44 deletions _delphi_utils_python/delphi_utils/data/fips_hhs_table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ fips,hhs
02020,10
02050,10
02060,10
02063,10
02066,10
02068,10
02070,10
02090,10
Expand All @@ -91,7 +93,6 @@ fips,hhs
02220,10
02230,10
02240,10
02261,10
02275,10
02282,10
02290,10
Expand Down Expand Up @@ -3234,60 +3235,60 @@ fips,hhs
69100,9
69110,9
69120,9
78000,2
33000,1
27000,5
40000,6
70000,9
31000,7
09000,1
48000,6
32000,9
04000,9
30000,8
15000,9
69000,9
50000,1
25000,1
19000,7
01000,4
51000,3
41000,10
66000,9
22000,6
06000,9
39000,5
38000,8
53000,10
12000,4
46000,8
17000,5
48000,6
34000,2
08000,8
36000,2
40000,6
47000,4
28000,4
02000,10
49000,8
54000,3
20000,7
08000,8
34000,2
35000,6
45000,4
29000,7
66000,9
05000,6
41000,10
37000,4
55000,5
11000,3
02000,10
72000,2
23000,1
16000,10
44000,1
54000,3
10000,3
21000,4
28000,4
18000,5
05000,6
56000,8
36000,2
19000,7
24000,3
50000,1
37000,4
20000,7
31000,7
29000,7
27000,5
46000,8
38000,8
72000,2
23000,1
78000,2
16000,10
47000,4
22000,6
13000,4
30000,8
39000,5
18000,5
11000,3
15000,9
42000,3
35000,6
60000,9
01000,4
12000,4
10000,3
04000,9
69000,9
06000,9
33000,1
26000,5
70000,9
21000,4
60000,9
51000,3
Loading