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 set up differently to the web based mSupply Grafana web dashboard

Mobile dashboards are built on the idea of reusing the same interface and report sets that the (non-grafana) mSupply web dashboards use. Hence in many cases a lot of web dashboards can be used as mobile dashboards. However, some reports may be store specific and require particular parameters. For the mobile stores, this requires the # syntax ( see below ) and these reports may not be suitable for the web dashboard.

The mSupply Mobile app dashboard set up is done in mSupply Desktop, via the Admin > Dashboard icon

Each report can be set to a mobile dashboard report OR a web dashboard report

  • There is only one mandatory report parameter, isMobile
    • isMobile must be set to True
    • When isMobile is set to True, it means that the dashboard report is destined to go into mobile and no web dashboard report is generated for that report
  • A specific feature of the mobile dashboard is that we can include store specific values. This allows each store to see its own customised dashboard.
    • If you want to display mobile store specific values, you need to insert the store fields
      • include a # symbol in front of the parameter name, e.g. #store_name
      • for the value of the parameter we set the field name used in the store table e.g. in this case it would be name indicating [store]name
  • An optional parameter is reportType, which determines how the data will be displayed
    • Valid options: table, bar, line and pie
    • When the reportType parameter is not set the data displays as a table by default
  • 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.
  • 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 database, since that's how web dashboard does it
  • When the report has been stored in database, we take that value and create the store specific record with the data in dashboard_store_report. Then we go off to another 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.
  • en/mobile/setup/server_side/dashboard.txt
  • Last modified: 2020/07/31 05:40
  • by Mark Glover