Skip to content

Commit

Permalink
fix(pipeline): revert bad diffusion codes removal
Browse files Browse the repository at this point in the history
This reverts commit dd1d76c.
  • Loading branch information
vmttn committed Sep 19, 2024
1 parent dd1d76c commit 245ea9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 1 addition & 10 deletions pipeline/dbt/macros/domain/checks/check_service.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,7 @@ BEGIN
("modes_accueil", "modes_accueil IS NULL OR modes_accueil <@ ARRAY(SELECT m.value FROM " ~ ref('modes_accueil') ~ "AS m)"),
("modes_orientation_accompagnateur", "modes_orientation_accompagnateur IS NULL OR modes_orientation_accompagnateur <@ ARRAY(SELECT m.value FROM " ~ ref('modes_orientation_accompagnateur') ~ "AS m)"),
("modes_orientation_beneficiaire", "modes_orientation_beneficiaire IS NULL OR modes_orientation_beneficiaire <@ ARRAY(SELECT m.value FROM " ~ ref('modes_orientation_beneficiaire') ~ "AS m)"),
(
"zone_diffusion_code",
"zone_diffusion_code IS NULL
OR zone_diffusion_type = 'pays'
OR zone_diffusion_type = 'region' AND zone_diffusion_code IN (SELECT code FROM " ~ ref('stg_decoupage_administratif__regions') ~ ")
OR zone_diffusion_type = 'departement' AND zone_diffusion_code IN (SELECT code FROM " ~ ref('stg_decoupage_administratif__departements') ~ ")
OR zone_diffusion_type = 'epci' AND zone_diffusion_code IN (SELECT code FROM " ~ ref('stg_decoupage_administratif__epcis') ~ ")
OR zone_diffusion_type = 'commune' AND zone_diffusion_code IN (SELECT code FROM " ~ ref('stg_decoupage_administratif__communes') ~ ")
"
),
("zone_diffusion_code", "zone_diffusion_code IS NULL OR zone_diffusion_code ~ '^(\d{9}|\w{5}|\w{2,3}|\d{2})$'"),
("zone_diffusion_type", "zone_diffusion_type IS NULL OR zone_diffusion_type IN (SELECT t.value FROM " ~ ref('zones_de_diffusion_types') ~ "AS t)"),
]
%}
Expand Down
10 changes: 10 additions & 0 deletions pipeline/dbt/models/intermediate/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,28 @@ models:
to: ref('stg_decoupage_administratif__regions')
field: code
where: "zone_diffusion_type = 'region'"
# TODO(vmttn): prevent false codes from being propagated downstream
# and set back severity to error
config:
severity: warn
- relationships:
to: ref('stg_decoupage_administratif__departements')
field: code
where: "zone_diffusion_type = 'departement'"
config:
severity: warn
- relationships:
to: ref('stg_decoupage_administratif__epcis')
field: code
where: "zone_diffusion_type = 'epci'"
config:
severity: warn
- relationships:
to: ref('stg_decoupage_administratif__communes')
field: code
where: "zone_diffusion_type = 'commune'"
config:
severity: warn

- name: int__union_structures__enhanced

Expand Down

0 comments on commit 245ea9a

Please sign in to comment.