diff --git a/app/__init__.py b/app/__init__.py index 070772f3943935e7fc668f65856e94ac88c79489..0d04a043038f0451540e07b6aca58e9f0d5b918c 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -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(): diff --git a/app/assets/kpi_hierarchy.json b/app/assets/kpi_hierarchy.json index daca4ed75082eddf334615fff64a70d33d8405f3..3ea4971b290e4c1ccc8e35c87ae0e9eae27e8120 100644 --- a/app/assets/kpi_hierarchy.json +++ b/app/assets/kpi_hierarchy.json @@ -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