OSU-Sustainability-Office / energy-dashboard

Oregon State University's energy dashboard.
https://dashboard.sustainability.oregonstate.edu
GNU General Public License v3.0
11 stars 0 forks source link

Pacific Power Recent Data GET Endpoint #309

Closed solderq35 closed 2 months ago

solderq35 commented 4 months ago

Related Issue

Changes

SQL code (backend\dependencies\nodejs\models\pacific_power_data.js)

JS Code (backend\dependencies\nodejs\models\pacific_power_data.js)

Testing

TODO

solderq35 commented 3 months ago

Misc Research

EDIT: I couldn't find any gaps (so far) in PacificPower meters data bigger than 1 day at a time of missed uploads (since the data seems to consistently show up on PacificPower, just up to 24 hours late for the latest upload)

Even in cases where the item number changed (replacement meter?), the gap was one day at most

Conclusion: 7 days is probably overkill, probably like 2 days timeframe is enough

image

image

====

Code Changes

I tried extending the time window from 3 to 7 days as a test, and the performance didn't seem that much worse (maybe about 1.5 to 2x slower at worst, and still faster than the allbuildings API endpoint).

Local backend testing screenshots

TODO

solderq35 commented 3 months ago

Marking this as ready for review. Think I will keep the 7 day timeframe because there were cases where the data was out of date for 2 days or more for one reason or another, and I have updated my missing data webscraper PR to check for up to 7 days prior via while loops

solderq35 commented 2 months ago

Follow-up task (future PR): https://github.com/OSU-Sustainability-Office/automated-jobs/issues/51

solderq35 commented 2 months ago

Updated to list data from past 7 days per meter. Duplicate values (same meter ID + time stamp as an existing value) are skipped

Also, upload with same meter ID + time stamp as an existing value now returns 400 error

solderq35 commented 2 months ago

Fixed merge errors from exclusion energy dashboard PR, will fix merge errors for automated-jobs repo later