Status: Work in Progress, see issues
Import Sirene data from data.gouv.fr website to PostgreSQL.
PostgREST service is used to provide Sirene API REST.
Considering that the file StockUniteLegale_utf8.csv
is very big 2.6G
then some filters are applied before importation:
- drop
Cessée
etatAdministratifUniteLegale
- use
--ape-filter
to apply a filter onAPE
code
Homebrew instructions:
$ brew cask install docker
$ brew install python3 curl
Download data from https://files.data.gouv.fr/insee-sirene/:
$ ./scripts/download-data.sh
Start and initialize PostgreSQL database:
$ ./scripts/up.sh
Setup Python environment:
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
Import StockUniteLegale_utf8.csv
file to PostgreSQL database:
$ ./import-csv-to-postgres.py --csv datas/StockUniteLegale_utf8.csv --db postgresql://postgres:password@127.0.0.1/postgres --ape-filter 62.01Z
Start REST API server (based on PostgREST):
$ docker-compose up -d
Urls:
- REST API: http://127.0.0.1:3000/
- Swagger doc: http://127.0.0.1:8080/