-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(openem): hackily add exchanges #8289
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
Conversation
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.
Looks good but I'd really like to add a snapshot test at the very least to ensure this is working correctly and that we don't get regressions in the future.
I can assist if needed 🙂
tests added! |
parsers/OPENNEM.py
Outdated
return [ | ||
{ | ||
"datetime": dt.to_pydatetime(), | ||
"netFlow": value * direction, | ||
"source": SOURCE, | ||
"sortedZoneKeys": key, | ||
} | ||
for dt, value in series.iteritems() | ||
Exchange(datetime=dt, netFlow=netflow, zoneKey=exchange_key, source=SOURCE) | ||
for dt, netflow in datetimes_and_netflows | ||
] |
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.
Don't this need to use the ExchangeList model if we are to use exchanges internally as the Exchange class itself don't serialize to JSON automatically?
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'd be happy to make the changes if you wish?
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.
LGTM! 🚀
Nice work!
poetry run test_parser "zone_key"
We parse data from openelectricity that powers their dashboard. The data includes total exports and imports for each of the connected zones in eastern Australia.
Most of the zones only have one exchange, so it's easy calculate the netflow to it's only neighbor. The only exchange that requires some math is AU-NSW->AU-VIC which can be calculated as described below
Side note: also cleaned up some of the parser code because it made no sense