Skip to content
Snippets Groups Projects
Commit 3eec814a authored by benoit-cty's avatar benoit-cty
Browse files

Date plus récentes des données

parent 8342fbc7
No related branches found
No related tags found
1 merge request!54Mise à jour de DataCirco
Pipeline #20071 passed
......@@ -41,6 +41,7 @@ cd $GEO
# Code officiel géographique au 1er janvier 2022 : https://www.insee.fr/fr/statistiques/fichier/6051727/cog_ensemble_2022_csv.zip
## découpage administratif
# https://geoservices.ign.fr/adminexpress
# -nc, --no-clobber: skip downloads that would download to existing files.
wget --no-clobber https://data.geopf.fr/telechargement/download/ADMIN-EXPRESS/ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2025-02-17/ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2025-02-17.7z
......@@ -50,7 +51,7 @@ wget --no-clobber https://data.geopf.fr/telechargement/download/ADMIN-EXPRESS/AD
for ADMIN in COMMUNE DEPARTEMENT REGION CANTON EPCI CHFLIEU_COMMUNE ARRONDISSEMENT_MUNICIPAL
do
PG_USE_COPY=1 ogr2ogr -f pgdump /vsistdout/ ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2025-02-17/ADMIN-EXPRESS/1_DONNEES_LIVRAISON_2024-01-00184/ADE_3-2_SHP_WGS84G_FRA-ED2025-02-17/$ADMIN.shp \
PG_USE_COPY=1 ogr2ogr -f pgdump /vsistdout/ ADMIN-EXPRESS_3-2__SHP_WGS84G_FRA_2025-02-17/ADMIN-EXPRESS/1_DONNEES_LIVRAISON_2025-02-00188/ADE_3-2_SHP_WGS84G_FRA-ED2025-02-17/$ADMIN.shp \
-t_srs EPSG:4326 -nln ign_$ADMIN -nlt geometry | $PSQL_COMMAND_LINE
done
......
......@@ -15,7 +15,7 @@ utilitaires.add_dataset_source(
module,
"Nombre d'établissements employeurs et effectifs salariés",
"URSSAF",
"2023",
"2024",
url_information=url,
url_data=url_data,
id_reference="urssaf_etablissements_et_effectifs_salaries_au_niveau_commune_x_ape",
......
......@@ -37,6 +37,7 @@ print("Import des données d'artificialisation des sols du CEREMA")
# assert utilitaires.download_file(path)
# Préférer la source Data.gouv.fr que celle de Box qui est plus compliquée à récupérer
# https://www.data.gouv.fr/fr/datasets/consommation-despaces-naturels-agricoles-et-forestiers-du-1er-janvier-2009-au-1er-janvier-2023/
path_artif = (
"https://www.data.gouv.fr/fr/datasets/r/f87abde2-f0ea-4d1d-86bd-eb2988d8a415"
)
......
......@@ -5,6 +5,8 @@ module = "equipements"
utilitaires.start("equipements.py")
utilitaires.clear_dataset_source(module)
# Base permanente des équipements (BPE)
# https://www.insee.fr/fr/metadonnees/source/serie/s1161
# url = "https://www.insee.fr/fr/statistiques/fichier/3568638/bpe21_ensemble_xy_csv.zip"
url = "https://www.insee.fr/fr/statistiques/fichier/8217525/BPE23.zip"
file = url.split("/")[-1]
......
......@@ -53,13 +53,24 @@ utilitaires.add_dataset_source(
)
print("Données IRIS :")
# iris_urls = [
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_LAMB93_FXX_2021-01-01.7z",
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGAF09UTM20_D971_2022-01-01.7z",
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGAF09UTM20_D972_2022-01-01.7z",
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_UTM22RGFG95_D973_2022-01-01.7z",
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGR92UTM40S_D974_2022-01-01.7z",
# "https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGM04UTM38S_D976_2022-01-01.7z",
# ]
iris_urls = [
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_LAMB93_FXX_2021-01-01.7z",
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGAF09UTM20_D971_2022-01-01.7z",
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGAF09UTM20_D972_2022-01-01.7z",
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_UTM22RGFG95_D973_2022-01-01.7z",
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGR92UTM40S_D974_2022-01-01.7z",
"https://data.cquest.org/ign/iris_ge/IRIS-GE_2-0__SHP_RGM04UTM38S_D976_2022-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_LAMB93_FXX_2024-01-01/IRIS-GE_3-0__SHP_LAMB93_FXX_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGAF09UTM20_GLP_2024-01-01/IRIS-GE_3-0__SHP_RGAF09UTM20_GLP_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGAF09UTM20_MTQ_2024-01-01/IRIS-GE_3-0__SHP_RGAF09UTM20_MTQ_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_UTM22RGFG95_GUF_2024-01-01/IRIS-GE_3-0__SHP_UTM22RGFG95_GUF_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGR92UTM40S_REU_2024-01-01/IRIS-GE_3-0__SHP_RGR92UTM40S_REU_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGSPM06U21_SPM_2024-01-01/IRIS-GE_3-0__SHP_RGSPM06U21_SPM_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGM04UTM38S_MYT_2024-01-01/IRIS-GE_3-0__SHP_RGM04UTM38S_MYT_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGAF09UTM20_BLM_2024-01-01/IRIS-GE_3-0__SHP_RGAF09UTM20_BLM_2024-01-01.7z",
"https://data.geopf.fr/telechargement/download/IRIS-GE/IRIS-GE_3-0__SHP_RGAF09UTM20_MAF_2024-01-01/IRIS-GE_3-0__SHP_RGAF09UTM20_MAF_2024-01-01.7z",
]
for url in iris_urls:
......@@ -75,10 +86,10 @@ for file, url in zip(tqdm(files), iris_urls):
module,
"Découpage géographique",
"Insee",
"2022",
"2024",
url_data=url,
url_information="https://geoservices.ign.fr/irisge",
id_reference=f"Insee-{file}-2022",
id_reference=f"Insee-{file}-2024",
)
utilitaires.end(f"{module}.py")
......@@ -16,7 +16,7 @@ utilitaires.clear_dataset_source(module)
# https://www.insee.fr/fr/statistiques/7704078
# https://www.insee.fr/fr/statistiques/fichier/7704078/base-ic-logement-2020_csv.zip
# https://www.insee.fr/fr/statistiques/fichier/7704078/base-ic-logement-2020-com_csv.zip pour Mayotte
# https://www.insee.fr/fr/statistiques/fichier/7704078/base-ic-logement-2020-com_csv.zip pour Collectivités d'outre-mer
base_logements = [
{
......@@ -29,6 +29,11 @@ base_logements = [
"url": "https://www.insee.fr/fr/statistiques/fichier/7704078/base-ic-logement-2020_csv.zip",
"url_data": "https://www.insee.fr/fr/statistiques/7704078",
},
{
"annee": "2021",
"url": "https://www.insee.fr/fr/statistiques/fichier/8268838/base-ic-logement-2021_csv.zip",
"url_data": "https://www.insee.fr/fr/statistiques/8268838",
},
]
for base_logement in base_logements:
......
......@@ -22,8 +22,8 @@ from datacirco import utilitaires
# Disable warning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
START_YEAR = 2024
END_YEAR = 2024
START_YEAR = 2025
END_YEAR = 2025
DATA_DIR = "ERA5/monthly_dl"
"""c.retrieve( 'reanalysis-era5-single-levels-monthly-means', { 'format':
......
......@@ -19,8 +19,8 @@ carroyage_200m = [
url_data = "https://www.insee.fr/fr/statistiques/2520034"
soup = utilitaires.get_soup(url_data)
result = soup.find("p", class_="paragraphe").text[-20:]
datetime = result[re.search(r"\d", result).start() :].strip()
datetime = dateparser.parse(datetime).date()
date_time = result[re.search(r"\d", result).start() :].strip()
date_time = dateparser.parse(date_time).date()
for file in carroyage_200m:
assert utilitaires.download_file(file)
......@@ -30,10 +30,10 @@ for file in carroyage_200m:
module,
"Données carroyées à 200m",
"Insee",
datetime.strftime("%Y"),
date_time.strftime("%Y"),
url_data=file,
url_information=url_data,
last_modified=datetime.strftime("%Y-%m-%d %H:%M:%S"),
last_modified=date_time.strftime("%Y-%m-%d %H:%M:%S"),
id_reference=f"Insee-{filename}",
)
......@@ -50,10 +50,10 @@ for file in carroyage_1km:
module,
"Données carroyées à 1km",
"Insee",
datetime.strftime("%Y"),
date_time.strftime("%Y"),
url_data=file,
url_information="https://www.insee.fr/fr/statistiques/1405815",
last_modified=datetime.strftime("%Y-%m-%d %H:%M:%S"),
last_modified=date_time.strftime("%Y-%m-%d %H:%M:%S"),
id_reference=f"Insee-{filename}",
)
......@@ -156,7 +156,7 @@ url_data = "https://www.insee.fr/fr/statistiques/2508230"
utilitaires.add_dataset_source(
filename + ".csv",
module,
"Populations légales des circonscriptions législatives pour les élections de 2024",
"Populations légales des circonscriptions législatives pour les élections",
"Insee",
"2021",
url_data=file,
......@@ -205,4 +205,25 @@ for file in recensement:
id_reference=f"Insee-{filename}",
)
print("Recensement 2021 à l'IRIS :")
recensement = [
"https://www.insee.fr/fr/statistiques/fichier/8268806/base-ic-evol-struct-pop-2021_csv.zip",
"https://www.insee.fr/fr/statistiques/fichier/8268806/base-ic-evol-struct-pop-2021-com_csv.zip",
]
for file in recensement:
assert utilitaires.download_file(file)
filename = file.split("/")[-1]
utilitaires.add_dataset_source(
filename,
module,
"Recensement de la population - Base infracommunale (IRIS)",
"Insee",
"2021",
url_data=file,
url_information="https://www.insee.fr/fr/statistiques/8268806",
last_modified="2023-01-01 00:00:00",
id_reference=f"Insee-{filename}",
)
utilitaires.end(f"{module}.py")
......@@ -74,4 +74,21 @@ utilitaires.add_dataset_source(
id_reference="insee_revenu_pauvrete_2020",
)
print("Données sur les revenus à l'échelle IRIS :")
# Pour insee_revenu_pauvrete_2021
insee_revenu_pauvrete_2021 = "https://www.insee.fr/fr/statistiques/fichier/8229323/BASE_TD_FILO_IRIS_2021_DEC_CSV.zip"
assert utilitaires.download_file(insee_revenu_pauvrete_2021)
utilitaires.add_dataset_source(
filename="insee_revenu_pauvrete_2021",
module=module,
description="Revenus, pauvreté et niveau de vie",
producteur="Insee",
version="2021",
url_data=insee_revenu_pauvrete_2021,
url_information="https://www.insee.fr/fr/statistiques/8229323",
last_modified="2023-03-31 00:00:00",
id_reference="insee_revenu_pauvrete_2021",
)
utilitaires.end(f"{module}.py")
......@@ -278,7 +278,7 @@ def population_france():
utilitaires.add_dataset_source(
"population_france.csv",
module,
"Population au 1er janvier (données annuelles de 1990 à 2024)",
"Population au 1er janvier (données annuelles de 1990 à 2025)",
"Insee",
datetime_object.strftime("%Y"),
url_data=url,
......
......@@ -85,6 +85,10 @@ with open("societes-immatriculees.csv", "w") as file:
"file": "societes-immatriculees-2024.csv",
"columns": [0, 1, 3, 6, 7, 8, 11, 13, 28, 17, 14, 4],
},
{
"file": "societes-immatriculees-2025.csv",
"columns": [0, 1, 3, 6, 7, 8, 11, 13, 28, 17, 14, 4],
},
]
for file_info in immatriculees_files:
......@@ -180,6 +184,10 @@ with open("societes-radiees.csv", "w") as file:
"file": "societes-radiees-2024.csv",
"columns": [0, 1, 3, 6, 7, 8, 11, 13, 17, 15, 4],
},
{
"file": "societes-radiees-2025.csv",
"columns": [0, 1, 3, 6, 7, 8, 11, 13, 17, 15, 4],
},
# TODO: trouver un meilleur moyen de gérer les fichiers pour les années suivantes : faire une boucle sur les années et changer les colonnes en fonction.
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment