mSupply Superset proof of concept
Refer to https://superset.apache.org/docs/installation/installing-superset-using-docker-compose
- Setup database in local Postgres
psql -c "create database superset;"
psql -c "create user superset with encrypted password 'superset';"
psql -c "grant all privileges on database superset to superset;"
- Update .env
- Depending on local OS, how you connect to the host from inside docker changes, update docker/.env-msupply entry DATABASE_HOST
docker-compose -f docker-compose-msupply.yml pull
docker-compose -f docker-compose-msupply.yml up
- Open localhost:8088
- Create Role
- Settings > List Roles > New
- Name: TupaiaAppRole
- Permissions: [can read on Chart, all datasource access on all_datasource_access]
- Note: all datasource access means access to the one and only database where the data is stored. Without this permission fetching data via the API below is not allowed.
- Create User
- Settings > List Users > New
- Name: TupaiaApp
- Username: TupaiaApp
- Password: TupaiaApp
- Email: igor@beyondessential.com.au
- Is Active: Yes
- Roles: [TupaiaAppRole]
- Create example chart
- ...
- Test access via API
- First request get access key:
POST localhost:8088/api/v1/security/login { "password": "TupaiaApp", "provider": "db", "refresh": true, "username": "TupaiaApp" }
- Second request fetch chart data:
returns
GET localhost:8088/api/v1/chart/133/data/ Authorization: Bearer <access key from above>
{ "result": [{ ... "data": [{ "country_code": "AFG", "SP_RUR_TOTL_ZS": 73.718, "SP_RUR_TOTL": 23315165.0 }, { "country_code": "ASM", "SP_RUR_TOTL_ZS": 12.736, "SP_RUR_TOTL": 7060.0 }, ...], }] }
- First request get access key: