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():
simulations_path = Path(
f"{app.dotenv['DATA_DIR']}/{app.dotenv['URBANITE_CITY']}/simulations"
)
dirs = [x for x in simulations_path.iterdir() if x.is_dir()]
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:
info_json_path = d / "info.json"
if not info_json_path.exists():
app.logger.warning(
f"info.json does not exists for {d.name}! It won't be added to the DB!"
if os.path.exists(simulations_path):
dirs = [x for x in simulations_path.iterdir() if x.is_dir()]
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:
info_json_path = d / "info.json"
if not info_json_path.exists():
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
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,
)
plan: Plan = Plan(name=info["name"], network=network)
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}")
plan: Plan = Plan(name=info["name"], network=network)
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}")
else:
app.logger.info(f"No simulations folder present, skipping adding simulations from info.json")
def setup_helsinki():
......
......@@ -24,12 +24,61 @@
"City-wide CO2": "4"
},
"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": {
"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": {
"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