Skip to content

statistics

Description

Display the dispatches statistics

Attributes

  • tile=statistics
  • title
  • query: Provide a stats query
  • participant: Provide a Participant query.
  • link: navigation link
  • range: used for the popup, should be a date expression
  • start: start date use to calculate the limit
  • end: end date use to calculate the limit
  • dayKey: Provide a key to get the day from ProgramParticipation.
  • stats: [Array of object]
    • title: title to display in header cell
    • icon: Icon name to display in header cell
    • handles: list of tracker handles
    • actions: [Array objects] Allow to dispatches the data from the stats table based on provide action details
      • title: title to display in dialog popup
      • action: dispatch
      • options: [Object] Option to dispatch the data
        • tracker: tracker handle.
        • user: user context.
    • conditionalBackground: [Object]
      • Provide different background color base on different condition like below example.
    • formatBackground: [Array of objects]
      • range: valid condition
      • color: any color

Example

{
  "tile": "statistics",
  "title": "Stats Count",
  "query": "current users, given tracker [wellness]  from 2021-01-12 to 2021-12-12 ",
  "range": "today to -30 days",
  "stats": [
    {
      "title": "test stats1",
      "icon": "heart",
      "handles": [
        "wellness"
      ],
      "conditionalBackground": {
        "lightgrey, #222": "days < 0",
        "limegreen, #222": "days >= 0 and days <= 4",
        "gold, #222": "days > 4 and days <= 8",
        "red, #fff": "days > 8 and days <= 12",
        "firebrick, #fff": "days > 12"
      },
      "formatBackground": [
        {
          "color": "lightgrey, #222",
          "range": "days < 0"
        },
        {
          "color": "limegreen, #222",
          "range": "days >= 0 and days <= 1"
        },
        {
          "color": "gold, #222",
          "range": "days > 1 and days <= 2"
        },
        {
          "color": "red, #fff",
          "range": "days > 2 and days <= 3"
        },
        {
          "color": "firebrick, #fff",
          "range": "days > 3"
        }
      ]
    }
  ]
}

Example1

 {
  "tile": "statistics",
  "title": "Stats Count",
  "query": "all users, given tracker [wellness]  from 2021-01-12 to 2021-12-12 ",
  "range": "today to -30 days",
  "stats": [
    {
      "title": "test stats1",
      "icon": "heart",
      "handles": [
        "wellness"
      ],
      "actions": [
        {
          "title": "New Wellness",
          "action": "dispatch",
          "options": {
            "tracker": "wellness",
            "user": "$context"
          }
        }
      ]
    }
  ]
}