-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathfluview_locations.py
114 lines (108 loc) · 3.12 KB
/
fluview_locations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
"""
===============
=== Purpose ===
===============
Defines a mapping of location names from CDC to the Delphi API.
See also:
- fluview_update.py
"""
# These keys come from CDC's metadata object, which is currently returned in a
# JSON response from:
# https://gis.cdc.gov/grasp/flu2/GetPhase02InitApp?appVersion=Public
# The values are used in queries of Delphi's Epidata API.
cdc_to_delphi = {
"national": {
"x": "nat",
},
"hhs regions": {
"region 1": "hhs1",
"region 2": "hhs2",
"region 3": "hhs3",
"region 4": "hhs4",
"region 5": "hhs5",
"region 6": "hhs6",
"region 7": "hhs7",
"region 8": "hhs8",
"region 9": "hhs9",
"region 10": "hhs10",
},
"census regions": {
"new england": "cen1",
"mid-atlantic": "cen2",
"east north central": "cen3",
"west north central": "cen4",
"south atlantic": "cen5",
"east south central": "cen6",
"west south central": "cen7",
"mountain": "cen8",
"pacific": "cen9",
},
"states": {
# states/territories: two-letter ISO 3166
"alabama": "al",
"alaska": "ak",
"arizona": "az",
"arkansas": "ar",
"california": "ca",
"colorado": "co",
"connecticut": "ct",
"delaware": "de",
"florida": "fl",
"georgia": "ga",
"hawaii": "hi",
"idaho": "id",
"illinois": "il",
"indiana": "in",
"iowa": "ia",
"kansas": "ks",
"kentucky": "ky",
"louisiana": "la",
"maine": "me",
"maryland": "md",
"massachusetts": "ma",
"michigan": "mi",
"minnesota": "mn",
"mississippi": "ms",
"missouri": "mo",
"montana": "mt",
"nebraska": "ne",
"nevada": "nv",
"new hampshire": "nh",
"new jersey": "nj",
"new mexico": "nm",
# Even though it's called "New York", this location doesn't include New
# York City ("jfk"). New York ("ny") is actually this *plus* jfk.
"new york": "ny_minus_jfk",
"north carolina": "nc",
"north dakota": "nd",
"ohio": "oh",
"oklahoma": "ok",
"oregon": "or",
"pennsylvania": "pa",
"rhode island": "ri",
"south carolina": "sc",
"south dakota": "sd",
"tennessee": "tn",
"texas": "tx",
"utah": "ut",
"vermont": "vt",
"virginia": "va",
"washington": "wa",
"west virginia": "wv",
"wisconsin": "wi",
"wyoming": "wy",
"american samoa": "as",
"commonwealth of the northern mariana islands": "mp",
"district of columbia": "dc",
"guam": "gu",
"puerto rico": "pr",
"virgin islands": "vi",
# cities: three-letter IATA
"chicago": "ord",
"los angeles": "lax",
"new york city": "jfk",
},
}
def get_location_name(region_type, region_name):
"""Convert a CDC location type and name pair into a Delphi location name."""
return cdc_to_delphi[region_type.lower()][region_name.lower()]