Repository navigation
Description
http://realtime.safecast.org/ today requires a lot of manual administration (for each new device) and uses a polling model that places a huge load on the database behind api.safecast.org. With many devices and high traffic, the system today will likely fall over.
In talking with @robouden today I think what might make the most sense for the future of http://realtime.safecast.org/ is to build a new DeviceStory (still not sure on the name) model/controller/view in api.safecast.org
Inside API we could pull http://tt.safecast.org/devices once every N minutes (maybe 5).
For any device that doesn't already have a DeviceStory model, we create one. This model would be the home for a few things:
- metadata about the device, as initially provided by ttserve (and possibly updated, if ttserve sends us a new name)
- comments about the device (from users logged into api)
- current owner of the device (an api user)
- photo attachments of the device
- embeds/links to grafana/kibana (keyed on device URN)
Note that one important aspect of this is that there could be multiple stories for a given piece of hardware (e.g., if it changes hands). But we still need a way to link to the latest story for a given device URN.
Echoing what I said to eito on slack
Things to work on:
- regular data import (done, https://github.com/Safecast/safecastapi/blob/08c604f794fe7825c30cb70398001a5aa9ee08a3/app/safecast/tasks/device_story/update_metadata.rb)
- device story listing
- single device show page with link to grafana (create device story device listing page #642)
- linkable search (e.g., https://safecast.jp/safecast-devices/?wdt_search=airnote)
- comment support
- image attachments (example photos here) - "Device story" page on API - realtime replacement #606
- get @Frangible to swap out the images noted on "Device story" page on API - realtime replacement #606 (comment) with grafana embeds
- can probably decommision realtime.safecast.org at this point
- user association via moderator (might be done already via rails admin really)
- allowing non-moderators to claim a device record
Activity
matschaffer commentedon Dec 1, 2019
@auspicacious @eitoball @ZacharyCChang0828 @robouden @thinrope @Frangible @rayozzie - pinging a few folks for comment, feel free to add your thoughts.
This was the result of a morning roundtable with @robouden @Frangible and myself that we should be able to build something like this into API (especially now that we're on postgres 9.5 and can leverage jsonb columns as well).
While we could also try to build up realtime to support something like this, building it into API seems like a better play to the strengths of the available team (basically none of us have deep wordpress expertise afaik).
robouden commentedon Dec 2, 2019
Thanks for the generation of the issue. I will add comments later.
Ray already implemented the device_urn at http://tt.safecast.org/devices
robouden commentedon Dec 5, 2019
RT replace API idea.pdf
robouden commentedon Dec 5, 2019
Sorry. closed. the issue by accident.
robouden commentedon Dec 6, 2019
Switched the issue to high priority because we have about 170 new devices coming online in the near future and I would like to have RT replacement being auto-scalable.
matschaffer commentedon Dec 10, 2019
There was some question from @auspicacious regarding usage of grafana in this scope.
It would be great if we could lean on grafana to do most of the visualization work for any given device that flows through ttserve/ingest.safecast.org (basically everything except the bgeigie nano)
The big shortcoming is the map click behavior. Ideally this would show a recent payload (CPM, PM2.5) data but right now it just shows the geohash & document count which isn’t terribly useful.
Compare https://grafana.safecast.cc/d/Med5wakZk/device-checker?orgId=1

With https://realtime.safecast.org/map/

Hopefully behavior is configurable, or we can get assistance from grafana community on a PR.
Or if not we may need to include a custom map in the scope of this issue.
Additionally, total decomissioning of realtime would be blocked on some work on the tile map.
Since the fixed sensor icons (e.g., from https://safecast.org/tilemap/?y=36.2&x=138.69&z=8&l=0&m=0) and graphs

Are fed from the realtime server
https://realtime.safecast.org/plots_new/out/100351_640x400.png?t=1575958755
cc @Frangible and @robouden incase I'm misrepresenting anything here.
robouden commentedon Dec 10, 2019
On Grafana we can customize the rollovers. I did some testing see the screenshot.
matschaffer commentedon Dec 10, 2019
I think I made some headway on the Map (NG) plugin https://grafana.safecast.cc/d/PtWmQlaZk/maptest?tab=visualization&orgId=1&fullscreen&edit&panelId=2
The rendering even looks better in light mode there
matschaffer commentedon Dec 10, 2019
https://grafana.com/grafana/plugins/ryantxu-annolist-panel could possibly be viable for comments without leaving grafana
robouden commentedon Dec 11, 2019
@matschaffer yes. seems to be good for what we want.
https://github.com/grafana/grafana/tree/master/public/app/plugins/panel/annolist
matschaffer commentedon Dec 11, 2019
@robouden do you have a link to the usage you mentioned? I don't see it on https://grafana.safecast.cc/d/xDN0RWlmz/radiation-use-to-be-dre
eitoball commentedon Dec 11, 2019
How do we associate
DeviceStorymodel with users? Would admin user do it by hand? Or else?27 remaining items
matschaffer commentedon Apr 14, 2021
Gonna close this out since it's largely done.
I opened a few followups:
matschaffer commentedon Apr 14, 2021
Also wanted to say big thanks for making this whole thing possible.
We haven't been able to totally remove rt.safecast.org yet, but we're pretty close. And in the mean time, these pages have provided a great exploration space for the new Airnote devices from http://blues.io/
@rdeskins @Nakushi64 and @eitoball ~
nokton commentedon Apr 14, 2021
matschaffer commentedon Apr 14, 2021