Skip to content

Commit

Permalink
Update Sewage Parser to create on file for all cities
Browse files Browse the repository at this point in the history
  • Loading branch information
frievoe97 committed Feb 27, 2024
1 parent f976827 commit 4b69fc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion scripts/build-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ pip install html_to_json
pip install bs2json
python3 scripts/sewage_data_parser.py -c Köln
python3 scripts/sewage_data_parser.py -a True
cp *sewage_data* Abwasser/
# ls
# pwd
# cp ./Abwasser/*sewage_data* Abwasser/
# cp ./Abwasser/sewage_combined_data.csv* Abwasser/

svn commit --username $SVN_USER --password $SVN_PASSWORD --no-auth-cache -m "autobuild: $TIMESTAMP" Abwasser

Expand Down
10 changes: 5 additions & 5 deletions scripts/sewage_data_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def main(city_name, parse_all_cities):
json_data_city = convert_script_to_json(matching_scripts[2])

if parse_all_cities:
os.makedirs("./sewage", exist_ok=True)
os.makedirs("./Abwasser/sewage", exist_ok=True)
for city_name in json_data_city["map"]:
city_data = json_data_city["map"][city_name]

Expand All @@ -146,11 +146,11 @@ def main(city_name, parse_all_cities):
file_city_name = file_city_name.replace(')', '')
file_city_name = file_city_name.replace('-', '_')
file_city_name = file_city_name.lower()
write_data_to_csv(f'sewage/{file_city_name}_sewage_data.csv', fields, [date_values_avg, map_values_avg, virus_loads_avg,
write_data_to_csv(f'Abwasser/sewage/{file_city_name}_sewage_data.csv', fields, [date_values_avg, map_values_avg, virus_loads_avg,
date_values_dots, map_values_dots, virus_loads_dots], city_data)

combine_csv_files("./sewage", "sewage_combined_data.csv")
shutil.rmtree("./sewage")
combine_csv_files("./Abwasser/sewage", "./Abwasser/sewage_combined_data.csv")
shutil.rmtree("./Abwasser/sewage")
else:
city_data = json_data_city["map"][city_name]

Expand All @@ -164,7 +164,7 @@ def main(city_name, parse_all_cities):
file_city_name = file_city_name.replace(')', '')
file_city_name = file_city_name.replace('-', '_')
file_city_name = file_city_name.lower()
write_data_to_csv(f'{file_city_name}_sewage_data.csv', fields, [date_values_avg, map_values_avg, virus_loads_avg,
write_data_to_csv(f'Abwasser/{file_city_name}_sewage_data.csv', fields, [date_values_avg, map_values_avg, virus_loads_avg,
date_values_dots, map_values_dots, virus_loads_dots], city_data)

# Read the CSV file into a DataFrame
Expand Down

0 comments on commit 4b69fc7

Please sign in to comment.