-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pipeline): remove district codes from zdf
Currently zone_diffusion_code can contain district codes introduced by geocodings. This is a side effect from our previous work on district codes. This leads to services being only discoverable using the district codes, not city codes. We can easily make the assumption that, in real life, services are never confined to districts. Therefore we dont want to allow a district zdf type. This commit replaces district codes by city codes for the zdf.
- Loading branch information
Showing
6 changed files
with
115 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...t/models/staging/decoupage_administratif/stg_decoupage_administratif__arrondissements.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
WITH source AS ( | ||
{{ stg_source_header('decoupage_administratif', 'arrondissements') }} | ||
), | ||
|
||
final AS ( | ||
SELECT | ||
code AS "code", | ||
nom AS "nom", | ||
"codeRegion" AS "code_region", | ||
"codeDepartement" AS "code_departement", | ||
CASE | ||
WHEN LEFT(code, 3) = '751' THEN '75056' -- Paris | ||
WHEN LEFT(code, 3) = '693' THEN '69123' -- Lyon | ||
WHEN LEFT(code, 3) = '132' THEN '13055' -- Marseille | ||
END AS "code_commune", | ||
ST_GEOMFROMGEOJSON(centre) AS "centre", | ||
"codesPostaux" AS "codes_postaux" | ||
FROM source | ||
ORDER BY code | ||
) | ||
|
||
SELECT * FROM final |
42 changes: 10 additions & 32 deletions
42
...line/dbt/models/staging/decoupage_administratif/stg_decoupage_administratif__communes.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters