Skip to content

Conversation

jereze
Copy link
Contributor

@jereze jereze commented Apr 11, 2025

Summary by CodeRabbit

  • Style
    • Uniformisation du format des identifiants pour certaines catégories de métabolites, avec un nouveau style d'identifiant standardisé.

Copy link

coderabbitai bot commented Apr 11, 2025

Walkthrough

La modification porte sur la standardisation des identifiants (id) de plusieurs catégories de métabolites dans le tableau availableCategories du fichier webapp/lib/polluants.ts. Les identifiants concernés passent d’un format en minuscules séparé par des tirets à un format utilisant des underscores et préfixé par metabolite_. Aucun autre aspect de la structure ou des propriétés des catégories n’a été modifié. Il n’y a pas eu de changement dans le contrôle du flux ou la gestion des erreurs.

Changes

Fichier Résumé des modifications
webapp/lib/polluants.ts Mise à jour des champs id pour plusieurs catégories de métabolites : passage d’un format tiret à un format underscore préfixé par metabolite_. Aucune autre modification.

Suggested labels

team-data-analyst

Poème

🎨
Les métabolites changent d’habit,
Tirets s’effacent, underscores s’invitent,
Un préfixe tout neuf, pour plus d’harmonie,
Les identifiants dansent, la norme est ravie !
Merci à l’équipe, pour ce petit coup de magie.
🌱

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 59d042a and 6682f04.

⛔ Files ignored due to path filters (11)
  • .sqlfluff is excluded by none and included by none
  • dbt_/models/intermediate/int__union_resultats_commune.sql is excluded by none and included by none
  • dbt_/models/intermediate/int__union_resultats_udi.sql is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite/_int__metabolite_models.yml is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite/int__resultats_metabolite_specifique_commune_dernier.sql is excluded by none and included by none
  • dbt_/models/intermediate/pesticide/metabolite/int__resultats_metabolite_specifique_udi_dernier.sql is excluded by none and included by none
  • dbt_/models/website/_web__models.yml is excluded by none and included by none
  • dbt_/models/website/web__resultats_communes.sql is excluded by none and included by none
  • dbt_/models/website/web__resultats_udi.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/unique_datetimeprel_per_cdreseau_referenceprel.sql is excluded by none and included by none
📒 Files selected for processing (1)
  • webapp/lib/polluants.ts (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (5)
webapp/lib/polluants.ts (5)

261-261:

✅ Verification successful

Bonne harmonisation de l’ID du métabolite ESA‑métolachlore
L’ID a bien été changé de "metabolites-esa-metolachlore" à "metabolite_esa_metolachlore" pour adopter la convention snake_case.
Merci pour cette clarté ! Assurez-vous cependant qu’aucune référence (tests, composants, services ou clés i18n) n’utilise encore l’ancien identifiant.


🏁 Script executed:

#!/bin/bash
# Vérifie les références à l'ancien ID dans le code
rg -n 'metabolites-esa-metolachlore'

Length of output: 36


Aucune référence résiduelle à l’ancien identifiant
La recherche rg -n 'metabolites-esa-metolachlore' n’a retourné aucun résultat, confirmant qu’il n’existe plus d’occurrence de l’ID précédent dans le code.


367-367:

✅ Verification successful

Uniformisation de l’ID du métabolite Chloridazone desphényl
L’ID est passé à "metabolite_chloridazone_desphenyl" pour respecter la nouvelle convention.
Un petit coup de scan pour s’assurer qu’aucune référence ne traîne avec l’ancien format ?


🏁 Script executed:

#!/bin/bash
# Recherche d'occurrences de l'ancien ID
rg -n 'metabolites-chloridazone-desphenyl'

Length of output: 42


✅ Pas de trace de l’ancien ID
Le scan rg -n 'metabolites-chloridazone-desphenyl' n’a retourné aucune occurrence.
L’ID metabolite_chloridazone_desphenyl est désormais uniforme partout – opération validée !


414-414:

✅ Verification successful

Alignement de l’ID du métabolite Chloridazone methyl desphényl
Le nouvel identifiant "metabolite_chloridazone_methyl_desphenyl" est cohérent avec le snake_case.
Veillez à mettre à jour toute référence (docs, tests, traductions) pointant vers l’ancien "chloridazone-methyl-desphenyl".


🏁 Script executed:

#!/bin/bash
# Recherche d'occurrences de l'ancien ID
rg -n 'chloridazone-methyl-desphenyl'

Length of output: 37


Aucune occurrence résiduelle de l’ancien ID
La commande rg -n 'chloridazone-methyl-desphenyl' n’a retourné aucun résultat : tous les référentiels vers l’ancien identifiant ont bien été mis à jour.


460-460:

❓ Verification inconclusive

Standardisation de l’ID du métabolite Atrazine déséthyl
L’ID est uniformisé en "metabolite_atrazine_desethyl".
N’oubliez pas de vérifier que les composants front, les services et les traductions utilisent bien ce nouveau libellé.


🏁 Script executed:

#!/bin/bash
# Recherche d'occurrences de l'ancien ID
rg -n 'metabolites-atrazine-desethyl'

Length of output: 37


Vérification de l’ID du métabolite Atrazine déséthyl
Aucune occurrence de l’ancien identifiant metabolites-atrazine-desethyl n’a été trouvée suite à la recherche.
Merci de vous assurer que :

  • les composants front
  • les services back
  • les fichiers de traduction

utilisent bien le nouveau libellé metabolite_atrazine_desethyl.


314-314:

✅ Verification successful

Mise à jour cohérente de l’ID du métabolite Chlorothalonil R471811
L’ID est désormais "metabolite_chlorothalonil_r471811", en alignement avec le nouveau format.
Pensez à valider qu’aucun fichier de configuration, test ou traduction ne pointe encore vers l’ancien metabolites-chlorothalonil-r471811.


🏁 Script executed:

#!/bin/bash
# Recherche d'occurrences de l'ancien ID
rg -n 'metabolites-chlorothalonil-r471811'

Length of output: 42


🏁 Script executed:

#!/bin/bash
# Vérification exhaustive des anciennes et nouvelles variantes de l’ID de Chlorothalonil R471811
rg -n --fixed-strings 'metabolites-chlorothalonil-r471811'
rg -n --fixed-strings 'metabolites_chlorothalonil_r471811'
rg -n --fixed-strings 'metabolite-chlorothalonil-r471811'
rg -n --fixed-strings 'metabolite_chlorothalonil_r471811'

Length of output: 314


Validation de la mise à jour de l’ID du métabolite Chlorothalonil R471811
Aucune occurrence de l’ancien identifiant metabolites-chlorothalonil-r471811 n’a été détectée dans le code ; la seule correspondance relevée est la nouvelle valeur à la ligne 314 de webapp/lib/polluants.ts.
Bravo pour cette mise à jour, tout est prêt pour la suite !

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@jereze jereze changed the title calcul resultats metabolites spécifiques calcul resultats metabolites Apr 11, 2025
CURRENT_DATE - datetimeprel < INTERVAL 1 YEAR
),

