Skip to content
Snippets Groups Projects
Commit bc2bc430 authored by Gjorgji's avatar Gjorgji
Browse files

Adding kpi hierarchy all cities, added check for info.json

parent 8b3070a9
Branches master
No related tags found
No related merge requests found
...@@ -151,45 +151,48 @@ def setup_bilbao(): ...@@ -151,45 +151,48 @@ def setup_bilbao():
simulations_path = Path( simulations_path = Path(
f"{app.dotenv['DATA_DIR']}/{app.dotenv['URBANITE_CITY']}/simulations" f"{app.dotenv['DATA_DIR']}/{app.dotenv['URBANITE_CITY']}/simulations"
) )
dirs = [x for x in simulations_path.iterdir() if x.is_dir()] if os.path.exists(simulations_path):
dirs.sort(key=lambda t: int(t.name)) dirs = [x for x in simulations_path.iterdir() if x.is_dir()]
app.logger.info(f"Found {dirs}") dirs.sort(key=lambda t: int(t.name))
app.logger.info(f"Found {dirs}")
# Inser the simulations based on the info.json file
for d in dirs: # Inser the simulations based on the info.json file
info_json_path = d / "info.json" for d in dirs:
info_json_path = d / "info.json"
if not info_json_path.exists():
app.logger.warning( if not info_json_path.exists():
f"info.json does not exists for {d.name}! It won't be added to the DB!" app.logger.warning(
f"info.json does not exists for {d.name}! It won't be added to the DB!"
)
continue
with open(info_json_path) as info_file:
info = json.load(info_file)
app.logger.info(f"Adding: {info['name']}")
network: Network = Network(
name=info["name"],
description=info["description"],
city=bilbao,
done_osm_processing=True,
donematsim_processing=True,
) )
continue plan: Plan = Plan(name=info["name"], network=network)
with open(info_json_path) as info_file: Simulation(
info = json.load(info_file) city=bilbao,
name=info["name"],
app.logger.info(f"Adding: {info['name']}") description=info["description"],
plan=plan,
network: Network = Network( status=Status.CREATED,
name=info["name"], )
description=info["description"],
city=bilbao, app.logger.info(f"Bilbao simulation: {info['name']}")
done_osm_processing=True, app.logger.info(f"Bilbao network: {network}")
donematsim_processing=True, app.logger.info(f"Bilbao plans: {plan}")
) else:
plan: Plan = Plan(name=info["name"], network=network) app.logger.info(f"No simulations folder present, skipping adding simulations from info.json")
Simulation(
city=bilbao,
name=info["name"],
description=info["description"],
plan=plan,
status=Status.CREATED,
)
app.logger.info(f"Bilbao simulation: {info['name']}")
app.logger.info(f"Bilbao network: {network}")
app.logger.info(f"Bilbao plans: {plan}")
def setup_helsinki(): def setup_helsinki():
......
...@@ -24,12 +24,61 @@ ...@@ -24,12 +24,61 @@
"City-wide CO2": "4" "City-wide CO2": "4"
}, },
"amsterdam": { "amsterdam": {
"Mobility Policy Quality": "0",
"Local": "1",
"City-wide": "1",
"Local traffic": "2",
"Local bike infrastructure": "2",
"City-wide traffic": "2",
"City-wide bike infrastructure": "2",
"Local bike intensity": "3",
"Local bike congestion": "3",
"Local bike safety": "3",
"Local bikeability": "3",
"City-wide bike intensity": "3",
"City-wide bike congestion": "3",
"City-wide bike safety": "3",
"City-wide bikeability": "3"
}, },
"helsinki": { "helsinki": {
"Mobility Policy Quality": "0",
"Local": "1",
"City-wide": "1",
"Harbour area traffic flow": "1",
"Local Pollution": "2",
"Local congestions and bottlenecks": "2",
"City-wide Pollution": "2",
"City-wide congestions and bottlenecks": "2",
"Local Emissions": "3",
"Local Acoustic Pollution": "3",
"City-wide Emissions": "3",
"City-wide Acoustic Pollution": "3",
"Local NOx": "4",
"Local PM10": "4",
"Local CO2": "4",
"City-wide NOx": "4",
"City-wide PM10": "4",
"City-wide CO2": "4"
}, },
"messina": { "messina": {
"Mobility Policy Quality": "0",
"Local": "1",
"City-wide": "1",
"Local public transport": "2",
"Local trips share": "2",
"Local number of bike trips": "2",
"City-wide public transport": "2",
"City-wide trips share": "2",
"City-wide number of bike trips": "2",
"Local public transport use": "3",
"Local average speed of public transport": "3",
"Local share of public transport": "3",
"Local share of car trips": "3",
"Local share of bicycles": "3",
"City-wide public transport use": "3",
"City-wide average speed of public transport": "3",
"City-wide share of public transport": "3",
"City-wide share of car trips": "3",
"City-wide share of bicycles": "3"
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment