Skip to content

Commit

Permalink
WIP: import operational units from afirev csv file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaupetit committed May 16, 2024
1 parent 241b3ae commit ef14f9f
Show file tree
Hide file tree
Showing 5 changed files with 1,762 additions and 40 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CURL = $(COMPOSE_RUN) curl
# -- Ressources
IRVE_STATIC_DATASET_URL = https://www.data.gouv.fr/fr/datasets/r/eb76d20a-8501-400e-b336-d85724de5435
AFIREV_CHARGING_DATASET_URL = https://afirev.fr/en/liste-des-identifiants-attribues/
AFIREV_MOBILITY_DATASET_URL = https://afirev.fr/en/liste-des-identifiants-attribues/

# ==============================================================================
# RULES
Expand All @@ -30,9 +29,6 @@ data/irve-statique.csv: data
data/afirev-charging.csv: data
@echo "You should download CSV file from $(AFIREV_CHARGING_DATASET_URL)"

data/afirev-mobility.csv: data
@echo "You should download CSV file from $(AFIREV_MOBILITY_DATASET_URL)"

# -- Docker/compose
bootstrap: ## bootstrap the project for development
bootstrap: \
Expand Down
16 changes: 16 additions & 0 deletions bin/ou
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# A small script used to generate python code to integrate to the
# initial alembic data migration for Operational units import from
# AFIREV CSV file.

declare csv="data/afirev-charging.csv"

while IFS=';' read -r code name; do
# trim leading whitespaces
name="${name##*( )}"
# trim trailing whitespaces
name="${name%%*( )}"

echo "OperationalUnit(code='${code}', name='${name//\'/\\\'}', type=OperationalUnitTypeEnum.CHARGING),"
done < <(csvcut -d ';' -K 1 -c 2,3 "${csv}" | csvformat -D ';')
Loading

0 comments on commit ef14f9f

Please sign in to comment.