Skip to content

Commit

Permalink
feat(api) : Use a single source of truth for the communes
Browse files Browse the repository at this point in the history
We now get all of our data from the DWH.

The services, structures and communes are all downloaded from the same
place and deemed coherent.
  • Loading branch information
vperron committed Aug 30, 2024
1 parent 5a3c048 commit 0d29c8b
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 300 deletions.
20 changes: 0 additions & 20 deletions api/requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ argon2-cffi-bindings==21.2.0
# via argon2-cffi
attrs==23.2.0
# via fiona
brotli==1.1.0
# via py7zr
certifi==2024.2.2
# via
# data-inclusion-api (setup.py)
Expand Down Expand Up @@ -93,8 +91,6 @@ idna==3.7
# email-validator
# httpx
# requests
inflate64==1.0.0
# via py7zr
jinja2==3.1.4
# via data-inclusion-api (setup.py)
mako==1.3.3
Expand All @@ -105,8 +101,6 @@ markupsafe==2.1.5
# mako
minio==7.2.5
# via data-inclusion-api (setup.py)
multivolumefile==0.2.3
# via py7zr
numpy==1.26.4
# via
# data-inclusion-api (setup.py)
Expand All @@ -124,26 +118,18 @@ pandas==2.2.2
# via
# data-inclusion-api (setup.py)
# geopandas
psutil==5.9.8
# via py7zr
psycopg2==2.9.9
# via data-inclusion-api (setup.py)
py7zr==0.21.0
# via data-inclusion-api (setup.py)
pyarrow==16.0.0
# via data-inclusion-api (setup.py)
pyasn1==0.6.0
# via
# python-jose
# rsa
pybcj==1.0.2
# via py7zr
pycparser==2.22
# via cffi
pycryptodome==3.20.0
# via minio
pycryptodomex==3.20.0
# via py7zr
pydantic==2.7.0
# via
# data-inclusion-api (setup.py)
Expand All @@ -155,8 +141,6 @@ pydantic-core==2.18.1
# via pydantic
pydantic-settings==2.2.1
# via data-inclusion-api (setup.py)
pyppmd==1.1.0
# via py7zr
pyproj==3.6.1
# via geopandas
python-dateutil==2.9.0.post0
Expand All @@ -176,8 +160,6 @@ pytz==2024.1
# pandas
pyyaml==6.0.1
# via uvicorn
pyzstd==0.15.10
# via py7zr
requests==2.31.0
# via data-inclusion-api (setup.py)
rsa==4.9
Expand All @@ -204,8 +186,6 @@ sqlalchemy==2.0.29
# geoalchemy2
starlette==0.37.2
# via fastapi
texttable==1.7.0
# via py7zr
tqdm==4.66.2
# via data-inclusion-api (setup.py)
typing-extensions==4.11.0
Expand Down
1 change: 0 additions & 1 deletion api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"numpy",
"pandas",
"psycopg2",
"py7zr",
"pyarrow",
"pydantic[email]>=2.5.0",
"pydantic-settings",
Expand Down
7 changes: 0 additions & 7 deletions api/src/data_inclusion/api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import click

from data_inclusion.api import auth
from data_inclusion.api.code_officiel_geo.commands import import_admin_express
from data_inclusion.api.inclusion_data.commands import load_inclusion_data

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -34,12 +33,6 @@ def _generate_token_for_user(
click.echo(auth.create_access_token(subject=email, admin=admin))


@cli.command(name="import_admin_express")
def _import_admin_express():
"""Import the latest Admin Express COG database"""
click.echo(import_admin_express())


@cli.command(name="load_inclusion_data")
def _load_inclusion_data():
"""Load the latest inclusion data"""
Expand Down
99 changes: 0 additions & 99 deletions api/src/data_inclusion/api/code_officiel_geo/commands.py

This file was deleted.

67 changes: 0 additions & 67 deletions api/src/data_inclusion/api/code_officiel_geo/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,70 +162,3 @@ class RegionEnum(Enum):
"RegionCodeEnum",
{member.name: member.value.code for member in RegionEnum},
)


# based on
# https://github.com/gip-inclusion/dora-back/blob/main/dora/admin_express/utils.py

_DISTRICTS_BY_CITY = {
# Paris
"75056": [
"75101",
"75102",
"75103",
"75104",
"75105",
"75106",
"75107",
"75108",
"75109",
"75110",
"75111",
"75112",
"75113",
"75114",
"75115",
"75116",
"75117",
"75118",
"75119",
"75120",
],
# Lyon
"69123": [
"69381",
"69382",
"69383",
"69384",
"69385",
"69386",
"69387",
"69388",
"69389",
],
# Marseille
"13055": [
"13201",
"13202",
"13203",
"13204",
"13205",
"13206",
"13207",
"13208",
"13209",
"13210",
"13211",
"13212",
"13213",
"13214",
"13215",
"13216",
],
}

CODE_COMMUNE_BY_CODE_ARRONDISSEMENT = {
code_arrondissement: code_commune
for code_commune, codes_arrondissements in _DISTRICTS_BY_CITY.items()
for code_arrondissement in codes_arrondissements
}
85 changes: 0 additions & 85 deletions api/src/data_inclusion/api/code_officiel_geo/models.py

This file was deleted.

Loading

0 comments on commit 0d29c8b

Please sign in to comment.