Skip to content

Fix epacriteriaairpollutants - #2206

Open
shourya116 wants to merge 7 commits into
datacommonsorg:masterfrom
shourya116:fix-epacriteriaairpollutants
Open

Fix epacriteriaairpollutants#2206
shourya116 wants to merge 7 commits into
datacommonsorg:masterfrom
shourya116:fix-epacriteriaairpollutants

Conversation

@shourya116

@shourya116 shourya116 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

- Pre-declare 47 unindexed EPA Air Quality monitoring stations in EPA_AirQuality.mcf
- Standardize units and add retry logic in air_quality.py
- Add node_mcf, validation_config_file, and resource limits to manifest.json
- Add validation_config.json with strict zero lint error threshold
@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a diagnostic runbook, configures validation rules, and updates the air_quality.py script to handle unit mapping, filter out cross-border monitors, and use a robust HTTP session with retries for downloading data. Feedback on the changes includes addressing a critical runtime AttributeError when configuring retries, relaxing the lint error threshold in validation_config.json to prevent pipeline failures from new stations, and resolving a potential KeyError and eager evaluation issue when parsing observation units.

Comment thread scripts/us_epa/airdata/air_quality.py
Comment thread scripts/us_epa/airdata/validation_config.json
Comment thread scripts/us_epa/airdata/air_quality.py Outdated
Comment on lines +164 to +166
raw_unit = observation.get('Units of Measure', '').strip().lower()
unit = UNIT_MAP.get(raw_unit,
get_camel_case(observation['Units of Measure']))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current implementation eagerly evaluates get_camel_case(observation['Units of Measure']) as the default argument to UNIT_MAP.get(), even if raw_unit is found in UNIT_MAP. Furthermore, if 'Units of Measure' is missing from observation, this will raise a KeyError despite the defensive .get() call on line 164. Using a short-circuiting or avoids both the eager evaluation and the potential KeyError.

            raw_unit = observation.get('Units of Measure', '') or ''
            unit = UNIT_MAP.get(raw_unit.strip().lower()) or get_camel_case(raw_unit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant