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

Only allow a single model to be returned through /historical #14

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

sam-watttime
Copy link
Contributor

If a model is not specified for the WattTimeHistorical accessor, it will grab the most recent model available for each point_time in the specified range (start -> end).

The optional include_meta parameter will alert users what model produced each point, however there is potential for accidental harm if this is not utilized. Furthermore, there aren't many valid use cases for requesting data from multiple models in a single request.

This change will ensure that historical requests can only return a single model's data. Additionally, that model will be the most recent one available for any point_time across their request.

This also required a few typing changes for datetimes. Previously were were returning train_start, train_end and date_start as strings from WattTimeMyAccess. This behavior is maintained for json responses, but pandas responses convert the type to datetime objects. Likewise, WattTimeHistorical will now return point_time as a datetime object for pandas formats.

Testing has been added for both the single model, and typing changes.

@sam-watttime sam-watttime requested review from xginn8 and jcofield March 7, 2024 21:56
Copy link
Contributor

@xginn8 xginn8 left a comment

Choose a reason for hiding this comment

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

lgtm!

@sam-watttime sam-watttime merged commit add3b7b into main Mar 19, 2024
1 check passed
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