-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: import operational units from afirev csv file
- Loading branch information
Showing
5 changed files
with
1,762 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ';') |
Oops, something went wrong.