statistics
Description
Display the dispatches statistics
Attributes
tile=statisticstitlequery: Provide a stats queryparticipant: Provide a Participant query.link: navigation linkrange: used for the popup, should be a date expressionstart: start date use to calculate the limitend: end date use to calculate the limitdayKey: Provide a key to get the day from ProgramParticipation.droppedUsers: "show" | "hide" (default hide). Show the past user or notstartDate: "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 configurationshow: "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 cellicon: Icon name to display in header cellhandles: list of tracker handlesactions: [Array objects] Allow to dispatches the data from the stats table based on provide action detailstitle: title to display in dialog popupaction: dispatchoptions: [Object] Option to dispatch the datatracker: tracker handle.user: user context.
conditionalBackground: [Object]- Provide different background color base on different condition like below example.
formatBackground: [Array of objects]range: valid conditioncolor: 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.