latest_datetimeprel_by_cdreseau AS (
Copy link
Collaborator

Choose a reason for hiding this comment

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

On ne peut pas fusionner le calcule de latest_datetimeprel_by_cdreseau et latest_referenceprel_results ?

J'ai l'impression que dans les deux cas c'est un MAX GROUP BY cdreseau, sur la même table

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On veut pour chaque cdreseau le referenceprel qui a le datetimeprel le plus récent. Peut-être qu'on peiut faire ça avec une window function mais on aura quand même besoin de deux CTEs pour faire le where row number = 1, non ?

Tu vois une façon de faire ça en une seule CTE ? Si oui, je prends!

Copy link
Collaborator

@20k-P 20k-P Apr 13, 2025

Choose a reason for hiding this comment

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

Est -ce que quelque chose du genre pourrait aller ?

-- latest_by_cdreseau AS (
    SELECT DISTINCT
        cdreseau,
        LAST(datetimeprel) OVER ( PARTITION BY cdreseau ORDER BY datetimeprel DESC/ASC) AS max_datetimeprel,
        LAST(referenceprel) OVER ( PARTITION BY cdreseau ORDER BY datetimeprel DESC/ASC) AS referenceprel
    FROM autres_metabolites_results
  -- )

J'ai un doute sur DESC/ASC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum, je pense que les valeurs retournées par LAST(datetimeprel) et LAST(referenceprel) ne proviennent pas nécessairement de la même ligne d'origine. Chaque fonction LAST() est évaluée indépendamment et du coup on peut avoir une referenceprel qui n'est pas lié à la même datetimeprel.

@jereze
Copy link
Contributor Author

jereze commented Apr 17, 2025

Merci @20k-P d'avoir regardé !

  • sur int__resultats_metabolite_specifique_udi_dernier j'ai appliqué ton conseil de simplification, j'ai ajouté des tests et bien vérifié les résultats à la mano, la logique et simple et proche des autres catégories. donc je vais merge !
  • sur _int__resultats_metabolite_divers_udi_dernier, la spécification de ce qu'on veut calculer est en train de changer (cf slack), ce sera peut-être pas nécessaire de faire le calcul, et on a encore une discussion ouverte sur la simplification possible ou non. du coup je vais supprimer le fichier, cela me permet de merge la PR ce soir, on verra dans une autre PR

@jereze jereze merged commit 463a3eb into main Apr 17, 2025
4 checks passed
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.

2 participants