-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(analytics) : Ajout d'une sous-application analytics #144
base: main
Are you sure you want to change the base?
Conversation
Use the base DBT skeleton, as created by the "dbt init" command. We'll then modify it incrementally, to keep the reader aware of the changes.
We'll change them incrementally as well.
TODO: - reference sources correctly through a YML - declare the index correctly in a _models.yml
Timed at 4 minutes an execution at the time of writing.
|
||
final AS ( | ||
SELECT * FROM orientations | ||
WHERE CAST(creation_date AS DATE) >= '2024-07-01' |
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.
ça me paraît un peu fort quand même ces conditions temporelles, ça sort d'où 07/2024 ?
perso je mettrais rien pour ne pas être bloqués si on veut par exemple comparer l'évolution mensuelle d'une année à une autre ?
CASE | ||
WHEN | ||
src.modification_date + '240 days' <= NOW() | ||
AND src.status = 'PUBLISHED' | ||
THEN 'REQUIRED' | ||
WHEN | ||
src.modification_date + '180 days' <= NOW() | ||
AND src.status = 'PUBLISHED' | ||
THEN 'NEEDED' | ||
ELSE 'NOT_NEEDED' | ||
END AS update_status |
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.
ça me semble utile un petit comm pour expliquer ça, non ?
final AS ( | ||
SELECT | ||
services.*, | ||
CONCAT('https://dora.inclusion.beta.gouv.fr/services/', services.slug) AS dora_url |
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.
c'est peut-être overkill mais je l'ai vu passer deux fois et j'adore les macros donc je me demandais s'il n'était pas opportun d'en faire une petite 0:)
{% macro dora_url(resource, slug) %}
CONCAT('https://dora.inclusion.beta.gouv.fr/', resource, '/', slug)
{% endmacro %}
dora_url("services", services.slug) as dora_url
en l'écrivant je me dis qu'on perd peut-être en lisibilité dans le code (mais j'aime trop les macros donc je laisse la proposition)
CONCAT('https://dora.inclusion.beta.gouv.fr/structures/', slug) AS dora_url | ||
FROM src | ||
structures.*, | ||
CONCAT('https://dora.inclusion.beta.gouv.fr/structures/', structures.slug) AS dora_url |
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.
et du coup
dora_url("structures", structures.slug) as dora_url
Les commits sont découpés pour aider à la compréhension.
L'idée est de passer doucement d'un modèle avec des scripts SQL non managés dans dora-back, à:
dora-analytics
, avec sa propre base PostgreSQL)dora-back-prod
dora-analytics
, avec le SSO Google et des permissions strictesLes deux Metabase peuvent coexister en attendant, de même que les scripts de synchronisation actuels.
Les questions et dashboards les plus utiles seront à porter individuellement dans le nouveau Metabase en faisant attention aux bonnes pratiques Metabase , cc @laurinehu .