Skip to content

Commit

Permalink
Apply feedback from revieiw (#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbowen-usds committed Aug 16, 2022
1 parent 2aff134 commit 702804e
Show file tree
Hide file tree
Showing 4 changed files with 431 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ datasets:
short_name: "eAMLIS"
module_name: "eamlis"
load_fields:
- short_name: "has_amlis"
df_field_name: "BINARY_HAS_AMLIS"
- short_name: "has_aml"
df_field_name: "AML_BOOLEAN"
long_name: "Is there at least one abandoned mine in this census tract?"
description_short:
"Whether the tract has an abandoned mine"
field_type: bool
include_in_tiles: false
include_in_downloadable_files: false
include_in_tiles: true
include_in_downloadable_files: true
- long_name: "Example ETL"
short_name: "Example"
module_name: "example_dataset"
Expand Down
12 changes: 6 additions & 6 deletions data/data-pipeline/data_pipeline/etl/sources/eamlis/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
logger = get_module_logger(__name__)


class AbandonedMineLandInventorySystem(ExtractTransformLoad):
class AbandonedMineETL(ExtractTransformLoad):
"""Data from Office Of Surface Mining Reclamation and Enforcement's
eAMLIS. These are the locations of abandoned mines.
"""

# Metadata for the baseclass
NAME = "eamlis"
GEO_LEVEL = ValidGeoLevel.CENSUS_TRACT
BINARY_HAS_AMLIS: str = "Has abandoned mine"
AML_BOOLEAN: str

# Define these for easy code completion
def __init__(self):
Expand All @@ -35,7 +35,7 @@ def __init__(self):

self.COLUMNS_TO_KEEP = [
self.GEOID_TRACT_FIELD_NAME,
self.BINARY_HAS_AMLIS,
self.AML_BOOLEAN,
]

self.output_df: pd.DataFrame
Expand All @@ -55,9 +55,9 @@ def transform(self) -> None:
),
crs="epsg:4326",
)
gdf.drop_duplicates(subset=["geometry"], inplace=True, keep="last")
gdf = gdf.drop_duplicates(subset=["geometry"], keep="last")
gdf_tracts = add_tracts_for_geometries(gdf)
gdf_tracts.drop_duplicates(self.GEOID_TRACT_FIELD_NAME, inplace=True)
gdf_tracts[self.BINARY_HAS_AMLIS] = True
gdf = gdf_tracts.drop_duplicates(self.GEOID_TRACT_FIELD_NAME)
gdf_tracts[self.AML_BOOLEAN] = True
self.output_df = gdf_tracts[self.COLUMNS_TO_KEEP]

Loading

0 comments on commit 702804e

Please sign in to comment.