up
This commit is contained in:
63
README.md
63
README.md
@ -1,7 +1,14 @@
|
||||
# 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
|
||||
@ -10,10 +17,11 @@ https://www.data.gouv.fr/fr/datasets/demandes-de-valeurs-foncieres/
|
||||
|
||||
Voila un sample des données parsées [dvf/sample.json](dvf/sample.json)
|
||||
|
||||
# GEODVF
|
||||
## 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
|
||||
@ -24,8 +32,53 @@ Voila un sample des données parsées [geodvf/sample.json](geodvf/sample.json)
|
||||
|
||||
# run
|
||||
|
||||
Cette commande ouvre les fichiers csv et chie du json
|
||||
Cette commande ouvre les fichiers csv et chie des inserts mysql en batch
|
||||
|
||||
node parse.js dvf/2023.csv
|
||||
node parse.js geodvf/2023.csv.gz
|
||||
...
|
||||
echo "MYSQL=mysql://user:password@host/database?charset=utf8mb4&connectionLimit=10" > .env
|
||||
node parse.js geodvf/2023.csv.gz > geodvf/2023.sql
|
||||
pv geodvf/2023.sql | 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)
|
||||
);
|
||||
```
|
||||
|
Reference in New Issue
Block a user