Skip to content

Commit

Permalink
chore(pipeline) : Fix naming inconsistency
Browse files Browse the repository at this point in the history
france-travail was the only source to have an intermediate table name in
"agences" instead of "structures".

At this stage it should be normalized.
  • Loading branch information
vperron committed Jul 18, 2024
1 parent ec33995 commit 3523c94
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pipeline/dbt/models/intermediate/int__union_structures.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
WITH structures AS (
{{
{{
dbt_utils.union_relations(
relations=[
ref('int_action_logement__structures'),
Expand All @@ -10,7 +10,7 @@ WITH structures AS (
ref('int_cd72__structures'),
ref('int_emplois_de_linclusion__structures'),
ref('int_finess__structures'),
ref('int_france_travail__agences'),
ref('int_france_travail__structures'),
ref('int_mediation_numerique__structures'),
ref('int_mes_aides__structures'),
ref('int_monenfant__structures'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ models:
tests:
- not_null
- relationships:
to: ref('int_france_travail__agences')
to: ref('int_france_travail__structures')
field: id
- name: adresse_id
tests:
Expand All @@ -37,7 +37,7 @@ models:
to: ref('int_france_travail__adresses')
field: id

- name: int_france_travail__agences
- name: int_france_travail__structures
tests:
- check_structure:
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WITH services AS (
),

agences AS (
SELECT * FROM {{ ref('int_france_travail__agences') }}
SELECT * FROM {{ ref('int_france_travail__structures') }}
),

adresses AS (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ WITH source AS (

final AS (
SELECT
_di_source_id AS "_di_source_id",
CURRENT_DATE AS "date_maj",
_di_source_id AS "_di_source_id",
CURRENT_DATE AS "date_maj",
CASE WHEN data ->> 'dispositifADEDA' = 'true' THEN 'https://www.francetravail.fr/actualites/a-laffiche/2022/adeda-un-dispositif-pour-mieux-a.html' END AS "accessibilite",
CAST(data #>> '{adressePrincipale,gpsLat}' AS FLOAT) AS "latitude",
CAST(data #>> '{adressePrincipale,gpsLon}' AS FLOAT) AS "longitude",
data #>> '{adressePrincipale,ligne4}' AS "adresse",
data #>> '{adressePrincipale,ligne3}' AS "complement_adresse",
data #>> '{adressePrincipale,communeImplantation}' AS "code_insee",
data #>> '{adressePrincipale,bureauDistributeur}' AS "code_postal",
data #>> '{contact,email}' AS "courriel",
data #>> '{contact,telephonePublic}' AS "telephone",
data ->> 'code' AS "id",
data ->> 'libelleEtendu' AS "nom",
data ->> 'siret' AS "siret",
data ->> 'type' AS "typologie"
CAST(data #>> '{adressePrincipale,gpsLat}' AS FLOAT) AS "latitude",
CAST(data #>> '{adressePrincipale,gpsLon}' AS FLOAT) AS "longitude",
data #>> '{adressePrincipale,ligne4}' AS "adresse",
data #>> '{adressePrincipale,ligne3}' AS "complement_adresse",
data #>> '{adressePrincipale,communeImplantation}' AS "code_insee",
data #>> '{adressePrincipale,bureauDistributeur}' AS "code_postal",
data #>> '{contact,email}' AS "courriel",
data #>> '{contact,telephonePublic}' AS "telephone",
data ->> 'code' AS "id",
data ->> 'libelleEtendu' AS "nom",
data ->> 'siret' AS "siret",
data ->> 'type' AS "typologie"
FROM source
)

Expand Down

0 comments on commit 3523c94

Please sign in to comment.