fix: score B instead of E for subventions over-budget + update methodology#495
Merged
cyrilledaily merged 4 commits intodataforgoodfr:mainfrom Feb 16, 2026
Conversation
Contributor
|
| ℹ️ Name | 🔗 Infos & links |
|---|---|
| 🌱 Deploying commit | 509c6b5 |
| 👁️ Preview | Generating preview app... |
Collaborator
|
RAS — logique métier cohérente entre backend et frontend. La docstring est maintenant alignée avec les vrais seuils du code (corrige un décalage pré-existant). |
jb-delafosse
approved these changes
Feb 16, 2026
509c6b5 to
d97d36d
Compare
jb-delafosse
requested changes
Feb 16, 2026
Collaborator
jb-delafosse
left a comment
There was a problem hiding this comment.
Juste ces 2 tests à updates FAILED back/tests/test_bareme_enricher.py::TestGetScoreFromTp::test_score_e_for_over_declaration
FAILED back/tests/test_bareme_enricher.py::TestGetScoreFromTp::test_boundary_values
cyrilledaily
pushed a commit
to cyrilledaily/13_eclaireur_public
that referenced
this pull request
Feb 16, 2026
Align test_score_e_for_over_declaration (renamed to test_score_b_for_over_declaration) and test_boundary_values with the new scoring logic where >105% returns B, not E. Fixes review comment by @jb-delafosse on PR dataforgoodfr#495. Co-authored-by: Cursor <cursoragent@cursor.com>
When declared subventions exceed the budgeted amount (ratio >105%), the previous logic penalized these collectivites with an E score, treating over-declaration the same as no data. Over-declaration still demonstrates a real transparency effort and is now scored B instead. Co-authored-by: Cursor <cursoragent@cursor.com>
…over-budget Move the ">105%" case from score E to score B in the subventions scoring grid. Score E now only covers "0% - no data". Score B now reads "50% to 95% or over 105% (over-declaration)" to match the updated backend logic. Co-authored-by: Cursor <cursoragent@cursor.com>
Align test_score_e_for_over_declaration (renamed to test_score_b_for_over_declaration) and test_boundary_values with the new scoring logic where >105% returns B, not E. Fixes review comment by @jb-delafosse on PR dataforgoodfr#495. Co-authored-by: Cursor <cursoragent@cursor.com>
PR dataforgoodfr#498 added a _schema_version column to clean_row output but didn't update test_marches_public_dataframes to expect 6 columns instead of 5. Also apply ruff format fixes to marches_enricher.py. Co-authored-by: Cursor <cursoragent@cursor.com>
a68c479 to
1e40215
Compare
m4xim1nus
added a commit
that referenced
this pull request
Feb 18, 2026
- Remplace les 4 KPIs par des valeurs plus signifiantes et sans ambiguïté : collectivités soumises à la loi, montant total MP+Sub depuis 2016 (hors aberrations), % score A/B marchés publics 2024, % subventions publiées 2024 - Aligne la logique de calcul sur fetchPerspectivesData : même condition "soumises" (communes ≥ 3500 hab + DEP/REG/GRP), même filtre outliers - Corrige SCORE_TO_RANGE (B/E) désynchronisé depuis le fix #495 : E = "0% - Aucune donnée", B inclut "ou > 105%" (sur-déclaration) - Passe KPI_REFERENCE_YEAR à 2024 pour cohérence avec le reste du site - Ajoute formatMilliardsPrice() pour un affichage "X,X Md€" robuste - Supprime 5 fetchers KPI orphelins remplacés par la nouvelle requête unifiée Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
cyrilledaily
pushed a commit
that referenced
this pull request
Feb 18, 2026
- Remplace les 4 KPIs par des valeurs plus signifiantes et sans ambiguïté : collectivités soumises à la loi, montant total MP+Sub depuis 2016 (hors aberrations), % score A/B marchés publics 2024, % subventions publiées 2024 - Aligne la logique de calcul sur fetchPerspectivesData : même condition "soumises" (communes ≥ 3500 hab + DEP/REG/GRP), même filtre outliers - Corrige SCORE_TO_RANGE (B/E) désynchronisé depuis le fix #495 : E = "0% - Aucune donnée", B inclut "ou > 105%" (sur-déclaration) - Passe KPI_REFERENCE_YEAR à 2024 pour cohérence avec le reste du site - Ajoute formatMilliardsPrice() pour un affichage "X,X Md€" robuste - Supprime 5 fetchers KPI orphelins remplacés par la nouvelle requête unifiée Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cyrilledaily
pushed a commit
that referenced
this pull request
Feb 18, 2026
- Remplace les 4 KPIs par des valeurs plus signifiantes et sans ambiguïté : collectivités soumises à la loi, montant total MP+Sub depuis 2016 (hors aberrations), % score A/B marchés publics 2024, % subventions publiées 2024 - Aligne la logique de calcul sur fetchPerspectivesData : même condition "soumises" (communes ≥ 3500 hab + DEP/REG/GRP), même filtre outliers - Corrige SCORE_TO_RANGE (B/E) désynchronisé depuis le fix #495 : E = "0% - Aucune donnée", B inclut "ou > 105%" (sur-déclaration) - Passe KPI_REFERENCE_YEAR à 2024 pour cohérence avec le reste du site - Ajoute formatMilliardsPrice() pour un affichage "X,X Md€" robuste - Supprime 5 fetchers KPI orphelins remplacés par la nouvelle requête unifiée Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_score_from_tp()inbareme_enricher.pyso that subventions ratios >105% return score B instead of E. Over-declaration still demonstrates a real transparency effort and should not be penalized the same as "no data"./methodologiepage to reflect the new logic — move ">105%" from score E to score B.Files changed
back/scripts/enrichment/bareme_enricher.py— scoring logic + docstringsfront/app/(comprendre)/methodologie/page.tsx— scoring grid displayTest plan
cc @jb-delafosse @m4xim1nus for review
Made with Cursor