diff --git a/dbt/models/marts/taux_transformation_prescripteurs.sql b/dbt/models/marts/taux_transformation_prescripteurs.sql index 7c2f9ae3..65bf45b3 100644 --- a/dbt/models/marts/taux_transformation_prescripteurs.sql +++ b/dbt/models/marts/taux_transformation_prescripteurs.sql @@ -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 diff --git a/dbt/models/staging/stg_organisations.sql b/dbt/models/staging/stg_organisations.sql index a4f2b2cd..e4cf9f5b 100644 --- a/dbt/models/staging/stg_organisations.sql +++ b/dbt/models/staging/stg_organisations.sql @@ -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')