-
Notifications
You must be signed in to change notification settings - Fork 51
calcul resultats metabolites #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughLa modification porte sur la standardisation des identifiants ( Changes
Suggested labels
Poème
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (11)
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (5)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
dbt_/models/intermediate/pesticide/metabolite/_int__metabolite_models.yml
Outdated
Show resolved
Hide resolved
CURRENT_DATE - datetimeprel < INTERVAL 1 YEAR | ||
), | ||
|
||
latest_datetimeprel_by_cdreseau AS ( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
dbt_/models/intermediate/pesticide/metabolite/_int__resultats_metabolite_divers_udi_dernier.sql
Outdated
Show resolved
Hide resolved
...odels/intermediate/pesticide/metabolite/int__resultats_metabolite_specifique_udi_dernier.sql
Show resolved
Hide resolved
...odels/intermediate/pesticide/metabolite/int__resultats_metabolite_specifique_udi_dernier.sql
Outdated
Show resolved
Hide resolved
Merci @20k-P d'avoir regardé !
|
Summary by CodeRabbit