This is an old revision of the document!
7. Setting up the mSupply Mobile app dashboard
The mSupply Mobile app has the capability to display store specific information as a dashboard to be viewed on the mobile device. There is also a function to view data for other stores anonymised.
The Mobile app dashboard is completely different to the mSupply Grafana web dashboard and is configured in a different manner.
Mobile dashboards are built on the idea of reusing the same report sets as the legacy (non-grafana) mSupply web dashboards. A lot of the legacy web dashboards can be used as mobile dashboards. However, some reports require particular parameters.
Mobile specific dashboard configuration
Dashboard reports are configured on the mSupply central server, refer Dashboard set up.
This section describes the additional configuration of reports on the mSupply central server, which will need to be done in order to have dashboard reports show on mSupply Mobile. The mSupply central server generates reports on a schedule, and if the reports are configured correctly, they will also generate versions for mobile sites, which will be synced to mobile stores tablets. Here's how!
Once a report is configured to be sent to mSupply Mobile sites, it will be sent to every mSupply Mobile site that has the Dashboard store preference turned on.
Dashboard reports need the following properties added to them in order for them to show in the mSupply mobile stores.
Property | Values | Description |
---|---|---|
isMobile | True or False | This is the important one! Enable or disable sending this report to your mobile sites |
reportType | Table , BarChart , LineChart or PieChart | The report display type. When the reportType parameter is not set the data displays as a Table by default. This parameter is mobile specific. |
#[report parameter] | [field on store table] | This allows you to pick a value from the store table, which is therefore store specific and assign the value to the report parameter . In this way you can create a report which is customised to each store. See example on the next row |
store_name | #name | The property is called store_name and has the value of #name .In the report, the store_name property will be replaced with the name of the store from the store table Obviously, the property store_name must be used in the report itself for this to do anything! |
- Existing reports can be used and the properties currently configured are used to generate the information. In this situation, the report shows in both the existing web dashboard and in mSupply mobile.
- The mobile dashboard data - in particular the mobileReportType and the store specific data - are only sent to mobile stores (that have the Dashboard store preference turned on).
- All remaining parameters are optional and dependent on the report method. The report method determine which parameters are available, including the isMobile parameter. They must be passed in exactly as the report method expects its parameter, using the correct names.
Internal code logic description
- Introduces new table dashboard_store_report
- The code checks for isMobile parameter, if present it will look for parameters with # prefix
- The code goes through each mobile site's store record, it will specifically look for the fields represented by # prefixed parameter's value
- The code will then take the value of the store field
- eg.
- if #store_name = “name”
- then we look for [store]name of each mobile site's store
- If [store]name = “ABC” we insert store_name = “ABC” in the dashboard method
- Repeat for next store
- A unique report is generated for the store specific dashboard
- We store this report data in dashboard_report table in the database, since that's how the legacy web dashboard does it
- When the report has been stored in the database, we take that value and create the store specific record with the data in dashboard_store_report. Then we go off to the next store's report generation
- If there are 17 mobile stores, there will be 17 records for each mobile dashboard report with each record representing each store's dashboard data
- Only the store specific record from dashboard_store_report will be synced to the particular store. So each store will get only the reports made for it
- Format of data is exactly same as Web dashboard data. With either the other stores' data anonymised or data being filtered for the mobile store. This depends on the dashboard method.