# Commune panels exported from house: sources

Exported on 2026-10-19 from the sibling repository `house` (hexagn), commit
`7c750a6a56dadf80771d2e29dfdf877e698e157d` (clean, as every manifest's
`commit` says), by its own command:

```
/Users/samoht/git/house/_build/default/bin/db/main.exe export \
  --db /Users/samoht/git/house/france.db --out DIR
```

(the built binary of `opam exec --switch=<house> -- dune exec --root <house>
bin/db/main.exe -- export ...`, `hexagn-db export` once installed). Once
house's server is live, `hexagn-db export --from https://hexagn.fr/api/export/
--out DIR` fetches the same bytes and checks each file against the SHA-256 of
the index and of its manifest.

Nothing in this repository reads `france.db`. Each `TABLE.csv` has its
manifest `TABLE.json` beside it: its columns (kind, unit, description,
source, derivation), its sources with every input file's URL, size and
SHA-256, its fetch record, the CSV's own SHA-256 and row count, its
geography and the codes it dropped, its notes, house's commit, and a
`credits` block: for each source the citation to print, the short
attribution, the citation the source asks for, its producer and the date
of its last update, and its licence where it has one. The data page prints
all of it beside each table. Two exports of the same data from the
same commit write the same bytes.

## Geography

Every row is a commune of the COG of 2025 (34,875 communes, those in force on
1 January 2025), Paris, Lyon and Marseille as the whole cities 75056, 69123
and 13055, their arrondissements summed into them. The column `geography`
says how a row was placed: `exact` (published under this code, unchanged
since), `summed` (several published codes, or one since renamed, summed into
it), `partial` (a part of the commune has no row that year, so the sum lacks
part of its territory), `wider` (a published code that handed land to another
commune: the row covers more than the commune); `membership.csv` has
`exact`, `merged` (codes landing on the commune in the same areas) and
`mixed` (in different areas, those cells empty). `published_as` gives the
source codes. A `partial` or `wider` row does not describe the commune and
should be left out of any per-commune estimate. `cog_passage.csv` is the
passage these panels were placed with: every published code moved, its 2025
commune, the date, the weight and INSEE's event code.

No cell is filled or estimated: every value is as published or a sum of
published values. An empty cell is no figure, never 0: a secret or withheld
cell, a commune a file does not list, or a sum with a part missing.

## The files

Under 30 MB, the CSV is committed with its manifest. Over 30 MB, only the
manifest is committed (it holds the CSV's SHA-256 and row count); the CSV is
listed in `.gitignore` and re-exported by the command above. Of the census
flows, the editions 2008, 2013, 2018 and 2023 are kept; `income_tax.csv`
(38 MB) stays committed, as it was before this export, because
`analysis/grants.ml` reads it.

The site serves none of these CSVs, as no page or figure reads them: the
data page lists each table with its dictionary, its SHA-256 and its
manifest's provenance, and links the committed ones to the repository.

| File | Bytes | Rows | Years | SHA-256 | In git |
|---|---|---|---|---|---|
| `cog_passage.csv` | 72,786 | 1,925 | - | afc27f33df1f5412c897161b6fb3a565635f08f2a3f3d3422457b6e5227e05c1 | CSV and manifest |
| `dotations.csv` | 26,921,213 | 453,316 | 2014-2026 | 00ebf48109a6b1899791b302aa072d2d6fa4bac29c4457360aacc26d51a11832 | CSV and manifest |
| `elections_leg_before1958.csv` | 77,005,662 | 751,686 | 1848-1956 | 910384ccb4539936ab45dfedf29823913e7d389bfa0b07c9a6321c081eb56748 | manifest |
| `elections_leg_from1958.csv` | 59,620,406 | 544,165 | 1958-2022 | e19cce01cc3af766799e8b5633baecd96a413a78f47bee4bdb2c5ca28b770b16 | manifest |
| `elections_pres.csv` | 47,954,644 | 410,652 | 1848-2022 | 9a29dda3fcb6b2dfbd2ef3bc959921a566161411dd47263fc76e7ee96c8054eb | manifest |
| `energy_dpe_years.csv` | 24,520,129 | 356,123 | 2013-2026 | 89d2bfe1ae5c53669bc059b9497684ca12e03dc3b0322a25d1a37f96df9fb340 | CSV and manifest |
| `energy_stock.csv` | 3,201,961 | 34,744 | 2026 | 65868246d01bfad71fb1705190eb273bfeede989cc8b0a477a5bc53405fc8e0a | CSV and manifest |
| `firms_creations_establishments_before2019.csv` | 74,984,855 | 1,220,625 | 2012-2018 | db6a7db86492c3df11d3a3b786f06ed243334de6f82992b2559c6a48ead58fb1 | manifest |
| `firms_creations_establishments_from2019.csv` | 75,137,058 | 1,220,625 | 2019-2025 | d9243e63759188ad7e380c2d256b67a1a8bd4ccb9fde16eb976c52d033402860 | manifest |
| `firms_creations_legal_units_before2019.csv` | 63,974,423 | 1,220,625 | 2012-2018 | 6b4236f54be1638b5e0bbc239286157bc956f2ee8278d7459c93a9ad4fbbc925 | manifest |
| `firms_creations_legal_units_from2019.csv` | 64,109,376 | 1,220,625 | 2019-2025 | c867a6920e2f9ba8ac3e505b8a03c6ea0032253d4eda806c452e6a16e1a83163 | manifest |
| `firms_stocks.csv` | 45,293,736 | 767,250 | 2014-2024 | b8adec7f43827c0ab1e288a4796c212fb6ef977d635af0b980c705be72c60a52 | manifest |
| `flows_2008.csv` | 38,351,027 | 907,277 | 2008 | 5bb60a603c9a3d8569fdd335751982a58741548bd502ea6bd9c318dd9aa33032 | manifest |
| `flows_2013.csv` | 38,879,293 | 920,200 | 2013 | a8b68b18e159afd53a4459b133c79844297875630b8ace34eb4ea624d97161a9 | manifest |
| `flows_2018.csv` | 37,593,193 | 896,572 | 2018 | 743d8d51e5a2e22aec8d4b103fe1d6e914c7a506e0bb56d36b480e0444a24e58 | manifest |
| `flows_2023.csv` | 39,232,656 | 937,164 | 2023 | 10e286f9498db4dc7e639fc22de70186e2090ca20223fd07316baecae7a9f0b1 | manifest |
| `income_brackets_set2001.csv` | 4,699,797 | 54,573 | 2001-2002 | ef8af191980815f0d49d6ef563a27585a6f86ffb2b1009c23a7c7de3523be9cd | CSV and manifest |
| `income_brackets_set2003.csv` | 15,036,619 | 171,140 | 2003-2005 | a63bef4ccfe4dbc060c0027c04431f978789490630aa473d2f8895229ad8580b | CSV and manifest |
| `income_brackets_set2006.csv` | 20,734,858 | 234,224 | 2006-2009 | 5ee68e8a34e73de3a9e37be24d98e7a6be16b0fbcf472642b1a63e9bef3604ad | CSV and manifest |
| `income_brackets_set2010.csv` | 60,702,816 | 677,985 | 2010-2024 | 5ae123ab2bcddddd9b9edf258c07b0200e11b4d4675c396c5c641b42e8afa355 | manifest |
| `income_tax.csv` | 38,297,195 | 834,000 | 2001-2024 | 9f3e18ffd0748e4b45237bac3bf969654d2957e97979571d632cf7284f38bdcc | CSV and manifest |
| `membership.csv` | 5,790,299 | 69,746 | 2024-2025 | 9452d408fa54734b614a8f11f62c663eb6271d9be7e393d5526c73a6bde023d7 | CSV and manifest |
| `membership_areas.csv` | 698,566 | 18,292 | 2024-2025 | 0e24f0b1b2b8f23256bf84068ee32073cd87f8103bee64c54d5d9f961674d1d8 | CSV and manifest |
| `price_series.csv` | 11,566,113 | 305,655 | 2016-2025 | a739174653cab4a663770193c85b6314fd5b83956cd3e06364e88d1f1f5233f2 | CSV and manifest |
| `vital.csv` | 17,328,011 | 627,563 | 2008-2025 | ea5e05788ab7da159e027c837515696db56e515997f7054807e3181d74540124 | CSV and manifest |

To get a file that is not committed, export its table into an empty
directory, check it against the committed manifest, and copy it here:

```
house=/Users/samoht/git/house
$house/_build/default/bin/db/main.exe export \
  --db $house/france.db --out /tmp/house-export elections
