ConservationMetrics / guardianconnector-views

A Nuxt.js tool that reads data from a SQL database and renders it on different views (map, gallery, alerts dashboard)
MIT License
3 stars 0 forks source link

Use alerts metadata table to compile statistics for `AlertsDashboard` #38

Closed rudokemper closed 3 months ago

rudokemper commented 3 months ago

Goal

To use an alerts metadata table, if found, to compile some of the statistics for alerts on the AlertsDashboard component.

This PR supplements the proposed work in https://github.com/ConservationMetrics/frizzle/issues/134 to create an {table_alias}__metadata table from a CSV published by a change detection data alerts provider.

Screenshots

image This shows an alert detection range of up to January 2024, but date of most recent alerts published in December 2023. In other words, no alerts were generated in January 2024.

What I changed

What I'm not doing here

Using the alerts metadata to update some of the other statistics fields, such as alertsTotal, recentAlertsDate, or recentAlertsNumber. I've gone back and forth on whether to use the metadata or the actual alerts published as the source of truth for these. I'm opting for the actual alerts published, because there could be an edge case scenario where there is a mismatch between the CSV and the actual alerts published, in which case we'll want the statistics to reflect what's actually shown on the map.