Skip to content
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(mes-aides): integration aides permis velo #296

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

hlecuyer
Copy link
Contributor

No description provided.

@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from 937e9ea to d0b9fa4 Compare September 17, 2024 14:27
@hlecuyer hlecuyer marked this pull request as ready for review September 17, 2024 15:20
@hlecuyer hlecuyer changed the title Hlecuyer/feat/mes aides/integration aides permis velo feat(mes-aides):integration aides permis velo Sep 17, 2024
@hlecuyer hlecuyer marked this pull request as draft September 17, 2024 15:37
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from d0b9fa4 to 61806d9 Compare September 18, 2024 08:03
@hlecuyer hlecuyer marked this pull request as ready for review September 18, 2024 08:36
Copy link
Contributor

@vmttn vmttn left a comment

Choose a reason for hiding this comment

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

1ère passe rapide :)

@vmttn vmttn changed the title feat(mes-aides):integration aides permis velo feat(mes-aides): integration aides permis velo Sep 18, 2024
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from 1c66198 to 23eb6c5 Compare September 18, 2024 15:33
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from 23eb6c5 to 8cd30cc Compare September 18, 2024 15:58
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from 8cd30cc to 5e5c762 Compare September 19, 2024 06:41
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from e382246 to f96279b Compare October 8, 2024 09:23
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from f96279b to 4c52f8e Compare October 9, 2024 13:33
@hlecuyer hlecuyer added the deploy-to-staging Permet d'activer le déploiement de la PR en staging. label Oct 9, 2024
@vmttn vmttn removed the deploy-to-staging Permet d'activer le déploiement de la PR en staging. label Oct 15, 2024
Copy link
Contributor

@vmttn vmttn left a comment

Choose a reason for hiding this comment

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

pas grand chose à dire, c'est propre ✨ juste quelques renommages + quelques tests à ajouter pour bien dormir 😴

Comment on lines 16 to 17
STRING_TO_ARRAY(data #>> '{fields,Liaisons Besoins}', ', ') AS "liaisons_besoins_mes_aides",
data #>> '{fields,Slug Thématiques}' AS "slug_thematique_mes_aides",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
STRING_TO_ARRAY(data #>> '{fields,Liaisons Besoins}', ', ') AS "liaisons_besoins_mes_aides",
data #>> '{fields,Slug Thématiques}' AS "slug_thematique_mes_aides",
STRING_TO_ARRAY(data #>> '{fields,Liaisons Besoins}', ', ') AS "liaisons_besoins",
data #>> '{fields,Slug Thématiques}' AS "slug_thematiques",

Comment on lines 26 to 27
data #>> '{fields,SIRET}' AS "siret_structure",
data #>> '{fields,Slug Organisme}' AS "slug_organisme_structure",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
data #>> '{fields,SIRET}' AS "siret_structure",
data #>> '{fields,Slug Organisme}' AS "slug_organisme_structure",
data #>> '{fields,SIRET}' AS "siret",
data #>> '{fields,Slug Organisme}' AS "slug_organisme",

Comment on lines 29 to 30
data #>> '{fields,Nom Organisme}' AS "nom_organisme_structure",
data #>> '{fields,Organisme Type}' AS "typologie_structure",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
data #>> '{fields,Nom Organisme}' AS "nom_organisme_structure",
data #>> '{fields,Organisme Type}' AS "typologie_structure",
data #>> '{fields,Nom Organisme}' AS "nom_organisme",
data #>> '{fields,Organisme Type}' AS "organisme_type",

_di_source_id AS "_di_source_id",
data #>> '{fields,ID}' AS "id",
TRIM(SUBSTRING(data #>> '{fields,Liaisons Villes}' FROM '^(.*) \(')) AS "liaisons_ville_nom",
TRIM(SUBSTRING(data #>> '{fields,Liaisons Villes}' FROM '\((\d+)\)$')) AS "liaisons_code_postal",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TRIM(SUBSTRING(data #>> '{fields,Liaisons Villes}' FROM '\((\d+)\)$')) AS "liaisons_code_postal",
TRIM(SUBSTRING(data #>> '{fields,Liaisons Villes}' FROM '\((\d+)\)$')) AS "liaisons_ville_code_postal",

Copy link
Contributor

Choose a reason for hiding this comment

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

reprends au maximum le nom des colonnes d'origine, ça facilite grandement la compréhension du mapping

WHEN LENGTH(permis_velo.description) > 280 THEN SUBSTRING(permis_velo.description FROM 1 FOR 277) || '...'
ELSE permis_velo.description
END AS "presentation_resume",
permis_velo.description || COALESCE(E'\n\n' || permis_velo.bon_a_savoir, '') || COALESCE(E'\n\n' || permis_velo.modalite_versement, '') AS "presentation_detail",
Copy link
Contributor

Choose a reason for hiding this comment

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

attention cette ligne est hyper longue et ça dégrade la visilibité en PR sur GH ^

NULL AS "horaires_ouverture",
NULL AS "accessibilite",
CASE
WHEN permis_velo.typologie_structure LIKE '%Mission locale%' THEN ARRAY['mission-locale']
Copy link
Contributor

Choose a reason for hiding this comment

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

insensible à la casse

Suggested change
WHEN permis_velo.typologie_structure LIKE '%Mission locale%' THEN ARRAY['mission-locale']
WHEN permis_velo.typologie_structure ~* 'mission locale' THEN ARRAY['mission-locale']

- name: stg_mes_aides__garages
- name: stg_mes_aides__permis_velo
Copy link
Contributor

@vmttn vmttn Oct 17, 2024

Choose a reason for hiding this comment

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

est-ce que tu pourrais ajouter quelques data_tests ? au minimum je dirais :

  • id : not_null, dbt_utils.not_empty_string, unique
  • date_maj : not_null, not_constant

mais je pense que ça serait bien de faire quelques checks sur les valeurs prédéfinies. Par exemple, le champ type contient Aide financière, Prestation et Accompagnement et ton mapping en dépend. Si une de ces valeurs est renommée, ça sera complément silencieux, il n'y aura juste plus de valeur mappée.

Pour tester ça simplement, je dirais qu'il faut faire comme pour fredo : dans models/staging/sources/mes_aides/ voir models/staging/sources/mes_aides/permis_velo tu crées des models supplémentaires où tu UNNEST : stg_mes_aides__permis_velo__types, etc. et là tu peux ajouter un data_test de type accepted_values.

(d'ailleurs je n'ai pas mis de tests pour les garages c'est dommage :))

@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch 3 times, most recently from 230ce5c to 0314344 Compare October 22, 2024 15:57
@hlecuyer hlecuyer added the deploy-to-staging Permet d'activer le déploiement de la PR en staging. label Oct 24, 2024
@hlecuyer hlecuyer force-pushed the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch from 5dbfca5 to 56835c2 Compare October 24, 2024 12:37
@hlecuyer hlecuyer merged commit b6787ec into main Oct 24, 2024
6 checks passed
@hlecuyer hlecuyer deleted the hlecuyer/feat/mes-aides/integration-aides-permis-velo branch October 24, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-to-staging Permet d'activer le déploiement de la PR en staging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants