Go to file
m.schnitzler af530b2283 renovate (#2)
Co-authored-by: m.schnitzler <martin.wb.2015@gmail.com>
Co-committed-by: m.schnitzler <martin.wb.2015@gmail.com>
2024-07-01 07:55:32 +00:00
dvf up 2024-06-01 23:27:24 +02:00
geodvf up 2024-06-01 23:27:24 +02:00
.gitignore up 2024-06-02 09:42:35 +02:00
package-lock.json renovate (#2) 2024-07-01 07:55:32 +00:00
package.json renovate (#2) 2024-07-01 07:55:32 +00:00
parse.js up 2024-06-02 01:30:12 +02:00
README.md up 2024-06-02 01:45:42 +02:00

DVF

Il y a deux sources de données. dvf et geodvf geodvf contient sensiblement les mêmes données mais avec la latitude et la longitude.

DVF

https://www.data.gouv.fr/fr/datasets/demandes-de-valeurs-foncieres/

mkdir -p dvf
curl -L https://www.data.gouv.fr/fr/datasets/r/78348f03-a11c-4a6b-b8db-2acf4fee81b1 -o dvf/2023.csv
curl -L https://www.data.gouv.fr/fr/datasets/r/87038926-fb31-4959-b2ae-7a24321c599a -o dvf/2022.csv
curl -L https://www.data.gouv.fr/fr/datasets/r/817204ac-2202-4b4a-98e7-4184d154d98c -o dvf/2021.csv
curl -L https://www.data.gouv.fr/fr/datasets/r/90a98de0-f562-4328-aa16-fe0dd1dca60f -o dvf/2020.csv
curl -L https://www.data.gouv.fr/fr/datasets/r/3004168d-bec4-44d9-a781-ef16f41856a2 -o dvf/2019.csv

Voila un sample des données parsées dvf/sample.json

GEODVF

https://files.data.gouv.fr/geo-dvf/latest/csv/

mkdir -p geodvf
curl https://files.data.gouv.fr/geo-dvf/latest/csv/2023/full.csv.gz -o geodvf/2023.csv.gz
curl https://files.data.gouv.fr/geo-dvf/latest/csv/2022/full.csv.gz -o geodvf/2022.csv.gz
curl https://files.data.gouv.fr/geo-dvf/latest/csv/2021/full.csv.gz -o geodvf/2021.csv.gz
curl https://files.data.gouv.fr/geo-dvf/latest/csv/2020/full.csv.gz -o geodvf/2020.csv.gz
curl https://files.data.gouv.fr/geo-dvf/latest/csv/2019/full.csv.gz -o geodvf/2019.csv.gz

Voila un sample des données parsées geodvf/sample.json

run

Cette commande ouvre les fichiers csv et chie des inserts mysql en batch

echo "MYSQL=mysql://user:password@host/database?charset=utf8mb4&connectionLimit=10" > .env
node parse.js geodvf/2022.csv.gz | gzip > geodvf/2022.sql.gz
pv geodvf/2023.sql.gz | gunzip | mysql -u user -ppassword -h host database
CREATE TABLE IF NOT EXISTS dvf (
    id_mutation VARCHAR(255),
    date_mutation DATE,
    numero_disposition VARCHAR(255),
    nature_mutation VARCHAR(255),
    valeur_fonciere DECIMAL(15, 2),
    adresse_numero VARCHAR(255),
    adresse_suffixe VARCHAR(255),
    adresse_nom_voie VARCHAR(255),
    adresse_code_voie VARCHAR(255),
    code_postal VARCHAR(255),
    code_commune VARCHAR(255),
    nom_commune VARCHAR(255),
    code_departement VARCHAR(255),
    ancien_code_commune VARCHAR(255),
    ancien_nom_commune VARCHAR(255),
    id_parcelle VARCHAR(255),
    ancien_id_parcelle VARCHAR(255),
    numero_volume VARCHAR(255),
    lot1_numero VARCHAR(255),
    lot1_surface_carrez DECIMAL(15, 2),
    lot2_numero VARCHAR(255),
    lot2_surface_carrez DECIMAL(15, 2),
    lot3_numero VARCHAR(255),
    lot3_surface_carrez DECIMAL(15, 2),
    lot4_numero VARCHAR(255),
    lot4_surface_carrez DECIMAL(15, 2),
    lot5_numero VARCHAR(255),
    lot5_surface_carrez DECIMAL(15, 2),
    nombre_lots INT,
    code_type_local VARCHAR(255),
    type_local VARCHAR(255),
    surface_reelle_bati DECIMAL(15, 2),
    nombre_pieces_principales INT,
    code_nature_culture VARCHAR(255),
    nature_culture VARCHAR(255),
    code_nature_culture_speciale VARCHAR(255),
    nature_culture_speciale VARCHAR(255),
    surface_terrain DECIMAL(15, 2),
    longitude DECIMAL(10, 6),
    latitude DECIMAL(10, 6)
);