diff --git a/docs/sources.md b/docs/sources.md index 51a7c876e..08ca8b210 100644 --- a/docs/sources.md +++ b/docs/sources.md @@ -231,7 +231,7 @@ Here's the scraper for Indiana that gets data from a CSV: { url: 'https://opendata.arcgis.com/datasets/d14de7e28b0448ab82eb36d6f25b1ea1_0.csv', country: 'iso1:US', - state: 'IN', + state: 'iso2:US-IN', scraper: async function() { let data = await fetch.csv(this.url); @@ -259,7 +259,7 @@ Here's the scraper for Oregon that pulls data from a HTML table: ```javascript { - state: 'OR', + state: 'iso2:US-OR', country: 'iso1:US', url: 'https://www.oregon.gov/oha/PH/DISEASESCONDITIONS/DISEASESAZ/Pages/emerging-respiratory-infections.aspx', scraper: async function() { @@ -298,7 +298,7 @@ Scrapers need to be able to operate correctly on old data, so updates to scraper ```javascript { - state: 'LA', + state: 'iso2:US-LA', country: 'iso1:US', aggregate: 'county', _countyMap: { 'La Salle Parish': 'LaSalle Parish' }, diff --git a/src/events/crawler/scrape-data/normalize-locations.js b/src/events/crawler/scrape-data/normalize-locations.js index 57dea438b..083a62887 100644 --- a/src/events/crawler/scrape-data/normalize-locations.js +++ b/src/events/crawler/scrape-data/normalize-locations.js @@ -1,10 +1,8 @@ -import path from 'path'; // eslint-disable-next-line import/no-extraneous-dependencies import fipsCodes from 'country-levels/fips.json'; -// eslint-disable-next-line import/no-extraneous-dependencies -import iso2Codes from 'country-levels/iso2.json'; -import { isId } from '../../../shared/lib/geography/country-levels.js'; +import path from 'path'; import * as countryLevels from '../../../shared/lib/geography/country-levels.js'; +import { isId } from '../../../shared/lib/geography/country-levels.js'; import * as geography from '../../../shared/lib/geography/index.js'; import log from '../../../shared/lib/log.js'; @@ -13,7 +11,7 @@ const UNASSIGNED = '(unassigned)'; function findCountryLevelID(location) { for (const [, properties] of Object.entries(fipsCodes)) { - if (properties.state_code_postal === location.state && properties.name === location.county) { + if (`iso2:${properties.state_code_iso}` === location.state && properties.name === location.county) { return properties.countrylevel_id; } } @@ -24,20 +22,28 @@ const normalizeLocations = args => { log('⏳ Normalizing locations...'); const { locations } = args; + const filteredLocations = []; // Normalize data for (const location of locations) { - // make sure location.country is always in country-level id form + // make sure location.country and state is always in country-level id form if (!isId(location.country)) { - log.error(` ❌ location.country not in country-level id: ${location.country}, ${location._path}`); + log.error(` ❌ location.country is not a country-level id: ${location.country}, ${location._path}`); + continue; + } + + if (location.state && !isId(location.state)) { + log.error(` ❌ location.state is not a country-level id: ${location.state}, ${location._path}`); + continue; } if (!countryLevels.getIdFromLocation(location)) { if (location.country === 'iso1:US') { - // Normalize states - location.state = geography.toUSStateAbbreviation(location.state); + if (location.county === UNASSIGNED) { + continue; + } - if (location.county && location.county !== UNASSIGNED) { + if (location.county) { // Find county FIPS ID if (Array.isArray(location.county)) { const aggregatedCounty = []; @@ -45,8 +51,7 @@ const normalizeLocations = args => { for (const subCounty of location.county) { const subLocation = { county: subCounty, - state: location.state, - country: location.country + state: location.state }; const countryLevelId = findCountryLevelID(subLocation); if (countryLevelId) { @@ -62,6 +67,8 @@ const normalizeLocations = args => { } if (fipsFound) { location.county = aggregatedCounty.join('+'); + } else { + continue; } } else { let fipsFound = false; @@ -72,18 +79,13 @@ const normalizeLocations = args => { } if (!fipsFound) { log.error(' ❌ Failed to find FIPS code for %s, %s', location.county, location.state); + continue; } } } - - // Find state ID - if (location.state) { - if (iso2Codes[`US-${location.state}`]) { - location.state = iso2Codes[`US-${location.state}`].countrylevel_id; - } else { - log.error(' ❌ Failed to find FIPS code for state %s', location.state); - } - } + } else { + log.error(` ❌ location.county is not a country-level id: ${location.state}, ${location._path}`); + continue; } } @@ -95,9 +97,11 @@ const normalizeLocations = args => { if (!location.type && path.extname(location.url).substr(1)) { location.type = path.extname(location.url).substr(1); } + + filteredLocations.push(location); } - return { ...args, locations }; + return { ...args, locations: filteredLocations }; }; export default normalizeLocations; diff --git a/src/shared/scrapers/BR/index.js b/src/shared/scrapers/BR/index.js index d257260a9..50a4fee86 100644 --- a/src/shared/scrapers/BR/index.js +++ b/src/shared/scrapers/BR/index.js @@ -29,33 +29,33 @@ const scraper = { } ], _ufs: { - Acre: ['AC', 881935, [-9.0238, -70.812]], - Alagoas: ['AL', 3337357, [-9.5713, -36.782]], - Amapá: ['AP', 845731, [0.902, -52.003]], - Amazonas: ['AM', 4144597, [-3.4168, -65.8561]], - Bahia: ['BA', 14873064, [-12.5797, -41.7007]], - Ceará: ['CE', 9132078, [-5.4984, -39.3206]], - 'Distrito Federal': ['DF', 3015268, [-15.7998, -47.8645]], - 'Espírito Santo': ['ES', 4018650, [-19.1834, -40.3089]], - Goiás: ['GO', 7018354, [-15.827, -49.8362]], - Maranhão: ['MA', 7075181, [-4.9609, -45.2744]], - 'Mato Grosso': ['MT', 3484466, [-12.6819, -56.9211]], - 'Mato Grosso do Sul': ['MS', 2778986, [-20.7722, -54.7852]], - 'Minas Gerais': ['MG', 21168791, [-18.5122, -44.555]], - Paraná: ['PR', 11433957, [-25.2521, -52.0215]], - Paraíba: ['PB', 4018127, [-7.24, -36.782]], - Pará: ['PA', 11433957, [-1.9981, -54.9306]], - Pernambuco: ['PE', 9557071, [-8.8137, -36.9541]], - Piauí: ['PI', 3273227, [-7.7183, -42.7289]], - 'Rio Grande do Norte': ['RN', 3506853, [-5.4026, -36.9541]], - 'Rio Grande do Sul': ['RS', 11377239, [-30.0346, -51.2177]], - 'Rio de Janeiro': ['RJ', 17264943, [-22.9099, -43.2095]], - Rondônia: ['RO', 1777225, [-11.5057, -63.5806]], - Roraima: ['RR', 60576, [2.7376, -62.0751]], - 'Santa Catarina': ['SC', 7164788, [-27.2423, -50.2189]], - Sergipe: ['SE', 2298696, [-10.5741, -37.3857]], - 'São Paulo': ['SP', 45919049, [-23.5505, -46.6333]], - Tocantins: ['TO', 1572866, [-10.1753, -48.2982]] + Acre: ['iso2:BR-AC', 881935, [-9.0238, -70.812]], + Alagoas: ['iso2:BR-AL', 3337357, [-9.5713, -36.782]], + Amapá: ['iso2:BR-AP', 845731, [0.902, -52.003]], + Amazonas: ['iso2:BR-AM', 4144597, [-3.4168, -65.8561]], + Bahia: ['iso2:BR-BA', 14873064, [-12.5797, -41.7007]], + Ceará: ['iso2:BR-CE', 9132078, [-5.4984, -39.3206]], + 'Distrito Federal': ['iso2:BR-DF', 3015268, [-15.7998, -47.8645]], + 'Espírito Santo': ['iso2:BR-ES', 4018650, [-19.1834, -40.3089]], + Goiás: ['iso2:BR-GO', 7018354, [-15.827, -49.8362]], + Maranhão: ['iso2:BR-MA', 7075181, [-4.9609, -45.2744]], + 'Mato Grosso': ['iso2:BR-MT', 3484466, [-12.6819, -56.9211]], + 'Mato Grosso do Sul': ['iso2:BR-MS', 2778986, [-20.7722, -54.7852]], + 'Minas Gerais': ['iso2:BR-MG', 21168791, [-18.5122, -44.555]], + Paraná: ['iso2:BR-PR', 11433957, [-25.2521, -52.0215]], + Paraíba: ['iso2:BR-PB', 4018127, [-7.24, -36.782]], + Pará: ['iso2:BR-PA', 11433957, [-1.9981, -54.9306]], + Pernambuco: ['iso2:BR-PE', 9557071, [-8.8137, -36.9541]], + Piauí: ['iso2:BR-PI', 3273227, [-7.7183, -42.7289]], + 'Rio Grande do Norte': ['iso2:BR-RN', 3506853, [-5.4026, -36.9541]], + 'Rio Grande do Sul': ['iso2:BR-RS', 11377239, [-30.0346, -51.2177]], + 'Rio de Janeiro': ['iso2:BR-RJ', 17264943, [-22.9099, -43.2095]], + Rondônia: ['iso2:BR-RO', 1777225, [-11.5057, -63.5806]], + Roraima: ['iso2:BR-RR', 60576, [2.7376, -62.0751]], + 'Santa Catarina': ['iso2:BR-SC', 7164788, [-27.2423, -50.2189]], + Sergipe: ['iso2:BR-SE', 2298696, [-10.5741, -37.3857]], + 'São Paulo': ['iso2:BR-SP', 45919049, [-23.5505, -46.6333]], + Tocantins: ['iso2:BR-TO', 1572866, [-10.1753, -48.2982]] }, async scraper() { const response = []; diff --git a/src/shared/scrapers/KR/index.js b/src/shared/scrapers/KR/index.js index 122a6f8d5..142b03e7f 100644 --- a/src/shared/scrapers/KR/index.js +++ b/src/shared/scrapers/KR/index.js @@ -62,7 +62,7 @@ const scraper = { const $ = await fetch.page(this.url); const $table = $('table.num'); - const states = []; + let states = []; const $headings = $table.find('thead tr:last-child th'); const headingOffset = $table.find('thead tr:first-child th[rowspan="2"]').length - 1; // -1 for the th in each province row. @@ -100,6 +100,8 @@ const scraper = { const summedData = transform.sumData(states); states.push(summedData); + + states = states.filter(s => s.state !== UNASSIGNED); assert(summedData.cases > 0, 'Cases is not reasonable'); return states; diff --git a/src/shared/scrapers/US/AK/index.js b/src/shared/scrapers/US/AK/index.js index 85512f2ce..0fb1c451c 100644 --- a/src/shared/scrapers/US/AK/index.js +++ b/src/shared/scrapers/US/AK/index.js @@ -3,7 +3,7 @@ import * as parse from '../../../lib/parse.js'; import * as transform from '../../../lib/transform.js'; const scraper = { - state: 'AK', + state: 'iso2:US-AK', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/AL/index.js b/src/shared/scrapers/US/AL/index.js index 1b92f7a96..e72781ed5 100644 --- a/src/shared/scrapers/US/AL/index.js +++ b/src/shared/scrapers/US/AL/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'AL', + state: 'iso2:US-AL', country: 'iso1:US', url: 'http://www.alabamapublichealth.gov/infectiousdiseases/2019-coronavirus.html', type: 'table', diff --git a/src/shared/scrapers/US/AR/index.js b/src/shared/scrapers/US/AR/index.js index 53c159380..4d3de70d8 100644 --- a/src/shared/scrapers/US/AR/index.js +++ b/src/shared/scrapers/US/AR/index.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'AR', + state: 'iso2:US-AR', country: 'iso1:US', url: 'https://services.arcgis.com/PwY9ZuZRDiI5nXUB/ArcGIS/rest/services/ADH_COVID19_Positive_Test_Results/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*', @@ -120,6 +120,7 @@ const scraper = { counties.push(transform.sumData(counties)); counties = geography.addEmptyRegions(counties, this._counties, 'county'); + counties = counties.filter(c => c.county !== UNASSIGNED); return counties; } }; diff --git a/src/shared/scrapers/US/AZ/index.js b/src/shared/scrapers/US/AZ/index.js index e7fb5df1a..6eae08e30 100644 --- a/src/shared/scrapers/US/AZ/index.js +++ b/src/shared/scrapers/US/AZ/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'AZ', + state: 'iso2:US-AZ', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/CA/alameda-county.js b/src/shared/scrapers/US/CA/alameda-county.js index d4a5f180e..c6a48fd24 100644 --- a/src/shared/scrapers/US/CA/alameda-county.js +++ b/src/shared/scrapers/US/CA/alameda-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Alameda County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/CA/butte-county.js b/src/shared/scrapers/US/CA/butte-county.js index b287c1f95..d1c07022c 100644 --- a/src/shared/scrapers/US/CA/butte-county.js +++ b/src/shared/scrapers/US/CA/butte-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Butte County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/CA/calaveras-county.js b/src/shared/scrapers/US/CA/calaveras-county.js index 02ed09101..bcce435e5 100644 --- a/src/shared/scrapers/US/CA/calaveras-county.js +++ b/src/shared/scrapers/US/CA/calaveras-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Calaveras County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://covid19.calaverasgov.us/', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/colusa-county.js b/src/shared/scrapers/US/CA/colusa-county.js index 18c861e66..f4b995dc6 100644 --- a/src/shared/scrapers/US/CA/colusa-county.js +++ b/src/shared/scrapers/US/CA/colusa-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Colusa County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'http://www.countyofcolusa.org/99/Public-Health', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/contra-costa-county.js b/src/shared/scrapers/US/CA/contra-costa-county.js index 3a9bd3f2a..b0f2fada2 100644 --- a/src/shared/scrapers/US/CA/contra-costa-county.js +++ b/src/shared/scrapers/US/CA/contra-costa-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Contra Costa County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://www.coronavirus.cchealth.org/', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/del-norte-county.js b/src/shared/scrapers/US/CA/del-norte-county.js index 151bb174c..d2bc36462 100644 --- a/src/shared/scrapers/US/CA/del-norte-county.js +++ b/src/shared/scrapers/US/CA/del-norte-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Del Norte County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'http://www.co.del-norte.ca.us/departments/health-human-services/public-health', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/fresno-county.js b/src/shared/scrapers/US/CA/fresno-county.js index 780d5d7a9..53f587841 100644 --- a/src/shared/scrapers/US/CA/fresno-county.js +++ b/src/shared/scrapers/US/CA/fresno-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Fresno County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://www.co.fresno.ca.us/departments/public-health/covid-19', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/glenn-county.js b/src/shared/scrapers/US/CA/glenn-county.js index 313ae9478..530c740d2 100644 --- a/src/shared/scrapers/US/CA/glenn-county.js +++ b/src/shared/scrapers/US/CA/glenn-county.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Glenn County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], async scraper() { diff --git a/src/shared/scrapers/US/CA/index.js b/src/shared/scrapers/US/CA/index.js index a72d61544..8192fa111 100644 --- a/src/shared/scrapers/US/CA/index.js +++ b/src/shared/scrapers/US/CA/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', priority: 1, type: 'csv', diff --git a/src/shared/scrapers/US/CA/kern-county.js b/src/shared/scrapers/US/CA/kern-county.js index 4aef94222..073902f05 100644 --- a/src/shared/scrapers/US/CA/kern-county.js +++ b/src/shared/scrapers/US/CA/kern-county.js @@ -6,7 +6,7 @@ import * as parse from '../../../lib/parse.js'; const scraper = { county: 'Kern County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://kernpublichealth.com/2019-novel-coronavirus/', type: 'table', diff --git a/src/shared/scrapers/US/CA/kings-county.js b/src/shared/scrapers/US/CA/kings-county.js index ba32675eb..2374b42e8 100644 --- a/src/shared/scrapers/US/CA/kings-county.js +++ b/src/shared/scrapers/US/CA/kings-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Kings County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: diff --git a/src/shared/scrapers/US/CA/los-angeles-county.js b/src/shared/scrapers/US/CA/los-angeles-county.js index 69cb58e55..384f6d18b 100644 --- a/src/shared/scrapers/US/CA/los-angeles-county.js +++ b/src/shared/scrapers/US/CA/los-angeles-county.js @@ -13,7 +13,7 @@ const scraper = { url: 'http://www.publichealth.lacounty.gov' } ], - state: 'CA', + state: 'iso2:US-CA', type: 'table', url: 'http://www.publichealth.lacounty.gov/media/Coronavirus/js/casecounter.js', scraper: { diff --git a/src/shared/scrapers/US/CA/madera-county.js b/src/shared/scrapers/US/CA/madera-county.js index 15c071fea..4edec3350 100644 --- a/src/shared/scrapers/US/CA/madera-county.js +++ b/src/shared/scrapers/US/CA/madera-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Madera County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.maderacounty.com/government/public-health/health-updates/corona-virus', diff --git a/src/shared/scrapers/US/CA/marin-county.js b/src/shared/scrapers/US/CA/marin-county.js index 3bebcc10b..4dbc236c5 100644 --- a/src/shared/scrapers/US/CA/marin-county.js +++ b/src/shared/scrapers/US/CA/marin-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Marin County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://coronavirus.marinhhs.org/surveillance', diff --git a/src/shared/scrapers/US/CA/mendocino-county.js b/src/shared/scrapers/US/CA/mendocino-county.js index fe0a57022..dd81fd9a9 100644 --- a/src/shared/scrapers/US/CA/mendocino-county.js +++ b/src/shared/scrapers/US/CA/mendocino-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Mendocino County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.mendocinocounty.org/community/novel-coronavirus', diff --git a/src/shared/scrapers/US/CA/merced-county.js b/src/shared/scrapers/US/CA/merced-county.js index 87904a3b3..6195ae762 100644 --- a/src/shared/scrapers/US/CA/merced-county.js +++ b/src/shared/scrapers/US/CA/merced-county.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Merced County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.co.merced.ca.us/3350/Coronavirus-Disease-2019', diff --git a/src/shared/scrapers/US/CA/mono-county.js b/src/shared/scrapers/US/CA/mono-county.js index 3fecd5f8a..389f53397 100644 --- a/src/shared/scrapers/US/CA/mono-county.js +++ b/src/shared/scrapers/US/CA/mono-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Mono County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://monocovid19-monomammoth.hub.arcgis.com/', diff --git a/src/shared/scrapers/US/CA/monterey-county.js b/src/shared/scrapers/US/CA/monterey-county.js index df9aaf9ee..1555f594e 100644 --- a/src/shared/scrapers/US/CA/monterey-county.js +++ b/src/shared/scrapers/US/CA/monterey-county.js @@ -6,7 +6,7 @@ import * as parse from '../../../lib/parse.js'; const scraper = { county: 'Monterey County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://www.co.monterey.ca.us/government/departments-a-h/administrative-office/office-of-emergency-services/response/covid-19', diff --git a/src/shared/scrapers/US/CA/orange-county.js b/src/shared/scrapers/US/CA/orange-county.js index e9acbea9a..dfd70b9aa 100644 --- a/src/shared/scrapers/US/CA/orange-county.js +++ b/src/shared/scrapers/US/CA/orange-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Orange County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://www.ochealthinfo.com/phs/about/epidasmt/epi/dip/prevention/novel_coronavirus', diff --git a/src/shared/scrapers/US/CA/placer-county.js b/src/shared/scrapers/US/CA/placer-county.js index a8c08ca55..9a1671bf1 100644 --- a/src/shared/scrapers/US/CA/placer-county.js +++ b/src/shared/scrapers/US/CA/placer-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Placer County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.placer.ca.gov/6448/Cases-in-Placer', diff --git a/src/shared/scrapers/US/CA/riverside-county.js b/src/shared/scrapers/US/CA/riverside-county.js index 555e8094b..096d7efd6 100644 --- a/src/shared/scrapers/US/CA/riverside-county.js +++ b/src/shared/scrapers/US/CA/riverside-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Riverside County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.rivcoph.org/coronavirus', diff --git a/src/shared/scrapers/US/CA/sacramento-county.js b/src/shared/scrapers/US/CA/sacramento-county.js index 4e417d9d8..56d9a51b9 100644 --- a/src/shared/scrapers/US/CA/sacramento-county.js +++ b/src/shared/scrapers/US/CA/sacramento-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Sacramento County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.saccounty.net/COVID-19/Pages/default.aspx', diff --git a/src/shared/scrapers/US/CA/san-benito-county.js b/src/shared/scrapers/US/CA/san-benito-county.js index ad93cdf96..9762f0ec0 100644 --- a/src/shared/scrapers/US/CA/san-benito-county.js +++ b/src/shared/scrapers/US/CA/san-benito-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Benito County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://hhsa.cosb.us/publichealth/communicable-disease/coronavirus/', diff --git a/src/shared/scrapers/US/CA/san-bernardino-county.js b/src/shared/scrapers/US/CA/san-bernardino-county.js index dd4fffe9f..3855df41e 100644 --- a/src/shared/scrapers/US/CA/san-bernardino-county.js +++ b/src/shared/scrapers/US/CA/san-bernardino-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Bernardino County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://wp.sbcounty.gov/dph/coronavirus/', diff --git a/src/shared/scrapers/US/CA/san-diego-county.js b/src/shared/scrapers/US/CA/san-diego-county.js index e9596c2ec..1b69208bb 100644 --- a/src/shared/scrapers/US/CA/san-diego-county.js +++ b/src/shared/scrapers/US/CA/san-diego-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Diego County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.sandiegocounty.gov/content/sdc/hhsa/programs/phs/community_epidemiology/dc/2019-nCoV/status.html', diff --git a/src/shared/scrapers/US/CA/san-francisco-county.js b/src/shared/scrapers/US/CA/san-francisco-county.js index 71cb4441c..376d78802 100644 --- a/src/shared/scrapers/US/CA/san-francisco-county.js +++ b/src/shared/scrapers/US/CA/san-francisco-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Francisco County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.sfdph.org/dph/alerts/coronavirus.asp', diff --git a/src/shared/scrapers/US/CA/san-joaquin-county.js b/src/shared/scrapers/US/CA/san-joaquin-county.js index 159283b1d..53dfa7086 100644 --- a/src/shared/scrapers/US/CA/san-joaquin-county.js +++ b/src/shared/scrapers/US/CA/san-joaquin-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Joaquin County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://www.sjcphs.org/coronavirus.aspx#res', diff --git a/src/shared/scrapers/US/CA/san-luis-obispo-county.js b/src/shared/scrapers/US/CA/san-luis-obispo-county.js index 95b489890..f4283238d 100644 --- a/src/shared/scrapers/US/CA/san-luis-obispo-county.js +++ b/src/shared/scrapers/US/CA/san-luis-obispo-county.js @@ -6,7 +6,7 @@ import * as parse from '../../../lib/parse.js'; const scraper = { county: 'San Luis Obispo County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', url: 'https://www.emergencyslo.org/en/covid19.aspx', type: 'paragraph', diff --git a/src/shared/scrapers/US/CA/san-mateo-county.js b/src/shared/scrapers/US/CA/san-mateo-county.js index 23495ac02..91db28ac9 100644 --- a/src/shared/scrapers/US/CA/san-mateo-county.js +++ b/src/shared/scrapers/US/CA/san-mateo-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'San Mateo County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.smchealth.org/coronavirus', diff --git a/src/shared/scrapers/US/CA/santa-barbara-county.js b/src/shared/scrapers/US/CA/santa-barbara-county.js index 0e317ddd3..14d580e90 100644 --- a/src/shared/scrapers/US/CA/santa-barbara-county.js +++ b/src/shared/scrapers/US/CA/santa-barbara-county.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Santa Barbara County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://publichealthsbc.org', diff --git a/src/shared/scrapers/US/CA/santa-clara-county.js b/src/shared/scrapers/US/CA/santa-clara-county.js index 73e744991..5044fb20c 100644 --- a/src/shared/scrapers/US/CA/santa-clara-county.js +++ b/src/shared/scrapers/US/CA/santa-clara-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Santa Clara County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://www.sccgov.org/sites/phd/DiseaseInformation/novel-coronavirus/Pages/home.aspx', diff --git a/src/shared/scrapers/US/CA/santa-cruz-county.js b/src/shared/scrapers/US/CA/santa-cruz-county.js index dae4c1d8f..3e46ee61e 100644 --- a/src/shared/scrapers/US/CA/santa-cruz-county.js +++ b/src/shared/scrapers/US/CA/santa-cruz-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Santa Cruz County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://www.santacruzhealth.org/HSAHome/HSADivisions/PublicHealth/CommunicableDiseaseControl/Coronavirus.aspx', diff --git a/src/shared/scrapers/US/CA/shasta-county.js b/src/shared/scrapers/US/CA/shasta-county.js index 9e0bfccfb..d581168df 100644 --- a/src/shared/scrapers/US/CA/shasta-county.js +++ b/src/shared/scrapers/US/CA/shasta-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Shasta County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], scraper: { diff --git a/src/shared/scrapers/US/CA/solano-county.js b/src/shared/scrapers/US/CA/solano-county.js index 774becf8c..7fe8e8d12 100644 --- a/src/shared/scrapers/US/CA/solano-county.js +++ b/src/shared/scrapers/US/CA/solano-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Solano County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://www.solanocounty.com/depts/ph/coronavirus.asp', diff --git a/src/shared/scrapers/US/CA/sonoma-county-argcgis.js b/src/shared/scrapers/US/CA/sonoma-county-argcgis.js index 7ba2b010d..ae43846c1 100644 --- a/src/shared/scrapers/US/CA/sonoma-county-argcgis.js +++ b/src/shared/scrapers/US/CA/sonoma-county-argcgis.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; const scraper = { country: 'iso1:US', - state: 'CA', + state: 'iso2:US-CA', url: 'https://opendata.arcgis.com/datasets/06fcfe6147574a75afea97a1f7565dc7_0.csv', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/CA/sonoma-county.js b/src/shared/scrapers/US/CA/sonoma-county.js index 606f26be0..458bfcb7f 100644 --- a/src/shared/scrapers/US/CA/sonoma-county.js +++ b/src/shared/scrapers/US/CA/sonoma-county.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Sonoma County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'https://socoemergency.org/emergency/novel-coronavirus/novel-coronavirus-in-sonoma-county/', diff --git a/src/shared/scrapers/US/CA/stanislaus-county.js b/src/shared/scrapers/US/CA/stanislaus-county.js index 49541e365..8af555436 100644 --- a/src/shared/scrapers/US/CA/stanislaus-county.js +++ b/src/shared/scrapers/US/CA/stanislaus-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Stanislaus County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: 'http://www.schsa.org/PublicHealth/pages/corona-virus/', diff --git a/src/shared/scrapers/US/CA/ventura-county.js b/src/shared/scrapers/US/CA/ventura-county.js index 91db747e8..e766b96e3 100644 --- a/src/shared/scrapers/US/CA/ventura-county.js +++ b/src/shared/scrapers/US/CA/ventura-county.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Ventura County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', type: 'paragraph', maintainers: [maintainers.jbencina], diff --git a/src/shared/scrapers/US/CA/yolo-county.js b/src/shared/scrapers/US/CA/yolo-county.js index 2ce822602..f5ee1b0f0 100644 --- a/src/shared/scrapers/US/CA/yolo-county.js +++ b/src/shared/scrapers/US/CA/yolo-county.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; const scraper = { county: 'Yolo County', - state: 'CA', + state: 'iso2:US-CA', country: 'iso1:US', maintainers: [maintainers.jbencina], url: diff --git a/src/shared/scrapers/US/CO/index.js b/src/shared/scrapers/US/CO/index.js index 9797be538..2035b3ccb 100644 --- a/src/shared/scrapers/US/CO/index.js +++ b/src/shared/scrapers/US/CO/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'CO', + state: 'iso2:US-CO', country: 'iso1:US', aggregate: 'county', priority: 1, diff --git a/src/shared/scrapers/US/CT/index.js b/src/shared/scrapers/US/CT/index.js index f7c78b70a..73bae2ab4 100644 --- a/src/shared/scrapers/US/CT/index.js +++ b/src/shared/scrapers/US/CT/index.js @@ -10,7 +10,7 @@ import maintainers from '../../../lib/maintainers.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'CT', + state: 'iso2:US-CT', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/DC/index.js b/src/shared/scrapers/US/DC/index.js index b8a153500..4a0f669e5 100644 --- a/src/shared/scrapers/US/DC/index.js +++ b/src/shared/scrapers/US/DC/index.js @@ -9,7 +9,7 @@ import * as parse from '../../../lib/parse.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'DC', + state: 'iso2:US-DC', country: 'iso1:US', county: 'District of Columbia', maintainers: [maintainers.aed3], diff --git a/src/shared/scrapers/US/DE/index.js b/src/shared/scrapers/US/DE/index.js index a4bf6787a..47863b089 100644 --- a/src/shared/scrapers/US/DE/index.js +++ b/src/shared/scrapers/US/DE/index.js @@ -9,7 +9,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'DE', + state: 'iso2:US-DE', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/FL/index.js b/src/shared/scrapers/US/FL/index.js index 83c1b2aa4..801d9656d 100644 --- a/src/shared/scrapers/US/FL/index.js +++ b/src/shared/scrapers/US/FL/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'FL', + state: 'iso2:US-FL', country: 'iso1:US', priority: 1, aggregate: 'county', @@ -241,6 +241,7 @@ const scraper = { counties.push(unassigned); counties.push(transform.sumData(counties)); counties = geography.addEmptyRegions(counties, this._counties, 'county'); + counties = counties.filter(c => c.county !== UNASSIGNED); return counties; } } diff --git a/src/shared/scrapers/US/GA/index.js b/src/shared/scrapers/US/GA/index.js index 579f37327..69e535347 100755 --- a/src/shared/scrapers/US/GA/index.js +++ b/src/shared/scrapers/US/GA/index.js @@ -7,7 +7,7 @@ import * as transform from '../../../lib/transform.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'GA', + state: 'iso2:US-GA', country: 'iso1:US', url: 'https://dph.georgia.gov/covid-19-daily-status-report', type: 'table', diff --git a/src/shared/scrapers/US/GU/index.js b/src/shared/scrapers/US/GU/index.js index ed8c84aa4..3a182f6e7 100644 --- a/src/shared/scrapers/US/GU/index.js +++ b/src/shared/scrapers/US/GU/index.js @@ -6,7 +6,7 @@ import { DeprecatedError } from '../../../lib/errors.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'GU', + state: 'iso2:US-GU', country: 'iso1:US', url: 'http://dphss.guam.gov/2019-novel-coronavirus-2019-n-cov/', sources: [ diff --git a/src/shared/scrapers/US/HI/index.js b/src/shared/scrapers/US/HI/index.js index cc90d3bd7..c878e169f 100644 --- a/src/shared/scrapers/US/HI/index.js +++ b/src/shared/scrapers/US/HI/index.js @@ -5,7 +5,7 @@ import * as transform from '../../../lib/transform.js'; const scraper = { country: 'iso1:US', - state: 'HI', + state: 'iso2:US-HI', priority: 1, sources: [ { diff --git a/src/shared/scrapers/US/IA/index.js b/src/shared/scrapers/US/IA/index.js index 97c67fc64..67b1542d1 100644 --- a/src/shared/scrapers/US/IA/index.js +++ b/src/shared/scrapers/US/IA/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'IA', + state: 'iso2:US-IA', country: 'iso1:US', aggregate: 'county', headless: true, diff --git a/src/shared/scrapers/US/ID/index.js b/src/shared/scrapers/US/ID/index.js index 8121f7828..8875e4ee9 100644 --- a/src/shared/scrapers/US/ID/index.js +++ b/src/shared/scrapers/US/ID/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'ID', + state: 'iso2:US-ID', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/IL/index.js b/src/shared/scrapers/US/IL/index.js index 7e7ba7440..8f75fb716 100755 --- a/src/shared/scrapers/US/IL/index.js +++ b/src/shared/scrapers/US/IL/index.js @@ -9,7 +9,7 @@ import * as rules from '../../../lib/rules.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'IL', + state: 'iso2:US-IL', country: 'iso1:US', priority: 1, aggregate: 'county', diff --git a/src/shared/scrapers/US/IN/index.js b/src/shared/scrapers/US/IN/index.js index 9bfb36ff5..3d3943dc5 100644 --- a/src/shared/scrapers/US/IN/index.js +++ b/src/shared/scrapers/US/IN/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; const scraper = { country: 'iso1:US', - state: 'IN', + state: 'iso2:US-IN', priority: 1, url: 'https://opendata.arcgis.com/datasets/d14de7e28b0448ab82eb36d6f25b1ea1_0.csv', aggregate: 'county', diff --git a/src/shared/scrapers/US/KS/index.js b/src/shared/scrapers/US/KS/index.js index ad73bfffb..8a80bb04e 100644 --- a/src/shared/scrapers/US/KS/index.js +++ b/src/shared/scrapers/US/KS/index.js @@ -12,7 +12,7 @@ import * as pdfUtils from '../../../lib/pdf.js'; // Based on the MO scraper, which was based on NY const scraper = { - state: 'KS', + state: 'iso2:US-KS', country: 'iso1:US', aggregate: 'county', _baseUrl: 'https://khap2.kdhe.state.ks.us/NewsRelease/COVID19/', diff --git a/src/shared/scrapers/US/KY/index.js b/src/shared/scrapers/US/KY/index.js index fb8e99ea4..7523085fd 100644 --- a/src/shared/scrapers/US/KY/index.js +++ b/src/shared/scrapers/US/KY/index.js @@ -6,7 +6,7 @@ import * as geography from '../../../lib/geography/index.js'; const scraper = { country: 'iso1:US', - state: 'KY', + state: 'iso2:US-KY', priority: 1, aggregate: 'county', url: 'https://datawrapper.dwcdn.net/BbowM/23/', diff --git a/src/shared/scrapers/US/LA/index.js b/src/shared/scrapers/US/LA/index.js index 68c2932e8..fe8895f27 100644 --- a/src/shared/scrapers/US/LA/index.js +++ b/src/shared/scrapers/US/LA/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'LA', + state: 'iso2:US-LA', country: 'iso1:US', aggregate: 'county', sources: [ @@ -36,7 +36,7 @@ const scraper = { } const cases = parse.number($tr.find('td:last-child').text()); counties.push({ - county: geography.getCounty(county, 'LA'), + county: geography.getCounty(county, 'iso2:US-LA'), cases }); }); @@ -66,7 +66,7 @@ const scraper = { } const countyName = `${parse.string(county.PARISH)} Parish`; counties.push({ - county: geography.getCounty(countyName, 'LA'), + county: geography.getCounty(countyName, 'iso2:US-LA'), cases: parse.number(county.Cases), deaths: parse.number(county.Deaths) }); @@ -98,7 +98,7 @@ const scraper = { } const countyName = `${parse.string(county.PARISH)} Parish`; counties.push({ - county: geography.getCounty(countyName, 'LA'), + county: geography.getCounty(countyName, 'iso2:US-LA'), cases: parse.number(county.Cases), deaths: parse.number(county.Deaths) }); @@ -133,7 +133,7 @@ const scraper = { } const countyName = `${parse.string(county.Parish)} Parish`; counties.push({ - county: geography.getCounty(countyName, 'LA'), + county: geography.getCounty(countyName, 'iso2:US-LA'), cases: parse.number(county.Cases), deaths: parse.number(county.Deaths) }); diff --git a/src/shared/scrapers/US/MA/index.js b/src/shared/scrapers/US/MA/index.js index 07987612c..67f2c02a6 100644 --- a/src/shared/scrapers/US/MA/index.js +++ b/src/shared/scrapers/US/MA/index.js @@ -10,7 +10,7 @@ import maintainers from '../../../lib/maintainers.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MA', + state: 'iso2:US-MA', country: 'iso1:US', aggregate: 'county', diff --git a/src/shared/scrapers/US/MD/index.js b/src/shared/scrapers/US/MD/index.js index 76985bfb1..f3a56485f 100644 --- a/src/shared/scrapers/US/MD/index.js +++ b/src/shared/scrapers/US/MD/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MD', + state: 'iso2:US-MD', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/ME/index.js b/src/shared/scrapers/US/ME/index.js index 98f1b92b2..83209fb7c 100644 --- a/src/shared/scrapers/US/ME/index.js +++ b/src/shared/scrapers/US/ME/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'ME', + state: 'iso2:US-ME', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/MI/index.js b/src/shared/scrapers/US/MI/index.js index aa0f29374..e5976c0bf 100644 --- a/src/shared/scrapers/US/MI/index.js +++ b/src/shared/scrapers/US/MI/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MI', + state: 'iso2:US-MI', country: 'iso1:US', sources: [ { @@ -130,7 +130,7 @@ const scraper = { let cases = parse.number(parse.string($tr.find('> *:nth-child(2)').text()) || 0); let deaths = parse.number(parse.string($tr.find('> *:last-child').text()) || 0); - const county = geography.getCounty(parse.string($tr.find('> *:first-child').text()), 'MI'); + const county = geography.getCounty(parse.string($tr.find('> *:first-child').text()), 'iso2:US-MI'); // Remember these to add them to Wayne County instead if (county === 'Detroit City') { diff --git a/src/shared/scrapers/US/MN/index.js b/src/shared/scrapers/US/MN/index.js index 44d6365aa..53f23815b 100644 --- a/src/shared/scrapers/US/MN/index.js +++ b/src/shared/scrapers/US/MN/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MN', // Minnesota! + state: 'iso2:US-MN', // Minnesota! country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/MO/index.js b/src/shared/scrapers/US/MO/index.js index e898f9a41..a096cb9fe 100644 --- a/src/shared/scrapers/US/MO/index.js +++ b/src/shared/scrapers/US/MO/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MO', + state: 'iso2:US-MO', country: 'iso1:US', type: 'table', aggregate: 'county', diff --git a/src/shared/scrapers/US/MO/st-louis-county.js b/src/shared/scrapers/US/MO/st-louis-county.js index 784a58a3f..d5bfccaa6 100644 --- a/src/shared/scrapers/US/MO/st-louis-county.js +++ b/src/shared/scrapers/US/MO/st-louis-county.js @@ -5,7 +5,7 @@ import * as geography from '../../../lib/geography/index.js'; const scraper = { county: 'St. Louis County', - state: 'MO', + state: 'iso2:US-MO', country: 'iso1:US', aggregate: 'county', priority: 1, diff --git a/src/shared/scrapers/US/MS/index.js b/src/shared/scrapers/US/MS/index.js index 6304b84ff..c9730c1a5 100644 --- a/src/shared/scrapers/US/MS/index.js +++ b/src/shared/scrapers/US/MS/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MS', + state: 'iso2:US-MS', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/MT/index.js b/src/shared/scrapers/US/MT/index.js index af598e8c5..20d11db54 100644 --- a/src/shared/scrapers/US/MT/index.js +++ b/src/shared/scrapers/US/MT/index.js @@ -6,7 +6,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'MT', + state: 'iso2:US-MT', country: 'iso1:US', url: 'https://services.arcgis.com/qnjIrwR8z5Izc0ij/arcgis/rest/services/PUBLIC_VIEW_COVID19_CASES/FeatureServer/0/query?f=json&where=Total%20%3C%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=NAMELABEL%20asc&resultOffset=0&resultRecordCount=56&cacheHint=true', diff --git a/src/shared/scrapers/US/NC/index.js b/src/shared/scrapers/US/NC/index.js index 7e5c54b7e..fb25c1ed4 100644 --- a/src/shared/scrapers/US/NC/index.js +++ b/src/shared/scrapers/US/NC/index.js @@ -9,7 +9,7 @@ import * as geography from '../../../lib/geography/index.js'; const scraper = { url: 'https://opendata.arcgis.com/datasets/969678bce431494a8f64d7faade6e5b8_0.csv', country: 'iso1:US', - state: 'NC', + state: 'iso2:US-NC', aggregate: 'county', async scraper() { const data = await fetch.csv(this.url); diff --git a/src/shared/scrapers/US/ND/index.js b/src/shared/scrapers/US/ND/index.js index 60867eedf..3074de74e 100644 --- a/src/shared/scrapers/US/ND/index.js +++ b/src/shared/scrapers/US/ND/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'ND', + state: 'iso2:US-ND', country: 'iso1:US', url: 'https://www.health.nd.gov/diseases-conditions/coronavirus/north-dakota-coronavirus-cases', type: 'table', diff --git a/src/shared/scrapers/US/NE/index.js b/src/shared/scrapers/US/NE/index.js index 0aac847d9..4e0d805af 100644 --- a/src/shared/scrapers/US/NE/index.js +++ b/src/shared/scrapers/US/NE/index.js @@ -8,7 +8,7 @@ import maintainers from '../../../lib/maintainers.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'NE', + state: 'iso2:US-NE', country: 'iso1:US', url: 'https://www.lincoln.ne.gov/city/covid19/', type: 'list', diff --git a/src/shared/scrapers/US/NH/index.js b/src/shared/scrapers/US/NH/index.js index 6b8a82b8e..043897fdb 100644 --- a/src/shared/scrapers/US/NH/index.js +++ b/src/shared/scrapers/US/NH/index.js @@ -11,7 +11,7 @@ import { DeprecatedError } from '../../../lib/errors.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'NH', + state: 'iso2:US-NH', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/NJ/index.js b/src/shared/scrapers/US/NJ/index.js index 3d98e8cdf..433c597d3 100644 --- a/src/shared/scrapers/US/NJ/index.js +++ b/src/shared/scrapers/US/NJ/index.js @@ -7,7 +7,7 @@ import * as transform from '../../../lib/transform.js'; const scraper = { country: 'iso1:US', - state: 'NJ', + state: 'iso2:US-NJ', aggregate: 'county', type: 'csv', source: { diff --git a/src/shared/scrapers/US/NM/index.js b/src/shared/scrapers/US/NM/index.js index aab234b77..c39ea67b9 100644 --- a/src/shared/scrapers/US/NM/index.js +++ b/src/shared/scrapers/US/NM/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'NM', + state: 'iso2:US-NM', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/NV/carson-city.js b/src/shared/scrapers/US/NV/carson-city.js index e436dfd6a..88ff61416 100644 --- a/src/shared/scrapers/US/NV/carson-city.js +++ b/src/shared/scrapers/US/NV/carson-city.js @@ -4,7 +4,7 @@ import * as parse from '../../../lib/parse.js'; // Set county to this if you only have state data, but this isn't the entire state // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'NV', + state: 'iso2:US-NV', country: 'iso1:US', aggregate: 'county', url: 'https://gethealthycarsoncity.org/novel-coronavirus-2019/', diff --git a/src/shared/scrapers/US/NV/clark-county.js b/src/shared/scrapers/US/NV/clark-county.js index bf56fdbd6..6a21ebeb6 100644 --- a/src/shared/scrapers/US/NV/clark-county.js +++ b/src/shared/scrapers/US/NV/clark-county.js @@ -6,7 +6,7 @@ import * as parse from '../../../lib/parse.js'; const scraper = { county: 'Clark County', - state: 'NV', + state: 'iso2:US-NV', country: 'iso1:US', url: 'https://www.southernnevadahealthdistrict.org/coronavirus', sources: [ diff --git a/src/shared/scrapers/US/NV/washoe-county.js b/src/shared/scrapers/US/NV/washoe-county.js index de26b19c3..fa0f3eabf 100644 --- a/src/shared/scrapers/US/NV/washoe-county.js +++ b/src/shared/scrapers/US/NV/washoe-county.js @@ -6,7 +6,7 @@ import * as parse from '../../../lib/parse.js'; const scraper = { county: 'Washoe County', - state: 'NV', + state: 'iso2:US-NV', country: 'iso1:US', url: 'https://www.washoecounty.us/health/programs-and-services/communicable-diseases-and-epidemiology/educational_materials/COVID-19.php', diff --git a/src/shared/scrapers/US/NY/index.js b/src/shared/scrapers/US/NY/index.js index 8bcf020bd..917d8d3ae 100644 --- a/src/shared/scrapers/US/NY/index.js +++ b/src/shared/scrapers/US/NY/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'NY', + state: 'iso2:US-NY', country: 'iso1:US', aggregate: 'county', sources: [ @@ -177,7 +177,7 @@ export default scraper; countyObj.feature = geography.generateMultiCountyFeature( ['Bronx County, NY', 'Kings County, NY', 'New York County, NY', 'Queens County, NY', 'Richmond County, NY'], { - state: 'NY', + state: 'iso2:US-NY', country: 'iso1:US' } ); diff --git a/src/shared/scrapers/US/OH/index.js b/src/shared/scrapers/US/OH/index.js index c7ddac5d2..1f1c2264e 100644 --- a/src/shared/scrapers/US/OH/index.js +++ b/src/shared/scrapers/US/OH/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'OH', + state: 'iso2:US-OH', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/OK/index.js b/src/shared/scrapers/US/OK/index.js index 95db7fa2f..6427f2650 100644 --- a/src/shared/scrapers/US/OK/index.js +++ b/src/shared/scrapers/US/OK/index.js @@ -10,7 +10,7 @@ import * as rules from '../../../lib/rules.js'; // updated to include deaths in timeseries const scraper = { - state: 'OK', + state: 'iso2:US-OK', country: 'iso1:US', type: 'table', aggregate: 'county', diff --git a/src/shared/scrapers/US/OR/index.js b/src/shared/scrapers/US/OR/index.js index 0204ba259..ec6d97d92 100644 --- a/src/shared/scrapers/US/OR/index.js +++ b/src/shared/scrapers/US/OR/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'OR', + state: 'iso2:US-OR', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/PA/index.js b/src/shared/scrapers/US/PA/index.js index 52631b7f5..23a70d936 100644 --- a/src/shared/scrapers/US/PA/index.js +++ b/src/shared/scrapers/US/PA/index.js @@ -8,7 +8,7 @@ import * as htmlTableValidation from '../../../lib/html/table-validation.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'PA', + state: 'iso2:US-PA', country: 'iso1:US', aggregate: 'county', sources: [ @@ -101,7 +101,7 @@ const scraper = { .text() .match(/([A-Za-z]+) \((\d+\))/); if (matches) { - const county = geography.getCounty(geography.addCounty(parse.string(matches[1])), 'PA'); + const county = geography.getCounty(geography.addCounty(parse.string(matches[1])), 'iso2:US-PA'); const cases = parse.number(matches[2]); counties.push({ county, @@ -123,7 +123,10 @@ const scraper = { $trs.each((index, tr) => { const $tr = $(tr); const data = { - county: geography.getCounty(geography.addCounty(parse.string($tr.find('td:first-child').text())), 'PA'), + county: geography.getCounty( + geography.addCounty(parse.string($tr.find('td:first-child').text())), + 'iso2:US-PA' + ), cases: parse.number($tr.find('td:last-child').text()) }; counties.push(data); @@ -142,7 +145,10 @@ const scraper = { $trs.each((index, tr) => { const $tr = $(tr); const data = { - county: geography.getCounty(geography.addCounty(parse.string($tr.find('td:first-child').text())), 'PA'), + county: geography.getCounty( + geography.addCounty(parse.string($tr.find('td:first-child').text())), + 'iso2:US-PA' + ), cases: parse.number($tr.find('td:last-child').text()) }; counties.push(data); @@ -161,7 +167,10 @@ const scraper = { $trs.each((index, tr) => { const $tr = $(tr); counties.push({ - county: geography.getCounty(geography.addCounty(parse.string($tr.find('td:first-child').text())), 'PA'), + county: geography.getCounty( + geography.addCounty(parse.string($tr.find('td:first-child').text())), + 'iso2:US-PA' + ), cases: parse.number($tr.find('td:nth-child(2)').text()), deaths: parse.number(parse.string($tr.find('td:last-child').text()) || 0) }); @@ -201,7 +210,10 @@ const scraper = { $trs.each((index, tr) => { const $tr = $(tr); counties.push({ - county: geography.getCounty(geography.addCounty(parse.string($tr.find('td:first-child').text())), 'PA'), + county: geography.getCounty( + geography.addCounty(parse.string($tr.find('td:first-child').text())), + 'iso2:US-PA' + ), cases: parse.number($tr.find('td:nth-child(2)').text()), deaths: parse.number(parse.string($tr.find('td:last-child').text()) || 0) }); diff --git a/src/shared/scrapers/US/RI/index.js b/src/shared/scrapers/US/RI/index.js index 023ce80cb..8fa1f9f43 100644 --- a/src/shared/scrapers/US/RI/index.js +++ b/src/shared/scrapers/US/RI/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'RI', + state: 'iso2:US-RI', country: 'iso1:US', priority: 1, type: 'csv', diff --git a/src/shared/scrapers/US/SC/index.js b/src/shared/scrapers/US/SC/index.js index 9c4e13c51..6710b5fb8 100644 --- a/src/shared/scrapers/US/SC/index.js +++ b/src/shared/scrapers/US/SC/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'SC', + state: 'iso2:US-SC', country: 'iso1:US', url: 'https://services2.arcgis.com/XZg2efAbaieYAXmu/arcgis/rest/services/COVID19_County_View/FeatureServer/0/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=Confirmed%20desc&resultOffset=0&resultRecordCount=1000&cacheHint=true', diff --git a/src/shared/scrapers/US/SD/index.js b/src/shared/scrapers/US/SD/index.js index 326c38dd6..43bc26700 100644 --- a/src/shared/scrapers/US/SD/index.js +++ b/src/shared/scrapers/US/SD/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'SD', + state: 'iso2:US-SD', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/TN/index.js b/src/shared/scrapers/US/TN/index.js index 497e87122..5502ca9fe 100755 --- a/src/shared/scrapers/US/TN/index.js +++ b/src/shared/scrapers/US/TN/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'TN', + state: 'iso2:US-TN', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/TX/index.js b/src/shared/scrapers/US/TX/index.js index ed568fb06..3f9df44ac 100644 --- a/src/shared/scrapers/US/TX/index.js +++ b/src/shared/scrapers/US/TX/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'TX', + state: 'iso2:US-TX', country: 'iso1:US', aggregate: 'county', certValidation: false, diff --git a/src/shared/scrapers/US/UT/index.js b/src/shared/scrapers/US/UT/index.js index 36b0bbfea..152ca759f 100644 --- a/src/shared/scrapers/US/UT/index.js +++ b/src/shared/scrapers/US/UT/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'UT', + state: 'iso2:US-UT', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/VA/index.js b/src/shared/scrapers/US/VA/index.js index 7182161cf..94a4028b3 100644 --- a/src/shared/scrapers/US/VA/index.js +++ b/src/shared/scrapers/US/VA/index.js @@ -9,7 +9,7 @@ import maintainers from '../../../lib/maintainers.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'VA', + state: 'iso2:US-VA', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/VT/index.js b/src/shared/scrapers/US/VT/index.js index 1816f7049..48d762cb6 100644 --- a/src/shared/scrapers/US/VT/index.js +++ b/src/shared/scrapers/US/VT/index.js @@ -7,7 +7,7 @@ import maintainers from '../../../lib/maintainers.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'VT', + state: 'iso2:US-VT', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/WA/index.js b/src/shared/scrapers/US/WA/index.js index a6c811111..b15486d1b 100644 --- a/src/shared/scrapers/US/WA/index.js +++ b/src/shared/scrapers/US/WA/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'WA', + state: 'iso2:US-WA', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/WI/index.js b/src/shared/scrapers/US/WI/index.js index 6c8af7f05..11113e4dd 100644 --- a/src/shared/scrapers/US/WI/index.js +++ b/src/shared/scrapers/US/WI/index.js @@ -8,7 +8,7 @@ import datetime from '../../../lib/datetime/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'WI', + state: 'iso2:US-WI', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/WV/index.js b/src/shared/scrapers/US/WV/index.js index 4f360ad25..c5d24b6d7 100644 --- a/src/shared/scrapers/US/WV/index.js +++ b/src/shared/scrapers/US/WV/index.js @@ -7,7 +7,7 @@ import * as geography from '../../../lib/geography/index.js'; // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'WV', + state: 'iso2:US-WV', country: 'iso1:US', sources: [ { diff --git a/src/shared/scrapers/US/WY/index.js b/src/shared/scrapers/US/WY/index.js index d426b3363..3db4a6109 100644 --- a/src/shared/scrapers/US/WY/index.js +++ b/src/shared/scrapers/US/WY/index.js @@ -8,7 +8,7 @@ import * as geography from '../../../lib/geography/index.js'; // Set county to this if you only have state data, but this isn't the entire state // const UNASSIGNED = '(unassigned)'; const scraper = { - state: 'WY', + state: 'iso2:US-WY', country: 'iso1:US', aggregate: 'county', sources: [ diff --git a/src/shared/scrapers/US/_usa-cdc.js b/src/shared/scrapers/US/_usa-cdc.js deleted file mode 100644 index dd8d0d00f..000000000 --- a/src/shared/scrapers/US/_usa-cdc.js +++ /dev/null @@ -1,46 +0,0 @@ -import * as fetch from '../../lib/fetch/index.js'; -import * as parse from '../../lib/parse.js'; -import * as geography from '../../lib/geography/index.js'; - -// Set county to this if you only have state data, but this isn't the entire state -// const UNASSIGNED = '(unassigned)'; - -const scraper = { - country: 'iso1:US', - sources: [ - { - url: 'https://www.cdc.gov', - name: 'CDC', - description: 'Centers for Disease Control and Prevention' - } - ], - url: 'https://www.cdc.gov/coronavirus/2019-ncov/map-data-cases.csv', - _getCaseNumber(string) { - if (typeof string === 'string') { - const matches = string.match(/(\d+) of (\d+)/); - if (string === 'None') { - return 0; - } - if (matches) { - return parse.number(matches[2]); - } - return parse.number(string); - } - return string; - }, - async _scraper() { - const data = await fetch.csv(this.url); - const states = []; - for (const stateData of data) { - if (stateData.Name) { - states.push({ - state: geography.toUSStateAbbreviation(parse.string(stateData.Name)), - cases: this._getCaseNumber(stateData['Cases Reported']) - }); - } - } - return states; - } -}; - -export default scraper; diff --git a/src/shared/scrapers/US/usa-covidtracking.js b/src/shared/scrapers/US/covidtracking.js similarity index 86% rename from src/shared/scrapers/US/usa-covidtracking.js rename to src/shared/scrapers/US/covidtracking.js index fdc7b39d4..f515ed904 100644 --- a/src/shared/scrapers/US/usa-covidtracking.js +++ b/src/shared/scrapers/US/covidtracking.js @@ -7,7 +7,7 @@ import * as transform from '../../lib/transform.js'; const scraper = { country: 'iso1:US', - url: 'https://covidtracking.com/api/states', + url: 'https://covidtracking.com/api/v1/states/current.json', type: 'json', curators: [ { @@ -22,12 +22,13 @@ const scraper = { priority: -0.5, async scraper() { const data = await fetch.json(this.url); + console.log(data); const regions = []; for (const stateData of data) { const stateObj = { - state: stateData.state + state: `iso2:US-${stateData.state}` }; if (stateData.death !== null) { stateObj.deaths = parse.number(stateData.death); @@ -35,9 +36,6 @@ const scraper = { if (stateData.total !== null) { stateObj.tested = parse.number(stateData.total); } - if (stateData.state === 'Washington, D.C.') { - stateObj.county = 'District of Columbia'; - } // Assume zero if none provided stateObj.cases = parse.number(stateData.positive || 0); diff --git a/src/shared/scrapers/US/nyt.js b/src/shared/scrapers/US/nyt-counties.js similarity index 81% rename from src/shared/scrapers/US/nyt.js rename to src/shared/scrapers/US/nyt-counties.js index fa73df32e..04243c00f 100644 --- a/src/shared/scrapers/US/nyt.js +++ b/src/shared/scrapers/US/nyt-counties.js @@ -1,8 +1,8 @@ +import fipsCodes from 'country-levels/fips.json'; +import datetime from '../../lib/datetime/index.js'; import * as fetch from '../../lib/fetch/index.js'; import * as parse from '../../lib/parse.js'; import * as transform from '../../lib/transform.js'; -import * as geography from '../../lib/geography/index.js'; -import datetime from '../../lib/datetime/index.js'; const scraper = { url: 'https://github.com/nytimes/covid-19-data', @@ -50,24 +50,27 @@ const scraper = { const locationsByState = {}; for (const row of data) { if (datetime.getYYYYMD(`${row.date} 12:00:00`) === scrapeDateString) { + const { fips } = row; + + // skip everything without fips, unassigned, etc. + if (!fips) { + continue; + } + + // Only include places we have data for + const countryLevelIDInfo = fipsCodes[fips]; + if (!countryLevelIDInfo) { + console.warn(` ⚠️ US/NYT FIPS not found: ${fips}`); + continue; + } + const locationObj = { - state: geography.getState(row.state), + county: `fips:${fips}`, + state: `iso2:${countryLevelIDInfo.state_code_iso}`, cases: parse.number(row.cases), deaths: parse.number(row.deaths) }; locationsByState[locationObj.state] = locationsByState[locationObj.state] || []; - if (row.county.toLowerCase().match(/city$/)) { - // Data is not for a county - // Todo: Check our citycounty to county map - locationObj.city = row.county; - } else { - locationObj.county = geography.getCounty(row.county, row.state); - - if (locationObj.county === '(unassigned)') { - // Skip unassigned locations from NYT, otherwise they mess up rollup totals - continue; - } - } locationsByState[locationObj.state].push(locationObj); locations.push(locationObj); } diff --git a/src/shared/scrapers/jhu-usa.js b/src/shared/scrapers/jhu-usa.js index 95b665111..42bb0f3b8 100644 --- a/src/shared/scrapers/jhu-usa.js +++ b/src/shared/scrapers/jhu-usa.js @@ -9,10 +9,6 @@ import maintainers from '../lib/maintainers.js'; // Set county to this if you only have state data, but this isn't the entire state const UNASSIGNED = '(unassigned)'; -function findCountryLevelID(fips) { - return fipsCodes[fips]; -} - const scraper = { maintainers: [maintainers.lazd], url: 'https://github.com/CSSEGISandData/COVID-19', @@ -98,7 +94,7 @@ const scraper = { } // Only include places we have data for - const countryLevelIDInfo = findCountryLevelID(fips); + const countryLevelIDInfo = fipsCodes[fips]; if (!countryLevelIDInfo) { console.warn(' ⚠️ Skipping %s at (FIPS %s)', caseInfo.Combined_Key, fips); continue; diff --git a/tests/integration/scrapers/scrapers-all-test.js b/tests/integration/scrapers/scrapers-all-test.js index 452935909..417101618 100644 --- a/tests/integration/scrapers/scrapers-all-test.js +++ b/tests/integration/scrapers/scrapers-all-test.js @@ -70,7 +70,7 @@ test('Scraper tests', async t => { // dynamically import the scraper const scraperObj = imports(join(testDir, '..', 'index.js')); - if (scraperObj.state === 'AL' && scraperObj.country === 'iso1:US') { + if (scraperObj.state === 'iso2:US-AL' && scraperObj.country === 'iso1:US') { [scraperObj.scraper] = scraperObj.scraper; }