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

CA-SK production parser down #5986

Closed
electricitymapsbot opened this issue Oct 6, 2023 · 11 comments
Closed

CA-SK production parser down #5986

electricitymapsbot opened this issue Oct 6, 2023 · 11 comments

Comments

@electricitymapsbot
Copy link
Collaborator

Description

This is an automatic error report generated for Canada Saskatchewan (CA-SK).

Issues:

  • No recent data found for production parser
  • No recent data found for consumption parser

Suggestions

You can see an overview of all parser issues here.

@kruschk
Copy link
Contributor

kruschk commented Oct 7, 2023

Hi! I contributed a few times last year, and Hacktober has inspired me to get back to it (I'm a sucker for gamification 😅 ). I hope I'm still welcome to lend a hand!

I dug into this issue a bit, and it seems like the consumption URL has started returning "Data Unavailable" instead of the numeric value that (I believe) it used to. I figured this was likely just a transient thing, but then I noticed the JSON returned by the production URL contains a systemDemand key that may not have been present before, so perhaps this was an API change. If that's the case, could we use that value instead? For reference, here's the relevant SaskPower dashboard.

@electricitymapsbot
Copy link
Collaborator Author

Closing this as the electricity data is flowing again.

@kruschk
Copy link
Contributor

kruschk commented Oct 11, 2023

I'm not sure why the bot closed this; the issue persists. I've noticed one other thing: the source is still reporting data from October 8, so something is likely wrong on SaskPower's end. Should I try contacting them to see if they're aware of the issue?

@VIKTORVAV99
Copy link
Member

If the bot closed the issue we got data again (it will open a new issue if it stops working again).

If you want to reach out feel free to do so but it's nothing that's expected or required.

@kruschk
Copy link
Contributor

kruschk commented Oct 11, 2023

I just thought it seemed odd because errors are still appearing in the runtime logs.

My last comment was wrong: the source is still updating because it now claims the data is "as of October 9, 2023", so I suppose it's just lagging by a few days. That said, the application shows data for October 10, so I'm not sure what's going on there. Looking at the parser logic, I don't see why this would be the case.

Despite the seemingly active production URL, the consumption URL is still responding with "Data Unavailable". Do you have any thoughts on using the SystemDemand key from the production URL's response instead?

@VIKTORVAV99
Copy link
Member

CA-SK is a little special as the production data is only reported on a daily basis. So we also consume hourly load data in the hope that we can estimate the hourly production data.

This is the reason the zone don't show up in the hourly view on the map.

@kruschk
Copy link
Contributor

kruschk commented Oct 13, 2023

What do you think of my proposed fix for the fetch_consumption function?

@kruschk
Copy link
Contributor

kruschk commented Oct 13, 2023

By the way, I noticed on the Building a new parser wiki page that some new data structures have been introduced to help enforce the expected data format. Perhaps I could contribute by updating this parser to use them?

@VIKTORVAV99
Copy link
Member

What do you think of my proposed fix for the fetch_consumption function?

Not sure this works, we specifically chose this endpoint because it updates during the day and isn't just a daily average.

@VIKTORVAV99
Copy link
Member

By the way, I noticed on the Building a new parser wiki page that some new data structures have been introduced to help enforce the expected data format. Perhaps I could contribute by updating this parser to use them?

Feel free to do so! We plan on migrating all parsers and parser functions eventually.

@kruschk
Copy link
Contributor

kruschk commented Oct 13, 2023

Not sure this works, we specifically chose this endpoint because it updates during the day and isn't just a daily average.

Oh, I see now!

Feel free to do so! We plan on migrating all parsers and parser functions eventually.

Great, I'll take a shot at it, and maybe I can work on some others afterward! I'll try to compile a list of parsers requiring migration in a new issue to help keep track. 🙂

kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 15, 2023
Upgrade the parser to use the ProductionBreakdown, ProductionMix, and
TotalConsumption, and ZoneKey classes. This should yield no functional
change to the parser. Note that this does not resolve the current issue
with the parser's fetch_consumption function. Additionally:

- Conform to Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 15, 2023
Upgrade the parser to use the ProductionBreakdown, ProductionMix,
TotalConsumption, and ZoneKey classes. This should yield no functional
change. Note that this does not resolve the current issue with the
fetch_consumption function. Additionally:

- Conform to Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 15, 2023
Upgrade the parser to use the ProductionBreakdown, ProductionMix,
TotalConsumption, and ZoneKey classes. This should yield no functional
change. Note that this does not resolve the current issue with the
fetch_consumption function. Additionally:

- Conform to Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
Upgrade the parser to use the ProductionBreakdown, ProductionMix,
TotalConsumption, and ZoneKey classes. This should yield no functional
change. Note that this does not resolve the current issue with the
fetch_consumption function. Additionally:

- Comply with Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
- Be more specific about the return type of the _request function.
- Import the Any type directly.
- Swap out pytz in exchange for zoneinfo.
- Use the ProductionMix.add_value method instead of a dictionary
  comprehension.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
Swap out TotalConsumption for TotalConsumptionList, as the former is
considered an implementation detail while the latter is part of the
public API.

Refs: electricitymaps#5986, electricitymaps#6011
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
Upgrade the parser to use the ProductionBreakdown, ProductionMix,
TotalConsumption, and ZoneKey classes. This should yield no functional
change. Note that this does not resolve the current issue with the
fetch_consumption function. Additionally:

- Comply with Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: electricitymaps#5986, electricitymaps#6011, electricitymaps#6013
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
- Be more specific about the return type of the _request function.
- Import the Any type directly.
- Swap out pytz in exchange for zoneinfo.
- Use the ProductionMix.add_value method instead of a dictionary
  comprehension.

Refs: electricitymaps#5986, electricitymaps#6011, electricitymaps#6013
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
Swap out TotalConsumption for TotalConsumptionList, as the former is
considered an implementation detail while the latter is part of the
public API.

Refs: electricitymaps#5986, electricitymaps#6011, electricitymaps#6013
kruschk added a commit to kruschk/electricitymap-contrib that referenced this issue Oct 24, 2023
VIKTORVAV99 added a commit that referenced this issue Oct 25, 2023
* refactor: upgrade CA-SK with event classes

Upgrade the parser to use the ProductionBreakdown, ProductionMix,
TotalConsumption, and ZoneKey classes. This should yield no functional
change. Note that this does not resolve the current issue with the
fetch_consumption function. Additionally:

- Comply with Black's 88-column default line length limit.
- Factor out duplicate code.

Refs: #5986, #6011, #6013

* refactor: address review comments

- Be more specific about the return type of the _request function.
- Import the Any type directly.
- Swap out pytz in exchange for zoneinfo.
- Use the ProductionMix.add_value method instead of a dictionary
  comprehension.

Refs: #5986, #6011, #6013

* refactor: switch to TotalConsumptionList

Swap out TotalConsumption for TotalConsumptionList, as the former is
considered an implementation detail while the latter is part of the
public API.

Refs: #5986, #6011, #6013

* refactor: narrow down payload types

Refs: #5986, #6011, #6013

---------

Co-authored-by: Viktor Andersson <30777521+VIKTORVAV99@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants