Skip to content

Commit

Permalink
chore(pipeline) : Sourcefix for mednum/sud-labs
Browse files Browse the repository at this point in the history
  • Loading branch information
vperron committed Oct 14, 2024
1 parent 3017004 commit 53fb177
Showing 1 changed file with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@ WITH source AS (

final AS (
SELECT
_di_source_id AS "_di_source_id",
CAST(ARRAY(SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'thematiques', 'null'))) AS TEXT []) AS "thematiques",
CAST((data ->> 'longitude') AS FLOAT) AS "longitude",
CAST((data ->> 'latitude') AS FLOAT) AS "latitude",
CAST((data ->> 'date_maj') AS TIMESTAMP WITH TIME ZONE) AS "date_maj",
CAST(ARRAY(SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'labels_nationaux', 'null'))) AS TEXT []) AS "labels_nationaux",
CAST(ARRAY(SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'labels_autres', 'null'))) AS TEXT []) AS "labels_autres",
data ->> 'id' AS "id",
data ->> 'nom' AS "nom",
NULLIF(data ->> 'siret', REPEAT('0', 14)) AS "siret",
data ->> 'source' AS "source",
NULLIF(TRIM(data ->> 'adresse'), '') AS "adresse",
NULLIF(TRIM(data ->> 'commune'), '') AS "commune",
NULLIF(TRIM(data ->> 'courriel'), '') AS "courriel",
data ->> 'site_web' AS "site_web",
NULLIF(TRIM(data ->> 'telephone'), '') AS "telephone",
data ->> 'code_postal' AS "code_postal",
data ->> 'code_insee' AS "code_insee",
data ->> 'horaires_ouverture' AS "horaires_ouverture",
data ->> 'typologie' AS "typologie",
data ->> 'presentation_resume' AS "presentation_resume",
data ->> 'accessibilite' AS "accessibilite",
data ->> 'presentation_detail' AS "presentation_detail"
_di_source_id AS "_di_source_id",
CAST(ARRAY(SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'thematiques', 'null'))) AS TEXT []) AS "thematiques",
CAST((data ->> 'longitude') AS FLOAT) AS "longitude",
CAST((data ->> 'latitude') AS FLOAT) AS "latitude",
CAST((data ->> 'date_maj') AS TIMESTAMP WITH TIME ZONE) AS "date_maj",
-- SOURCEFIX(2024-10-14)
ARRAY_REMOVE(CAST(ARRAY(
SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'labels_nationaux', 'null'))
) AS TEXT []), 'sud-labs') AS "labels_nationaux",
CAST(ARRAY(SELECT * FROM JSONB_ARRAY_ELEMENTS_TEXT(NULLIF(data -> 'labels_autres', 'null'))) AS TEXT []) AS "labels_autres",
data ->> 'id' AS "id",
data ->> 'nom' AS "nom",
NULLIF(data ->> 'siret', REPEAT('0', 14)) AS "siret",
data ->> 'source' AS "source",
NULLIF(TRIM(data ->> 'adresse'), '') AS "adresse",
NULLIF(TRIM(data ->> 'commune'), '') AS "commune",
NULLIF(TRIM(data ->> 'courriel'), '') AS "courriel",
data ->> 'site_web' AS "site_web",
NULLIF(TRIM(data ->> 'telephone'), '') AS "telephone",
data ->> 'code_postal' AS "code_postal",
data ->> 'code_insee' AS "code_insee",
data ->> 'horaires_ouverture' AS "horaires_ouverture",
data ->> 'typologie' AS "typologie",
data ->> 'presentation_resume' AS "presentation_resume",
data ->> 'accessibilite' AS "accessibilite",
data ->> 'presentation_detail' AS "presentation_detail"
FROM source
WHERE
data ->> 'source' != 'dora'
Expand Down

0 comments on commit 53fb177

Please sign in to comment.