Skip to content

Conversation

jereze
Copy link
Contributor

@jereze jereze commented Aug 13, 2025

Summary by CodeRabbit

  • Style
    • Harmonisation de l’intitulé des résultats “Concentration > 3 µg/L” dans plusieurs catégories.
    • Remplacement de l’icône “croix rouge” par un pictogramme d’avertissement.
    • Mise à jour des couleurs et fonds (nouvelles teintes plus cohérentes) pour ces résultats.
    • Amélioration de la lisibilité et de la cohérence visuelle des indicateurs d’excès de concentration, sans modification du fonctionnement.

Copy link

coderabbitai bot commented Aug 13, 2025

Walkthrough

Renommage du key sup_valeur_sanitaire en sup_limite_qualite_sup_3 dans availableCategories.resultats de webapp/lib/polluants.ts, avec mise à jour des labels (“Concentration > 3 µg/L”), des pictos (“warning”) et des couleurs (#d94801, #F3903F). Aucune signature de type ou fonction modifiée.

Changes

Cohort / File(s) Summary
Mise à jour des clés et présentations des résultats
webapp/lib/polluants.ts
Renomme resultats.sup_valeur_sanitaire en sup_limite_qualite_sup_3 dans plusieurs catégories; met à jour label (“Concentration > 3 µg/L”), picto (“warning”), et couleurs (couleur/couleurFond). Aucun changement de types exportés (ICategory, DetailResultat, etc.).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested labels

team-data-analyst

Suggested reviewers

  • LounesAbd

Poem

Nouvelles couleurs sur l’eau qui court,
Un “warning” s’allume, discret mais sûr.
Les clés changent de nom, sans détour,
3 µg/L, le seuil fait tour.
Bravo les bénévoles, cap au futur !

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/new-values-for-R471811-and-ESA-metolachlore

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
webapp/lib/polluants.ts (1)

470-475: Couleur identique à “sup_limite_qualite” pour R471811: confirmer l’intention

Ici, sup_limite_qualite_sup_3 utilise #F3903F, identique à sup_limite_qualite. Pour ESA-métolachlore, vous avez renforcé la couleur (#d94801) pour le seuil > 3 µg/L, ce qui distingue visuellement la gravité. Pour R471811, garder la même couleur risque de rendre la légende moins discriminante (deux niveaux différents, même couleur).

  • Si c’est intentionnel (p. ex. décision produit), RAS.
  • Sinon, je recommande d’harmoniser la couleur avec #d94801 pour le seuil > 3 µg/L, comme pour ESA-métolachlore.

Proposition de patch minimal:

-              sup_limite_qualite_sup_3: {
-                label: "Concentration > 3 µg/L",
-                couleur: "#F3903F",
-                couleurFond: "#F3903F",
-                picto: "warning",
-              },
+              sup_limite_qualite_sup_3: {
+                label: "Concentration > 3 µg/L",
+                couleur: "#d94801",
+                couleurFond: "#d94801",
+                picto: "warning",
+              },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00673df and 77538f2.

⛔ Files ignored due to path filters (11)
  • dbt_/models/intermediate/int__mapping_category_simple.sql is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite_specifique/_int__metabolite_specifique_models.yml is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite_specifique/int__resultats_metabolite_specifique_commune_dernier.sql is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite_specifique/int__resultats_metabolite_specifique_udi_dernier.sql is excluded by none and included by none
  • dbt_/models/intermediate/tous/int__resultats_tous_udi_dernier.sql is excluded by none and included by none
  • dbt_/seeds/mapping_categories.csv is excluded by !**/*.csv and included by none
  • dbt_/seeds/references_generations_futures.csv is excluded by !**/*.csv and included by none
  • dbt_/seeds/schema.yml is excluded by none and included by none
  • dbt_/tests/test_metabolite_results.sql is excluded by none and included by none
  • dbt_/tests/test_metabolite_specifique_results.sql is excluded by none and included by none
  • dbt_/tests/test_pesticide_results.sql is excluded by none and included by none
📒 Files selected for processing (1)
  • webapp/lib/polluants.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
webapp/lib/polluants.ts (3)
webapp/components/PollutionSidePanel.tsx (1)
  • PollutionSidePanel (67-226)
webapp/components/PollutionMapMarker.tsx (1)
  • cat (160-175)
webapp/components/PollutionMapLegend.tsx (1)
  • PollutionMapLegend (25-120)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

Comment on lines +403 to 408
sup_limite_qualite_sup_3: {
label: "Concentration > 3 µg/L",
couleur: "#d94801",
couleurFond: "#d94801",
picto: "warning",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Renommage + seuil ESA-métolachlore: OK, mais valider l’alignement côté données

Le passage à sup_limite_qualite_sup_3 avec label “Concentration > 3 µg/L”, picto “warning” et couleur plus sévère #d94801 est cohérent et lisible. Point d’attention: si le backend ou la pipeline de classification envoient encore sup_valeur_sanitaire pour cette sous-catégorie, les composants qui mappent resultat -> categoryDetails.resultats[resultValue] risquent de ne plus trouver de correspondance (et donc pas de couleur/picto).

  • Confirmer que la valeur émise pour ESA-métolachlore est bien sup_limite_qualite_sup_3 pour > 3 µg/L, et que sup_limite_qualite couvre toujours 0,9–3 µg/L.
  • Vérifier qu’aucun code (UI ou data) ne dépend explicitement de l’ancienne clé pour ce polluant.

Proposition de script pour vérifier rapidement les occurrences des clés dans le repo:


🏁 Script executed:

#!/bin/bash
# Liste les occurrences des anciennes/nouvelles clés de résultat
set -euo pipefail
echo "Occurrences de 'sup_valeur_sanitaire' :"
rg -n --no-heading "sup_valeur_sanitaire(?!_)" || true

echo
echo "Occurrences de 'sup_limite_qualite_sup_3' :"
rg -n --no-heading "sup_limite_qualite_sup_3" || true

Length of output: 716


On dirait que rg n’aime pas le lookahead ! Retentons une recherche plus simple pour l’ancienne clé :


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Occurrences de 'sup_valeur_sanitaire' :"
rg -n --no-heading "sup_valeur_sanitaire" || true

Length of output: 1192


Vérifier et mettre à jour la prise en charge de la nouvelle clé sup_limite_qualite_sup_3
Le script montre que l’ancienne clé sup_valeur_sanitaire est toujours largement utilisée dans la couche UI et dans le mapping des couleurs. Si le backend émet désormais sup_limite_qualite_sup_3 pour ESA-métolachlore > 3 µg/L, ces composants ne trouveront plus de correspondance et risquent d’afficher des états absents ou des erreurs.

Fichiers à adapter :

  • webapp/components/PollutionMapLegend.tsx (ligne ~187) : génération de statName sur ${period}_${category}_sup_valeur_sanitaire
  • webapp/components/PollutionMapMarker.tsx (ligne ~312) : attente de la clé "nb_sup_valeur_sanitaire"
  • webapp/lib/colorMapping.ts (lignes ~74–86) : logique qui teste et colore sur nb_sup_valeur_sanitaire

Actions recommandées :

  1. Confirmer avec l’équipe backend que la nouvelle valeur émise est bien sup_limite_qualite_sup_3 et que sup_limite_qualite reste 0,9–3 µg/L.
  2. Étendre ou refactorer le code UI et colorMapping pour gérer également sup_limite_qualite_sup_3 (et son préfixe nb_ le cas échéant).
  3. Ajouter des tests unitaires/viz manuels pour vérifier l’affichage correct du picto, de la couleur et du libellé « Concentration > 3 µg/L ».
🤖 Prompt for AI Agents
In webapp/lib/polluants.ts around lines 403–408 the new key
sup_limite_qualite_sup_3 is defined but the UI and color-mapping still expect
sup_valeur_sanitaire/nb_sup_valeur_sanitaire; update the UI and mapping to
accept the new key and its prefixed count variant: modify
webapp/components/PollutionMapLegend.tsx (≈line 187) to build statName that
checks both `${period}_${category}_sup_valeur_sanitaire` and
`${period}_${category}_sup_limite_qualite_sup_3`, update
webapp/components/PollutionMapMarker.tsx (≈line 312) to read both
"nb_sup_valeur_sanitaire" and "nb_sup_limite_qualite_sup_3", and change
webapp/lib/colorMapping.ts (≈lines 74–86) to include coloring/label/picto logic
for sup_limite_qualite_sup_3 (and its nb_ prefix) mapping to "Concentration > 3
µg/L"; add unit tests or manual checks to ensure picto, color and label render
correctly; confirm backend key with the team before finalizing.

@jereze jereze merged commit 903b667 into main Aug 13, 2025
3 of 4 checks passed
jereze added a commit that referenced this pull request Aug 25, 2025
jereze added a commit that referenced this pull request Aug 25, 2025
* update csv file with references

* calculations for nitrates are now much simpler (following new specs)

* update leng for nitrates

* misc

* forgot to remove this when cleaning in PR #184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant