I looked at the patch and it does seem that the current codebase (pulled directly from Github master) doesn’t need it as there is a call to a new function validate_timevalue
that seems to do the same. It does however highlight the subtleties of null
being interpreted correctly, or not, which may be relevant.
However, it didn’t happen again so I won’t be pursuing a solution until it does. It did inspire me to write a command line script (cliFina
) that can apply updates to PHPFina files directly. It’s a bit like the postprocess ability or the Visualization editor but it can specify a range within the file to update. I used it to fix the issue by subtracting out the erroneous delta from the point it happened to the end of the current file. I had to run this four times. Here’s the call to fix the single intermediate datapoint error:
**pi@emonpi**:**~ $** sudo scripts/cliFina -n -p10 65:[1675255250,+0]=1893.3502197265625
Processing file /var/opt/emoncms/phpfina/65...
metafile: start_time=1673470640, interval=10, end_time=1675348560, 187793 entries
requested range: [1675255250,+0] normalized to [1675255250,1675255250]
Backing up file...done
time=1675255250, data=2339.209228515625, new=1893.3502197265625
File /var/opt/emoncms/phpfina/65 (1 changes were made in 0.001 seconds)
And heres the call subtracting the delta from the following point to the end of the file:
**pi@emonpi**:**~ $** sudo scripts/cliFina -n -p10 65:[1675255260,end]-=471.34313964844
Processing file /var/opt/emoncms/phpfina/65...
metafile: start_time=1673470640, interval=10, end_time=1675348870, 187824 entries
requested range: [1675255260,end] normalized to [1675255260,1675348870]
Backing up file...done
time=1675255260, data=2364.693359375, new=1893.35021972656
time=1675255270, data=2364.693359375, new=1893.35021972656
time=1675255280, data=2364.693359375, new=1893.35021972656
time=1675255290, data=2364.693359375, new=1893.35021972656
time=1675255300, data=2364.693359375, new=1893.35021972656
time=1675255310, data=2364.693359375, new=1893.35021972656
time=1675255320, data=2364.693359375, new=1893.35021972656
time=1675255330, data=2364.693359375, new=1893.35021972656
...
time=1675348870, data=3500.836669921875, new=3029.4935302734348
File /var/opt/emoncms/phpfina/65 (9362 changes were made in 0.585 seconds)
It’s available in the scripts
folder of my emoncms
clone and I’ll include it in my (eventual) pull request.