-
Notifications
You must be signed in to change notification settings - Fork 438
Description
Is your feature request related to a problem? Please describe.
OED now automatically decides the accuracy of the points returned for the line graphic. It is done so that each item returns the highest frequency of points possible given the restriction on the number of points returned. The user can determine the frequency by looking at the lines but this requires more work and, sometimes, an understanding of the underlying meter or group. If there are multiple meters and/or groups then the frequency can vary by each line so that is even more work. It would seem simpler and better if OED directly provided this information.
Describe the solution you'd like
src/server/sql/reading/create_reading_line_accuracy_enum.sql defines the allowed values to request line data from OED. Currently all line requests use 'auto' so OED decides among the others ('daily', 'hourly', 'raw'). Note that 'raw' is the older term where users should be shown 'meter' since it is returning the original meter readings in this case.
Currently meter_line_readings_unit and group_line_readings_unit in src/server/sql/reading/create_reading_views.sql decides the frequency of readings to return and then gets the readings. The proposed change is to:
- Have the associated reading model first call a new database function(s) to determine the desired accuracy for each item (meter/group).
- The model would use this result to then get the needed line readings at that accuracy. While not available via the UI where it is always 'auto', the line readings function can have the accuracy set in the request. A new array parameter may be needed to tell the accuracy for each item to get line readings. The logic to decide the reading frequency would be removed from the DB function getting the data and the 'auto' choice would be removed.
- The model would return both the accuracy and the readings to the route and then to the client.
- Redux state will be modified to hold the accuracy for each line reading's data as provided by the route changes.
- The line graphic will have the top labels for each line modified to include this information as shown in the following figure (only one line was used with "(daily)" but all lines would have a similar label).
To guarantee that the accuracy is always correct in case of other DB changes at the same time, steps 1 & 2 would use a transaction.
Describe alternatives you've considered
Not show the user.
Additional context
Note OED is in the process of doing substantial changes to line readings for the new views and time-varying conversion work (during summer 2025 and continuing after that). This work should be incorporated into that code and it would be best to wait until it is stable - it is hoped that will happen by late summer/early fall of 2025. Anyone interested on working on this can check on the status if it is in doubt.