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.
  • droppedUsers: "show" | "hide" (default hide). Show the past user or not
  • startDate : "program" | "user" (default program). Display the user start date or program start date on the dashboard.
  • columns: [Array of objects] Show a column based on configuration
    • show: "program" | "participations" | "programDay" | "priorCompletion";
    • query: provide a participants query[optional]
    • template: Provide a display template based on paritipants data[optional]
  • exceptionQuery: Provide a another stats query for differentiation from actual stats query data to exception stats query data.
  • 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",
  "exceptionQuery": "given program [%program], all trackers from today to +1 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"
          }
        }
      ]
    }
  ]
}

Stats Query Example

Query 1: -
    given user[%id], given program-id [$empty, %program] from %userSpan
Here it will generate a data for open-vairable program dashboard type. %userSpan means calculating a date range from user start date and program duration.