Skip to content

Commit eb737f4

Browse files
authored
Merge pull request #470 from JedGrabman/jedgrabman/geo_id_validation
Make geo_id list creation robust
2 parents fb15373 + 22e88e2 commit eb737f4

File tree

4 files changed

+117
-10
lines changed

4 files changed

+117
-10
lines changed

validator/scripts/unique_geoids.R

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
library(covidcast)
2+
library(dplyr)
3+
meta_info = covidcast_meta()
4+
locations_by_type = meta_info %>% group_by(geo_type) %>% summarize(Value = max(num_locations))
25

3-
geo_types = c("county", "state", "hrr", "msa")
4-
for(type in geo_types){
5-
dtf = covidcast_signal("indicator-combination", "confirmed_7dav_incidence_num", start_day = "2020-10-01", end_day = "2020-10-01", geo_type = type)
6+
results = list()
7+
for (i in 1:nrow(locations_by_type)){
8+
type = locations_by_type$geo_type[i]
9+
max_locations = locations_by_type$Value[i]
10+
max_row = with(meta_info, meta_info[geo_type == type & num_locations == max_locations,][1,])
11+
data_source = max_row$data_source
12+
signal = max_row$signal
13+
results[[i]] = covidcast_signal(data_source, signal, geo_type = type)
14+
geo_values = sort(unique(results[[i]]$geo_value))
615
file_name = paste0("../static/", type, "_geo.csv")
7-
write.table(unique(dtf$geo_value), file = file_name, row.names = F, col.names = "geo_id")
16+
write.table(geo_values, file = file_name, row.names = F, col.names = "geo_id")
817
}
918

10-
dtf = covidcast_signal("ght", "raw_search", start_day = "2020-10-01", end_day = "2020-10-01", geo_type = "dma")
11-
file_name = "../static/dma_geo.csv"
12-
write.table(unique(dtf$geo_value), file = file_name, row.names = F, col.names = "geo_id")
13-
14-
national_file = "../static/national_geo.csv"
15-
write.table("us", file = national_file, row.names = F, col.names = "geo_id")

validator/static/county_geo.csv

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"02230"
9595
"02240"
9696
"02261"
97+
"02270"
9798
"02275"
9899
"02282"
99100
"02290"
@@ -326,6 +327,7 @@
326327
"10001"
327328
"10003"
328329
"10005"
330+
"11000"
329331
"11001"
330332
"12000"
331333
"12001"
@@ -2458,6 +2460,7 @@
24582460
"46107"
24592461
"46109"
24602462
"46111"
2463+
"46113"
24612464
"46115"
24622465
"46117"
24632466
"46119"
@@ -3191,4 +3194,90 @@
31913194
"56041"
31923195
"56043"
31933196
"56045"
3197+
"60000"
3198+
"66000"
3199+
"69000"
3200+
"70002"
3201+
"70003"
31943202
"72000"
3203+
"72001"
3204+
"72003"
3205+
"72005"
3206+
"72007"
3207+
"72009"
3208+
"72011"
3209+
"72013"
3210+
"72015"
3211+
"72017"
3212+
"72019"
3213+
"72021"
3214+
"72023"
3215+
"72025"
3216+
"72027"
3217+
"72029"
3218+
"72031"
3219+
"72033"
3220+
"72035"
3221+
"72037"
3222+
"72039"
3223+
"72041"
3224+
"72043"
3225+
"72045"
3226+
"72047"
3227+
"72049"
3228+
"72051"
3229+
"72053"
3230+
"72054"
3231+
"72055"
3232+
"72057"
3233+
"72059"
3234+
"72061"
3235+
"72063"
3236+
"72065"
3237+
"72067"
3238+
"72069"
3239+
"72071"
3240+
"72073"
3241+
"72075"
3242+
"72077"
3243+
"72079"
3244+
"72081"
3245+
"72083"
3246+
"72085"
3247+
"72087"
3248+
"72089"
3249+
"72091"
3250+
"72093"
3251+
"72095"
3252+
"72097"
3253+
"72099"
3254+
"72101"
3255+
"72103"
3256+
"72105"
3257+
"72107"
3258+
"72109"
3259+
"72111"
3260+
"72113"
3261+
"72115"
3262+
"72117"
3263+
"72119"
3264+
"72121"
3265+
"72123"
3266+
"72125"
3267+
"72127"
3268+
"72129"
3269+
"72131"
3270+
"72133"
3271+
"72135"
3272+
"72137"
3273+
"72139"
3274+
"72141"
3275+
"72143"
3276+
"72145"
3277+
"72147"
3278+
"72149"
3279+
"72151"
3280+
"72153"
3281+
"72888"
3282+
"72999"
3283+
"78000"

validator/static/msa_geo.csv

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"geo_id"
22
"10180"
3+
"10380"
34
"10420"
45
"10500"
56
"10540"
@@ -14,6 +15,7 @@
1415
"11460"
1516
"11500"
1617
"11540"
18+
"11640"
1719
"11700"
1820
"12020"
1921
"12060"
@@ -144,11 +146,13 @@
144146
"24660"
145147
"24780"
146148
"24860"
149+
"25020"
147150
"25060"
148151
"25180"
149152
"25220"
150153
"25260"
151154
"25420"
155+
"25500"
152156
"25540"
153157
"25620"
154158
"25860"
@@ -175,6 +179,7 @@
175179
"27780"
176180
"27860"
177181
"27900"
182+
"27980"
178183
"28020"
179184
"28100"
180185
"28140"
@@ -218,6 +223,7 @@
218223
"31740"
219224
"31860"
220225
"31900"
226+
"32420"
221227
"32580"
222228
"32780"
223229
"32820"
@@ -272,6 +278,7 @@
272278
"38300"
273279
"38340"
274280
"38540"
281+
"38660"
275282
"38860"
276283
"38900"
277284
"38940"
@@ -309,7 +316,9 @@
309316
"41700"
310317
"41740"
311318
"41860"
319+
"41900"
312320
"41940"
321+
"41980"
313322
"42020"
314323
"42100"
315324
"42140"
@@ -334,6 +343,7 @@
334343
"44180"
335344
"44220"
336345
"44300"
346+
"44420"
337347
"44700"
338348
"44940"
339349
"45060"
@@ -376,6 +386,7 @@
376386
"49180"
377387
"49340"
378388
"49420"
389+
"49500"
379390
"49620"
380391
"49660"
381392
"49700"

validator/static/state_geo.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"ak"
33
"al"
44
"ar"
5+
"as"
56
"az"
67
"ca"
78
"co"
@@ -10,6 +11,7 @@
1011
"de"
1112
"fl"
1213
"ga"
14+
"gu"
1315
"hi"
1416
"ia"
1517
"id"
@@ -24,6 +26,7 @@
2426
"mi"
2527
"mn"
2628
"mo"
29+
"mp"
2730
"ms"
2831
"mt"
2932
"nc"
@@ -46,6 +49,7 @@
4649
"tx"
4750
"ut"
4851
"va"
52+
"vi"
4953
"vt"
5054
"wa"
5155
"wi"

0 commit comments

Comments
 (0)