JonnyDawe / UK-Sewage-Map

This map shows real-time information about river sections that might be affected by sewage discharges from combined sewer overflows. Currently, it is limited to the Thames basin.
https://sewagemap-jonnydawe.vercel.app
MIT License
4 stars 1 forks source link

Add a "History Last Updated" timestamp to the history barcode #16

Closed AlexLipp closed 3 months ago

AlexLipp commented 4 months ago

Problem

The overall map shows a timestamp for when the downstream predictions had last been calculated: image

However, we don't show such a timestamp on the "History" tab of the pop-ups. This is a problem because the Thames Water history API is particularly "sticky" and can not-update for a relatively long period of time. Currently, so as not to display "false" information the back-end simply returns no history if it is even 30 minutes out of date. However, this results in a fair amount of undesirable downtime. If we can instead display a "last updated" timestamp (with perhaps a visible marker of when that was on the barcode) we can assume that the limitations are being accurately communicated.

Solution

It would be helpful to include a timestamp moving forwards in the pop-up such as:
image.

The time-stamp which indicates when the discharges were last updated is already available in the AWS bucket.

JonnyDawe commented 3 months ago

@AlexLipp - I have stubbed in the initial logic into a branch here: https://github.com/JonnyDawe/UK-Sewage-Map/tree/%2316-enhancement/history-update-text

Currently I don't have access to the AWS endpoint and am hitting 403 forbidden errors. Would it be possible to have it set up via the cloudfont endpoint as with the other services?

AlexLipp commented 3 months ago

Ok, the corrected CloudFront URL should now be here, sorry: https://d1kmd884co9q6x.cloudfront.net/discharges_to_date/timestamp.txt

This URL is sometimes not pointing at anything due to the way it automatically updates, but if you think everything else is set up well I can stop it autodeleting the AWS bucket if an error is returned. Let me know if you think we're ready for that?

JonnyDawe commented 3 months ago

Happy for it it be switched over - I'll be able to get it updated in the next day or so!

AlexLipp commented 3 months ago

Great, I will sort this shortly.

AlexLipp commented 3 months ago

I've updated the back-end to not automatically wipe the last successful history generation. This should mean that there is always a valid history and timestamp present in the bucket (will take a few hours to run through the system I guess) so you can go ahead with updating the front-end.

JonnyDawe commented 3 months ago

@AlexLipp - all merged and looks to be working well! I might refine the UI a bit as part of some other tickets!

AlexLipp commented 3 months ago

 Amazing, this looks great! Although, seems like when long duration the text overlaps slightly, but this is a minor UI fix (smaller font? Remove some words?)

But yes this is great and gives better idea of confidence in history + much less downtime.

[image0.jpeg]

On 1 Jun 2024, at 14:07, Jonny Dawe @.***> wrote:



@AlexLipphttps://github.com/AlexLipp - all merged and looks to be working well! I might refine the UI a bit as part of some other tickets!

— Reply to this email directly, view it on GitHubhttps://github.com/JonnyDawe/UK-Sewage-Map/issues/16#issuecomment-2143444061, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACNXQX3ZNOE2MPJ3YITAEHDZFHBWHAVCNFSM6AAAAABHKYWUSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGQ2DIMBWGE. You are receiving this because you were mentioned.Message ID: @.***>

JonnyDawe commented 3 months ago

@AlexLipp yep I spotted that on mobile! Will tweak the layout to make it wrap better.

Unfortunately I'm seeing that the failed to load discharge warning has returned indicating failed requests to the endpoint?

JonnyDawe commented 3 months ago

Actually it seems to have come back... I may have had an old page cached

AlexLipp commented 3 months ago

Yes I can’t reproduce that bug. I’ll keep an eye out in future to see if it reoccurs. Just from having checked this a lot I’m seeing much less downtime than previously so I think it’s working ok. I’ll check the logs too (need to get that set up to have them emailed to a server rather than only stored locally)

On 1 Jun 2024, at 17:22, Jonny Dawe @.***> wrote:



@AlexLipphttps://github.com/AlexLipp yep I spotted that on mobile! Will tweak the layout to make it wrap better.

Unfortunately I'm seeing that the failed to load discharge warning has returned indicating failed requests to the endpoint?

— Reply to this email directly, view it on GitHubhttps://github.com/JonnyDawe/UK-Sewage-Map/issues/16#issuecomment-2143503981, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACNXQX3D63MXZOWE7QK57ADZFHYP5AVCNFSM6AAAAABHKYWUSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTGUYDGOJYGE. You are receiving this because you were mentioned.Message ID: @.***>