Aller au contenu

Scripts d'ingestion

État des scripts ingest_*.py et leurs tables cibles.

Scripts existants

Script Source Table(s) Statut Notes
ingest_housing_rp.py RP logements rp_housing Direct mode disponible
ingest_housing_rp_direct.py RP logements rp_housing Performance optimisée
ingest_rpls.py RPLS rpls Parc social
ingest_lovac_zonage.py LOVAC + Zonage ABC lovac, zonage_abc
ingest_sante.py RPPS + FINESS rpps, finess
ingest_social.py CAF + aides dept. caf_communal, aides_dept
ingest_epci.py COG EPCI epci
ingest_arrondissements.py COG arrondissements PLM fix
ingest_finances_omphale.py DGFiP + OMPHALE finances_communes, projections
ingest_cadastre.py Cadastre national parcelles ⚠️ Réimport 99 fichiers dept en cours
ingest_cadastre_commune.py Cadastre commune parcelles Fallback unitaire
ingest_cadastre_national.py Cadastre national parcelles ⚠️ Legacy
ingest_paris.py RP Paris Arrondissements
ingest_lyon.py RP Lyon Arrondissements
ingest_marseille.py RP Marseille Arrondissements
ingest_school_urbanisme.py Equipements scolaires education
import_dvf_light.py DVF dvf_staging + dvf ⚠️ Batch 50K (après crash 100K)
migrate_dvf.sh DVF dvf ⚠️ Pipeline complet

Scripts à créer (Sprint 1+)

Script Source Table cible Sprint
ingest_anil.py ANIL MEF-DHUP anil_loyers S1
ingest_dpe_ademe.py ADEME API live dpe_logements S1 (ou live)
ingest_bpe.py BPE 2024 bpe_equipements S1
ingest_sne.py SNE DHUP sne_demandes_social futur (LOG-05)
ingest_cpam.py CPAM cpam_beneficiaires futur (SOC-02)
ingest_sirene.py SIRENE sirene_etablissements bloqué (upload Marc)

Conventions

  • Python 3.10+ avec asyncpg pour ingestion async
  • Chunking : 50 000 lignes max par batch (leçon DVF crash 100K)
  • Encoding : vérifier toujours (bug encoding DVF UTF-16LE)
  • Idempotence : INSERT ... ON CONFLICT DO UPDATE
  • Logs : fichier *_progress.log avec progression %

Réimports en cours

  • DVF : batch 50K, 6 premiers départements OK, reste à finir
  • Cadastre : 99 fichiers département à traiter un par un