diff --git a/usafacts/.gitignore b/usafacts/.gitignore deleted file mode 100644 index 53dcaac42..000000000 --- a/usafacts/.gitignore +++ /dev/null @@ -1,124 +0,0 @@ -# You should hard commit a prototype for this file, but we -# want to avoid accidental adding of API tokens and other -# private data parameters -params.json - -# Do not commit output files -receiving/*.csv -receiving\ copy/*.csv - -# Do not commit test files -tests/receiving/*.csv - -# Remove macOS files -.DS_Store - -# virtual environment -dview/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -coverage.xml -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -.static_storage/ -.media/ -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ diff --git a/usafacts/.pylintrc b/usafacts/.pylintrc deleted file mode 100644 index f30837c7e..000000000 --- a/usafacts/.pylintrc +++ /dev/null @@ -1,22 +0,0 @@ - -[MESSAGES CONTROL] - -disable=logging-format-interpolation, - too-many-locals, - too-many-arguments, - # Allow pytest functions to be part of a class. - no-self-use, - # Allow pytest classes to have one test. - too-few-public-methods - -[BASIC] - -# Allow arbitrarily short-named variables. -variable-rgx=[a-z_][a-z0-9_]* -argument-rgx=[a-z_][a-z0-9_]* -attr-rgx=[a-z_][a-z0-9_]* - -[DESIGN] - -# Don't complain about pytest "unused" arguments. -ignored-argument-names=(_.*|run_as_module) \ No newline at end of file diff --git a/usafacts/DETAILS.md b/usafacts/DETAILS.md deleted file mode 100644 index 3a6aedb03..000000000 --- a/usafacts/DETAILS.md +++ /dev/null @@ -1,126 +0,0 @@ -# USA Facts Cases and Deaths - -We import the confirmed case and deaths data from USA Facts website and export -the county-level data as-is. We also aggregate the data to the MSA, HRR, HHS, -State, and Nation levels. - -In order to avoid confusing public consumers of the data, we maintain -consistency how USA Facts reports the data, please refer to [Exceptions](#Exceptions). - -## Geographical Levels (`geo`) -* `county`: reported using zero-padded FIPS codes. There are some exceptions - that lead to inconsistency with the other COVIDcast data (but are necessary - for internal consistency), noted below. -* `msa`: reported using cbsa (consistent with all other COVIDcast sensors) -* `hrr`: reported using HRR number (consistent with all other COVIDcast sensors) -* `hhs`: reported using HHS region number -* `state`: reported using two-letter postal code -* `nation`: reported using two-letter nation code. Just 'us' for now - -## Metrics, Level 1 (`m1`) -* `confirmed`: Confirmed cases -* `deaths` - -Recoveries are _not_ reported. - -## Metrics, Level 2 (`m2`) -* `new_counts`: number of new {confirmed cases, deaths} on a given day -* `cumulative_counts`: total number of {confirmed cases, deaths} up until the - first day of data (January 22nd) -* `incidence`: `new_counts` / population * 100000 - -All three `m2` are ultimately derived from `cumulative_counts`, which is first -available on January 22nd. In constructing `new_counts`, we take the first -discrete difference of `cumulative_counts`, and assume that the -`cumulative_counts` for January 21st is uniformly zero. This should not be a -problem, because there there is only one county with a nonzero -`cumulative_count` on January 22nd, with a value of 1. - -For deriving `incidence`, we use the estimated 2019 county population values -from the US Census Bureau. https://www.census.gov/data/tables/time-series/demo/popest/2010s-counties-total.html - -## Exceptions - -At the County (FIPS) level, we report the data _exactly_ as USA Facts reports their -data, to prevent confusing public consumers of the data. -The visualization and modeling teams should take note of these exceptions. - -### New York City - -New York City comprises of five boroughs: - -|Borough Name |County Name |FIPS Code | -|-------------------|-------------------|---------------| -|Manhattan |New York County |36061 | -|The Bronx |Bronx County |36005 | -|Brooklyn |Kings County |36047 | -|Queens |Queens County |36081 | -|Staten Island |Richmond County |36085 | - -**New York City Unallocated cases/deaths are reported by USA Facts independently.** We split them evenly among the five NYC FIPS, which results in float numbers. - -All NYC counts are mapped to the MSA with CBSA ID 35620, which encompasses -all five boroughs. All NYC counts are mapped to HRR 303, which intersects -all five boroughs (297 also intersects the Bronx, 301 also intersects -Brooklyn and Queens, but absent additional information, We are leaving all -counts in 303). - - -### Mismatched FIPS Codes - -There are two FIPS codes that were changed in 2015, leading to -mismatch between us and USA Facts. We report the data using the FIPS code used -by USA Facts, again to promote consistency and avoid confusion by external users -of the dataset. For the mapping to MSA, HRR, these two counties are -included properly. - -|County Name |State |"Our" FIPS |USA Facts FIPS | -|-------------------|---------------|-------------------|---------------| -|Oglala Lakota |South Dakota |46113 |46102 | -|Kusilvak |Alaska |02270 |02158 \& 02270 | - -Documentation for the changes made by the US Census Bureau in 2015: -https://www.census.gov/programs-surveys/geography/technical-documentation/county-changes.html - -Besides, Wade Hampton Census Area and Kusilvak Census Area are reported by USA Facts with FIPS 02270 and 02158 respectively, though there is always 0 cases/deaths reported for Wade Hampton Census Area (02270). According to US Census Bureau, Wade Hampton Census Area has changed name and code from Wade Hampton Census Area, Alaska (02270) to Kusilvak Census Area, Alaska (02158) effective July 1, 2015. -https://www.census.gov/quickfacts/kusilvakcensusareaalaska - -### Grand Princess Cruise Ship -Data from Grand Princess Cruise Ship is given its own dedicated line, with FIPS code 6000. We just ignore these cases/deaths. - - - - -## Negative incidence - -Negative incidence is possible because figures are sometimes revised -downwards, e.g., when a public health authority moves cases from County X -to County Y, County X may have negative incidence. - -## Non-integral counts - -Because the MSA and HRR numbers are computed by taking population-weighted -averages, the count data at those geographical levels may be non-integral. - -## Counties not in our canonical dataset - -Some FIPS codes do not appear as the primary FIPS for any ZIP code in our -canonical `02_20_uszips.csv`; they appear in the `county` exported files, but -for the MSA/HRR mapping, we disburse them equally to the counties with whom -they appear as a secondary FIPS code. The identification of such "secondary" -FIPS codes are documented in `notebooks/create-mappings.ipynb`. The full list -of `secondary, [mapped]` is: - -``` -SECONDARY_FIPS = [ # generated by notebooks/create-mappings.ipynb - ('51620', ['51093', '51175']), - ('51685', ['51153']), - ('28039', ['28059', '28041', '28131', '28045', '28059', '28109', - '28047']), - ('51690', ['51089', '51067']), - ('51595', ['51081', '51025', '51175', '51183']), - ('51600', ['51059', '51059', '51059']), - ('51580', ['51005']), - ('51678', ['51163']), - ] -``` diff --git a/usafacts/Makefile b/usafacts/Makefile deleted file mode 100644 index bc88f1fec..000000000 --- a/usafacts/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY = venv, lint, test, clean - -dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1) -venv: - python3.8 -m venv env - -install: venv - . env/bin/activate; \ - pip install wheel ; \ - pip install -e ../_delphi_utils_python ;\ - pip install -e . - -install-ci: venv - . env/bin/activate; \ - pip install wheel ; \ - pip install ../_delphi_utils_python ;\ - pip install . - -lint: - . env/bin/activate; pylint $(dir) - . env/bin/activate; pydocstyle $(dir) - -test: - . env/bin/activate ;\ - (cd tests && ../env/bin/pytest --cov=$(dir) --cov-report=term-missing) - -clean: - rm -rf env - rm -f params.json diff --git a/usafacts/README.md b/usafacts/README.md deleted file mode 100644 index a2e30c46d..000000000 --- a/usafacts/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# USA Facts Cases and Deaths - -We import the confirmed case and deaths data from USA Facts website and export -the county-level data as-is. We also aggregate the data to the MSA, HRR, HHS, -State, and Nation levels. For detailed information see the files `DETAILS.md` contained -in this directory. - -## Running the Indicator - -The indicator is run by directly executing the Python module contained in this -directory. The safest way to do this is to create a virtual environment, -installed the common DELPHI tools, and then install the module and its -dependencies. To do this, run the following command from this directory: - -``` -make install -``` - -This command will install the package in editable mode, so you can make changes that -will automatically propagate to the installed package. - -All of the user-changable parameters are stored in `params.json`. To execute -the module and produce the output datasets (by default, in `receiving`), run -the following: - -``` -env/bin/python -m delphi_usafacts -``` - -If you want to enter the virtual environment in your shell, -you can run `source env/bin/activate`. Run `deactivate` to leave the virtual environment. - -Once you are finished, you can remove the virtual environment and -params file with the following: - -``` -make clean -``` - -## Testing the code - -To run static tests of the code style, run the following command: - -``` -make lint -``` - -Unit tests are also included in the module. To execute these, run the following -command from this directory: - -``` -make test -``` - -To run individual tests, run the following: - -``` -(cd tests && ../env/bin/pytest .py --cov=delphi_usafacts --cov-report=term-missing) -``` - -The output will show the number of unit tests that passed and failed, along -with the percentage of code covered by the tests. - -None of the linting or unit tests should fail, and the code lines that are not covered by unit tests should be small and -should not include critical sub-routines. diff --git a/usafacts/REVIEW.md b/usafacts/REVIEW.md deleted file mode 100644 index 93a5a6579..000000000 --- a/usafacts/REVIEW.md +++ /dev/null @@ -1,39 +0,0 @@ -## Code Review (Python) - -A code review of this module should include a careful look at the code and the -output. To assist in the process, but certainly not in replace of it, please -check the following items. - -**Documentation** - -- [ ] the README.md file template is filled out and currently accurate; it is -possible to load and test the code using only the instructions given -- [ ] minimal docstrings (one line describing what the function does) are -included for all functions; full docstrings describing the inputs and expected -outputs should be given for non-trivial functions - -**Structure** - -- [ ] code should use 4 spaces for indentation; other style decisions are -flexible, but be consistent within a module -- [ ] any required metadata files are checked into the repository and placed -within the directory `static` -- [ ] any intermediate files that are created and stored by the module should -be placed in the directory `cache` -- [ ] final expected output files to be uploaded to the API are placed in the -`receiving` directory; output files should not be committed to the respository -- [ ] all options and API keys are passed through the file `params.json` -- [ ] template parameter file (`params.json.template`) is checked into the -code; no personal (i.e., usernames) or private (i.e., API keys) information is -included in this template file - -**Testing** - -- [ ] module can be installed in a new virtual environment -- [ ] pylint with the default `.pylint` settings run over the module produces -minimal warnings; warnings that do exist have been confirmed as false positives -- [ ] reasonably high level of unit test coverage covering all of the main logic -of the code (e.g., missing coverage for raised errors that do not currently seem -possible to reach are okay; missing coverage for options that will be needed are -not) -- [ ] all unit tests run without errors diff --git a/usafacts/cache/.gitignore b/usafacts/cache/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/usafacts/delphi_usafacts/__init__.py b/usafacts/delphi_usafacts/__init__.py deleted file mode 100644 index 65b806d9f..000000000 --- a/usafacts/delphi_usafacts/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -"""Module to pull and clean indicators from the USAFacts source. - -This file defines the functions that are made public by the module. As the -module is intended to be executed though the main method, these are primarily -for testing. -""" - -from __future__ import absolute_import - -from . import geo -from . import pull -from . import run diff --git a/usafacts/delphi_usafacts/__main__.py b/usafacts/delphi_usafacts/__main__.py deleted file mode 100644 index 32fc0eecc..000000000 --- a/usafacts/delphi_usafacts/__main__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -"""Call the function run_module when executed. - -This file indicates that calling the module (`python -m MODULE_NAME`) will -call the function `run_module` found within the run.py file. There should be -no need to change this template. -""" - -from delphi_utils import read_params -from .run import run_module # pragma: no cover - -run_module(read_params()) # pragma: no cover diff --git a/usafacts/delphi_usafacts/geo.py b/usafacts/delphi_usafacts/geo.py deleted file mode 100644 index 59adcdeb4..000000000 --- a/usafacts/delphi_usafacts/geo.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*- coding: utf-8 -*- -"""Functions for converting geocodes.""" -import pandas as pd - -from delphi_utils import GeoMapper - -INCIDENCE_BASE = 100000 - -SECONDARY_FIPS = [ - ("51620", ["51093", "51175"]), - ("51685", ["51153"]), - ("28039", ["28059", "28041", "28131", "28045", "28059", "28109", "28047"]), - ("51690", ["51089", "51067"]), - ("51595", ["51081", "51025", "51175", "51183"]), - ("51600", ["51059", "51059", "51059"]), - ("51580", ["51005"]), - ("51678", ["51163"]), -] -NYC_FIPS = [ - ("00001", ["36061", "36005", "36047", "36081", "36085"]) -] -REPLACE_FIPS = [ - ("02158", "02270"), - ("46102", "46113"), -] - - -# Valid geographical resolutions output by this indicator. -VALID_GEO_RES = ("county", "state", "msa", "hrr", "hhs", "nation") -# Sensors that report proportions. For geo resolutions with unallocated cases -# or deaths, we avoid reporting these sensors. -PROP_SENSORS = ("incidence", "cumulative_prop") - - -def disburse(df: pd.DataFrame, pooled_fips: str, fips_list: list): - """Disburse counts from POOLED_FIPS equally to the counties in FIPS_LIST. - - Parameters - ---------- - df: pd.DataFrame - Columns: fips, timestamp, new_counts, cumulative_counts, ... - pooled_fips: str - FIPS of county from which to disburse counts - fips_list: list[str] - FIPS of counties to which to disburse counts. - - Results - ------- - pd.DataFrame - Dataframe with same schema as df, with the counts disbursed. - """ - cols = ["new_counts", "cumulative_counts"] - df = df.copy().sort_values(["fips", "timestamp"]) - for col in cols: - # Get values from the aggregated county: - vals = df.loc[df["fips"] == pooled_fips, col].values / len(fips_list) - if len(vals) > 0: - for fips in fips_list: - df.loc[df["fips"] == fips, col] += vals - return df - - -def geo_map(df: pd.DataFrame, geo_res: str, sensor: str): - """ - Map a DataFrame with county level data and aggregate it to the geographic resolution geo_res. - - Parameters - ---------- - df: pd.DataFrame - Columns: fips, timestamp, new_counts, cumulative_counts, population ... - geo_res: str - Geographic resolution to which to aggregate. Valid options: - ("county", "state", "msa", "hrr", "hhs", "nation"). - sensor: str - sensor type. Valid options: - ("new_counts", "cumulative_counts", - "incidence", "cumulative_prop") - - Returns - ------- - pd.DataFrame - Columns: geo_id, timestamp, ... - """ - if geo_res not in VALID_GEO_RES: - raise ValueError(f"geo_res must be one of {VALID_GEO_RES}") - - # State-level records unassigned to specific counties are coded as fake - # counties with fips XX000. - unassigned_counties = df[df["fips"].str.endswith("000")].copy() - df = df[~df["fips"].str.endswith("000")].copy() - # Disburse unallocated cases/deaths in NYC to NYC counties - df = disburse(df, NYC_FIPS[0][0], NYC_FIPS[0][1]) - df = df[df["fips"] != NYC_FIPS[0][0]] - gmpr = GeoMapper() - # The FIPS code 00001 is a dummy for unallocated NYC data. It doesn't have - # a corresponding population entry in the GeoMapper so it will be dropped - # in the call to `add_population_column()`. We pull it out here to - # reinsert it after the population data is added. - nyc_dummy_row = df[df["fips"] == "00001"] - - # Merge in population LOWERCASE, consistent across confirmed and deaths - # Population for unassigned cases/deaths is NAN - df = gmpr.add_population_column(df, "fips") - df = df.append(nyc_dummy_row, ignore_index=True) if not nyc_dummy_row.empty else df - if geo_res == "county": - if sensor not in PROP_SENSORS: - # It is not clear how to calculate the proportion for unallocated - # cases/deaths, so we exclude them for those sensors. - df = df.append(unassigned_counties) if not unassigned_counties.empty else df - df.rename({"fips": "geo_id"}, inplace=True, axis=1) - elif geo_res in ("state", "hhs", "nation"): - state_geo = "state_id" if geo_res == "state" else geo_res - df = df.append(unassigned_counties) if not unassigned_counties.empty else df - df = gmpr.replace_geocode(df, "fips", state_geo, new_col="geo_id") - else: - # Map "missing" secondary FIPS to those that are in our canonical set - for fips, fips_list in SECONDARY_FIPS: - df = disburse(df, fips, fips_list) - for usafacts_fips, our_fips in REPLACE_FIPS: - df.loc[df["fips"] == usafacts_fips, "fips"] = our_fips - merged = gmpr.replace_geocode(df, "fips", geo_res, new_col="geo_id") - if "weight" not in merged.columns: - merged["weight"] = 1 - merged["cumulative_counts"] = merged["cumulative_counts"] * merged["weight"] - merged["new_counts"] = merged["new_counts"] * merged["weight"] - merged["population"] = merged["population"] * merged["weight"] - df = merged.drop(["weight"], axis=1) - df = df.groupby(["geo_id", "timestamp"]).sum().reset_index() - df["incidence"] = df["new_counts"] / df["population"] * INCIDENCE_BASE - df["cumulative_prop"] = df["cumulative_counts"] / df["population"] * INCIDENCE_BASE - return df diff --git a/usafacts/delphi_usafacts/pull.py b/usafacts/delphi_usafacts/pull.py deleted file mode 100644 index 0c2717baa..000000000 --- a/usafacts/delphi_usafacts/pull.py +++ /dev/null @@ -1,177 +0,0 @@ -# -*- coding: utf-8 -*- -"""Functions for pulling data from the USAFacts website.""" -from datetime import date -import hashlib -from logging import Logger -import os - -import numpy as np -import pandas as pd -import requests - -# Columns to drop the the data frame. -DROP_COLUMNS = [ - "countyfips", - "county name", - "state", - "statefips" -] - -def fetch(url: str, cache: str) -> pd.DataFrame: - """Handle network I/O for fetching raw input data file. - - This is necessary because for some reason pd.read_csv is generating - 403:Forbidden on the new URLs. - """ - r = requests.get(url) - r.raise_for_status() - datestamp = date.today().strftime('%Y%m%d') - name = url.split('/')[-1].replace('.csv','') - os.makedirs(cache, exist_ok=True) - filename = os.path.join(cache, f"{datestamp}_{name}.csv") - with open(filename, "w") as f: - f.write(r.text) - return pd.read_csv(filename) - - -def pull_usafacts_data(base_url: str, metric: str, logger: Logger, cache: str=None) -> pd.DataFrame: - """Pull the latest USA Facts data, and conform it into a dataset. - - The output dataset has: - - - Each row corresponds to (County, Date), denoted (FIPS, timestamp) - - Each row additionally has a column `new_counts` corresponding to the new - new_counts (either `confirmed` cases or `deaths`), and a column - `cumulative_counts`, correspond to the aggregate metric from January 22nd - (as of April 27th) until the latest date. - - Note that the raw dataset gives the `cumulative_counts` metric, from which - we compute `new_counts` by taking first differences. Hence, `new_counts` - may be negative. This is wholly dependent on the quality of the raw - dataset. - - We filter the data such that we only keep rows with valid FIPS, or "FIPS" - codes defined under the exceptions of the README. The current exceptions - include: - - # - 6000: Grand Princess Cruise Ship - # - 2270: Wade Hampton Census Area in AK, but no cases/deaths were assigned - # - 0: statewise unallocated - # - 1: New York City Unallocated/Probable (only exists for NYC) - - PS: No information for PR - Parameters - ---------- - base_url: str - Base URL for pulling the USA Facts data - metric: str - One of 'confirmed' or 'deaths'. The keys of base_url. - logger: Logger - cache: str - Directory where downloaded csvs should be stashed. - - Returns - ------- - pd.DataFrame - Dataframe as described above. - """ - # Read data - df = fetch(base_url.format(metric=metric), cache) - date_cols = [i for i in df.columns if i.startswith("2")] - logger.info("data retrieved from source", - metric=metric, - num_rows=df.shape[0], - num_cols=df.shape[1], - min_date=min(date_cols), - max_date=max(date_cols), - checksum=hashlib.sha256(pd.util.hash_pandas_object(df).values).hexdigest()) - df.columns = [i.lower() for i in df.columns] - # Clean commas in count fields in case the input file included them - df[df.columns[4:]] = df[df.columns[4:]].applymap( - lambda x: int(x.replace(",", "")) if isinstance(x, str) else x) - # Check missing FIPS - null_mask = pd.isnull(df["countyfips"]) - assert null_mask.sum() == 0 - - unexpected_columns = [x for x in df.columns if "Unnamed" in x] - unexpected_columns.extend(DROP_COLUMNS) - - # Assign Grand Princess Cruise Ship a special FIPS 90000 - # df.loc[df["FIPS"] == 6000, "FIPS"] = 90000 - # df.loc[df["FIPS"] == 6000, "stateFIPS"] = 90 - - # Ignore Grand Princess Cruise Ship and Wade Hampton Census Area in AK - df = df[ - (df["countyfips"] != 6000) - & (df["countyfips"] != 2270) - ] - - # Change FIPS from 0 to XX000 for statewise unallocated cases/deaths - unassigned_index = (df["countyfips"] == 0) - df.loc[unassigned_index, "countyfips"] = df["statefips"].loc[unassigned_index].values * 1000 - - # Conform FIPS - df["fips"] = df["countyfips"].apply(lambda x: f"{int(x):05d}") - - - - # Drop unnecessary columns (state is pre-encoded in fips) - try: - df.drop(DROP_COLUMNS, axis=1, inplace=True) - except KeyError as e: - raise ValueError( - "Tried to drop non-existent columns. The dataset " - "schema may have changed. Please investigate and " - "amend DROP_COLUMNS." - ) from e - # Check that columns are either FIPS or dates - try: - columns = list(df.columns) - columns.remove("fips") - # Detects whether there is a non-date string column -- not perfect - # USAFacts has used both / and -, so account for both cases. - _ = [int(x.replace("/", "").replace("-", "")) for x in columns] - except ValueError as e: - raise ValueError( - "Detected unexpected column(s) " - "after dropping DROP_COLUMNS. The dataset " - "schema may have changed. Please investigate and " - "amend DROP_COLUMNS." - ) from e - # Reshape dataframe - df = df.melt( - id_vars=["fips"], - var_name="timestamp", - value_name="cumulative_counts", - ) - # timestamp: str -> datetime - df["timestamp"] = pd.to_datetime(df["timestamp"]) - # Add a dummy first row here on day before first day - min_ts = min(df["timestamp"]) - df_dummy = df.loc[df["timestamp"] == min_ts].copy() - df_dummy.loc[:, "timestamp"] = min_ts - pd.Timedelta(days=1) - df_dummy.loc[:, "cumulative_counts"] = 0 - df = pd.concat([df_dummy, df]) - # Obtain new_counts - df.sort_values(["fips", "timestamp"], inplace=True) - df["new_counts"] = df["cumulative_counts"].diff() # 1st discrete difference - # Handle edge cases where we diffed across fips - mask = df["fips"] != df["fips"].shift(1) - df.loc[mask, "new_counts"] = np.nan - df.reset_index(inplace=True, drop=True) - - # Final sanity checks - days_by_fips = df.groupby("fips").count()["cumulative_counts"].unique() - unique_days = df["timestamp"].unique() - # each FIPS has same number of rows - if (len(days_by_fips) > 1) or (days_by_fips[0] != len(unique_days)): - raise ValueError("Differing number of days by fips") - return df.loc[ - df["timestamp"] >= min_ts, - [ # Reorder - "fips", - "timestamp", - "new_counts", - "cumulative_counts", - ], - ] diff --git a/usafacts/delphi_usafacts/run.py b/usafacts/delphi_usafacts/run.py deleted file mode 100644 index 4c659679a..000000000 --- a/usafacts/delphi_usafacts/run.py +++ /dev/null @@ -1,150 +0,0 @@ -# -*- coding: utf-8 -*- -"""Functions to call when running the function. - -This module should contain a function called `run_module`, that is executed -when the module is run with `python -m MODULE_NAME`. -""" -import time as t -from datetime import datetime, date, time, timedelta -from itertools import product -from typing import Dict, Any - -import numpy as np -from delphi_utils import ( - create_export_csv, - get_structured_logger, - Smoother -) - -from .geo import geo_map -from .pull import pull_usafacts_data - -# global constants -METRICS = [ - "confirmed", - "deaths", -] -SENSORS = [ - "new_counts", - "cumulative_counts", - "incidence", # new_counts per 100k people - "cumulative_prop", -] -SMOOTHERS = [ - "unsmoothed", - "seven_day_average", -] -SENSOR_NAME_MAP = { - "new_counts": ("incidence_num", False), - "cumulative_counts": ("cumulative_num", False), - "incidence": ("incidence_prop", False), - "cumulative_prop": ("cumulative_prop", False), -} -# Temporarily added for wip_ signals -# WIP_SENSOR_NAME_MAP = { -# "new_counts": ("incid_num", False), -# "cumulative_counts": ("cumul_num", False), -# "incidence": ("incid_prop", False), -# "cumulative_prop": ("cumul_prop", False), -# } - -SMOOTHERS_MAP = { - "unsmoothed": (Smoother("identity"), "", False, lambda d: d - timedelta(days=7)), - "seven_day_average": (Smoother("moving_average", window_length=7), "7dav_", True, lambda d: d), -} -GEO_RESOLUTIONS = [ - "county", - "state", - "msa", - "hrr", - "hhs", - "nation" -] - - -def run_module(params: Dict[str, Dict[str, Any]]): - """Run the usafacts indicator. - - The `params` argument is expected to have the following structure: - - "common": - - "export_dir": str, directory to write output - - "log_exceptions" (optional): bool, whether to log exceptions to file - - "log_filename" (optional): str, name of file to write logs - - "indicator": - - "base_url": str, URL from which to read upstream data - - "export_start_date": str, date from which to export data in YYYY-MM-DD format - - "archive" (optional): if provided, output will be archived with S3 - - "aws_credentials": Dict[str, str], AWS login credentials (see S3 documentation) - - "bucket_name: str, name of S3 bucket to read/write - - "cache_dir": str, directory of locally cached data - """ - start_time = t.time() - csv_export_count = 0 - oldest_final_export_date = None - logger = get_structured_logger( - __name__, filename=params["common"].get("log_filename"), - log_exceptions=params["common"].get("log_exceptions", True)) - export_start_date = params["indicator"]["export_start_date"] - if export_start_date == "latest": - export_start_date = datetime.combine(date.today(), time(0, 0)) - timedelta(days=1) - else: - export_start_date = datetime.strptime(export_start_date, "%Y-%m-%d") - export_dir = params["common"]["export_dir"] - input_dir = params["common"]["input_dir"] - base_url = params["indicator"]["base_url"] - - dfs = {metric: pull_usafacts_data(base_url, metric, logger, input_dir) for metric in METRICS} - for metric, geo_res, sensor, smoother in product( - METRICS, GEO_RESOLUTIONS, SENSORS, SMOOTHERS): - if "cumulative" in sensor and "seven_day_average" in smoother: - continue - logger.info("Generating signal and exporting to CSV", - geo_res = geo_res, - metric = metric, - sensor = sensor, - smoother = smoother) - df = dfs[metric] - # Aggregate to appropriate geographic resolution - df = geo_map(df, geo_res, sensor) - df["val"] = df[["geo_id", sensor]].groupby("geo_id")[sensor].transform( - SMOOTHERS_MAP[smoother][0].smooth - ) - df["se"] = np.nan - df["sample_size"] = np.nan - # Drop early entries where data insufficient for smoothing - df = df.loc[~df["val"].isnull(), :] - sensor_name = SENSOR_NAME_MAP[sensor][0] - # if (SENSOR_NAME_MAP[sensor][1] or SMOOTHERS_MAP[smoother][2]): - # metric = f"wip_{metric}" - # sensor_name = WIP_SENSOR_NAME_MAP[sensor][0] - sensor_name = SMOOTHERS_MAP[smoother][1] + sensor_name - exported_csv_dates = create_export_csv( - df, - export_dir=export_dir, - start_date=SMOOTHERS_MAP[smoother][3](export_start_date), - metric=metric, - geo_res=geo_res, - sensor=sensor_name, - ) - if not exported_csv_dates.empty: - logger.info("Exported CSV", - csv_export_count = exported_csv_dates.size, - min_csv_export_date = min(exported_csv_dates).strftime("%Y-%m-%d"), - max_csv_export_date = max(exported_csv_dates).strftime("%Y-%m-%d")) - csv_export_count += exported_csv_dates.size - if not oldest_final_export_date: - oldest_final_export_date = max(exported_csv_dates) - oldest_final_export_date = min( - oldest_final_export_date, max(exported_csv_dates)) - - elapsed_time_in_seconds = round(t.time() - start_time, 2) - max_lag_in_days = None - formatted_oldest_final_export_date = None - if oldest_final_export_date: - max_lag_in_days = (datetime.now() - oldest_final_export_date).days - formatted_oldest_final_export_date = oldest_final_export_date.strftime("%Y-%m-%d") - logger.info("Completed indicator run", - elapsed_time_in_seconds = elapsed_time_in_seconds, - csv_export_count = csv_export_count, - max_lag_in_days = max_lag_in_days, - oldest_final_export_date = formatted_oldest_final_export_date) diff --git a/usafacts/input-cache/.gitignore b/usafacts/input-cache/.gitignore deleted file mode 100644 index 552154e09..000000000 --- a/usafacts/input-cache/.gitignore +++ /dev/null @@ -1,120 +0,0 @@ -# You should hard commit a prototype for this file, but we -# want to avoid accidental adding of API tokens and other -# private data parameters -params.json - -# Do not commit output files -receiving/*.csv - -# Remove macOS files -.DS_Store - -# virtual environment -dview/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -coverage.xml -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -.static_storage/ -.media/ -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ diff --git a/usafacts/params.json.template b/usafacts/params.json.template deleted file mode 100644 index 68594fdc7..000000000 --- a/usafacts/params.json.template +++ /dev/null @@ -1,56 +0,0 @@ -{ - "common": { - "export_dir": "./receiving", - "input_dir": "./input-cache", - "log_exceptions": false, - "log_filename": "./usa-facts.log" - }, - "indicator": { - "base_url": "https://static.usafacts.org/public/data/covid-19/covid_{metric}_usafacts.csv", - "export_start_date": "2020-02-20" - }, - "archive": { - "aws_credentials": { - "aws_access_key_id": "", - "aws_secret_access_key": "" - }, - "bucket_name": "", - "indicator_prefix": "usafacts", - "cache_dir": "./cache" - }, - "validation": { - "common": { - "data_source": "usa-facts", - "span_length": 14, - "min_expected_lag": {"all": "1"}, - "max_expected_lag": {"all": "5"}, - "dry_run": true, - "suppressed_errors": [ - {"check_name": "check_val_lt_0"}, - {"check_name": "check_test_vs_reference_avg_changed", - "signal": "deaths_7dav_incidence_prop", - "geo_type": "county"} - ] - }, - "static": { - "minimum_sample_size": 100, - "missing_se_allowed": true, - "missing_sample_size_allowed": true - }, - "dynamic": { - "ref_window_size": 7, - "smoothed_signals": [ - "confirmed_7dav_cumulative_num", - "confirmed_7dav_cumulative_prop", - "confirmed_7dav_incidence_num", - "confirmed_7dav_incidence_prop", - "deaths_7dav_cumulative_num", - "deaths_7dav_cumulative_prop", - "deaths_7dav_incidence_num", - "deaths_7dav_incidence_prop"] - } - }, - "delivery": { - "delivery_dir": "./receiving" - } -} diff --git a/usafacts/receiving/.gitignore b/usafacts/receiving/.gitignore deleted file mode 100644 index 552154e09..000000000 --- a/usafacts/receiving/.gitignore +++ /dev/null @@ -1,120 +0,0 @@ -# You should hard commit a prototype for this file, but we -# want to avoid accidental adding of API tokens and other -# private data parameters -params.json - -# Do not commit output files -receiving/*.csv - -# Remove macOS files -.DS_Store - -# virtual environment -dview/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -coverage.xml -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -.static_storage/ -.media/ -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ diff --git a/usafacts/setup.py b/usafacts/setup.py deleted file mode 100644 index e15cae933..000000000 --- a/usafacts/setup.py +++ /dev/null @@ -1,28 +0,0 @@ -from setuptools import setup -from setuptools import find_packages - -required = [ - "numpy", - "pandas", - "pydocstyle", - "pytest", - "pytest-cov", - "pylint==2.8.3", - "delphi-utils" -] - -setup( - name="delphi_usafacts", - version="0.0.1", - description="Indicators from USAFacts website", - author="", - author_email="", - url="https://github.com/cmu-delphi/covidcast-indicators", - install_requires=required, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", - ], - packages=find_packages(), -) diff --git a/usafacts/tests/receiving/.gitignore b/usafacts/tests/receiving/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/usafacts/tests/test_data/bad_confirmed_extra_cols.csv b/usafacts/tests/test_data/bad_confirmed_extra_cols.csv deleted file mode 100644 index 6356cd19f..000000000 --- a/usafacts/tests/test_data/bad_confirmed_extra_cols.csv +++ /dev/null @@ -1,150 +0,0 @@ -countyFIPS,County Name,State,stateFIPS,2/29/20,3/1/20,3/2/20,3/3/20,3/4/20,3/5/20,3/6/20,3/7/20,3/8/20,3/9/20,3/10/20,extra -1041,Crenshaw County,AL,1,0,0,0,0,0,0,0,0,0,0,0,0.375787942 -1067,Henry County,AL,1,0,0,0,0,0,0,0,0,0,0,0,0.066511498 -2158,Kusilvak Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0,0.455249355 -2270,Wade Hampton Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0,0.996748628 -5043,Drew County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.666117206 -5053,Grant County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.366926139 -5075,Lawrence County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.323615234 -5077,Lee County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.6081579 -5085,Lonoke County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.054141562 -5119,Pulaski County,AR,5,0,0,0,0,0,0,0,0,0,0,0,0.224773839 -6051,Mono County,CA,6,0,0,0,0,0,0,0,0,0,0,0,0.990063918 -6071,San Bernardino County,CA,6,0,0,0,0,0,0,0,0,0,0,0,0.59723346 -8014,Broomfield County and City,CO,8,0,0,0,0,0,0,0,0,0,0,0,0.391679582 -8015,Chaffee County,CO,8,0,0,0,0,0,0,0,0,0,0,0,0.827943492 -9011,New London County,CT,9,0,0,0,0,0,0,0,0,0,0,0,0.870062283 -12073,Leon County,FL,12,0,0,0,0,0,0,0,0,0,0,0,0.610998435 -12127,Volusia County,FL,12,0,0,0,0,0,0,0,0,1,2,2,0.057455221 -13043,Candler County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.381481406 -13167,Johnson County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.474407949 -13211,Morgan County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.541769038 -13289,Twiggs County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.179386589 -13295,Walker County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.380050517 -13303,Washington County,GA,13,0,0,0,0,0,0,0,0,0,0,0,0.188258 -16033,Clark County,ID,16,0,0,0,0,0,0,0,0,0,0,0,0.590671628 -17043,DuPage County,IL,17,0,0,0,0,0,0,0,0,0,0,0,0.913104276 -17091,Kankakee County,IL,17,0,0,0,0,0,0,0,0,0,0,0,0.849751706 -17129,Menard County,IL,17,0,0,0,0,0,0,0,0,0,0,0,0.441192922 -18055,Greene County,IN,18,0,0,0,0,0,0,0,0,0,0,0,0.439793293 -19047,Crawford County,IA,19,0,0,0,0,0,0,0,0,0,0,0,0.559894716 -19063,Emmet County,IA,19,0,0,0,0,0,0,0,0,0,0,0,0.749048215 -19159,Ringgold County,IA,19,0,0,0,0,0,0,0,0,0,0,0,0.405824907 -20053,Ellsworth County,KS,20,0,0,0,0,0,0,0,0,0,0,0,0.133293501 -20179,Sheridan County,KS,20,0,0,0,0,0,0,0,0,0,0,0,0.009196377 -21037,Campbell County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.643508283 -21045,Casey County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.04787821 -21101,Henderson County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.688646454 -21171,Monroe County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.956877829 -21207,Russell County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.724252877 -21211,Shelby County,KY,21,0,0,0,0,0,0,0,0,0,0,0,0.746473025 -22023,Cameron Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0,0.438619356 -22073,Ouachita Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0,0.418155584 -22079,Rapides Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0,0.025580324 -22081,Red River Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0,0.113589984 -24023,Garrett County,MD,24,0,0,0,0,0,0,0,0,0,0,0,0.195743996 -25025,Suffolk County,MA,25,1,1,1,1,1,1,3,3,8,10,20,0.129699433 -26047,Emmet County,MI,26,0,0,0,0,0,0,0,0,0,0,0,0.638499028 -26069,Iosco County,MI,26,0,0,0,0,0,0,0,0,0,0,0,0.776239696 -27025,Chisago County,MN,27,0,0,0,0,0,0,0,0,0,0,0,0.604720039 -28001,Adams County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.935420125 -28005,Amite County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.213331478 -28039,George County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.34302082 -28041,Greene County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.843846373 -28045,Hancock County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.055195881 -28047,Harrison County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.556056038 -28051,Holmes County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.415691747 -28059,Jackson County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.445610646 -28107,Panola County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.618054101 -28109,Pearl River County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.018010684 -28131,Stone County,MS,28,0,0,0,0,0,0,0,0,0,0,0,0.027833815 -29011,Barton County,MO,29,0,0,0,0,0,0,0,0,0,0,0,0.196346445 -29057,Dade County,MO,29,0,0,0,0,0,0,0,0,0,0,0,0.571409571 -29125,Maries County,MO,29,0,0,0,0,0,0,0,0,0,0,0,0.390961033 -29213,Taney County,MO,29,0,0,0,0,0,0,0,0,0,0,0,0.752934897 -30095,Stillwater County,MT,30,0,0,0,0,0,0,0,0,0,0,0,0.766884174 -31029,Chase County,NE,31,0,0,0,0,0,0,0,0,0,0,0,0.775370468 -31057,Dundy County,NE,31,0,0,0,0,0,0,0,0,0,0,0,0.938416056 -31105,Kimball County,NE,31,0,0,0,0,0,0,0,0,0,0,0,0.865652547 -31115,Loup County,NE,31,0,0,0,0,0,0,0,0,0,0,0,0.839548936 -31165,Sioux County,NE,31,0,0,0,0,0,0,0,0,0,0,0,0.719030732 -32001,Churchill County,NV,32,0,0,0,0,0,0,0,0,0,0,0,0.809140745 -32510,Carson City,NV,32,0,0,0,0,0,0,0,0,0,0,0,0.553552142 -33003,Carroll County,NH,33,0,0,0,0,0,0,0,0,0,0,0,0.014039113 -35045,San Juan County,NM,35,0,0,0,0,0,0,0,0,0,0,0,0.906951537 -1,New York City Unallocated/Probable,NY,36,0,0,0,0,0,0,0,0,0,0,0,0.661171876 -36005,Bronx County,NY,36,0,0,0,0,0,0,0,0,1,2,3,0.849372568 -36009,Cattaraugus County,NY,36,0,0,0,0,0,0,0,0,0,0,0,0.524406259 -36035,Fulton County,NY,36,0,0,0,0,0,0,0,0,0,0,0,0.977151927 -36047,Kings County,NY,36,0,0,0,0,0,1,1,3,3,4,10,0.082690112 -36061,New York County,NY,36,0,0,1,1,1,3,4,8,8,11,17,0.961515156 -36081,Queens County,NY,36,0,0,0,0,0,0,0,1,1,2,4,0.253326779 -36085,Richmond County,NY,36,0,0,0,0,0,0,0,0,0,1,2,0.111593279 -36093,Schenectady County,NY,36,0,0,0,0,0,0,0,0,0,0,0,0.688451563 -37135,Orange County,NC,37,0,0,0,0,0,0,0,0,0,0,0,0.874004855 -38019,Cavalier County,ND,38,0,0,0,0,0,0,0,0,0,0,0,0.853618385 -38031,Foster County,ND,38,0,0,0,0,0,0,0,0,0,0,0,0.477998123 -39075,Holmes County,OH,39,0,0,0,0,0,0,0,0,0,0,0,0.768172331 -40045,Ellis County,OK,40,0,0,0,0,0,0,0,0,0,0,0,0.574251695 -40059,Harper County,OK,40,0,0,0,0,0,0,0,0,0,0,0,0.906817227 -40061,Haskell County,OK,40,0,0,0,0,0,0,0,0,0,0,0,0.083670301 -40079,Le Flore County,OK,40,0,0,0,0,0,0,0,0,0,0,0,0.395117375 -41013,Crook County,OR,41,0,0,0,0,0,0,0,0,0,0,0,0.61269078 -41015,Curry County,OR,41,0,0,0,0,0,0,0,0,0,0,0,0.152169926 -41045,Malheur County,OR,41,0,0,0,0,0,0,0,0,0,0,0,0.015867277 -46021,Campbell County,SD,46,0,0,0,0,0,0,0,0,0,0,0,0.621704912 -46063,Harding County,SD,46,0,0,0,0,0,0,0,0,0,0,0,0.43073374 -46102,Oglala Lakota County,SD,46,0,0,0,0,0,0,0,0,0,0,0,0.558856723 -47031,Coffee County,TN,47,0,0,0,0,0,0,0,0,0,0,0,0.513213487 -47077,Henderson County,TN,47,0,0,0,0,0,0,0,0,0,0,0,0.120434772 -47099,Lawrence County,TN,47,0,0,0,0,0,0,0,0,0,0,0,0.448264508 -47113,Madison County,TN,47,0,0,0,0,0,0,0,0,0,0,0,0.933012241 -47177,Warren County,TN,47,0,0,0,0,0,0,0,0,0,0,0,0.045186278 -47187,Williamson County,TN,47,0,0,0,0,0,1,1,1,1,1,4,0.882893715 -48021,Bastrop County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.537368768 -48059,Callahan County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.006211813 -48061,Cameron County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.5477017 -48143,Erath County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.374143857 -48151,Fisher County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.019588993 -48173,Glasscock County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.787249999 -48263,Kent County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.729777059 -48303,Lubbock County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.725433325 -48365,Panola County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.215021962 -48411,San Saba County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.350624457 -48425,Somervell County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.733466401 -48449,Titus County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.46527388 -48495,Winkler County,TX,48,0,0,0,0,0,0,0,0,0,0,0,0.839100125 -50005,Caledonia County,VT,50,0,0,0,0,0,0,0,0,0,0,0,0.436112894 -50027,Windsor County,VT,50,0,0,0,0,0,0,0,0,0,0,0,0.419253248 -51005,Alleghany County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.964938849 -51015,Augusta County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.291844802 -51025,Brunswick County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.974326893 -51043,Clarke County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.591362341 -51059,Fairfax County,VA,51,0,0,0,0,0,0,0,0,2,4,4,0.485940359 -51067,Franklin County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.668380203 -51081,Greensville County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.330777413 -51089,Henry County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.863131813 -51093,Isle of Wight County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.537115632 -51131,Northampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.004090703 -51153,Prince William County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.131381189 -51163,Rockbridge County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.629461679 -51175,Southampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.382284867 -51183,Sussex County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.0099569 -51195,Wise County,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.331588188 -51520,Bristol city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.091178276 -51540,Charlottesville City,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.163164481 -51580,Covington city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.307774599 -51595,Emporia city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.376350363 -51600,Fairfax city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.427536647 -51620,Franklin city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.253925287 -51678,Lexington city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.48266825 -51685,Manassas Park city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.501915901 -51690,Martinsville city,VA,51,0,0,0,0,0,0,0,0,0,0,0,0.369187756 -53063,Spokane County,WA,53,0,0,0,0,0,0,0,0,0,0,0,0.9956488 -54015,Clay County,WV,54,0,0,0,0,0,0,0,0,0,0,0,0.707045861 -54033,Harrison County,WV,54,0,0,0,0,0,0,0,0,0,0,0,0.367922736 -54087,Roane County,WV,54,0,0,0,0,0,0,0,0,0,0,0,0.913909792 -55009,Brown County,WI,55,0,0,0,0,0,0,0,0,0,0,0,0.637695999 -55071,Manitowoc County,WI,55,0,0,0,0,0,0,0,0,0,0,0,0.384496752 -55107,Rusk County,WI,55,0,0,0,0,0,0,0,0,0,0,0,0.176242413 -55115,Shawano County,WI,55,0,0,0,0,0,0,0,0,0,0,0,0.948897692 \ No newline at end of file diff --git a/usafacts/tests/test_data/bad_confirmed_missing_cols.csv b/usafacts/tests/test_data/bad_confirmed_missing_cols.csv deleted file mode 100644 index c65a21565..000000000 --- a/usafacts/tests/test_data/bad_confirmed_missing_cols.csv +++ /dev/null @@ -1,150 +0,0 @@ -countyFIPS,State,stateFIPS,2/29/20,3/1/20,3/2/20,3/3/20,3/4/20,3/5/20,3/6/20,3/7/20,3/8/20,3/9/20,3/10/20 -1041,AL,1,0,0,0,0,0,0,0,0,0,0,0 -1067,AL,1,0,0,0,0,0,0,0,0,0,0,0 -2158,AK,2,0,0,0,0,0,0,0,0,0,0,0 -2270,AK,2,0,0,0,0,0,0,0,0,0,0,0 -5043,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5053,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5075,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5077,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5085,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5119,AR,5,0,0,0,0,0,0,0,0,0,0,0 -6051,CA,6,0,0,0,0,0,0,0,0,0,0,0 -6071,CA,6,0,0,0,0,0,0,0,0,0,0,0 -8014,CO,8,0,0,0,0,0,0,0,0,0,0,0 -8015,CO,8,0,0,0,0,0,0,0,0,0,0,0 -9011,CT,9,0,0,0,0,0,0,0,0,0,0,0 -12073,FL,12,0,0,0,0,0,0,0,0,0,0,0 -12127,FL,12,0,0,0,0,0,0,0,0,1,2,2 -13043,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13167,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13211,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13289,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13295,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13303,GA,13,0,0,0,0,0,0,0,0,0,0,0 -16033,ID,16,0,0,0,0,0,0,0,0,0,0,0 -17043,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17091,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17129,IL,17,0,0,0,0,0,0,0,0,0,0,0 -18055,IN,18,0,0,0,0,0,0,0,0,0,0,0 -19047,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19063,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19159,IA,19,0,0,0,0,0,0,0,0,0,0,0 -20053,KS,20,0,0,0,0,0,0,0,0,0,0,0 -20179,KS,20,0,0,0,0,0,0,0,0,0,0,0 -21037,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21045,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21101,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21171,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21207,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21211,KY,21,0,0,0,0,0,0,0,0,0,0,0 -22023,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22073,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22079,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22081,LA,22,0,0,0,0,0,0,0,0,0,0,0 -24023,MD,24,0,0,0,0,0,0,0,0,0,0,0 -25025,MA,25,1,1,1,1,1,1,3,3,8,10,20 -26047,MI,26,0,0,0,0,0,0,0,0,0,0,0 -26069,MI,26,0,0,0,0,0,0,0,0,0,0,0 -27025,MN,27,0,0,0,0,0,0,0,0,0,0,0 -28001,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28005,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28039,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28041,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28045,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28047,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28051,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28059,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28107,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28109,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28131,MS,28,0,0,0,0,0,0,0,0,0,0,0 -29011,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29057,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29125,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29213,MO,29,0,0,0,0,0,0,0,0,0,0,0 -30095,MT,30,0,0,0,0,0,0,0,0,0,0,0 -31029,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31057,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31105,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31115,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31165,NE,31,0,0,0,0,0,0,0,0,0,0,0 -32001,NV,32,0,0,0,0,0,0,0,0,0,0,0 -32510,NV,32,0,0,0,0,0,0,0,0,0,0,0 -33003,NH,33,0,0,0,0,0,0,0,0,0,0,0 -35045,NM,35,0,0,0,0,0,0,0,0,0,0,0 -1,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36005,NY,36,0,0,0,0,0,0,0,0,1,2,3 -36009,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36035,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36047,NY,36,0,0,0,0,0,1,1,3,3,4,10 -36061,NY,36,0,0,1,1,1,3,4,8,8,11,17 -36081,NY,36,0,0,0,0,0,0,0,1,1,2,4 -36085,NY,36,0,0,0,0,0,0,0,0,0,1,2 -36093,NY,36,0,0,0,0,0,0,0,0,0,0,0 -37135,NC,37,0,0,0,0,0,0,0,0,0,0,0 -38019,ND,38,0,0,0,0,0,0,0,0,0,0,0 -38031,ND,38,0,0,0,0,0,0,0,0,0,0,0 -39075,OH,39,0,0,0,0,0,0,0,0,0,0,0 -40045,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40059,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40061,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40079,OK,40,0,0,0,0,0,0,0,0,0,0,0 -41013,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41015,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41045,OR,41,0,0,0,0,0,0,0,0,0,0,0 -46021,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46063,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46102,SD,46,0,0,0,0,0,0,0,0,0,0,0 -47031,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47077,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47099,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47113,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47177,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47187,TN,47,0,0,0,0,0,1,1,1,1,1,4 -48021,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48059,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48061,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48143,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48151,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48173,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48263,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48303,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48365,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48411,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48425,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48449,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48495,TX,48,0,0,0,0,0,0,0,0,0,0,0 -50005,VT,50,0,0,0,0,0,0,0,0,0,0,0 -50027,VT,50,0,0,0,0,0,0,0,0,0,0,0 -51005,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51015,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51025,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51043,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51059,VA,51,0,0,0,0,0,0,0,0,2,4,4 -51067,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51081,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51089,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51093,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51131,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51153,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51163,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51175,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51183,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51195,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51520,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51540,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51580,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51595,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51600,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51620,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51678,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51685,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51690,VA,51,0,0,0,0,0,0,0,0,0,0,0 -53063,WA,53,0,0,0,0,0,0,0,0,0,0,0 -54015,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54033,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54087,WV,54,0,0,0,0,0,0,0,0,0,0,0 -55009,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55071,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55107,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55115,WI,55,0,0,0,0,0,0,0,0,0,0,0 \ No newline at end of file diff --git a/usafacts/tests/test_data/bad_confirmed_missing_days.csv b/usafacts/tests/test_data/bad_confirmed_missing_days.csv deleted file mode 100644 index b256c2ed3..000000000 --- a/usafacts/tests/test_data/bad_confirmed_missing_days.csv +++ /dev/null @@ -1,150 +0,0 @@ -countyFIPS,County Name,State,stateFIPS,2/29/20,3/2/20,3/3/20,3/6/20,3/7/20,3/9/20,3/10/20 -1041,Crenshaw County,AL,1,0,0,0,0,0,0,0 -1067,Henry County,AL,1,0,0,0,0,0,0,0 -2158,Kusilvak Census Area,AK,2,0,0,0,0,0,0,0 -2270,Wade Hampton Census Area,AK,2,0,0,0,0,0,0,0 -5043,Drew County,AR,5,0,0,0,0,0,0,0 -5053,Grant County,AR,5,0,0,0,0,0,0,0 -5075,Lawrence County,AR,5,0,0,0,0,0,0,0 -5077,Lee County,AR,5,0,0,0,0,0,0,0 -5085,Lonoke County,AR,5,0,0,0,0,0,0,0 -5119,Pulaski County,AR,5,0,0,0,0,0,0,0 -6051,Mono County,CA,6,0,0,0,0,0,0,0 -6071,San Bernardino County,CA,6,0,0,0,0,0,0,0 -8014,Broomfield County and City,CO,8,0,0,0,0,0,0,0 -8015,Chaffee County,CO,8,0,0,0,0,0,0,0 -9011,New London County,CT,9,0,0,0,0,0,0,0 -12073,Leon County,FL,12,0,0,0,0,0,0,0 -12127,Volusia County,FL,12,0,0,0,0,0,2,2 -13043,Candler County,GA,13,0,0,0,0,0,0,0 -13167,Johnson County,GA,13,0,0,0,0,0,0,0 -13211,Morgan County,GA,13,0,0,0,0,0,0,0 -13289,Twiggs County,GA,13,0,0,0,0,0,0,0 -13295,Walker County,GA,13,0,0,0,0,0,0,0 -13303,Washington County,GA,13,0,0,0,0,0,0,0 -16033,Clark County,ID,16,0,0,0,0,0,0,0 -17043,DuPage County,IL,17,0,0,0,0,0,0,0 -17091,Kankakee County,IL,17,0,0,0,0,0,0,0 -17129,Menard County,IL,17,0,0,0,0,0,0,0 -18055,Greene County,IN,18,0,0,0,0,0,0,0 -19047,Crawford County,IA,19,0,0,0,0,0,0,0 -19063,Emmet County,IA,19,0,0,0,0,0,0,0 -19159,Ringgold County,IA,19,0,0,0,0,0,0,0 -20053,Ellsworth County,KS,20,0,0,0,0,0,0,0 -20179,Sheridan County,KS,20,0,0,0,0,0,0,0 -21037,Campbell County,KY,21,0,0,0,0,0,0,0 -21045,Casey County,KY,21,0,0,0,0,0,0,0 -21101,Henderson County,KY,21,0,0,0,0,0,0,0 -21171,Monroe County,KY,21,0,0,0,0,0,0,0 -21207,Russell County,KY,21,0,0,0,0,0,0,0 -21211,Shelby County,KY,21,0,0,0,0,0,0,0 -22023,Cameron Parish,LA,22,0,0,0,0,0,0,0 -22073,Ouachita Parish,LA,22,0,0,0,0,0,0,0 -22079,Rapides Parish,LA,22,0,0,0,0,0,0,0 -22081,Red River Parish,LA,22,0,0,0,0,0,0,0 -24023,Garrett County,MD,24,0,0,0,0,0,0,0 -25025,Suffolk County,MA,25,1,1,1,3,3,10,20 -26047,Emmet County,MI,26,0,0,0,0,0,0,0 -26069,Iosco County,MI,26,0,0,0,0,0,0,0 -27025,Chisago County,MN,27,0,0,0,0,0,0,0 -28001,Adams County,MS,28,0,0,0,0,0,0,0 -28005,Amite County,MS,28,0,0,0,0,0,0,0 -28039,George County,MS,28,0,0,0,0,0,0,0 -28041,Greene County,MS,28,0,0,0,0,0,0,0 -28045,Hancock County,MS,28,0,0,0,0,0,0,0 -28047,Harrison County,MS,28,0,0,0,0,0,0,0 -28051,Holmes County,MS,28,0,0,0,0,0,0,0 -28059,Jackson County,MS,28,0,0,0,0,0,0,0 -28107,Panola County,MS,28,0,0,0,0,0,0,0 -28109,Pearl River County,MS,28,0,0,0,0,0,0,0 -28131,Stone County,MS,28,0,0,0,0,0,0,0 -29011,Barton County,MO,29,0,0,0,0,0,0,0 -29057,Dade County,MO,29,0,0,0,0,0,0,0 -29125,Maries County,MO,29,0,0,0,0,0,0,0 -29213,Taney County,MO,29,0,0,0,0,0,0,0 -30095,Stillwater County,MT,30,0,0,0,0,0,0,0 -31029,Chase County,NE,31,0,0,0,0,0,0,0 -31057,Dundy County,NE,31,0,0,0,0,0,0,0 -31105,Kimball County,NE,31,0,0,0,0,0,0,0 -31115,Loup County,NE,31,0,0,0,0,0,0,0 -31165,Sioux County,NE,31,0,0,0,0,0,0,0 -32001,Churchill County,NV,32,0,0,0,0,0,0,0 -32510,Carson City,NV,32,0,0,0,0,0,0,0 -33003,Carroll County,NH,33,0,0,0,0,0,0,0 -35045,San Juan County,NM,35,0,0,0,0,0,0,0 -1,New York City Unallocated/Probable,NY,36,0,0,0,0,0,0,0 -36005,Bronx County,NY,36,0,0,0,0,0,2,3 -36009,Cattaraugus County,NY,36,0,0,0,0,0,0,0 -36035,Fulton County,NY,36,0,0,0,0,0,0,0 -36047,Kings County,NY,36,0,0,0,1,3,4,10 -36061,New York County,NY,36,0,1,1,4,8,11,17 -36081,Queens County,NY,36,0,0,0,0,1,2,4 -36085,Richmond County,NY,36,0,0,0,0,0,1,2 -36093,Schenectady County,NY,36,0,0,0,0,0,0,0 -37135,Orange County,NC,37,0,0,0,0,0,0,0 -38019,Cavalier County,ND,38,0,0,0,0,0,0,0 -38031,Foster County,ND,38,0,0,0,0,0,0,0 -39075,Holmes County,OH,39,0,0,0,0,0,0,0 -40045,Ellis County,OK,40,0,0,0,0,0,0,0 -40059,Harper County,OK,40,0,0,0,0,0,0,0 -40061,Haskell County,OK,40,0,0,0,0,0,0,0 -40079,Le Flore County,OK,40,0,0,0,0,0,0,0 -41013,Crook County,OR,41,0,0,0,0,0,0,0 -41015,Curry County,OR,41,0,0,0,0,0,0,0 -41045,Malheur County,OR,41,0,0,0,0,0,0,0 -46021,Campbell County,SD,46,0,0,0,0,0,0,0 -46063,Harding County,SD,46,0,0,0,0,0,0,0 -46102,Oglala Lakota County,SD,46,0,0,0,0,0,0,0 -47031,Coffee County,TN,47,0,0,0,0,0,0,0 -47077,Henderson County,TN,47,0,0,0,0,0,0,0 -47099,Lawrence County,TN,47,0,0,0,0,0,0,0 -47113,Madison County,TN,47,0,0,0,0,0,0,0 -47177,Warren County,TN,47,0,0,0,0,0,0,0 -47187,Williamson County,TN,47,0,0,0,1,1,1,4 -48021,Bastrop County,TX,48,0,0,0,0,0,0,0 -48059,Callahan County,TX,48,0,0,0,0,0,0,0 -48061,Cameron County,TX,48,0,0,0,0,0,0,0 -48143,Erath County,TX,48,0,0,0,0,0,0,0 -48151,Fisher County,TX,48,0,0,0,0,0,0,0 -48173,Glasscock County,TX,48,0,0,0,0,0,0,0 -48263,Kent County,TX,48,0,0,0,0,0,0,0 -48303,Lubbock County,TX,48,0,0,0,0,0,0,0 -48365,Panola County,TX,48,0,0,0,0,0,0,0 -48411,San Saba County,TX,48,0,0,0,0,0,0,0 -48425,Somervell County,TX,48,0,0,0,0,0,0,0 -48449,Titus County,TX,48,0,0,0,0,0,0,0 -48495,Winkler County,TX,48,0,0,0,0,0,0,0 -50005,Caledonia County,VT,50,0,0,0,0,0,0,0 -50027,Windsor County,VT,50,0,0,0,0,0,0,0 -51005,Alleghany County,VA,51,0,0,0,0,0,0,0 -51015,Augusta County,VA,51,0,0,0,0,0,0,0 -51025,Brunswick County,VA,51,0,0,0,0,0,0,0 -51043,Clarke County,VA,51,0,0,0,0,0,0,0 -51059,Fairfax County,VA,51,0,0,0,0,0,4,4 -51067,Franklin County,VA,51,0,0,0,0,0,0,0 -51081,Greensville County,VA,51,0,0,0,0,0,0,0 -51089,Henry County,VA,51,0,0,0,0,0,0,0 -51093,Isle of Wight County,VA,51,0,0,0,0,0,0,0 -51131,Northampton County,VA,51,0,0,0,0,0,0,0 -51153,Prince William County,VA,51,0,0,0,0,0,0,0 -51163,Rockbridge County,VA,51,0,0,0,0,0,0,0 -51175,Southampton County,VA,51,0,0,0,0,0,0,0 -51183,Sussex County,VA,51,0,0,0,0,0,0,0 -51195,Wise County,VA,51,0,0,0,0,0,0,0 -51520,Bristol city,VA,51,0,0,0,0,0,0,0 -51540,Charlottesville City,VA,51,0,0,0,0,0,0,0 -51580,Covington city,VA,51,0,0,0,0,0,0,0 -51595,Emporia city,VA,51,0,0,0,0,0,0,0 -51600,Fairfax city,VA,51,0,0,0,0,0,0,0 -51620,Franklin city,VA,51,0,0,0,0,0,0,0 -51678,Lexington city,VA,51,0,0,0,0,0,0,0 -51685,Manassas Park city,VA,51,0,0,0,0,0,0,0 -51690,Martinsville city,VA,51,0,0,0,0,0,0,0 -53063,Spokane County,WA,53,0,0,0,0,0,0,0 -54015,Clay County,WV,54,0,0,0,0,0,0,0 -54033,Harrison County,WV,54,0,0,0,0,0,0,0 -54087,Roane County,WV,54,0,0,0,0,0,0,0 -55009,Brown County,WI,55,0,0,0,0,0,0,0 -55071,Manitowoc County,WI,55,0,0,0,0,0,0,0 -55107,Rusk County,WI,55,0,0,0,0,0,0,0 -55115,Shawano County,WI,55,0,0,0,0,0,0,0 \ No newline at end of file diff --git a/usafacts/tests/test_data/small_confirmed.csv b/usafacts/tests/test_data/small_confirmed.csv deleted file mode 100644 index 0ce99b406..000000000 --- a/usafacts/tests/test_data/small_confirmed.csv +++ /dev/null @@ -1,149 +0,0 @@ -countyFIPS,County Name,State,StateFIPS,2/29/20,3/1/20,3/2/20,3/3/20,3/4/20,3/5/20,3/6/20,3/7/20,3/8/20,3/9/20,3/10/20 -1041,Crenshaw County,AL,1,0,0,0,0,0,0,0,0,0,0,0 -1067,Henry County,AL,1,0,0,0,0,0,0,0,0,0,0,0 -2158,Kusilvak Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0 -2270,Wade Hampton Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0 -5043,Drew County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5053,Grant County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5075,Lawrence County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5077,Lee County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5085,Lonoke County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5119,Pulaski County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -6051,Mono County,CA,6,0,0,0,0,0,0,0,0,0,0,0 -6071,San Bernardino County,CA,6,0,0,0,0,0,0,0,0,0,0,0 -8014,Broomfield County and City,CO,8,0,0,0,0,0,0,0,0,0,0,0 -8015,Chaffee County,CO,8,0,0,0,0,0,0,0,0,0,0,0 -9011,New London County,CT,9,0,0,0,0,0,0,0,0,0,0,0 -12073,Leon County,FL,12,0,0,0,0,0,0,0,0,0,0,0 -12127,Volusia County,FL,12,0,0,0,0,0,0,0,0,1,2,2 -13043,Candler County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13167,Johnson County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13211,Morgan County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13289,Twiggs County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13295,Walker County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13303,Washington County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -16033,Clark County,ID,16,0,0,0,0,0,0,0,0,0,0,0 -17043,DuPage County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17091,Kankakee County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17129,Menard County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -18055,Greene County,IN,18,0,0,0,0,0,0,0,0,0,0,0 -19047,Crawford County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19063,Emmet County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19159,Ringgold County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -20053,Ellsworth County,KS,20,0,0,0,0,0,0,0,0,0,0,0 -20179,Sheridan County,KS,20,0,0,0,0,0,0,0,0,0,0,0 -21037,Campbell County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21045,Casey County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21101,Henderson County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21171,Monroe County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21207,Russell County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21211,Shelby County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -22023,Cameron Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22073,Ouachita Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22079,Rapides Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22081,Red River Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -24023,Garrett County,MD,24,0,0,0,0,0,0,0,0,0,0,0 -25025,Suffolk County,MA,25,1,1,1,1,1,1,3,3,8,10,20 -26047,Emmet County,MI,26,0,0,0,0,0,0,0,0,0,0,0 -26069,Iosco County,MI,26,0,0,0,0,0,0,0,0,0,0,0 -27025,Chisago County,MN,27,0,0,0,0,0,0,0,0,0,0,0 -28001,Adams County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28005,Amite County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28039,George County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28041,Greene County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28045,Hancock County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28047,Harrison County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28051,Holmes County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28059,Jackson County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28107,Panola County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28109,Pearl River County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28131,Stone County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -29011,Barton County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29057,Dade County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29125,Maries County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29213,Taney County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -30095,Stillwater County,MT,30,0,0,0,0,0,0,0,0,0,0,0 -31029,Chase County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31057,Dundy County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31105,Kimball County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31115,Loup County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31165,Sioux County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -32001,Churchill County,NV,32,0,0,0,0,0,0,0,0,0,0,0 -32510,Carson City,NV,32,0,0,0,0,0,0,0,0,0,0,0 -33003,Carroll County,NH,33,0,0,0,0,0,0,0,0,0,0,0 -35045,San Juan County,NM,35,0,0,0,0,0,0,0,0,0,0,0 -36005,Bronx County,NY,36,0,0,0,0,0,0,0,0,1,2,3 -36009,Cattaraugus County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36035,Fulton County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36047,Kings County,NY,36,0,0,0,0,0,1,1,3,3,4,10 -36061,New York County,NY,36,0,0,1,1,1,3,4,8,8,11,17 -36081,Queens County,NY,36,0,0,0,0,0,0,0,1,1,2,4 -36085,Richmond County,NY,36,0,0,0,0,0,0,0,0,0,1,2 -36093,Schenectady County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -37135,Orange County,NC,37,0,0,0,0,0,0,0,0,0,0,0 -38019,Cavalier County,ND,38,0,0,0,0,0,0,0,0,0,0,0 -38031,Foster County,ND,38,0,0,0,0,0,0,0,0,0,0,0 -39075,Holmes County,OH,39,0,0,0,0,0,0,0,0,0,0,0 -40045,Ellis County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40059,Harper County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40061,Haskell County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40079,Le Flore County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -41013,Crook County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41015,Curry County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41045,Malheur County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -46021,Campbell County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46063,Harding County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46102,Oglala Lakota County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -47031,Coffee County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47077,Henderson County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47099,Lawrence County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47113,Madison County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47177,Warren County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47187,Williamson County,TN,47,0,0,0,0,0,1,1,1,1,1,4 -48021,Bastrop County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48059,Callahan County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48061,Cameron County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48143,Erath County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48151,Fisher County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48173,Glasscock County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48263,Kent County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48303,Lubbock County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48365,Panola County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48411,San Saba County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48425,Somervell County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48449,Titus County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48495,Winkler County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -50005,Caledonia County,VT,50,0,0,0,0,0,0,0,0,0,0,0 -50027,Windsor County,VT,50,0,0,0,0,0,0,0,0,0,0,0 -51005,Alleghany County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51015,Augusta County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51025,Brunswick County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51043,Clarke County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51059,Fairfax County,VA,51,0,0,0,0,0,0,0,0,2,4,4 -51067,Franklin County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51081,Greensville County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51089,Henry County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51093,Isle of Wight County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51131,Northampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51153,Prince William County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51163,Rockbridge County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51175,Southampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51183,Sussex County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51195,Wise County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51520,Bristol city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51540,Charlottesville City,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51580,Covington city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51595,Emporia city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51600,Fairfax city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51620,Franklin city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51678,Lexington city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51685,Manassas Park city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51690,Martinsville city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -53063,Spokane County,WA,53,0,0,0,0,0,0,0,0,0,0,0 -54015,Clay County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54033,Harrison County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54087,Roane County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -55009,Brown County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55071,Manitowoc County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55107,Rusk County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55115,Shawano County,WI,55,0,0,0,0,0,0,0,0,0,0,0 \ No newline at end of file diff --git a/usafacts/tests/test_data/small_deaths.csv b/usafacts/tests/test_data/small_deaths.csv deleted file mode 100644 index 24d596210..000000000 --- a/usafacts/tests/test_data/small_deaths.csv +++ /dev/null @@ -1,150 +0,0 @@ -countyFIPS,County Name,State,stateFIPS,2-29-20,3-1-20,3-2-20,3-3-20,3-4-20,3-5-20,3-6-20,3-7-20,3-8-20,3-9-20,3-10-20 -1041,Crenshaw County,AL,1,0,0,0,0,0,0,0,0,0,0,0 -1067,Henry County,AL,1,0,0,0,0,0,0,0,0,0,0,0 -2158,Kusilvak Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0 -2270,Wade Hampton Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0 -5043,Drew County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5053,Grant County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5075,Lawrence County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5077,Lee County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5085,Lonoke County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -5119,Pulaski County,AR,5,0,0,0,0,0,0,0,0,0,0,0 -6051,Mono County,CA,6,0,0,0,0,0,0,0,0,0,0,0 -6071,San Bernardino County,CA,6,0,0,0,0,0,0,0,0,0,0,0 -8014,Broomfield County,CO,8,0,0,0,0,0,0,0,0,0,0,0 -8015,Chaffee County,CO,8,0,0,0,0,0,0,0,0,0,0,0 -9011,New London County,CT,9,0,0,0,0,0,0,0,0,0,0,0 -12073,Leon County,FL,12,0,0,0,0,0,0,0,0,0,0,0 -12127,Volusia County,FL,12,0,0,0,0,0,0,0,0,0,0,0 -13043,Candler County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13167,Johnson County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13211,Morgan County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13289,Twiggs County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13295,Walker County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -13303,Washington County,GA,13,0,0,0,0,0,0,0,0,0,0,0 -16033,Clark County,ID,16,0,0,0,0,0,0,0,0,0,0,0 -17043,DuPage County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17091,Kankakee County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -17129,Menard County,IL,17,0,0,0,0,0,0,0,0,0,0,0 -18055,Greene County,IN,18,0,0,0,0,0,0,0,0,0,0,0 -19047,Crawford County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19063,Emmet County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -19159,Ringgold County,IA,19,0,0,0,0,0,0,0,0,0,0,0 -20053,Ellsworth County,KS,20,0,0,0,0,0,0,0,0,0,0,0 -20179,Sheridan County,KS,20,0,0,0,0,0,0,0,0,0,0,0 -21037,Campbell County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21045,Casey County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21101,Henderson County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21171,Monroe County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21207,Russell County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -21211,Shelby County,KY,21,0,0,0,0,0,0,0,0,0,0,0 -22023,Cameron Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22073,Ouachita Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22079,Rapides Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -22081,Red River Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0 -24023,Garrett County,MD,24,0,0,0,0,0,0,0,0,0,0,0 -25025,Suffolk County,MA,25,0,0,0,0,0,0,0,0,0,0,0 -26047,Emmet County,MI,26,0,0,0,0,0,0,0,0,0,0,0 -26069,Iosco County,MI,26,0,0,0,0,0,0,0,0,0,0,0 -27025,Chisago County,MN,27,0,0,0,0,0,0,0,0,0,0,0 -28001,Adams County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28005,Amite County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28039,George County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28041,Greene County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28045,Hancock County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28047,Harrison County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28051,Holmes County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28059,Jackson County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28107,Panola County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28109,Pearl River County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -28131,Stone County,MS,28,0,0,0,0,0,0,0,0,0,0,0 -29011,Barton County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29057,Dade County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29125,Maries County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -29213,Taney County,MO,29,0,0,0,0,0,0,0,0,0,0,0 -30095,Stillwater County,MT,30,0,0,0,0,0,0,0,0,0,0,0 -31029,Chase County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31057,Dundy County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31105,Kimball County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31115,Loup County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -31165,Sioux County,NE,31,0,0,0,0,0,0,0,0,0,0,0 -32001,Churchill County,NV,32,0,0,0,0,0,0,0,0,0,0,0 -32510,Carson City,NV,32,0,0,0,0,0,0,0,0,0,0,0 -33003,Carroll County,NH,33,0,0,0,0,0,0,0,0,0,0,0 -35045,San Juan County,NM,35,0,0,0,0,0,0,0,0,0,0,0 -1,New York City Unallocated/Probable,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36005,Bronx County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36009,Cattaraugus County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36035,Fulton County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36047,Kings County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36061,New York County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36081,Queens County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36085,Richmond County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -36093,Schenectady County,NY,36,0,0,0,0,0,0,0,0,0,0,0 -37135,Orange County,NC,37,0,0,0,0,0,0,0,0,0,0,0 -38019,Cavalier County,ND,38,0,0,0,0,0,0,0,0,0,0,0 -38031,Foster County,ND,38,0,0,0,0,0,0,0,0,0,0,0 -39075,Holmes County,OH,39,0,0,0,0,0,0,0,0,0,0,0 -40045,Ellis County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40059,Harper County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40061,Haskell County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -40079,Le Flore County,OK,40,0,0,0,0,0,0,0,0,0,0,0 -41013,Crook County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41015,Curry County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -41045,Malheur County,OR,41,0,0,0,0,0,0,0,0,0,0,0 -46021,Campbell County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46063,Harding County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -46102,Oglala Lakota County,SD,46,0,0,0,0,0,0,0,0,0,0,0 -47031,Coffee County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47077,Henderson County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47099,Lawrence County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47113,Madison County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47177,Warren County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -47187,Williamson County,TN,47,0,0,0,0,0,0,0,0,0,0,0 -48021,Bastrop County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48059,Callahan County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48061,Cameron County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48143,Erath County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48151,Fisher County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48173,Glasscock County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48263,Kent County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48303,Lubbock County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48365,Panola County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48411,San Saba County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48425,Somervell County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48449,Titus County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -48495,Winkler County,TX,48,0,0,0,0,0,0,0,0,0,0,0 -50005,Caledonia County,VT,50,0,0,0,0,0,0,0,0,0,0,0 -50027,Windsor County,VT,50,0,0,0,0,0,0,0,0,0,0,0 -51005,Alleghany County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51015,Augusta County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51025,Brunswick County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51043,Clarke County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51059,Fairfax County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51067,Franklin County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51081,Greensville County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51089,Henry County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51093,Isle of Wight County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51131,Northampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51153,Prince William County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51163,Rockbridge County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51175,Southampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51183,Sussex County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51195,Wise County,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51520,Bristol city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51540,Charlottesville city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51580,Covington city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51595,Emporia city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51600,Fairfax city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51620,Franklin city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51678,Lexington city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51685,Manassas Park city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -51690,Martinsville city,VA,51,0,0,0,0,0,0,0,0,0,0,0 -53063,Spokane County,WA,53,0,0,0,0,0,0,0,0,0,0,0 -54015,Clay County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54033,Harrison County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -54087,Roane County,WV,54,0,0,0,0,0,0,0,0,0,0,0 -55009,Brown County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55071,Manitowoc County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55107,Rusk County,WI,55,0,0,0,0,0,0,0,0,0,0,0 -55115,Shawano County,WI,55,0,0,0,0,0,0,0,0,0,0,0 \ No newline at end of file diff --git a/usafacts/tests/test_data/small_deaths_pull.csv b/usafacts/tests/test_data/small_deaths_pull.csv deleted file mode 100644 index 5b29b18f1..000000000 --- a/usafacts/tests/test_data/small_deaths_pull.csv +++ /dev/null @@ -1,5 +0,0 @@ -countyFIPS,County Name,State,stateFIPS,2/29/20,3/1/20,3/2/20 -1,New York City Unallocated/Probable,NY,36,0,0,1 -6000,Somewhere,NY,36,11,12,13 -2270,Place,NY,36,101,101,"1,0,2" -36009,City,NY,36,2,4,6 \ No newline at end of file diff --git a/usafacts/tests/test_geo.py b/usafacts/tests/test_geo.py deleted file mode 100644 index 43debc3b1..000000000 --- a/usafacts/tests/test_geo.py +++ /dev/null @@ -1,140 +0,0 @@ -import pytest - -import pandas as pd -import numpy as np -from delphi_utils.geomap import GeoMapper -from delphi_usafacts.geo import disburse, geo_map - -SENSOR = "new_counts" - -class TestDisburse: - """Tests for the `geo.disburse()` function.""" - def test_even(self): - """Tests that values are disbursed evenly across recipients.""" - df = pd.DataFrame( - { - "fips": ["51093", "51175", "51620"], - "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15"], - "new_counts": [3, 2, 2], - "cumulative_counts": [13, 12, 12], - "population": [100, 2100, 300], - } - ).sort_values(["fips", "timestamp"]) - - new_df = disburse(df, "51620", ["51093", "51175"]) - - assert new_df["new_counts"].values == pytest.approx([4, 3, 2]) - assert new_df["cumulative_counts"].values == pytest.approx([19, 18, 12]) - - -class TestGeoMap: - """Tests for `geo.geo_map()`.""" - def test_incorrect_geo(self): - """Tests that an invalid resolution raises an error.""" - df = pd.DataFrame( - { - "fips": ["53003", "48027", "50103"], - "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15"], - "new_counts": [10, 15, 2], - "cumulative_counts": [100, 20, 45], - } - ) - - with pytest.raises(ValueError): - geo_map(df, "département", SENSOR) - - def test_county(self): - """Tests that values are correctly aggregated at the county level.""" - df = pd.DataFrame( - { - "fips": ["53003", "48027", "50103"], - "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15"], - "new_counts": [10, 15, 2], - "cumulative_counts": [100, 20, 45], - } - ) - new_df = geo_map(df, "county", SENSOR) - gmpr = GeoMapper() - df = gmpr.add_population_column(df, "fips") - exp_incidence = df["new_counts"] / df["population"] * 100000 - exp_cprop = df["cumulative_counts"] / df["population"] * 100000 - - assert set(new_df["geo_id"].values) == set(df["fips"].values) - assert set(new_df["timestamp"].values) == set(df["timestamp"].values) - assert set(new_df["incidence"].values) == set(exp_incidence.values) - assert set(new_df["cumulative_prop"].values) == set(exp_cprop.values) - - def test_state_hhs_nation(self): - """Tests that values are correctly aggregated at the state, HHS, and nation level.""" - df = pd.DataFrame( - { - "fips": ["04001", "04003", "04009", "25023", "25000"], - "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"], - "new_counts": [10, 15, 2, 13, 1], - "cumulative_counts": [100, 20, 45, 60, 1], - } - ) - - state_df = geo_map(df, "state", SENSOR) - gmpr = GeoMapper() - fips_pop = gmpr.get_crosswalk("fips", "pop") - pop04 = float(fips_pop.loc[fips_pop.fips.isin(["04001", "04003", "04009"]), "pop"].sum()) - pop25 = float(fips_pop.loc[fips_pop.fips.isin(["25023", "25000"]), "pop"].sum()) - expected_df = pd.DataFrame({ - "geo_id": ["az", "ma"], - "timestamp": ["2020-02-15"]*2, - "new_counts": [27, 14], - "cumulative_counts": [165, 61], - "population": [pop04, pop25], - "incidence": [27 / pop04 * 100000, 14 / pop25 * 100000], - "cumulative_prop": [165 / pop04 * 100000, 61 / pop25 * 100000] - }) - pd.testing.assert_frame_equal(state_df, expected_df) - - hhs_df = geo_map(df, "hhs", SENSOR) - hhs_pop = gmpr.replace_geocode(gmpr.add_geocode(df, "fips", "pop"), "fips", "hhs") - pop1 = float(hhs_pop.loc[hhs_pop.hhs == "1", "pop"]) - pop9 = float(hhs_pop.loc[hhs_pop.hhs == "9", "pop"]) - expected_df = pd.DataFrame({ - "geo_id": ["1", "9"], - "timestamp": ["2020-02-15"]*2, - "new_counts": [14, 27], - "cumulative_counts": [61, 165], - "population": [pop1, pop9], - "incidence": [14 / pop1 * 100000, 27 / pop9 * 100000], - "cumulative_prop": [61 / pop1 * 100000, 165 / pop9 * 100000] - }) - pd.testing.assert_frame_equal(hhs_df, expected_df) - - nation_df = geo_map(df, "nation", SENSOR) - nation_pop = gmpr.replace_geocode(gmpr.add_geocode(df, "fips", "pop"), "fips", "nation") - us_pop = float(nation_pop.loc[nation_pop.nation == "us", "pop"]) - expected_df = pd.DataFrame({ - "geo_id": ["us"], - "timestamp": ["2020-02-15"], - "new_counts": [41], - "cumulative_counts": [226], - "population": [us_pop], - "incidence": [41 / us_pop * 100000], - "cumulative_prop": [226 / us_pop * 100000] - }) - pd.testing.assert_frame_equal(nation_df, expected_df) - - def test_hrr_msa(self): - """Tests that values are correctly aggregated at the HRR and MSA level.""" - df = pd.DataFrame( - { - "fips": ["13009", "13017", "13021", "09015"], - "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"], - "new_counts": [10, 15, 2, 13], - "cumulative_counts": [100, 20, 45, 60], - } - ) - hrr_df = geo_map(df, "hrr", SENSOR) - msa_df = geo_map(df, "msa", SENSOR) - assert msa_df.shape == (2, 7) - gmpr = GeoMapper() - df = gmpr.add_population_column(df, "fips") - assert np.isclose(hrr_df.new_counts.sum(), df.new_counts.sum()) - assert np.isclose(hrr_df.population.sum(), df.population.sum()) - assert hrr_df.shape == (5, 7) diff --git a/usafacts/tests/test_pull.py b/usafacts/tests/test_pull.py deleted file mode 100644 index 327a53eb3..000000000 --- a/usafacts/tests/test_pull.py +++ /dev/null @@ -1,51 +0,0 @@ -import pytest -import logging -from unittest.mock import patch - -import pandas as pd - -from delphi_usafacts.pull import pull_usafacts_data - -from test_run import local_fetch - -BASE_URL_GOOD = "test_data/small_{metric}_pull.csv" - -BASE_URL_BAD = { - "missing_days": "test_data/bad_{metric}_missing_days.csv", - "missing_cols": "test_data/bad_{metric}_missing_cols.csv", - "extra_cols": "test_data/bad_{metric}_extra_cols.csv" -} - -TEST_LOGGER = logging.getLogger() - -@patch("delphi_usafacts.pull.fetch", local_fetch) -class TestPullUSAFacts: - def test_good_file(self): - metric = "deaths" - df = pull_usafacts_data(BASE_URL_GOOD, metric, TEST_LOGGER) - expected_df = pd.DataFrame({ - "fips": ["00001", "00001", "00001", "36009", "36009", "36009"], - "timestamp": [pd.Timestamp("2020-02-29"), pd.Timestamp("2020-03-01"), - pd.Timestamp("2020-03-02"), pd.Timestamp("2020-02-29"), - pd.Timestamp("2020-03-01"), pd.Timestamp("2020-03-02")], - "new_counts": [0., 0., 1., 2., 2., 2.], - "cumulative_counts": [0, 0, 1, 2, 4, 6]}, - index=[1, 2, 3, 5, 6, 7]) - # sort since rows order doesn't matter - pd.testing.assert_frame_equal(df.sort_index(), expected_df.sort_index()) - - def test_missing_cols(self): - - metric = "confirmed" - with pytest.raises(ValueError): - pull_usafacts_data( - BASE_URL_BAD["missing_cols"], metric, TEST_LOGGER - ) - - def test_extra_cols(self): - - metric = "confirmed" - with pytest.raises(ValueError): - pull_usafacts_data( - BASE_URL_BAD["extra_cols"], metric, TEST_LOGGER - ) diff --git a/usafacts/tests/test_run.py b/usafacts/tests/test_run.py deleted file mode 100644 index 20f4db47e..000000000 --- a/usafacts/tests/test_run.py +++ /dev/null @@ -1,75 +0,0 @@ -"""Tests for running the USAFacts indicator.""" -from itertools import product -from os import listdir -from os.path import join -from unittest.mock import patch - -import pandas as pd - -from delphi_usafacts.run import run_module - -def local_fetch(url, cache): - return pd.read_csv(url) - -@patch("delphi_usafacts.pull.fetch", local_fetch) -class TestRun: - """Tests for the `run_module()` function.""" - PARAMS = { - "common": { - "export_dir": "./receiving", - "input_dir": "./input_cache" - }, - "indicator": { - "base_url": "./test_data/small_{metric}.csv", - "export_start_date": "2020-02-29" - } - } - - def test_output_files_exist(self): - """Test that the expected output files exist.""" - run_module(self.PARAMS) - - csv_files = [f for f in listdir("receiving") if f.endswith(".csv")] - - dates = [ - "20200229", - "20200301", - "20200302", - "20200303", - "20200304", - "20200305", - "20200306", - "20200307", - "20200308", - "20200309", - "20200310", - ] - geos = ["county", "hrr", "msa", "state", "hhs", "nation"] - - # enumerate metric names. - metrics = [] - for event, span, stat in product(["deaths", "confirmed"], - ["cumulative", "incidence"], - ["num", "prop"]): - metrics.append("_".join([event, span, stat])) - metrics.append("_".join([event, "7dav", span, stat])) - - expected_files = [] - for date in dates: - for geo in geos: - for metric in metrics: - if "7dav" in metric and date in dates[:6]: - continue # there are no 7dav signals for first 6 days - if "7dav" in metric and "cumulative" in metric: - continue - expected_files += [date + "_" + geo + "_" + metric + ".csv"] - assert set(csv_files) == set(expected_files) - - def test_output_file_format(self): - """Test that the output files have the proper format.""" - run_module(self.PARAMS) - - df = pd.read_csv( - join("receiving", "20200310_state_confirmed_cumulative_num.csv") - ) - assert (df.columns.values == ["geo_id", "val", "se", "sample_size"]).all()