feat: refonte dynamique de la page Perspectives#504
Conversation
Remplace le contenu statique par des données temps réel issues de PostgreSQL. - KPIs dynamiques : collectivités, marchés publics, subventions, couverture, scores - Graphiques Recharts : distribution des scores par année et par type, volumes - Filtre des communes < 3500 habitants (non soumises à la loi) - Encart France championne européenne de l'open data TODO: la section "Bons et mauvais élèves" (ScoreByTypeChart) apparaît vide, à investiguer dans un prochain commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
| ℹ️ Name | 🔗 Infos & links |
|---|---|
| 🌱 Deploying commit | d069141 |
| 👁️ Preview | Generating preview app... |
pg retourne les BIGINT comme strings en JS. La comparaison stricte row.annee !== year échouait silencieusement (\"2024\" !== 2024). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…grée - Intègre le classement France championne dans l'introduction - Supprime l'encart séparé - Titres de section porteurs du message principal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…alyses Les anciennes mentions "seules 10% le font" / "Anticor a évalué" étaient une estimation initiale sur échantillon. Reformulé avec le constat actuel d'Éclaireur Public (majorité ne publie pas, subventions quasi inexistantes). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e nos analyses" This reverts commit 26ab1cb.
…alyses Les mentions "seules 10% le font" / "Anticor a évalué sur un échantillon que moins de 10%" étaient une estimation initiale. Reformulé en s'appuyant sur le constat d'Éclaireur Public sans toucher au reste du texte éditorial. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Great work @m4xim1nus — this is a big upgrade from the static page. The dynamic KPIs, the Recharts charts, and the editorial rewrite are all well-structured. A few things to address before merging: 🔴 Critical: Outlier amounts will show absurd numbersThe KPI query sums
The page would display something like "3 213 T€ de marchés publics" which is nonsensical. Fix for marchés: filter on WHERE (montant_aberrant IS NULL OR montant_aberrant = false)Fix for subventions: there's no WHERE montant <= 1000000000 -- 1 Md€This is the same approach as our insights dashboard — 780 subventions above 1B€ account for 99.997% of the total. 🟡
|
…constants - Filter montant_aberrant for marchés publics and montant > 1 Md€ for subventions in KPI totals and yearly volume charts so that extreme outliers no longer skew the displayed amounts. TODO: switch subventions filter to montant_aberrant once the column is added to the subventions table by the ETL pipeline. - Replace hardcoded LATEST_SCORE_YEAR = 2024 with a dynamic MAX(annee) query from the bareme table so the page stays current after each ETL run without code changes. - Add `export const revalidate = 3600` (ISR) to the perspectives page so the 4 heavy DB queries are cached for 1 hour instead of running on every page load. - Extract duplicated SCORE_COLORS, SCORE_ORDER, TYPE_LABELS and TYPE_ORDER into a shared constants.ts file used by both ScoreByTypeChart and ScoreDistributionChart. Co-authored-by: Cursor <cursoragent@cursor.com>
The bareme table contains rows up to 2026, but 2025/2026 data is far too sparse — especially for subventions — to produce meaningful KPIs or score distributions. Pin REFERENCE_SCORE_YEAR = 2024 (the latest year with reasonably complete data) with a clear comment explaining when and why to bump it. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
TODO (prochain commit)
Test plan
/perspectivescharge correctement avec les données de la BDD🤖 Generated with Claude Code