Skip to content

Commit

Permalink
update stg_orga BE + add orga BE to taux_transfo_prescripteurs
Browse files Browse the repository at this point in the history
  • Loading branch information
laurinehu committed Oct 20, 2023
1 parent 85ba863 commit 5d43244
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions dbt/models/marts/taux_transformation_prescripteurs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ select
c.*,
organisations_libelles.libelle as type_auteur_diagnostic_detaille,
prescripteurs.type_prescripteur as type_prescripteur,
prescripteurs.zone_emploi as bassin_emploi_prescripteur,
prescripteurs."nom_département" as "nom_département_prescripteur",
prescripteurs."région" as "nom_région_prescripteur",
case
Expand Down
7 changes: 1 addition & 6 deletions dbt/models/staging/stg_organisations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@ select
from {{ source('emplois', 'organisations_v0') }} as organisations
left join {{ ref('organisations_libelles') }} as organisations_libelles
on organisations.type = organisations_libelles.type
-- (laurine) temporary : this join is made on a cleaned version of organisations.ville
-- and based on a levenshtein distance with the clean libelle_commune of the insee table
-- (cedex and integers are remove and the levenshtein distance helps to ignore typo errors or misleading accents)
-- This is done like this as long as the organisations.ville entries are yet not cleaned
-- but it will be removed when c1 work on adressses will be finished.
left join {{ ref('stg_insee_appartenance_geo_communes') }} as appartenance_geo_communes
on levenshtein(unaccent(regexp_replace(regexp_replace(initcap(ville), ' \d+', '', 'g'), ' Cedex ?', '')), unaccent(appartenance_geo_communes.libelle_commune)) < 1 and ltrim(organisations."département", '0') = appartenance_geo_communes.code_dept
on organisations.code_commune = ltrim(appartenance_geo_communes.code_insee, '0')

0 comments on commit 5d43244

Please sign in to comment.