4.3. SSPI Web Interface - tjmisko/sspi-data-webapp GitHub Wiki
Once the application is running (you've flask run), this page will guide any queries you hope to make. Below is the "base url" for the app.
Local URL: http://127.0.0.1:5000
Remote URL: https://sspi.world
These three functions are core to SSPI data collection, cleaning, and processing. Collect sends a GET request to external data source (like the World Bank) and stores the raw response in the sspi_raw_api_data database. Compute parses and processes our locally-stored raw data, then stores cleaned data in the sspi_clean_api_data database. Impute fills any gaps left in the data with imputed data to the full coverage series needed for scoring.
There is one collect, one compute, and (at most) one impute route per indicator.
Collect: http://127.0.0.1:5000/api/v1/collect/<database_name>
Compute: http://127.0.0.1:5000/api/v1/compute/<database_name>
Impute: http://127.0.0.1:5000/api/v1/impute/<database_name>
This important function allows for inspection of data (in its raw or clean form) in its respective databases.
Query All: http://127.0.0.1:5000/api/v1/query/<database_name>
Query Filtered to Indicator: http://127.0.0.1:5000/api/v1/query/<database_name>?IndicatorCode=<IndicatorCode>
Query Filtered to Country: http://127.0.0.1:5000/api/v1/query/<database_name>?CountryCode=<CountryCode>
Query Filtered to Year: http://127.0.0.1:5000/api/v1/query/<database_name>?Year=2015
Query filters can be combined to pinpoint exactly the observations you're looking for. For example:
http://127.0.0.1:5000/api/v1/query/sspi_clean_api_data?CountryCode=SWE&CountryCode=IND&CountryCode=RUS&IndicatorCode=REDLST&Year=2015
This page hosts all of our delete capabilities. This allows us to remove duplicates from databases, delete specific databases (by indicator), etc.
Delete: http://127.0.0.1:5000/api/v1/delete
After you have confirmed collect and compute are working, you can plot the country scores (by indicator) using the live charts on the website. In order to do this, you must run the respective routes from finalize_bp to generate
Finalize All: http://127.0.0.1:5000/api/v1/production/finalize
Finalize Dynamic Line (for use with indicators): http://127.0.0.1:5000/api/v1/production/finalize
Finalize Dynamic (for use with indicators): http://127.0.0.1:5000/api/v1/production/finalize
To access the various plots, use the URLs below:
Indicator Plots: http://127.0.0.1:5000/data/indicator/<indicator_code>
Category Plots: http://127.0.0.1:5000/data/category/<category_code>
Pillar Plots: http://127.0.0.1:5000/data/pillar/<pillar_code>
SSPI Plot: http://127.0.0.1:5000/data
Coverage Plot: http://127.0.0.1:5000/data/overview
Comparison Plots: http://127.0.0.1:5000/compare
Indicator Plots: http://127.0.0.1:5000/data/static/indicator/<indicator_code>
Category Plots: http://127.0.0.1:5000/data/static/category/<category_code>
Pillar Plots: http://127.0.0.1:5000/data/static/pillar/<pillar_code>
SSPI Plot: http://127.0.0.1:5000/data/static
Comparison Plots: http://127.0.0.1:5000/compare/static
To generate custom plots as you're working on any data series, see the documentation for sspi panel plot at 4.3.-SSPI-CLI.md.
Once you've started the app, you may need to register an account with the SSPI API if you have not done so already. This is necessary to protect sensitive routes which cause our server to make requests or do significant requests from public traffic. It also allows us to keep track of who has collected what data and when in the raw database, which can be useful for versioning, debugging, and traceability.
Register: http://127.0.0.1:5000/register
- If you cannot reach this endpoint, you can try commenting out the
@fresh_login_requireddecorator on the/registerroute in./sspi_flask_app/auth/routes.py - Just remember to comment it out again: your PR tests will fail if you leave this commented out!
- Contact @tjmisko to request access or with further questions.
URL: http://127.0.0.1:5000/login