Created
November 3, 2020 14:59
-
-
Save ColinMaudry/1190e06a3413f71df5ca058e2d9b35be to your computer and use it in GitHub Desktop.
Script pour la création de la liste des délégataires de service public à partir des DECP
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
#!/bin/bash | |
# Vous devez installer jq https://stedolan.github.io/jq/ | |
# decp.json : https://www.data.gouv.fr/fr/datasets/5cd57bf68b4c4179299eb0e9/#resource-16962018-5c31-4296-9454-5998585496d2 | |
echo "nom,id,typeId" > delegataires-service-public.csv | |
jq '[.marches[] | select(.nature == "Délégation de service public") | .concessionnaires[] ] | unique_by(.id) | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $rows[] | @csv ' json/decp.json | sort -u | sed 's/[\\"]//g' >> delegataires-service-public.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment