Skip to content

Instantly share code, notes, and snippets.

@ColinMaudry
Last active October 4, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColinMaudry/78bd2fa840b3a10225d9f4ce61a2f678 to your computer and use it in GitHub Desktop.
Save ColinMaudry/78bd2fa840b3a10225d9f4ce61a2f678 to your computer and use it in GitHub Desktop.
Étapes de transformation du CSV des marchés publics bretons vers le format JSON réglementaire (jq 1.5)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Nmarché;SIRETMandataire;LibelleEntiteMandataire;SIRETAcheteur;LibelleAcheteur;Nature;Objet;CodeCPV;Type ;Procedure;CodePostalCommuneExecution;NomCommuneExecution;CodeINSEEExecution;GranulariteINSEEExecution;MillesimeMandatement;DateNotification;Montant mandate TTC;Montant mandate HT;Montant attribue TTC;Montant attribue HT;Date de cloture;Duree;SIRETContractant;DenominationSociale;Role;CodePostal;Dpt ID ;Département;Commune;Taille;Taille des entreprises par categorie officielle;Code NAF;Libelle NAF;Libelle SBA;Libelle CCI;geolocalisation
2013-90006;;Région Bretagne;;;;PBF Formation qualifiante 2013 Monteur en construction bois lot 4;;Services;MAPA - art 30 - au dessus des seuils;35000;Rennes;;;2013;2013-10-01;245526;;245526;;;;300599123;AFPA DIRECTION REGIONALE BRETAGNE;Titulaire;35208;35;Ille-et-Vilaine;RENNES;10 000 et plus;Grande entreprise;8559;ENSEIGNEMENT;Administration publique/enseignement;Tertiaire non marchand;
2013-90144;;Région Bretagne;;;;Dispositif de formations : Compétences clés 2013 - Lot 1;;Services;MAPA - art 30 - au dessus des seuils;;;;;2013;2013-01-01;0;;200817;;;;192900710;GRETA BRETAGNE OCCIDENTALE;Titulaire;29104;29;Finistère;PLUGUFFAN;100 à 199;PME;8559;ENSEIGNEMENT;Administration publique/enseignement;Tertiaire non marchand;
[
{
"Nmarché": "2013-90006",
"SIRETMandataire": null,
"LibelleEntiteMandataire": "Région Bretagne",
"SIRETAcheteur": null,
"LibelleAcheteur": null,
"Nature": null,
"Objet": "PBF Formation qualifiante 2013 Monteur en construction bois lot 4",
"CodeCPV": null,
"Type ": "Services",
"Procedure": "MAPA - art 30 - au dessus des seuils",
"CodePostalCommuneExecution": 35000,
"NomCommuneExecution": "Rennes",
"CodeINSEEExecution": null,
"GranulariteINSEEExecution": null,
"MillesimeMandatement": 2013,
"DateNotification": "2013-10-01",
"Montant mandate TTC": 245526,
"Montant mandate HT": null,
"Montant attribue TTC": 245526,
"Montant attribue HT": null,
"Date de cloture": null,
"Duree": null,
"SIRETContractant": 300599123,
"DenominationSociale": "AFPA DIRECTION REGIONALE BRETAGNE",
"Role": "Titulaire",
"CodePostal": 35208,
"Dpt ID ": 35,
"Département": "Ille-et-Vilaine",
"Commune": "RENNES",
"Taille": "10 000 et plus",
"Taille des entreprises par categorie officielle": "Grande entreprise",
"Code NAF": 8559,
"Libelle NAF": "ENSEIGNEMENT",
"Libelle SBA": "Administration publique/enseignement",
"Libelle CCI": "Tertiaire non marchand",
"geolocalisation": null
},
{
"Nmarché": "2013-90144",
"SIRETMandataire": null,
"LibelleEntiteMandataire": "Région Bretagne",
"SIRETAcheteur": null,
"LibelleAcheteur": null,
"Nature": null,
"Objet": "Dispositif de formations : Compétences clés 2013 - Lot 1",
"CodeCPV": null,
"Type ": "Services",
"Procedure": "MAPA - art 30 - au dessus des seuils",
"CodePostalCommuneExecution": null,
"NomCommuneExecution": null,
"CodeINSEEExecution": null,
"GranulariteINSEEExecution": null,
"MillesimeMandatement": 2013,
"DateNotification": "2013-01-01",
"Montant mandate TTC": 0,
"Montant mandate HT": null,
"Montant attribue TTC": 200817,
"Montant attribue HT": null,
"Date de cloture": null,
"Duree": null,
"SIRETContractant": 192900710,
"DenominationSociale": "GRETA BRETAGNE OCCIDENTALE",
"Role": "Titulaire",
"CodePostal": 29104,
"Dpt ID ": 29,
"Département": "Finistère",
"Commune": "PLUGUFFAN",
"Taille": "100 à 199",
"Taille des entreprises par categorie officielle": "PME",
"Code NAF": 8559,
"Libelle NAF": "ENSEIGNEMENT",
"Libelle SBA": "Administration publique/enseignement",
"Libelle CCI": "Tertiaire non marchand",
"geolocalisation": null
}
]
{
"$schema": "https://raw.githubusercontent.com/etalab/format-commande-publique/master/sch%C3%A9mas/json/paquet.json",
"marches" : [.[] | {
id: ."Nmarché",
acheteur: {
id: .SIRETMandataire,
nom: .LibelleEntiteMandataire
},
nature: .Nature,
objet: .Objet,
codeCPV: .CodeCPV,
procedure: $procedures[0][.Procedure // "bla"],
lieuExecution: {
code: ( .CodeINSEEExecution //.CodePostalCommuneExecution),
nom: .NomCommuneExecution,
typeCode: (if .CodeINSEEExecution != null then "Code commune" elif .CodePostalCommuneExecution != null then "Code postal" else null end)
},
dateNotification: .DateNotification,
montant: ."Montant Attribue HT",
dureeMois: null,
titulaires: {
id: .SIRETContractant,
denominationSociale: .DenominationSociale
}
}
]
}
{
"MAPA - art 28": "Procédure adaptée",
"MAPA - art 30 - au dessus des seuils": "Procédure adaptée",
"MAPA - art 30 - en dessous des seuils": "Procédure adaptée",
"Proc. adaptée/allégée (art.28et30)": "Procédure adaptée",
"Procédure adaptée (MAPA)": "Procédure adaptée",
"Appel d\u0027offre ouvert": "Appel d\u0027offres ouvert",
"appel d\u0027offres ouvert": "Appel d\u0027offres ouvert",
"Appel d\u0027offre ouvert (art.33)": "Appel d\u0027offres ouvert",
"Appel d\u0027offre restreint": "Appel d\u0027offres restreint",
"Achat direct": "Marché négocié sans publicité ni mise en concurrence préalable",
"Négocié avec pub (art.35I)": "Procédure négociée avec mise en concurrence préalable",
"Procédure négociée après pub": "Procédure négociée avec mise en concurrence préalable",
"Procédure négociée après pub.": "Procédure négociée avec mise en concurrence préalable",
"Procédure négociée sans pub": "Marché négocié sans publicité ni mise en concurrence préalable",
"Procédure négociée sans pub.": "Marché négocié sans publicité ni mise en concurrence préalable",
"Marché négocié": "Marché négocié sans publicité ni mise en concurrence préalable",
"marché négocié": "Marché négocié sans publicité ni mise en concurrence préalable",
"Marché negocié": "Marché négocié sans publicité ni mise en concurrence préalable"
}
{
"$schema": "https://raw.githubusercontent.com/etalab/format-commande-publique/master/sch%C3%A9mas/json/paquet.json",
"marches": [
{
"id": "2013-90006",
"acheteur": {
"id": null,
"nom": "Région Bretagne"
},
"nature": null,
"objet": "PBF Formation qualifiante 2013 Monteur en construction bois lot 4",
"codeCPV": null,
"procedure": "Procédure adaptée",
"lieuExecution": {
"code": 35000,
"nom": "Rennes",
"typeCode": "Code postal"
},
"dateNotification": "2013-10-01",
"montant": null,
"dureeMois": null,
"titulaires": {
"id": 300599123,
"denominationSociale": "AFPA DIRECTION REGIONALE BRETAGNE"
}
},
{
"id": "2013-90144",
"acheteur": {
"id": null,
"nom": "Région Bretagne"
},
"nature": null,
"objet": "Dispositif de formations : Compétences clés 2013 - Lot 1",
"codeCPV": null,
"procedure": "Procédure adaptée",
"lieuExecution": {
"code": null,
"nom": null,
"typeCode": null
},
"dateNotification": "2013-01-01",
"montant": null,
"dureeMois": null,
"titulaires": {
"id": 192900710,
"denominationSociale": "GRETA BRETAGNE OCCIDENTALE"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment