2. API descriptors¶
The React front-end has access to mapping coordinates reflecting product categories, countries and indicators. See project root static_assets:
- final_countryTree_exiovisuals.csv
- final_productTree_exiovisuals.csv
- mod_indicators.csv
These mapping coordinates are not only used to render tree selectables, but also to transmit the global id’s of the product categories, countries and indicators over the websocket channel. In turn the back-end handles these messages to perform calculations and store results.
API routing:
- API URL Websockets:
<domain-ip>/ramascene/
- API URL AJAX:
<domain-ip>/ajaxhandling/
- Interface format: JSON
Interface descriptors [websocket message to back-end]:
Stage | Instances relation | Variable name, dataType, example |
---|---|---|
Dimension | Production, Consumption |
|
Visualization | TreeMap, GeoMap |
|
Filter | Product |
|
Filter | Country |
|
Filter | Indicator |
|
All |
|
|
→ to back-end complete payload example:
{
“action”:
“start_calc”,
“querySelection”:{
“dimType”:”Production”,
“vizType”:”TreeMap”,
“nodesSec”:[1],
“nodesReg”:[4,5],
“ext”:[8]
}
}
Interface descriptors [websocket messages from back-end]:
Stage | Instances relation | Variable name, dataType, example |
---|---|---|
Action request status |
|
|
Job status |
|
|
Job status |
|
|
Job name |
|
|
→ from back-end complete response example:
{
“job_id”:176,
“action”:”check status”,
“job_status”:”completed”,
“job_name”:{
‘nodesReg’: [‘Total’],
‘vizType’: ‘TreeMap’,
‘nodesSec’: [‘Fishing’, ‘Mining and quarrying’, ‘Construction’],
‘dimType’: ‘Consumption’,
‘extn’: [‘Value Added: Total’]
}
}
Interface descriptors [AJAX response]:
Stage | Instances relation | Variable name, dataType, example |
---|---|---|
Retrieve calculation |
|
|
All |
|
|
All |
|
|
All |
|
|
→ from back-end complete response example:
{
“job_id”:
175,
“unit”:
{“GHG emissions: Total”: “kg CO2 eq”},
“job_name”:
{“nodesReg”: [“Europe”],
“nodesSec”: [“Fishing”],
“dimType”: “Production”,
“extn”: [“GHG emissions: Total”],
“vizType”: “GeoMap”},
“rawResultData”:
{“Europe”: 13787995489.580374}
}