-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Conversation
@larsks did a proof of concept here that would be both human-friendly and tooling friendly. |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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).
class OutageItemDict(Base): | |
class OutageItem(Base): |
|
||
|
||
class Outages(pydantic.RootModel): | ||
root: list[OutageItemDict] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
root: list[OutageItemDict] | |
root: list[OutageItem] |
) | ||
|
||
|
||
def load_from_url(url: str | None = None) -> Outages: |
There was a problem hiding this comment.
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.
start: datetime | ||
end: datetime |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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).
No description provided.