forked from healthysustainablecities/global-indicators
-
Notifications
You must be signed in to change notification settings - Fork 1
/
1_create_project_configuration_files.py
60 lines (45 loc) · 1.86 KB
/
1_create_project_configuration_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Create project configuration files.
Copies configuration templates to configuration folder for custom modification.
"""
import os.path
import shutil
source_folder = './configuration/templates'
dest_folder = './configuration'
print(
'Creating project configuration files, if not already existing in the configuration folder...',
)
try:
for folder, subfolders, files in os.walk(source_folder):
for file in files:
path_file = os.path.join(folder, file)
if os.path.exists(f'{dest_folder}/{file}'):
print(f'\t- {file} exists.')
else:
shutil.copyfile(path_file, path_file.replace('templates/', ''))
print(f'\t- created {file}')
print(
"""
All required configuration files are present in the configuration folder, and may be customised as required:
config.yml:
Configuration of overall project
regions.yml
Configuration of study regions of interest
datasets.yml
Configuration of datasets, which may be referenced by study regions of interest
indicators.yml
Configuration of indicators
osm_destination_definitions.csv
Configuration of key-value pairs used to identify features of interest using OpenStreetMap data
osm_open_space.yml
Configuration of queries used to derive a dataset of areas of open space using OpenStreetMap data
resources.json
A file which may be used to log details of users processing environments (not currently implemented in code, but may be manually edited by users for their records).
policies.yml
Configuration of policies for reporting in generated reports
_report_configuration.xlsx
Use to configure generation of report PDFs for processed cities; in particular, the translation of prose and executive summaries for different languages
""",
)
except Exception as e:
raise Exception(f'An error occurred: {e}')