Skip to content
Snippets Groups Projects
Commit f62142ef authored by Smerkol, Maj's avatar Smerkol, Maj
Browse files

update for spider chart with hierarchical buttons

parent 252ba85f
Branches
No related tags found
No related merge requests found
...@@ -5,14 +5,15 @@ PG_PORT=5432 ...@@ -5,14 +5,15 @@ PG_PORT=5432
PG_USER="urbanite" PG_USER="urbanite"
PG_PASSWORD="password" PG_PASSWORD="password"
PG_DB="urbanite" PG_DB="urbanite"
PG_HOST="0.0.0.0" PG_HOST="db"
FLASK_SECRET_KEY="secret" FLASK_SECRET_KEY="secret"
# URLS of other components with ports # URLS of other components with ports
DATA_DIR = "/storage/app/data" DATA_DIR="/storage/app/data"
HOST_DATA_DIR = "../storage_data" ASSETS_DIR="/storage/app/app/assets"
TS_URL = "http://ts:8082" HOST_DATA_DIR="../storage_data"
DSS_URL = "http://dss:5003" TS_URL="http://ts:8082"
DEXI_DIR = "/storage/app/dexi" DSS_URL="http://dss:5003"
DEXI_DIR="/storage/app/dexi"
# city - one of "bilbao", "amsterdam", "messina", "helsinki" # city - one of "bilbao", "amsterdam", "messina", "helsinki"
URBANITE_CITY="amsterdam" URBANITE_CITY="bilbao"
DEVELOPMENT=True DEVELOPMENT=True
\ No newline at end of file
.env
# Created by http://www.gitignore.io
postgres-data/*
storage_data.zip
pg_data
storage_data
### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
## Directory-based project format
.idea/
# if you remove the above rule, at least ignore user-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# and these sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
## File-based project format
*.ipr
*.iml
*.iws
## Additional for IntelliJ
out/
# generated by mpeltonen/sbt-idea
.idea_modules/
# generated by JIRA plugin
atlassian-ide-plugin.xml
# generated by Crashlytics plugin (for Android Studio and Intellij)
com_crashlytics_export_strings.xml
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
gaenv_lib/
appengine_config.py
...@@ -12,8 +12,6 @@ from pony.orm.dbapiprovider import OperationalError ...@@ -12,8 +12,6 @@ from pony.orm.dbapiprovider import OperationalError
# load environment variables, add interal # load environment variables, add interal
load_dotenv() load_dotenv()
os.environ["DATA_DIR"] = "/storage/app/data"
os.environ["ASSETS_DIR"] = "/storage/app/assets"
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
......
...@@ -13,6 +13,7 @@ from app.entities import City, Simulation, Network, Plan ...@@ -13,6 +13,7 @@ from app.entities import City, Simulation, Network, Plan
api_bp = Blueprint("api", __name__) api_bp = Blueprint("api", __name__)
data_dir = f"{app.dotenv['DATA_DIR']}/{app.dotenv['URBANITE_CITY']}" data_dir = f"{app.dotenv['DATA_DIR']}/{app.dotenv['URBANITE_CITY']}"
assets_dir = f"{app.dotenv['ASSETS_DIR']}"
city = app.dotenv["URBANITE_CITY"] city = app.dotenv["URBANITE_CITY"]
# Endpoints for EDA # Endpoints for EDA
...@@ -50,7 +51,12 @@ def evaluated_kpis_many(): ...@@ -50,7 +51,12 @@ def evaluated_kpis_many():
) as file: ) as file:
json_obj = json.loads(file.read()) json_obj = json.loads(file.read())
jsons[sim_id] = json_obj jsons[sim_id] = json_obj
return jsons
meta_path = f"{assets_dir}/kpi_hierarchy.json"
app.logger.debug("meta path %s", meta_path)
with open(meta_path) as f:
metadata = json.load(f)
return {"data": jsons, "metadata": metadata[city]}
@app.route("/storage/dss/kpis", methods=["POST"]) @app.route("/storage/dss/kpis", methods=["POST"])
......
{
"bilbao": {
"Mobility Policy Quality": "0",
"Local": "1",
"City-wide": "1",
"Entry capacity to center": "1",
"Local Pollution": "2",
"Local Traffic": "2",
"City-wide Pollution": "2",
"City-wide Traffic": "2",
"City-wide Emissions": "3",
"City-wide Acoustic pollution": "3",
"City-wide Pedestrian travel time": "3",
"City-wide Daily internal bike travels": "3",
"Local Emissions": "3",
"Local Acoustic pollution": "3",
"Local Pedestrian travel time": "3",
"Local Daily internal bike travels": "3",
"Local NOx": "4",
"Local PM10": "4",
"Local CO2": "4",
"City-wide NOx": "4",
"City-wide PM10": "4",
"City-wide CO2": "4"
},
"amsterdam": {
},
"helsinki": {
},
"messina": {
}
}
\ 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