Skip to content

Commit

Permalink
revisions based on Mjumbe's review
Browse files Browse the repository at this point in the history
  • Loading branch information
charlie-costanzo committed Nov 22, 2024
1 parent a81b205 commit f0247fe
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions airflow/plugins/operators/scrape_state_geoportal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import gzip
import logging

# import os
import os
from typing import ClassVar, List

import pandas as pd # type: ignore
Expand All @@ -12,8 +11,7 @@

from airflow.models import BaseOperator # type: ignore

API_BUCKET = "gs://calitp-state-geoportal-scrape"
# API_BUCKET = os.environ["CALITP_BUCKET__STATE_GEOPORTAL_DATA_PRODUCTS"]
API_BUCKET = os.environ["CALITP_BUCKET__STATE_GEOPORTAL_DATA_PRODUCTS"]


class StateGeoportalAPIExtract(PartitionedGCSArtifact):
Expand Down Expand Up @@ -88,7 +86,8 @@ def fetch_from_state_geoportal(self):
params["resultOffset"] = offset

# Make the request
response = requests.get(validated_url, params=params).raise_for_status()
response = requests.get(validated_url, params=params)
response.raise_for_status()
data = response.json()

# Break the loop if there are no more features
Expand Down Expand Up @@ -187,7 +186,7 @@ def execute(self, **kwargs):
df = pd.json_normalize(api_content)

if self.product == "state_highway_network":
# Select columns to keep, have to be explicit because there are duplicate values after normalizing
# Select columns to keep, have to be explicit before renaming because there are duplicate values after normalizing
df = df[
[
"properties.Route",
Expand Down

0 comments on commit f0247fe

Please sign in to comment.