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

Store outages in Outages.yaml #6

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

knikolla
Copy link
Contributor

No description provided.

@knikolla
Copy link
Contributor Author

@larsks did a proof of concept here that would be both human-friendly and tooling friendly.

Copy link
Member

Choose a reason for hiding this comment

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

I think I would either merge these models into models.py, or I would rename models.py to models/rates.py and make this models/outages.py, and then have models/__init__.py import all the models.

end: datetime


class OutageItemDict(Base):
Copy link
Member

Choose a reason for hiding this comment

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

This is not actually a dicitonary (unlike RateItemDict, which is).

Suggested change
class OutageItemDict(Base):
class OutageItem(Base):



class Outages(pydantic.RootModel):
root: list[OutageItemDict]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
root: list[OutageItemDict]
root: list[OutageItem]

)


def load_from_url(url: str | None = None) -> Outages:
Copy link
Member

Choose a reason for hiding this comment

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

Do we want the outages file to be loaded separately from the rates file, or should a single call to load_from_... load both rates and outages data? That would require restructuring some things.

Comment on lines +10 to +11
start: datetime
end: datetime
Copy link
Member

Choose a reason for hiding this comment

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

In the Rate model, we use attributes date_from and date_until (and map them to YAML attributes from and until). Any reason not to use the same names here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For rate I chose from and until as a shorthand for "effective from" and "effective until". Here start and end felt more aligned with how I would refer to an outage start and end. Ultimately from and until would work fine too and I don't have a strong opinion either way.

@@ -0,0 +1,5 @@
- name: MGHPCC Shutdown 2024
information: https://nerc.mghpcc.org/event/mghpcc-annual-power-shutdown-2024/
Copy link
Member

Choose a reason for hiding this comment

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

If this is always a URL, I would just call it "url" (and we would validate as such).

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.

2 participants