shasum -a 256 /tmp/house-export/elections_*.csv   # against csv.sha256 in each manifest
cp /tmp/house-export/elections_*.csv data/house/
```

The table names are `income_tax`, `income_brackets`, `vital`, `price_series`,
`elections`, `flows`, `membership`, `dotations`, `firms` and `energy`; one
table writes all its files (`flows` writes every census edition, 2006 to
2023, `flows_EDITION.csv` each, with its manifest). Export into a scratch
directory, not here: an export of some tables writes a `cog_passage.csv` of
their codes alone, which would replace the full one. A file exported from a
later house commit or database has another SHA-256 than the manifest here;
commit the new manifest with it.

## Credits

Each table below names its publishers as the manifests do and the credit
line this repository prints with the table (on the data page, from
`data/catalogue.ml`, beside the manifest's own citations). Every table also
uses
INSEE's Code officiel géographique,
https://www.insee.fr/fr/information/8377162 (Licence Ouverte 2.0), read from
https://www.insee.fr/fr/statistiques/fichier/8740222/cog_ensemble_2026_csv.zip.
For a table under the Licence Ouverte, the credit is its attribution: the
producer, the title and the date of the data.

### `income_tax.csv`: income tax by commune

One row per commune and revenue year (the year the income was earned), 2001
to 2024: tax households, taxed households, reference income and net tax, in
euros. 834,000 rows (819,657 exact, 13,820 summed, 145 partial, 378 wider).

- Publisher: DGFiP, « L'impôt sur le revenu par collectivité territoriale
  (IRCOM) »,
  https://www.data.gouv.fr/datasets/limpot-sur-le-revenu-par-collectivite-territoriale-ircom/.
- Licence: Licence Ouverte 1.0.
- Credit: « DGFiP, « L'impôt sur le revenu par collectivité territoriale
  (IRCOM) », revenus 2001 to 2024, data.gouv.fr, updated 2 July 2026; Licence
  Ouverte 1.0; on COG 2025 by house ».
- Caveats: secret cells are empty, never 0; the per-year URLs of house's
  assembled series are null in the manifest, with its reason; the brackets
  are in `income_brackets_*`.

### `income_brackets_set2001.csv` to `income_brackets_set2010.csv`: income tax by bracket

One row per commune, revenue year and bracket of reference income, for the
communes DGFiP breaks down by bracket (4,641 codes in revenus 2001, 6,306 in
revenus 2024): households, taxed households, reference income, net tax,
salaries and pensions with their households. Four files, one per set of
brackets DGFiP published (set2001: 2001-2002; set2003: 2003-2005; set2006:
2006-2009; set2010: 2010-2024), never rebinned, their bounds in nominal euros
of the revenue year; the sets are not comparable with each other.

- Publisher: DGFiP, IRCOM, as `income_tax.csv`.
- Licence: Licence Ouverte 1.0.
- Credit: « DGFiP, « L'impôt sur le revenu par collectivité territoriale
  (IRCOM) », by bracket of reference income, revenus 2001 to 2024,
  data.gouv.fr, updated 2 July 2026; Licence Ouverte 1.0; on COG 2025 by
  house ».
- Caveats: a commune with no row in a year was published with its total
  alone (`income_tax.csv`); a commune made of several published codes is
  summed only where every code has the bracket that year, otherwise the row
  is `partial` with its cells empty; secret cells are empty, never 0.

### `vital.csv`: births and deaths

One row per commune and year, 2008 to 2025: births and deaths (état civil).
627,563 rows, all exact.

- Publisher: INSEE, état civil, « Naissances et décès par commune »,
  https://api.insee.fr/melodi/file/DS_ETAT_CIVIL_NAIS_COMMUNES_2025/PARQUET and
  https://api.insee.fr/melodi/file/DS_ETAT_CIVIL_DECES_COMMUNES_2025/PARQUET.
- Licence: Licence Ouverte 2.0.
- Credit: « INSEE, « Naissances et décès par commune » (état civil), 2008 to
  2025, edition 2025; Licence Ouverte 2.0; on COG 2025 by house ».
- Caveats: a commune-year INSEE withheld for both counts has no row; it is
  not a year without births or deaths.

### `price_series.csv`: dwelling sales and prices

One row per commune and year, 2016 to 2025: sales and the price per m², all
dwellings, then flats and houses apart. 305,655 rows.

- Publishers: DGFiP via Etalab, « Prix au m² par commune et par mois (DVF) »,
  https://files.data.gouv.fr/geo-dvf/; for the years before Etalab's rolling
  five-year window, DGFiP's « Demandes de valeurs foncières »,
  https://www.data.gouv.fr/datasets/demandes-de-valeurs-foncieres, computed by
  house with Etalab's method.
- Licence: Licence Ouverte 2.0.
- Credit: « DGFiP and Etalab, « Prix au m² par commune et par mois (DVF) »,
  file of July 2026, and DGFiP, « Demandes de valeurs foncières », 2016 to
  2020; Licence Ouverte 2.0; on COG 2025 by house ».
- Caveats: no row where the commune had no priced dwelling sale; 2014 and
  2015 are absent; the flats and houses apart are empty in Etalab's years; on
  2021, the year both cover, house's computation gives Etalab's figures for
  31,448 of 31,499 communes.

### `dotations.csv`: the State's grants to communes

One row per commune and year of allocation, 2014 to 2026: the DGF and its
parts (dotation forfaitaire, DSU, the three fractions of the DSR, DNP,
DACOM) and the grants beside it (DPEL, the two parts of the dotation de
communes nouvelles, the dotation biodiversité), in euros as allocated.
453,316 rows (449,953 exact, 3,292 summed, 1 partial, 70 wider).

- Publisher: DGCL (Direction générale des collectivités locales), «
  Répartition des dotations de l'État aux communes », dotations en ligne,
  http://www.dotations-dgcl.interieur.gouv.fr/consultation/dotations_en_ligne.php.
- Credit: « Direction générale des collectivités locales (DGCL), ministère de
  l'Intérieur, « dotations en ligne » (dotations-dgcl.interieur.gouv.fr), by
  year, 2014 to 2026 ».
- Caveats: a commune a year's file does not list is empty, never 0 (some
  years list only the communes allocated a grant; the manifest counts the
  communes listed per column and year); the DGF total `dgf` is DGCL's own and
  published for 2019-2026 only, the parts before; `dgf` differs from the sum
  of its parts for a few dozen communes nouvelles of 2019-2023; nothing before
  2014.

### `elections_leg_before1958.csv`, `elections_leg_from1958.csv`, `elections_pres.csv`: elections

One row per commune and ballot, first rounds, of the 40 legislative and 12
presidential elections of 1848-2022: registered voters, voters, expressed
votes, turnout, the shares of the five blocs (G, CG, C, CD, D), the left's
share by Cagé and Piketty's convention, and the far right's where separable.
Three files (legislative before 1958, from 1958, presidential), so that none
passes 100 MB; their rows are placed together.

- Publisher: Julia Cagé and Thomas Piketty, the data of *Une histoire du
  conflit politique. Élections et inégalités sociales en France, 1789-2022*
  (Seuil, 2023), « Élections par commune, 1848-2022 »,
  https://unehistoireduconflitpolitique.fr/.
- Credit: « Julia Cagé and Thomas Piketty, « Une histoire du conflit
  politique. Élections et inégalités sociales en France, 1789-2022 », Seuil,
  2023; data: unehistoireduconflitpolitique.fr ».
- Caveats: the ballot's day (`date`) is declared by house from the electoral
  calendar, as the archive gives the year alone; a registered or voter count
  the archive gives as 0 is empty; `far_right_pct` is empty where no column
  is separable (before 1974, and the 1981 elections), which is not a share of
  0; every share is recomputed from votes summed over `published_as`; a
  commune with no row has no figure in the archive for that ballot.

### `flows_2008.csv`, `flows_2013.csv`, `flows_2018.csv`, `flows_2023.csv`: commutes

One row per pair of a commune of residence and a commune of work, for one
census edition: the workers who commute between them, as INSEE's weights
give them (not whole). The edition pools five yearly surveys (2023: 2021 to
2025). About 900,000 pairs each.

- Publisher: INSEE, recensement de la population, « Déplacements
  domicile-travail entre communes (bases flux de mobilité) »,
  https://www.insee.fr/fr/information/2383370.
- Licence: Licence Ouverte 2.0.
- Credit: « INSEE, recensement de la population, « Déplacements
  domicile-travail entre communes (bases flux de mobilité) », editions 2008,
  2013, 2018 and 2023; Licence Ouverte 2.0; on COG 2025 by house ».
- Caveats: both ends are placed, and `geography` is the worse of the two; a
  pair with an end abroad is dropped (listed in the manifest); a pair with no
  row is not 0 but unpublished. The other editions (2006, 2007, 2009-2012,
  2014-2017, 2019-2022) are not here: `hexagn-db export ... flows` writes
  them all.

### `membership.csv`, `membership_areas.csv`: the areas each commune lies in

`membership.csv`: one row per commune and edition (2024, 2025) of INSEE's
table d'appartenance géographique: its département, région, EPCI, EPT,
arrondissement, canton-ou-ville, zone d'emploi 2020, unité urbaine 2020, aire
d'attraction des villes 2020 and bassin de vie 2022. `membership_areas.csv`:
one row per area and edition, its name and number of communes.

- Publisher: INSEE, « Table d'appartenance géographique des communes »,
  https://www.insee.fr/fr/statistiques/fichier/7671844/table-appartenance-geo-communes-2025.zip.
- Licence: Licence Ouverte 2.0.
- Credit: « INSEE, « Table d'appartenance géographique des communes », COG
  2024 and 2025; Licence Ouverte 2.0; on COG 2025 by house ».
- Caveats: ZZZZZZZZZ means no such area; a `mixed` row's cell is empty where
  its parts lie in different areas; the aire d'attraction's category is not
  in this table.

### `energy_stock.csv`, `energy_dpe_years.csv`: energy performance (DPE)

`energy_stock.csv`: one row per commune (the BDNB millésime 2026-02-a): its
building groups and dwellings, those under a representative DPE of the 2021
method, of an earlier method and of none, the dwellings by energy and
emissions étiquette (A to G) under the 2021 method, and the passoires (F or
G) as a share of the diagnosed dwellings and of all dwellings.
`energy_dpe_years.csv`: one row per commune, year (2013-2026) and method of
the representative DPE, with the same étiquette counts.

- Publisher: CSTB, « Base de données nationale des bâtiments (BDNB) »,
  https://bdnb.io/ (open millésime 2026-02-a), from ADEME's DPEs and the
  Fichiers fonciers' dwellings.
- Licence: Licence Ouverte 2.0.
- Credit: « CSTB, « Base de données nationale des bâtiments (BDNB) », open
  millésime 2026-02-a, from ADEME's DPE and the Fichiers fonciers; Licence
  Ouverte 2.0; on COG 2025 by house ».
- Caveats: the BDNB keeps one representative DPE per building group, and the
  export counts every dwelling of the group under it (fifty flats with one
  flat's DPE are fifty dwellings of that class), so these are not
  dwelling-level classes: the share of dwellings in F or G comes from ONRE's
  estimate of the stock, which reweights the DPEs on INSEE's Fidéli. DPEs are
  made at a sale, a letting or a construction, not a sample of the stock; the
  2012-method classes are not comparable with the 2021 ones; the BDNB
  recalculates 2021-method classes made before 2026 with the electricity
  coefficient of 1.9; a year's row in `energy_dpe_years.csv` holds the groups
  whose DPE in force dates from that year, not the DPEs made that year.

### `firms_stocks.csv`, `firms_creations_*.csv`: firms

One row per commune, year, measure and legal form, a column per A10 sector
(agriculture excluded) and their total. `firms_stocks.csv`, 2014-2024: the
legal units and the establishments economically active in the year (no
legal form). `firms_creations_legal_units_*` and
`firms_creations_establishments_*`, 2012-2018 and 2019-2025: the creations,
by legal form (entrepreneur individuel, SARL, SAS, other, all).

- Publisher: INSEE, Side (Système d'information sur la démographie
  d'entreprises): « Stocks d'unités légales et d'établissements par activité
  (A10) », https://api.insee.fr/melodi/catalog/DS_SIDE_STOCKS_COM, and «
  Créations d'entreprises et d'établissements au niveau communal et supra
  communal par secteur d'activité (A10) et forme légale »,
  https://api.insee.fr/melodi/catalog/DS_SIDE_CREA_COM.
- Licence: Licence Ouverte 2.0 (melodi's catalogue leaves its licence field
  empty; INSEE's terms for the data it publishes apply).
- Credit: « INSEE, Side, « Stocks d'unités légales et d'établissements par
  activité (A10) », edition 2024, and « Créations d'entreprises et
  d'établissements au niveau communal et supra communal par secteur
  d'activité (A10) et forme légale », edition 2025; Licence Ouverte 2.0; on
  COG 2025 by house ».
- Caveats: a stock (units active in the year) and a creation (a new Sirene
  registration, whether or not the activity started) are not comparable, as
  INSEE warns; cells INSEE counts in another commune's row (K) are empty and
  that commune's row is `wider` (the codes and years are in the manifests);
  no size band by commune.

### `cog_passage.csv`: the passage

One row per published code moved and way it was placed: its 2025 commune,
the date of the first movement, the weight (1 for a whole code, empty for a
code divided, whose rows are left out), INSEE's event code, and the years of
the rows placed that way. Only the codes the panels above were published
under.

- Publisher: INSEE, Code officiel géographique, as above.
- Licence: Licence Ouverte 2.0.
- Credit: « INSEE, « Code officiel géographique », COG 2026 file; Licence
  Ouverte 2.0; passage by house ».

## Use in this repository

`data/house.ml` holds a typed nox-csv codec for every table, and
`test/test_house.ml` checks each committed CSV against its manifest (SHA-256,
rows, header) and a few cells by hand (01001, 75056).

`analysis/commune.ml` reads `income_tax.csv` (tax households and reference
income per household), `vital.csv` (births and deaths) and
`price_series.csv` (price per m² of dwellings sold, years of five sales or
more) into the commune panel of the matched and event-study evaluations:
`analysis/zrr.ml`, `zrr_rdd.ml`, `places.ml` and `places_did.ml`;
`analysis/vacancy.ml` and `zoning.ml` read `price_series.csv` through it.
`analysis/grants.ml` reads `income_tax.csv` and `vital.csv` as predetermined
covariates of every grant design: the reference income per tax household and
the births per 1,000 inhabitants of year t - 2, whose jump at the threshold
should be zero (`pre_period` rows `income_per_household_t_minus_2` and
`births_per_1000_t_minus_2`). All of them read through the codecs of
`data/house.ml` and leave out rows whose `geography` is `partial` or
`wider`, since they do not describe the commune; a commune code of an
earlier COG, as the criteria of 2016-2019 write some, finds no row.

`data/zrr/ircom.csv`, an older extract of the same income table that no
evaluation reads, differs from it: against the export of 2026-10-18 (house
`898b7f0`), of its 784,257 rows 755,404 joined house's, 12,209 of them
differing where house sums merged communes, and 28,853 carrying codes that
are not communes of COG 2025.
