Skip to content

Commit

Permalink
chore(pipeline): remove bad zone diffusion codes
Browse files Browse the repository at this point in the history
  • Loading branch information
vmttn committed Sep 19, 2024
1 parent 81b4357 commit dd1d76c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 10 additions & 1 deletion pipeline/dbt/macros/domain/checks/check_service.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ 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_code ~ '^(\d{9}|\w{5}|\w{2,3}|\d{2})$'"),
(
"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_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: 0 additions & 10 deletions pipeline/dbt/models/intermediate/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,18 @@ 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 dd1d76c

Please sign in to comment.