Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IN-DL parser #7768

Merged
merged 3 commits into from
Jan 27, 2025
Merged

Conversation

yifanmai
Copy link
Contributor

Issue

Closes #6741

Description

Fixes the IN-DL parser:

  • This parser contains a constant lookup table of power plant names to plant type. The parser broke because one of the plant names was changed on the scraped HTML page. This updates the plant name in the lookup table to match the HTML page.
  • The parser was looking for values under the "Actual" column, but the parser used a hardcoded column index, and the column index changed in the HTML table. This changes the parser to determine the correct column index using the header row.

Preview

$ poetry run test_parser IN-DL
Parser result:
{'datetime': datetime.datetime(2025, 1, 27, 3, 46, 2, tzinfo=zoneinfo.ZoneInfo(key='Asia/Kolkata')),
 'production': {'biomass': 30.0, 'coal': 0.0, 'gas': 40.0},
 'source': 'delhisldc.org',
 'zoneKey': 'IN-DL'}
---------------------
took 1.52s
min returned datetime: 2025-01-26 22:16:02+00:00 UTC
max returned datetime: 2025-01-26 22:16:02+00:00 UTC  -- OK, <2h from now :) (now=2025-01-26T22:16:23+00:00 UTC)

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier@2 --write . and poetry run format in the top level directory to format my changes.

@yifanmai yifanmai requested a review from VIKTORVAV99 as a code owner January 26, 2025 22:25
@github-actions github-actions bot added parser python Pull requests that update Python code labels Jan 26, 2025
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@VIKTORVAV99 VIKTORVAV99 enabled auto-merge (squash) January 27, 2025 10:49
@VIKTORVAV99 VIKTORVAV99 disabled auto-merge January 27, 2025 10:52
@VIKTORVAV99 VIKTORVAV99 enabled auto-merge (squash) January 27, 2025 10:53
@VIKTORVAV99 VIKTORVAV99 merged commit 07dd0cb into electricitymaps:master Jan 27, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IN-DL production parser down
2 participants