diff --git a/_delphi_utils_python/data_proc/geomap/chng_county_groups.csv b/_delphi_utils_python/data_proc/geomap/chng_county_groups.csv index c09ace96c..c754eccb7 100644 --- a/_delphi_utils_python/data_proc/geomap/chng_county_groups.csv +++ b/_delphi_utils_python/data_proc/geomap/chng_county_groups.csv @@ -1,402 +1,402 @@ -state_fips,fips_list,county1,county2,county3,county4,county5,county6,county7,county8,group -1,01063|01065,01063,01065,,,,,,,1 -1,01105|01047,01105,01047,,,,,,,2 -4,04011|04009,04011,04009,,,,,,,1 -5,05025|05013|05011,05025,05013,05011,,,,,,1 -5,05039|05053,05039,05053,,,,,,,2 -5,05073|05091,05073,05091,,,,,,,3 -5,05077|05123,05077,05123,,,,,,,4 -5,05095|05117,05095,05117,,,,,,,5 -5,05097|05109,05097,05109,,,,,,,6 -5,05099|05057,05099,05057,,,,,,,7 -5,05101|05009,05101,05009,,,,,,,8 -5,05129|05089,05129,05089,,,,,,,9 -5,05147|05067,05147,05067,,,,,,,10 -6,06003|06109,06003,06109,,,,,,,1 -6,06049|06035,06049,06035,,,,,,,2 -6,06091|06057,06091,06057,,,,,,,3 -8,08011|08061|08009|08099,08011,08061,08009,08099,,,,,1 -8,08017|08063|08125,08017,08063,08125,,,,,,2 -8,08019|08047,08019,08047,,,,,,,3 -8,08023|08003,08023,08003,,,,,,,4 -8,08025|08089,08025,08089,,,,,,,5 -8,08027|08043,08027,08043,,,,,,,6 -8,08053|08111|08091|08033|08113|08085,08053,08111,08091,08033,08113,08085,,,7 -8,08055|08101,08055,08101,,,,,,,8 -8,08057|08049,08057,08049,,,,,,,9 -8,08065|08015,08065,08015,,,,,,,10 -8,08073|08039,08073,08039,,,,,,,11 -8,08079|08007,08079,08007,,,,,,,12 -8,08095|08115|08075,08095,08115,08075,,,,,,13 -8,08103|08045,08103,08045,,,,,,,14 -8,08109|08021|08105,08109,08021,08105,,,,,,15 -8,08121|08087,08121,08087,,,,,,,16 -12,12067|12121,12067,12121,,,,,,,1 -12,12077|12037,12077,12037,,,,,,,2 -13,13003|13069,13003,13069,,,,,,,1 -13,13007|13205,13007,13205,,,,,,,2 -13,13061|13239|13037|13243,13061,13239,13037,13243,,,,,3 -13,13065|13101,13065,13101,,,,,,,4 -13,13125|13301|13189,13125,13301,13189,,,,,,5 -13,13155|13017,13155,13017,,,,,,,6 -13,13165|13033,13165,13033,,,,,,,7 -13,13167|13303,13167,13303,,,,,,,8 -13,13181|13317,13181,13317,,,,,,,9 -13,13197|13249,13197,13249,,,,,,,10 -13,13201|13099,13201,13099,,,,,,,11 -13,13209|13279,13209,13279,,,,,,,12 -13,13253|13087,13253,13087,,,,,,,13 -13,13259|13307|13053,13259,13307,13053,,,,,,14 -13,13263|13293,13263,13293,,,,,,,15 -13,13265|13133,13265,13133,,,,,,,16 -13,13269|13193,13269,13193,,,,,,,17 -13,13273|13177,13273,13177,,,,,,,18 -13,13283|13107,13283,13107,,,,,,,19 -13,13287|13081,13287,13081,,,,,,,20 -13,13289|13023,13289,13023,,,,,,,21 -13,13309|13271,13309,13271,,,,,,,22 -13,13315|13235,13315,13235,,,,,,,23 -13,13319|13141|13009,13319,13141,13009,,,,,,24 -16,16003|16087,16003,16087,,,,,,,1 -16,16009|16057,16009,16057,,,,,,,2 -16,16015|16045,16015,16045,,,,,,,3 -16,16025|16047,16025,16047,,,,,,,4 -16,16029|16007|16041,16029,16007,16041,,,,,,5 -16,16033|16023|16051,16033,16023,16051,,,,,,6 -16,16035|16079,16035,16079,,,,,,,7 -16,16037|16059,16037,16059,,,,,,,8 -16,16061|16069,16061,16069,,,,,,,9 -16,16063|16053,16063,16053,,,,,,,10 -16,16071|16077,16071,16077,,,,,,,11 -17,17003|17153,17003,17153,,,,,,,1 -17,17009|17169,17009,17169,,,,,,,2 -17,17013|17083,17013,17083,,,,,,,3 -17,17047|17185,17047,17185,,,,,,,4 -17,17059|17069|17165,17059,17069,17165,,,,,,5 -17,17065|17193,17065,17193,,,,,,,6 -17,17071|17187,17071,17187,,,,,,,7 -17,17079|17035,17079,17035,,,,,,,8 -17,17151|17127,17151,17127,,,,,,,9 -17,17155|17123,17155,17123,,,,,,,10 -17,17171|17137,17171,17137,,,,,,,11 -17,17175|17143,17175,17143,,,,,,,12 -18,18007|18171,18007,18171,,,,,,,1 -18,18115|18155,18115,18155,,,,,,,2 -18,18161|18041,18161,18041,,,,,,,3 -19,19001|19077,19001,19077,,,,,,,1 -19,19003|19173,19003,19173,,,,,,,2 -19,19009|19029,19009,19029,,,,,,,3 -19,19025|19151,19025,19151,,,,,,,4 -19,19039|19053,19039,19053,,,,,,,5 -19,19051|19179,19051,19179,,,,,,,6 -19,19063|19147,19063,19147,,,,,,,7 -19,19071|19129,19071,19129,,,,,,,8 -19,19089|19037,19089,19037,,,,,,,9 -19,19091|19073|19187,19091,19073,19187,,,,,,10 -19,19093|19035,19093,19035,,,,,,,11 -19,19117|19185,19117,19185,,,,,,,12 -19,19133|19193,19133,19193,,,,,,,13 -19,19135|19007,19135,19007,,,,,,,14 -19,19143|19141,19143,19141,,,,,,,15 -19,19159|19175,19159,19175,,,,,,,16 -19,19177|19101,19177,19101,,,,,,,17 -19,19195|19033,19195,19033,,,,,,,18 -20,20003|20001,20003,20001,,,,,,,1 -20,20017|20127|20061,20017,20127,20061,,,,,,2 -20,20023|20181|20199,20023,20181,20199,,,,,,3 -20,20025|20057,20025,20057,,,,,,,4 -20,20039|20179|20137,20039,20179,20137,,,,,,5 -20,20043|20013|20005,20043,20013,20005,,,,,,6 -20,20053|20105|20159,20053,20105,20159,,,,,,7 -20,20063|20101|20171|20109,20063,20101,20171,20109,,,,,8 -20,20065|20195|20051,20065,20195,20051,,,,,,9 -20,20069|20055,20069,20055,,,,,,,10 -20,20071|20203|20093|20075|20187,20071,20203,20093,20075,20187,,,,11 -20,20073|20031|20207,20073,20031,20207,,,,,,12 -20,20077|20095,20077,20095,,,,,,,13 -20,20083|20135|20165|20145,20083,20135,20165,20145,,,,,14 -20,20107|20121,20107,20121,,,,,,,15 -20,20117|20149,20117,20149,,,,,,,16 -20,20119|20081|20175,20119,20081,20175,,,,,,17 -20,20129|20067|20189,20129,20067,20189,,,,,,18 -20,20147|20163,20147,20163,,,,,,,19 -20,20153|20193,20153,20193,,,,,,,20 -20,20157|20029|20143,20157,20029,20143,,,,,,21 -20,20167|20009,20167,20009,,,,,,,22 -20,20183|20089|20123|20141,20183,20089,20123,20141,,,,,23 -20,20185|20033|20097|20047|20007|20151,20185,20033,20097,20047,20007,20151,,,24 -20,20197|20177,20197,20177,,,,,,,25 -20,20201|20027|20161,20201,20027,20161,,,,,,26 -20,20205|20019|20049|20125,20205,20019,20049,20125,,,,,27 -21,21007|21039,21007,21039,,,,,,,1 -21,21023|21201,21023,21201,,,,,,,2 -21,21055|21139,21055,21139,,,,,,,3 -21,21057|21053,21057,21053,,,,,,,4 -21,21063|21043,21063,21043,,,,,,,5 -21,21075|21105,21075,21105,,,,,,,6 -21,21077|21187,21077,21187,,,,,,,7 -21,21129|21189,21129,21189,,,,,,,8 -21,21143|21033,21143,21033,,,,,,,9 -21,21149|21091|21059,21149,21091,21059,,,,,,10 -21,21165|21237,21165,21237,,,,,,,11 -21,21169|21087,21169,21087,,,,,,,12 -21,21181|21017,21181,21017,,,,,,,13 -21,21223|21041,21223,21041,,,,,,,14 -22,22021|22073,22021,22073,,,,,,,1 -22,22023|22019,22023,22019,,,,,,,2 -22,22035|22123,22035,22123,,,,,,,3 -22,22081|22013,22081,22013,,,,,,,4 -22,22107|22041,22107,22041,,,,,,,5 -26,26003|26153,26003,26153,,,,,,,1 -26,26083|26013|26061,26083,26013,26061,,,,,,2 -26,26095|26097,26095,26097,,,,,,,3 -26,26119|26135,26119,26135,,,,,,,4 -26,26131|26053,26131,26053,,,,,,,5 -27,27029|27087,27029,27087,,,,,,,1 -27,27031|27075,27031,27075,,,,,,,2 -27,27051|27011|27155|27149,27051,27011,27155,27149,,,,,3 -27,27069|27089,27069,27089,,,,,,,4 -27,27073|27173,27073,27173,,,,,,,5 -27,27077|27007,27077,27007,,,,,,,6 -27,27081|27117,27081,27117,,,,,,,7 -27,27125|27113,27125,27113,,,,,,,8 -27,27133|27101|27105,27133,27101,27105,,,,,,9 -27,27151|27023,27151,27023,,,,,,,10 -27,27167|27107|27027,27167,27107,27027,,,,,,11 -28,28009|28139,28009,28139,,,,,,,1 -28,28019|28155,28019,28155,,,,,,,2 -28,28021|28063,28021,28063,,,,,,,3 -28,28037|28005,28037,28005,,,,,,,4 -28,28055|28125|28053|28163,28055,28125,28053,28163,,,,,5 -28,28069|28075,28069,28075,,,,,,,6 -28,28119|28027,28119,28027,,,,,,,7 -28,28157|28001,28157,28001,,,,,,,8 -29,29005|29087|29147,29005,29087,29147,,,,,,1 -29,29025|29177,29025,29177,,,,,,,2 -29,29033|29117,29033,29117,,,,,,,3 -29,29035|29181,29035,29181,,,,,,,4 -29,29041|29115,29041,29115,,,,,,,5 -29,29045|29111,29045,29111,,,,,,,6 -29,29057|29039,29057,29039,,,,,,,7 -29,29061|29081,29061,29081,,,,,,,8 -29,29075|29227|29063,29075,29227,29063,,,,,,9 -29,29085|29167,29085,29167,,,,,,,10 -29,29103|29199|29197,29103,29199,29197,,,,,,11 -29,29125|29151,29125,29151,,,,,,,12 -29,29129|29079,29129,29079,,,,,,,13 -29,29137|29205,29137,29205,,,,,,,14 -29,29153|29067,29153,29067,,,,,,,15 -29,29171|29211,29171,29211,,,,,,,16 -29,29179|29093,29179,29093,,,,,,,17 -29,29185|29083,29185,29083,,,,,,,18 -29,29203|29065,29203,29065,,,,,,,19 -30,30005|30071,30005,30071,,,,,,,1 -30,30007|30043,30007,30043,,,,,,,2 -30,30015|30041,30015,30041,,,,,,,3 -30,30023|30001|30093,30023,30001,30093,,,,,,4 -30,30037|30107|30097|30095,30037,30107,30097,30095,,,,,5 -30,30039|30077,30039,30077,,,,,,,6 -30,30045|30059|30013,30045,30059,30013,,,,,,7 -30,30051|30101|30073,30051,30101,30073,,,,,,8 -30,30055|30079|30011|30025|30109|30021,30055,30079,30011,30025,30109,30021,,,9 -30,30057|30031,30057,30031,,,,,,,10 -30,30061|30089,30061,30089,,,,,,,11 -30,30065|30111,30065,30111,,,,,,,12 -30,30069|30027,30069,30027,,,,,,,13 -30,30075|30017,30075,30017,,,,,,,14 -30,30099|30049,30099,30049,,,,,,,15 -30,30103|30033|30087,30103,30033,30087,,,,,,16 -30,30105|30091|30019|30085,30105,30091,30019,30085,,,,,17 -31,31003|31011,31003,31011,,,,,,,1 -31,31015|31009|31017|31149|31103|31115|31071|31089,31015,31009,31017,31149,31103,31115,31071,31089,2 -31,31021|31177,31021,31177,,,,,,,3 -31,31023|31037,31023,31037,,,,,,,4 -31,31027|31051,31027,31051,,,,,,,5 -31,31029|31057|31085|31087|31005|31075|31101|31135,31029,31057,31085,31087,31005,31075,31101,31135,6 -31,31031|31091|31171|31117|31113|31111,31031,31091,31171,31117,31113,31111,,,7 -31,31035|31129,31035,31129,,,,,,,8 -31,31039|31173,31039,31173,,,,,,,9 -31,31059|31169,31059,31169,,,,,,,10 -31,31063|31145,31063,31145,,,,,,,11 -31,31095|31151,31095,31151,,,,,,,12 -31,31097|31133|31131,31097,31133,31131,,,,,,13 -31,31107|31139,31107,31139,,,,,,,14 -31,31123|31049|31069|31033,31123,31049,31069,31033,,,,,15 -31,31125|31081|31121,31125,31081,31121,,,,,,16 -31,31127|31147,31127,31147,,,,,,,17 -31,31137|31065|31073|31083,31137,31065,31073,31083,,,,,18 -31,31143|31185,31143,31185,,,,,,,19 -31,31161|31045|31013,31161,31045,31013,,,,,,20 -31,31165|31105|31007|31157,31165,31105,31007,31157,,,,,21 -31,31167|31179,31167,31179,,,,,,,22 -31,31175|31077|31183|31093|31163,31175,31077,31183,31093,31163,,,,23 -31,31181|31061|31099|31001,31181,31061,31099,31001,,,,,24 -32,32009|32021|32019,32009,32021,32019,,,,,,1 -32,32017|32003,32017,32003,,,,,,,2 -32,32027|32011|32015|32001,32027,32011,32015,32001,,,,,3 -32,32029|32510,32029,32510,,,,,,,4 -32,32033|32007,32033,32007,,,,,,,5 -35,35003|35006,35003,35006,,,,,,,1 -35,35021|35059|35007,35021,35059,35007,,,,,,2 -35,35023|35017,35023,35017,,,,,,,3 -35,35033|35011|35019|35047,35033,35011,35019,35047,,,,,4 -35,35037|35009,35037,35009,,,,,,,5 -36,36041|36043,36041,36043,,,,,,,1 -37,37075|37043,37075,37043,,,,,,,1 -37,37095|37177|37187,37095,37177,37187,,,,,,2 -38,38005|38103,38005,38103,,,,,,,1 -38,38009|38049,38009,38049,,,,,,,2 -38,38013|38061,38013,38061,,,,,,,3 -38,38019|38071,38019,38071,,,,,,,4 -38,38021|38045|38003,38021,38045,38003,,,,,,5 -38,38023|38105,38023,38105,,,,,,,6 -38,38025|38007|38033|38087|38011|38001|38041|38089,38025,38007,38033,38087,38011,38001,38041,38089,7 -38,38039|38063|38091|38035,38039,38063,38091,38035,,,,,8 -38,38043|38047|38051|38027|38031|38093,38043,38047,38051,38027,38031,38093,,,9 -38,38057|38055|38065,38057,38055,38065,,,,,,10 -38,38067|38099,38067,38099,,,,,,,11 -38,38073|38081|38077,38073,38081,38077,,,,,,12 -38,38075|38101,38075,38101,,,,,,,13 -38,38083|38029|38015,38083,38029,38015,,,,,,14 -38,38085|38037|38059,38085,38037,38059,,,,,,15 -38,38095|38069|38079,38095,38069,38079,,,,,,16 -38,38097|38017,38097,38017,,,,,,,17 -40,40007|40059|40045,40007,40059,40045,,,,,,1 -40,40011|40073,40011,40073,,,,,,,2 -40,40025|40139,40025,40139,,,,,,,3 -40,40029|40005,40029,40005,,,,,,,4 -40,40043|40039,40043,40039,,,,,,,5 -40,40053|40047,40053,40047,,,,,,,6 -40,40055|40057|40065,40055,40057,40065,,,,,,7 -40,40067|40137,40067,40137,,,,,,,8 -40,40075|40149,40075,40149,,,,,,,9 -40,40085|40019,40085,40019,,,,,,,10 -40,40129|40009,40129,40009,,,,,,,11 -40,40141|40033|40031,40141,40033,40031,,,,,,12 -40,40151|40003|40093,40151,40003,40093,,,,,,13 -41,41021|41055|41065,41021,41055,41065,,,,,,1 -41,41023|41069|41049,41023,41069,41049,,,,,,2 -41,41025|41045,41025,41045,,,,,,,3 -41,41037|41035,41037,41035,,,,,,,4 -41,41063|41061,41063,41061,,,,,,,5 -42,42023|42105,42023,42105,,,,,,,1 -42,42053|42123,42053,42123,,,,,,,2 -42,42113|42015,42113,42015,,,,,,,3 -45,45005|45011,45005,45011,,,,,,,1 -45,45065|45047,45065,45047,,,,,,,2 -46,46007|46071|46055|46095,46007,46071,46055,46095,,,,,1 -46,46009|46067,46009,46067,,,,,,,2 -46,46015|46017|46053,46015,46017,46053,,,,,,3 -46,46023|46043,46023,46043,,,,,,,4 -46,46031|46041|46137,46031,46041,46137,,,,,,5 -46,46033|46047,46033,46047,,,,,,,6 -46,46039|46011,46039,46011,,,,,,,7 -46,46045|46089|46049|46021|46129|46107|46119,46045,46089,46049,46021,46129,46107,46119,,8 -46,46051|46109,46051,46109,,,,,,,9 -46,46057|46025|46037|46029,46057,46025,46037,46029,,,,,10 -46,46061|46097|46087,46061,46097,46087,,,,,,11 -46,46063|46019,46063,46019,,,,,,,12 -46,46077|46079,46077,46079,,,,,,,13 -46,46085|46075|46117|46059|46069|46065,46085,46075,46117,46059,46069,46065,,,14 -46,46091|46013,46091,46013,,,,,,,15 -46,46101|46099,46101,46099,,,,,,,16 -46,46105|46093,46105,46093,,,,,,,17 -46,46111|46003|46073|46035,46111,46003,46073,46035,,,,,18 -46,46115|46005,46115,46005,,,,,,,19 -46,46121|46123,46121,46123,,,,,,,20 -46,46125|46135,46125,46135,,,,,,,21 -47,47027|47087,47027,47087,,,,,,,1 -47,47067|47073,47067,47073,,,,,,,2 -47,47083|47161,47083,47161,,,,,,,3 -47,47095|47045,47095,47045,,,,,,,4 -47,47127|47003,47127,47003,,,,,,,5 -47,47135|47039,47135,47039,,,,,,,6 -47,47137|47049,47137,47049,,,,,,,7 -47,47169|47111,47169,47111,,,,,,,8 -47,47175|47185,47175,47185,,,,,,,9 -48,48009|48485,48009,48485,,,,,,,1 -48,48011|48065|48233,48011,48065,48233,,,,,,2 -48,48017|48079,48017,48079,,,,,,,3 -48,48023|48447|48275|48207,48023,48447,48275,48207,,,,,4 -48,48043|48377,48043,48377,,,,,,,5 -48,48045|48153|48345|48107,48045,48153,48345,48107,,,,,6 -48,48047|48247,48047,48247,,,,,,,7 -48,48069|48279,48069,48279,,,,,,,8 -48,48081|48353,48081,48353,,,,,,,9 -48,48083|48049,48083,48049,,,,,,,10 -48,48095|48327|48307,48095,48327,48307,,,,,,11 -48,48103|48135,48103,48135,,,,,,,12 -48,48105|48383|48235|48461,48105,48383,48235,48461,,,,,13 -48,48109|48243|48389,48109,48243,48389,,,,,,14 -48,48111|48205,48111,48205,,,,,,,15 -48,48119|48223,48119,48223,,,,,,,16 -48,48125|48263|48169|48415,48125,48263,48169,48415,,,,,17 -48,48137|48385|48463,48137,48385,48463,,,,,,18 -48,48151|48433|48253,48151,48433,48253,,,,,,19 -48,48173|48033|48227,48173,48033,48227,,,,,,20 -48,48175|48025,48175,48025,,,,,,,21 -48,48191|48101|48269|48155|48197|48075|48087,48191,48101,48269,48155,48197,48075,48087,,22 -48,48193|48099,48193,48099,,,,,,,23 -48,48195|48421|48341,48195,48421,48341,,,,,,24 -48,48229|48141,48229,48141,,,,,,,25 -48,48237|48363,48237,48363,,,,,,,26 -48,48261|48489,48261,48489,,,,,,,27 -48,48267|48319|48265,48267,48319,48265,,,,,,28 -48,48271|48323,48271,48323,,,,,,,29 -48,48283|48163,48283,48163,,,,,,,30 -48,48295|48357,48295,48357,,,,,,,31 -48,48301|48495|48475,48301,48495,48475,,,,,,32 -48,48305|48303,48305,48303,,,,,,,33 -48,48311|48297,48311,48297,,,,,,,34 -48,48317|48115,48317,48115,,,,,,,35 -48,48333|48411,48333,48411,,,,,,,36 -48,48335|48431,48335,48431,,,,,,,37 -48,48369|48359|48117,48369,48359,48117,,,,,,38 -48,48391|48007,48391,48007,,,,,,,39 -48,48393|48211|48483|48129|48179,48393,48211,48483,48129,48179,,,,40 -48,48405|48403,48405,48403,,,,,,,41 -48,48413|48435|48451,48413,48435,48451,,,,,,42 -48,48417|48059,48417,48059,,,,,,,43 -48,48425|48221,48425,48221,,,,,,,44 -48,48429|48133,48429,48133,,,,,,,45 -48,48437|48381,48437,48381,,,,,,,46 -48,48443|48371,48443,48371,,,,,,,47 -48,48501|48165,48501,48165,,,,,,,48 -49,49001|49021,49001,49021,,,,,,,1 -49,49009|49047,49009,49047,,,,,,,2 -49,49019|49015,49019,49015,,,,,,,3 -49,49025|49031|49017|49055|49041,49025,49031,49017,49055,49041,,,,4 -49,49033|49005,49033,49005,,,,,,,5 -50,50009|50005,50009,50005,,,,,,,1 -50,50013|50011,50013,50011,,,,,,,2 -51,51017|51091|51163,51017,51091,51163,,,,,,1 -51,51021|51197,51021,51197,,,,,,,2 -51,51036|51127,51036,51127,,,,,,,3 -51,51045|51161,51045,51161,,,,,,,4 -51,51049|51029,51049,51029,,,,,,,5 -51,51097|51101,51097,51101,,,,,,,6 -51,51115|51073,51115,51073,,,,,,,7 -51,51157|51187,51157,51187,,,,,,,8 -51,51159|51193,51159,51193,,,,,,,9 -51,51181|51095,51181,51095,,,,,,,10 -53,53013|53023|53003,53013,53023,53003,,,,,,1 -53,53019|53065,53019,53065,,,,,,,2 -53,53069|53049,53069,53049,,,,,,,3 -54,54013|54087,54013,54087,,,,,,,1 -54,54015|54067,54015,54067,,,,,,,2 -54,54017|54095,54017,54095,,,,,,,3 -54,54021|54007,54021,54007,,,,,,,4 -54,54073|54085,54073,54085,,,,,,,5 -54,54075|54101,54075,54101,,,,,,,6 -54,54093|54071|54023,54093,54071,54023,,,,,,7 -54,54105|54107,54105,54107,,,,,,,8 -55,55037|55041,55037,55041,,,,,,,1 -55,55051|55003,55051,55003,,,,,,,2 -55,55078|55115,55078,55115,,,,,,,3 -55,55091|55011,55091,55011,,,,,,,4 -56,56011|56045,56011,56045,,,,,,,1 -56,56017|56013,56017,56013,,,,,,,2 -56,56019|56033,56019,56033,,,,,,,3 -56,56031|56027|56015,56031,56027,56015,,,,,,4 -56,56035|56023,56035,56023,,,,,,,5 -56,56043|56003,56043,56003,,,,,,,6 +state_fips,fips_list,group +1,01063|01065,1 +1,01105|01047,2 +4,04011|04009,1 +5,05025|05013|05011,1 +5,05039|05053,2 +5,05073|05091,3 +5,05077|05123,4 +5,05095|05117,5 +5,05097|05109,6 +5,05099|05057,7 +5,05101|05009,8 +5,05129|05089,9 +5,05147|05067,10 +6,06003|06109,1 +6,06049|06035,2 +6,06091|06057,3 +8,08011|08061|08009|08099,1 +8,08017|08063|08125,2 +8,08019|08047,3 +8,08023|08003,4 +8,08025|08089,5 +8,08027|08043,6 +8,08053|08111|08091|08033|08113|08085,7 +8,08055|08101,8 +8,08057|08049,9 +8,08065|08015,10 +8,08073|08039,11 +8,08079|08007,12 +8,08095|08115|08075,13 +8,08103|08045,14 +8,08109|08021|08105,15 +8,08121|08087,16 +12,12067|12121,1 +12,12077|12037,2 +13,13003|13069,1 +13,13007|13205,2 +13,13061|13239|13037|13243,3 +13,13065|13101,4 +13,13125|13301|13189,5 +13,13155|13017,6 +13,13165|13033,7 +13,13167|13303,8 +13,13181|13317,9 +13,13197|13249,10 +13,13201|13099,11 +13,13209|13279,12 +13,13253|13087,13 +13,13259|13307|13053,14 +13,13263|13293,15 +13,13265|13133,16 +13,13269|13193,17 +13,13273|13177,18 +13,13283|13107,19 +13,13287|13081,20 +13,13289|13023,21 +13,13309|13271,22 +13,13315|13235,23 +13,13319|13141|13009,24 +16,16003|16087,1 +16,16009|16057,2 +16,16015|16045,3 +16,16025|16047,4 +16,16029|16007|16041,5 +16,16033|16023|16051,6 +16,16035|16079,7 +16,16037|16059,8 +16,16061|16069,9 +16,16063|16053,10 +16,16071|16077,11 +17,17003|17153,1 +17,17009|17169,2 +17,17013|17083,3 +17,17047|17185,4 +17,17059|17069|17165,5 +17,17065|17193,6 +17,17071|17187,7 +17,17079|17035,8 +17,17151|17127,9 +17,17155|17123,10 +17,17171|17137,11 +17,17175|17143,12 +18,18007|18171,1 +18,18115|18155,2 +18,18161|18041,3 +19,19001|19077,1 +19,19003|19173,2 +19,19009|19029,3 +19,19025|19151,4 +19,19039|19053,5 +19,19051|19179,6 +19,19063|19147,7 +19,19071|19129,8 +19,19089|19037,9 +19,19091|19073|19187,10 +19,19093|19035,11 +19,19117|19185,12 +19,19133|19193,13 +19,19135|19007,14 +19,19143|19141,15 +19,19159|19175,16 +19,19177|19101,17 +19,19195|19033,18 +20,20003|20001,1 +20,20017|20127|20061,2 +20,20023|20181|20199,3 +20,20025|20057,4 +20,20039|20179|20137,5 +20,20043|20013|20005,6 +20,20053|20105|20159,7 +20,20063|20101|20171|20109,8 +20,20065|20195|20051,9 +20,20069|20055,10 +20,20071|20203|20093|20075|20187,11 +20,20073|20031|20207,12 +20,20077|20095,13 +20,20083|20135|20165|20145,14 +20,20107|20121,15 +20,20117|20149,16 +20,20119|20081|20175,17 +20,20129|20067|20189,18 +20,20147|20163,19 +20,20153|20193,20 +20,20157|20029|20143,21 +20,20167|20009,22 +20,20183|20089|20123|20141,23 +20,20185|20033|20097|20047|20007|20151,24 +20,20197|20177,25 +20,20201|20027|20161,26 +20,20205|20019|20049|20125,27 +21,21007|21039,1 +21,21023|21201,2 +21,21055|21139,3 +21,21057|21053,4 +21,21063|21043,5 +21,21075|21105,6 +21,21077|21187,7 +21,21129|21189,8 +21,21143|21033,9 +21,21149|21091|21059,10 +21,21165|21237,11 +21,21169|21087,12 +21,21181|21017,13 +21,21223|21041,14 +22,22021|22073,1 +22,22023|22019,2 +22,22035|22123,3 +22,22081|22013,4 +22,22107|22041,5 +26,26003|26153,1 +26,26083|26013|26061,2 +26,26095|26097,3 +26,26119|26135,4 +26,26131|26053,5 +27,27029|27087,1 +27,27031|27075,2 +27,27051|27011|27155|27149,3 +27,27069|27089,4 +27,27073|27173,5 +27,27077|27007,6 +27,27081|27117,7 +27,27125|27113,8 +27,27133|27101|27105,9 +27,27151|27023,10 +27,27167|27107|27027,11 +28,28009|28139,1 +28,28019|28155,2 +28,28021|28063,3 +28,28037|28005,4 +28,28055|28125|28053|28163,5 +28,28069|28075,6 +28,28119|28027,7 +28,28157|28001,8 +29,29005|29087|29147,1 +29,29025|29177,2 +29,29033|29117,3 +29,29035|29181,4 +29,29041|29115,5 +29,29045|29111,6 +29,29057|29039,7 +29,29061|29081,8 +29,29075|29227|29063,9 +29,29085|29167,10 +29,29103|29199|29197,11 +29,29125|29151,12 +29,29129|29079,13 +29,29137|29205,14 +29,29153|29067,15 +29,29171|29211,16 +29,29179|29093,17 +29,29185|29083,18 +29,29203|29065,19 +30,30005|30071,1 +30,30007|30043,2 +30,30015|30041,3 +30,30023|30001|30093,4 +30,30037|30107|30097|30095,5 +30,30039|30077,6 +30,30045|30059|30013,7 +30,30051|30101|30073,8 +30,30055|30079|30011|30025|30109|30021,9 +30,30057|30031,10 +30,30061|30089,11 +30,30065|30111,12 +30,30069|30027,13 +30,30075|30017,14 +30,30099|30049,15 +30,30103|30033|30087,16 +30,30105|30091|30019|30085,17 +31,31003|31011,1 +31,31015|31009|31017|31149|31103|31115|31071|31089,2 +31,31021|31177,3 +31,31023|31037,4 +31,31027|31051,5 +31,31029|31057|31085|31087|31005|31075|31101|31135,6 +31,31031|31091|31171|31117|31113|31111,7 +31,31035|31129,8 +31,31039|31173,9 +31,31059|31169,10 +31,31063|31145,11 +31,31095|31151,12 +31,31097|31133|31131,13 +31,31107|31139,14 +31,31123|31049|31069|31033,15 +31,31125|31081|31121,16 +31,31127|31147,17 +31,31137|31065|31073|31083,18 +31,31143|31185,19 +31,31161|31045|31013,20 +31,31165|31105|31007|31157,21 +31,31167|31179,22 +31,31175|31077|31183|31093|31163,23 +31,31181|31061|31099|31001,24 +32,32009|32021|32019,1 +32,32017|32003,2 +32,32027|32011|32015|32001,3 +32,32029|32510,4 +32,32033|32007,5 +35,35003|35006,1 +35,35021|35059|35007,2 +35,35023|35017,3 +35,35033|35011|35019|35047,4 +35,35037|35009,5 +36,36041|36043,1 +37,37075|37043,1 +37,37095|37177|37187,2 +38,38005|38103,1 +38,38009|38049,2 +38,38013|38061,3 +38,38019|38071,4 +38,38021|38045|38003,5 +38,38023|38105,6 +38,38025|38007|38033|38087|38011|38001|38041|38089,7 +38,38039|38063|38091|38035,8 +38,38043|38047|38051|38027|38031|38093,9 +38,38057|38055|38065,10 +38,38067|38099,11 +38,38073|38081|38077,12 +38,38075|38101,13 +38,38083|38029|38015,14 +38,38085|38037|38059,15 +38,38095|38069|38079,16 +38,38097|38017,17 +40,40007|40059|40045,1 +40,40011|40073,2 +40,40025|40139,3 +40,40029|40005,4 +40,40043|40039,5 +40,40053|40047,6 +40,40055|40057|40065,7 +40,40067|40137,8 +40,40075|40149,9 +40,40085|40019,10 +40,40129|40009,11 +40,40141|40033|40031,12 +40,40151|40003|40093,13 +41,41021|41055|41065,1 +41,41023|41069|41049,2 +41,41025|41045,3 +41,41037|41035,4 +41,41063|41061,5 +42,42023|42105,1 +42,42053|42123,2 +42,42113|42015,3 +45,45005|45011,1 +45,45065|45047,2 +46,46007|46071|46055|46095,1 +46,46009|46067,2 +46,46015|46017|46053,3 +46,46023|46043,4 +46,46031|46041|46137,5 +46,46033|46047,6 +46,46039|46011,7 +46,46045|46089|46049|46021|46129|46107|46119,8 +46,46051|46109,9 +46,46057|46025|46037|46029,10 +46,46061|46097|46087,11 +46,46063|46019,12 +46,46077|46079,13 +46,46085|46075|46117|46059|46069|46065,14 +46,46091|46013,15 +46,46101|46099,16 +46,46105|46093,17 +46,46111|46003|46073|46035,18 +46,46115|46005,19 +46,46121|46123,20 +46,46125|46135,21 +47,47027|47087,1 +47,47067|47073,2 +47,47083|47161,3 +47,47095|47045,4 +47,47127|47003,5 +47,47135|47039,6 +47,47137|47049,7 +47,47169|47111,8 +47,47175|47185,9 +48,48009|48485,1 +48,48011|48065|48233,2 +48,48017|48079,3 +48,48023|48447|48275|48207,4 +48,48043|48377,5 +48,48045|48153|48345|48107,6 +48,48047|48247,7 +48,48069|48279,8 +48,48081|48353,9 +48,48083|48049,10 +48,48095|48327|48307,11 +48,48103|48135,12 +48,48105|48383|48235|48461,13 +48,48109|48243|48389,14 +48,48111|48205,15 +48,48119|48223,16 +48,48125|48263|48169|48415,17 +48,48137|48385|48463,18 +48,48151|48433|48253,19 +48,48173|48033|48227,20 +48,48175|48025,21 +48,48191|48101|48269|48155|48197|48075|48087,22 +48,48193|48099,23 +48,48195|48421|48341,24 +48,48229|48141,25 +48,48237|48363,26 +48,48261|48489,27 +48,48267|48319|48265,28 +48,48271|48323,29 +48,48283|48163,30 +48,48295|48357,31 +48,48301|48495|48475,32 +48,48305|48303,33 +48,48311|48297,34 +48,48317|48115,35 +48,48333|48411,36 +48,48335|48431,37 +48,48369|48359|48117,38 +48,48391|48007,39 +48,48393|48211|48483|48129|48179,40 +48,48405|48403,41 +48,48413|48435|48451,42 +48,48417|48059,43 +48,48425|48221,44 +48,48429|48133,45 +48,48437|48381,46 +48,48443|48371,47 +48,48501|48165,48 +49,49001|49021,1 +49,49009|49047,2 +49,49019|49015,3 +49,49025|49031|49017|49055|49041,4 +49,49033|49005,5 +50,50009|50005,1 +50,50013|50011,2 +51,51017|51091|51163,1 +51,51021|51197,2 +51,51036|51127,3 +51,51045|51161,4 +51,51049|51029,5 +51,51097|51101,6 +51,51115|51073,7 +51,51157|51187,8 +51,51159|51193,9 +51,51181|51095,10 +53,53013|53023|53003,1 +53,53019|53065,2 +53,53069|53049,3 +54,54013|54087,1 +54,54015|54067,2 +54,54017|54095,3 +54,54021|54007,4 +54,54073|54085,5 +54,54075|54101,6 +54,54093|54071|54023,7 +54,54105|54107,8 +55,55037|55041,1 +55,55051|55003,2 +55,55078|55115,3 +55,55091|55011,4 +56,56011|56045,1 +56,56017|56013,2 +56,56019|56033,3 +56,56031|56027|56015,4 +56,56035|56023,5 +56,56043|56003,6 diff --git a/_delphi_utils_python/data_proc/geomap/geo_data_proc.py b/_delphi_utils_python/data_proc/geomap/geo_data_proc.py index 2e4c1874b..d51f9b551 100755 --- a/_delphi_utils_python/data_proc/geomap/geo_data_proc.py +++ b/_delphi_utils_python/data_proc/geomap/geo_data_proc.py @@ -483,14 +483,15 @@ def derive_fips_chngfips_crosswalk(): if not isfile(join(OUTPUT_DIR, FIPS_STATE_OUT_FILENAME)): derive_fips_state_crosswalk() - # County mapping file is derived from - # https://docs.google.com/spreadsheets/d/1PEce4CjjHbRM1Z5xEMNI6Xsq_b2kkCh0/edit#gid=871427657. - # We assign an incrementing integer to be the group id of each county - # grouping within the given state via: - # - # county_groups["group"] = (county_groups.groupby("state_fips").cumcount() + 1).astype("string") - county_groups = pd.read_csv(CHNG_COUNTY_GROUPS_FILE, dtype="string", index_col=False - ).drop(columns = "fips_list") + assign_county_groups() + county_groups = pd.read_csv(CHNG_COUNTY_GROUPS_FILE, dtype="string", index_col=False) + # Split list of county FIPS codes into separate columns. + county_groups = pd.concat( + [county_groups, county_groups.fips_list.str.split("|", expand=True)], + axis=1 + ).drop( + columns = "fips_list" + ) # Change to long format. county_groups = pd.melt( @@ -548,6 +549,105 @@ def derive_chngfips_state_crosswalk(): group_to_state.to_csv(join(OUTPUT_DIR, CHNGFIPS_STATE_OUT_FILENAME), index=False) +def fetch_county_groups_spreadsheet(): + # County mapping file is derived from + # https://docs.google.com/spreadsheets/d/1PEce4CjjHbRM1Z5xEMNI6Xsq_b2kkCh0/edit#gid=871427657 + sheet_id = "1PEce4CjjHbRM1Z5xEMNI6Xsq_b2kkCh0" + sheet_name = "groupings" + # Request sheet in CSV format via tag in URL. + url = f"https://docs.google.com/spreadsheets/d/{sheet_id}/gviz/tq?tqx=out:csv&sheet={sheet_name}" + + county_groups = pd.read_csv( + url, dtype="string", index_col=False + ).dropna( + how="all", axis=1 + ) + county_groups["state FIPS"] = county_groups["state FIPS"].astype(int) + + # Counties belonging to each group are listed (as FIPS codes) in the "county + # FIPS grouping" column, concatenated and separated by the pipe "|". + new_names = { + "state FIPS": "state_fips", + "county FIPS grouping": "fips_list" + } + + county_groups = county_groups.rename( + columns=new_names + )[new_names.values()] + + return county_groups + + +def assign_county_groups(): + county_groups = fetch_county_groups_spreadsheet() + + # If a county groups mapping file already exists in `data_proc/geomap`, we + # have to be careful to not reassign a group number to a different group. + # Group numbers must remain fixed, even if a given county group is no longer + # being used. + if isfile(CHNG_COUNTY_GROUPS_FILE): + old_county_groups = pd.read_csv(CHNG_COUNTY_GROUPS_FILE, dtype="string", index_col=False) + old_county_groups.group = old_county_groups.group.astype(int) + old_county_groups.state_fips = old_county_groups.state_fips.astype(int) + + # Remove rows from county_groups if that `fips_list` value already + # exists in old_county_groups. + county_groups = county_groups[ + ~county_groups.fips_list.isin(old_county_groups.fips_list) + ] + + # If grouping file has no new rows, no need to process again. + if county_groups.empty: + return + # Grouping spreadsheet contains rows not seen in old, on-disk county + # groupings file. Combining the two is delicate. While the code below + # appears to work, it has not been formally tested and could be + # invalid for even small changes to the format of the input county + # groupings file. + else: + raise NotImplementedError( + "Can't combine old and new county groupings automatically, " + "code below is not tested or robust to changes in input format." + "We recommend manually working with the code below and the new" + "data in a REPL." + ) + + # Assign an incrementing integer to be the group id of each remaining + # county grouping within a state using the given sort order. + county_groups["group"] = county_groups.groupby("state_fips").cumcount() + 1 + + # Find max group number by state in old_county_groups, join on, and + # add max group number to group number. + max_group_by_state = old_county_groups.groupby( + "state_fips" + ).group.max( + ).reset_index( + ).rename( + columns = {"group": "max_group"} + ) + county_groups = county_groups.join( + max_group_by_state.set_index("state_fips"), + how="left", + on="state_fips" + ).assign( + group = lambda x: x.group + x.max_group + ).drop( + ["max_group"], axis=1 + ) + + # Combine old_county_groups and county_groups + county_groups = pd.concat([old_county_groups, county_groups]) + else: + # Group numbers are 1-indexed. + county_groups["group"] = county_groups.groupby("state_fips").cumcount() + 1 + + county_groups.sort_values( + ["state_fips"], kind="stable" + ).to_csv( + CHNG_COUNTY_GROUPS_FILE, index=False + ) + + def clear_dir(dir_path: str): for fname in listdir(dir_path): remove(join(dir_path, fname))