Add tests for all non-census sources (#1899)

* Refactor CDC life-expectancy (1554)

* Update to new tract list (#1554)

* Adjust for tests (#1848)

* Add tests for cdc_places (#1848)

* Add EJScreen tests (#1848)

* Add tests for HUD housing (#1848)

* Add tests for GeoCorr (#1848)

* Add persistent poverty tests (#1848)

* Update for sources without zips, for new validation (#1848)

* Update tests for new multi-CSV but (#1848)

Lucas updated the CDC life expectancy data to handle a bug where two
states are missing from the US Overall download. Since virtually none of
our other ETL classes download multiple CSVs directly like this, it
required a pretty invasive new mocking strategy.

* Add basic tests for nature deprived (#1848)

* Add wildfire tests (#1848)

* Add flood risk tests (#1848)

* Add DOT travel tests (#1848)

* Add historic redlining tests (#1848)

* Add tests for ME and WI (#1848)

* Update now that validation exists (#1848)

* Adjust for validation (#1848)

* Add health insurance back to cdc places (#1848)

Ooops

* Update tests with new field (#1848)

* Test for blank tract removal (#1848)

* Add tracts for clipping behavior

* Test clipping and zfill behavior (#1848)

* Fix bad test assumption (#1848)

* Simplify class, add test for tract padding (#1848)

* Fix percentage inversion, update tests (#1848)

Looking through the transformations, I noticed that we were subtracting
a percentage that is usually between 0-100 from 1 instead of 100, and so
were endind up with some surprising results. Confirmed with lucasmbrown-usds

* Add note about first street data (#1848)
This commit is contained in:
Matt Bowen 2022-09-19 15:17:00 -04:00 committed by GitHub
commit 876655d2b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 2032 additions and 178 deletions

View file

@ -0,0 +1,16 @@
GEOID10,SF,CF,P200_PFS,CA_LT20,TractAcres,AcresCrops,PctCrops,PctImperv,PctNatural,PctNat90,ImpOrCrop,LowInAndEd,NatureDep,GEOID10_TRACT
6027000800,California,Inyo County,0.6700000000,1,4374150.0000000000,833.5350000000,0.0190559000,0.2995360000,99.6814000000,0,0,1,0,06027000800
6069000802,California,San Benito County,0.3700000000,1,738261.0000000000,4498.8200000000,0.6093810000,0.1123740000,99.2782000000,0,0,0,0,06069000802
6061021322,California,Placer County,0.2500000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,06061021322
15001021010,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021010
15001021101,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021101
15007040603,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040603
15007040700,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040700
15009030100,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030100
15009030201,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030201
15001021402,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021402
15001021800,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021800
15009030402,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030402
15009030800,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030800
15003010201,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15003010201
15007040604,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040604
1 GEOID10 SF CF P200_PFS CA_LT20 TractAcres AcresCrops PctCrops PctImperv PctNatural PctNat90 ImpOrCrop LowInAndEd NatureDep GEOID10_TRACT
2 6027000800 California Inyo County 0.6700000000 1 4374150.0000000000 833.5350000000 0.0190559000 0.2995360000 99.6814000000 0 0 1 0 06027000800
3 6069000802 California San Benito County 0.3700000000 1 738261.0000000000 4498.8200000000 0.6093810000 0.1123740000 99.2782000000 0 0 0 0 06069000802
4 6061021322 California Placer County 0.2500000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 06061021322
5 15001021010 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021010
6 15001021101 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021101
7 15007040603 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040603
8 15007040700 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040700
9 15009030100 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030100
10 15009030201 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030201
11 15001021402 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021402
12 15001021800 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021800
13 15009030402 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030402
14 15009030800 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030800
15 15003010201 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15003010201
16 15007040604 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040604

View file

@ -0,0 +1,16 @@
GEOID10_TRACT,Does the tract have at least 35 acres in it?,Share of the tract's land area that is covered by impervious surface as a percent,Share of the tract's land area that is covered by impervious surface or cropland as a percent,Share of the tract's land area that is covered by cropland as a percent
06027000800,True,0.2995360000,0.3186000000,0.0190559000
06069000802,True,0.1123740000,0.7218000000,0.6093810000
06061021322,True,2.9274100000,42.4778000000,39.5504000000
15001021010,True,2.9274100000,42.4778000000,39.5504000000
15001021101,True,2.9274100000,42.4778000000,39.5504000000
15007040603,True,2.9274100000,42.4778000000,39.5504000000
15007040700,True,2.9274100000,42.4778000000,39.5504000000
15009030100,True,2.9274100000,42.4778000000,39.5504000000
15009030201,True,2.9274100000,42.4778000000,39.5504000000
15001021402,True,2.9274100000,42.4778000000,39.5504000000
15001021800,True,2.9274100000,42.4778000000,39.5504000000
15009030402,True,2.9274100000,42.4778000000,39.5504000000
15009030800,True,2.9274100000,42.4778000000,39.5504000000
15003010201,True,2.9274100000,42.4778000000,39.5504000000
15007040604,True,2.9274100000,42.4778000000,39.5504000000
1 GEOID10_TRACT Does the tract have at least 35 acres in it? Share of the tract's land area that is covered by impervious surface as a percent Share of the tract's land area that is covered by impervious surface or cropland as a percent Share of the tract's land area that is covered by cropland as a percent
2 06027000800 True 0.2995360000 0.3186000000 0.0190559000
3 06069000802 True 0.1123740000 0.7218000000 0.6093810000
4 06061021322 True 2.9274100000 42.4778000000 39.5504000000
5 15001021010 True 2.9274100000 42.4778000000 39.5504000000
6 15001021101 True 2.9274100000 42.4778000000 39.5504000000
7 15007040603 True 2.9274100000 42.4778000000 39.5504000000
8 15007040700 True 2.9274100000 42.4778000000 39.5504000000
9 15009030100 True 2.9274100000 42.4778000000 39.5504000000
10 15009030201 True 2.9274100000 42.4778000000 39.5504000000
11 15001021402 True 2.9274100000 42.4778000000 39.5504000000
12 15001021800 True 2.9274100000 42.4778000000 39.5504000000
13 15009030402 True 2.9274100000 42.4778000000 39.5504000000
14 15009030800 True 2.9274100000 42.4778000000 39.5504000000
15 15003010201 True 2.9274100000 42.4778000000 39.5504000000
16 15007040604 True 2.9274100000 42.4778000000 39.5504000000

View file

@ -0,0 +1,16 @@
GEOID10,SF,CF,P200_PFS,CA_LT20,TractAcres,AcresCrops,Share of the tract's land area that is covered by cropland as a percent,Share of the tract's land area that is covered by impervious surface as a percent,PctNatural,PctNat90,ImpOrCrop,LowInAndEd,NatureDep,GEOID10_TRACT,Does the tract have at least 35 acres in it?,Share of the tract's land area that is covered by impervious surface or cropland as a percent
6027000800,California,Inyo County,0.6700000000,1,4374150.0000000000,833.5350000000,0.0190559000,0.2995360000,99.6814000000,0,0,1,0,06027000800,True,0.3186000000
6069000802,California,San Benito County,0.3700000000,1,738261.0000000000,4498.8200000000,0.6093810000,0.1123740000,99.2782000000,0,0,0,0,06069000802,True,0.7218000000
6061021322,California,Placer County,0.2500000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,06061021322,True,42.4778000000
15001021010,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021010,True,42.4778000000
15001021101,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021101,True,42.4778000000
15007040603,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040603,True,42.4778000000
15007040700,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040700,True,42.4778000000
15009030100,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030100,True,42.4778000000
15009030201,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030201,True,42.4778000000
15001021402,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021402,True,42.4778000000
15001021800,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15001021800,True,42.4778000000
15009030402,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030402,True,42.4778000000
15009030800,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15009030800,True,42.4778000000
15003010201,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15003010201,True,42.4778000000
15007040604,Hawaii,Hawaii County,0.3700000000,1,63993.3000000000,25309.6000000000,39.5504000000,2.9274100000,57.5222000000,0,1,0,0,15007040604,True,42.4778000000
1 GEOID10 SF CF P200_PFS CA_LT20 TractAcres AcresCrops Share of the tract's land area that is covered by cropland as a percent Share of the tract's land area that is covered by impervious surface as a percent PctNatural PctNat90 ImpOrCrop LowInAndEd NatureDep GEOID10_TRACT Does the tract have at least 35 acres in it? Share of the tract's land area that is covered by impervious surface or cropland as a percent
2 6027000800 California Inyo County 0.6700000000 1 4374150.0000000000 833.5350000000 0.0190559000 0.2995360000 99.6814000000 0 0 1 0 06027000800 True 0.3186000000
3 6069000802 California San Benito County 0.3700000000 1 738261.0000000000 4498.8200000000 0.6093810000 0.1123740000 99.2782000000 0 0 0 0 06069000802 True 0.7218000000
4 6061021322 California Placer County 0.2500000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 06061021322 True 42.4778000000
5 15001021010 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021010 True 42.4778000000
6 15001021101 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021101 True 42.4778000000
7 15007040603 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040603 True 42.4778000000
8 15007040700 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040700 True 42.4778000000
9 15009030100 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030100 True 42.4778000000
10 15009030201 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030201 True 42.4778000000
11 15001021402 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021402 True 42.4778000000
12 15001021800 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15001021800 True 42.4778000000
13 15009030402 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030402 True 42.4778000000
14 15009030800 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15009030800 True 42.4778000000
15 15003010201 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15003010201 True 42.4778000000
16 15007040604 Hawaii Hawaii County 0.3700000000 1 63993.3000000000 25309.6000000000 39.5504000000 2.9274100000 57.5222000000 0 1 0 0 15007040604 True 42.4778000000

View file

@ -0,0 +1,19 @@
import pathlib
from data_pipeline.tests.sources.example.test_etl import TestETL
from data_pipeline.etl.sources.nlcd_nature_deprived.etl import NatureDeprivedETL
class TestNatureDeprivedETL(TestETL):
_ETL_CLASS = NatureDeprivedETL
_SAMPLE_DATA_PATH = pathlib.Path(__file__).parents[0] / "data"
_SAMPLE_DATA_FILE_NAME = "usa_conus_nat_dep__compiled_by_TPL.csv"
_SAMPLE_DATA_ZIP_FILE_NAME = "usa_conus_nat_dep__compiled_by_TPL.csv.zip"
_EXTRACT_TMP_FOLDER_NAME = "NatureDeprivedETL"
def setup_method(self, _method, filename=__file__):
"""Invoke `setup_method` from Parent, but using the current file name.
This code can be copied identically between all child classes.
"""
super().setup_method(_method=_method, filename=filename)