分析工具¶
分析工具¶
要访问 DHIS2 中的分析汇总数据,您可以使用 *分析*资源。分析资源非常强大,因为它可以让您 查询和检索沿所有可用数据维度聚合的数据。 例如,您可以要求分析资源提供 一组数据元素、时间段和 组织单位。此外,您可以检索聚合数据 基于数据元素的任意数量维度的组合和 组织单位组集。
Table: Data query parameters
请求查询参数¶
分析资源可让您指定一系列查询参数:
选项值
| 查询参数 | 需要 | 描述 | 选项(默认为默认) |
|---|---|---|---|
| 维度 | 是的 | width | /api/visualizations/R0DVGvXDUNP/data |
| /api/visualizations/R0DVGvXDUNP/data?date=2013-06-01 |
/api/visualizations/jIISuEWxmoI/data.html
/api/visualizations/jIISuEWxmoI/data.html?date=2013-01-01
/api/visualizations/FPmvWs7bn2P/data.xls
/api/visualizations/FPmvWs7bn2P/data.pdf
/api/eventVisualizations/x5FVFVt5CDI/data
/api/eventVisualizations/x5FVFVt5CDI/data.png
/api/maps/DHE98Gsynpr/data
/api/maps/DHE98Gsynpr/data?date=2013-07-01
/api/reports/OeJsA6K1Otx/data.pdf
/api/reports/OeJsA6K1Otx/data.pdf?date=2014-01-01 |
| 数据值 | 不 | 用于检索各种分析的有效 URL 的一些示例 代表如下。 | /api/visualizations/R0DVGvXDUNP/data /api/visualizations/R0DVGvXDUNP/data?date=2013-06-01
/api/visualizations/jIISuEWxmoI/data.html
/api/visualizations/jIISuEWxmoI/data.html?date=2013-01-01
/api/visualizations/FPmvWs7bn2P/data.xls
/api/visualizations/FPmvWs7bn2P/data.pdf
/api/eventVisualizations/x5FVFVt5CDI/data
/api/eventVisualizations/x5FVFVt5CDI/data.png
/api/maps/DHE98Gsynpr/data
/api/maps/DHE98Gsynpr/data?date=2013-07-01
/api/reports/OeJsA6K1Otx/data.pdf
/api/reports/OeJsA6K1Otx/data.pdf?date=2014-01-01 |
| Events resource only. Custom period on scheduledDate. See "custom date periods" section. | 不 | 要访问 DHIS2 中的分析汇总数据,您可以使用 *分析*资源。分析资源非常强大,因为它可以让您 查询和检索沿所有可用数据维度聚合的数据。 例如,您可以要求分析资源提供 一组数据元素、时间段和 组织单位。此外,您可以检索聚合数据 基于数据元素的任意数量维度的组合和 组织单位组集。 | no | | 请求查询参数 { #webapi_analytics_query_parameters } | 不 | Table: Query parameters | 查询参数 | | 需要 | 不 | 选项(默认为默认) | 查询参数 | | 开始日期 | 不 | Any dimension | 日期 | | 结束日期 | 不 | Any dimension | 日期 | | 不 | 不 | SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | LAST | LAST_AVERAGE_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX | 假 | | 不 | 不 | ASC | DESC | 假 | | sortOrder | 不 | EQ | GT | GE | LT | LE | 假 | | stage | 不 | Program stage identifier. | 假 | | 不 | 不 | 日期 | 假 | | 不 | 不 | false | true | 假 | | 不 | 不 | false | true | 假 | | The program stage associated. | 不 | false | true | 假 | | Custom period on incidentDate. See "custom date periods" section. | 不 | lastUpdated | 假 | | 不 | 不 | false | true | 假 | | 不 | 不 | ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier> | 假 | | Custom period on lastUpdated. See "custom date periods" section. | 不 | DESCENDANTS, CHILDREN, SELECTED | 查询参数 | | json { "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "responseType": "ObjectReport", "uid": "pG4bBTMiCqO", "klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange", "errorReports": [] } } | 不 | false | true | page | | Required / Notes | 不 | false | true | includeNumDen | | 是的 | 不 | false | true | includeNumDen | | The name of the headers to be returned as part of the response. One or more headers name separated by comma | 不 | 不 | displayProperty | | 不 | 不 | NAME | SHORTNAME | outputIdScheme | | 描述 | 不 | 需要 | 日期 | | 不 | 不 | UUID | CODE | NAME | ATTRIBUTE:<ID> | outputDataElementIdScheme | | 列 | 不 | UUID | CODE | NAME | ATTRIBUTE:<ID> | hierarchyMeta | | 不 | 不 | UID | CODE | ATTRIBUTE:<ID> | hierarchyMeta | | iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 | 不 | Identifier of approval level | 价值 | | 不 | 不 | 日期 | EVENT_DATE | ENROLLMENT_DATE | INCIDENT_DATE | DUE_DATE | COMPLETED_DATE | CREATED | LAST_UPDATED | <Attribute ID> | <Data element ID> | | 事件聚合资源不返回事件信息 本身,而不是与请求匹配的事件总数 询问。事件维度包括数据元素、人员属性、人员 标识符、期间和组织单位。聚合事件查询 应该是下面描述的格式。 | 不 | false | true | skipMeta | | 不 | 不 | Any dimension (must be query dimension) | 假 |
dimension 查询参数定义了哪些维度应该是 包含在分析查询中。可以是任意数量的维度 指定的。每个维度都应该重复维度参数 包含在查询响应中。查询响应可能 包含指定的所有组合的聚合值 维度项。
filter 参数定义应将哪些维度用作 在分析查询中检索到的数据的过滤器。任意数量 可以指定过滤器。过滤器参数应该重复 要在查询中使用的每个过滤器。过滤器与维度的不同之处在于 过滤器维度不会成为查询响应的一部分 内容,并且响应中的聚合值将是 在过滤器尺寸上折叠。换句话说,数据在 响应将在过滤器维度上聚合,但过滤器 不会作为维度包含在实际响应中。作为 例如,查询按句点过滤的某些数据元素和 您可以使用以下 URL 的组织单位:
Any dimension (must be query dimension)
aggregationType 查询参数允许您定义哪个聚合 运算符应该用于查询。默认情况下,聚合 将使用为查询中包含的数据元素定义的运算符。 如果您的查询不包含任何数据元素但包含数据 元素组,第一个数据元素的聚合运算符 将使用第一组。组和数据元素的顺序是 不明确的。此查询参数允许您覆盖默认值和 指定特定的聚合运算符。例如,您可以设置 使用以下 URL 进行“计数”的聚合运算符:
不
measureCriteria 查询参数可让您过滤掉数据范围 要返回的记录。您可以指示系统仅返回记录 其中聚合数据值等于、大于、大于或 等于、小于或小于或等于某些值。您可以指定任何 以下格式的标准数量,其中 criteria 和 value 应替换为实际值:
ASC | DESC
例如,以下查询将仅返回以下记录 数据值大于或等于 6500 且小于 33000:
不
类似于 measureCriteria,preAggregationMeasureCriteria 查询 参数让你过滤掉数据,只有在聚合之前 执行。例如,以下查询仅聚合数据,其中 原始值在定义的标准内:
EVENT_DATE | ENROLLMENT_DATE | INCIDENT_DATE | DUE_DATE | COMPLETED_DATE | CREATED | LAST_UPDATED | <Attribute ID> | <Data element ID>
startDate 和 endDate 参数可用于指定自定义 要汇总的日期范围。指定日期范围时,您不能 将相对或固定期间指定为维度或过滤器。日期范围 将过滤分析响应。你可以这样使用它:
不
为了让分析资源生成形状中的数据 一个现成的表格,你可以提供 tableLayout 参数 true 作为值。而不是生成一个普通的、规范化的数据源, 分析资源现在将生成表格布局中的数据。你 可以将 columns 和 rows 参数与维度标识符一起使用 用分号分隔作为值以指示使用哪些值 表格列和行。列和行维度必须存在 作为查询中的数据维度(不是过滤器)。这样的请求可以看 像这样:
<Attribute ID> | <Data element ID> | REGISTRATION | ENROLLMENT | OWNER_AT_START | OWNER_AT_END
order 参数可用于分析资源生成 有序数据。数据将按升序(或降序)排序 值。以降序对值进行排序的示例请求 顺序是:
不
尺寸和项目¶
false | true
dimension 查询参数定义了哪些维度应该是 包含在分析查询中。可以是任意数量的维度 指定的。每个维度都应该重复维度参数 包含在查询响应中。查询响应可能 包含指定的所有组合的聚合值 维度项。
| 尺寸 | 值不引用数字元素或项目一部分的数据元素或属性 | aggregationType 查询参数允许您定义哪个聚合 运算符应该用于查询。默认情况下,聚合 将使用为查询中包含的数据元素定义的运算符。 如果您的查询不包含任何数据元素但包含数据 元素组,第一个数据元素的聚合运算符 将使用第一组。组和数据元素的顺序是 不明确的。此查询参数允许您覆盖默认值和 指定特定的聚合运算符。例如,您可以设置 使用以下 URL 进行“计数”的聚合运算符: | |---|---|---| | /api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2014Q1&dimension=ou:O6uvpzGd5pu &aggregationType=COUNT | measureCriteria 查询参数可让您过滤掉数据范围 要返回的记录。您可以指示系统仅返回记录 其中聚合数据值等于、大于、大于或 等于、小于或小于或等于某些值。您可以指定任何 以下格式的标准数量,其中 criteria 和 value 应替换为实际值: | 数据元素、指标、数据集报告率指标、数据元素操作数、项目指标、项目属性标识符、关键字 DE_GROUP-<group-id>, IN_GROUP-<group-id>, 使用<dataelement-id>.<optioncombo-id> 表示数据元素操作数,<program-id>.<dataelement-id> 表示项目数据元素,<program-id>.<attribute-id> 表示项目属性,<validationrule-id> 表示验证结果。 | | 例如,以下查询将仅返回以下记录 数据值大于或等于 6500 且小于 33000: | 聚乙烯 | Fallback coordinate field is invalid | | /api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014 &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&preAggregationMeasureCriteria=GE:10;LT:100 | 欧 | /api/analytics.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU &dimension=ou:ImspTQPwCqd&startDate=2018-01-01&endDate=2018-06-01 | | 为了让分析资源生成形状中的数据 一个现成的表格,你可以提供 tableLayout 参数 true 作为值。而不是生成一个普通的、规范化的数据源, 分析资源现在将生成表格布局中的数据。你 可以将 columns 和 rows 参数与维度标识符一起使用 用分号分隔作为值以指示使用哪些值 表格列和行。列和行维度必须存在 作为查询中的数据维度(不是过滤器)。这样的请求可以看 像这样: | 描述 | order 参数可用于分析资源生成 有序数据。数据将按升序(或降序)排序 值。以降序对值进行排序的示例请求 顺序是: | | /api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:LAST_12_MONTHS &dimension=ou:O6uvpzGd5pu&order=DESC | 尺寸和项目 { #webapi_analytics_dimensions_and_items } | DHIS2 features a multi-dimensional data model with several fixed and dynamic data dimensions. The fixed dimensions are the data element, period (time) and organisation unit dimension. You can dynamically add dimensions through categories, category option group sets, organisation unit group sets, data element group sets and organisation unit group sets. The table below displays the available data dimensions in DHIS2. Each data dimension has a corresponding dimension identifier, and each dimension can have a set of dimension items: | | 分类目录 | 尺寸 | Dimension id | | 数据元素组集 | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | dx | | /api/analytics/events | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | 聚乙烯 | | ISO periods and relative periods, see "date and period format" | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | 欧 |
没有必要知道哪些对象用于 设计分析查询时的各种动态维度。你可以得到 通过访问 Web API 中的此 URL 获得动态维度的完整列表:
Category option combinations
co
Category option combo identifiers (omit to get all items)
Attribute option combinations
ao
Category option combo identifiers (omit to get all items)
分类目录
<category id>
Category option identifiers (omit to get all items)
分析资源的基本 URL 是/api/analytics。请求 您可以在其上使用查询字符串的特定维度和维度项目 以下格式,其中 dim-id 和 dim-item 应替换为实际值:
{
"headers": [
{
"name": "psi",
"column": "Event",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "ps",
"column": "Program stage",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "eventdate",
"column": "Event date",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "storedby",
"column": "Stored by",
"valueType": "TEXT",
"hidden": false,
"meta": true
},
{
"name": "lastupdated",
"column": "Last Updated",
"valueType": "DATE",
"hidden": false,
"meta": true
},
{
"name": "createdbydisplayname",
"column": "Created by (display name)",
"valueType": "TEXT",
"hidden": false,
"meta": true
},
{
"name": "lastupdatedbydisplayname",
"column": "Last updated by (display name)",
"valueType": "TEXT",
"hidden": false,
"meta": true
},
{
"name": "coordinates",
"column": "Coordinates",
"valueType": "COORDINATE",
"hidden": false,
"meta": false
},
{
"name": "ouname",
"column": "Organisation unit name",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "oucode",
"column": "Organisation unit code",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "ou",
"column": "Organisation unit",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "oZg33kd9taw",
"column": "Gender",
"valueType": "TEXT",
"hidden": false,
"meta": false
},
{
"name": "qrur9Dvnyt5",
"column": "Age",
"valueType": "TEXT",
"hidden": false,
"meta": false
}
],
"metaData": {
"names": {
"qrur9Dvnyt5": "Age",
"eBAyeGv0exc": "Inpatient morbidity and mortality",
"ImspTQPwCqd": "Sierra Leone",
"O6uvpzGd5pu": "Bo",
"YuQRtpLP10I": "Badjia",
"oZg33kd9taw": "Gender"
},
"ouHierarchy": {
"YuQRtpLP10I": "/ImspTQPwCqd/O6uvpzGd5pu"
}
},
"width": 8,
"height": 4,
"rows": [
[
"yx9IDINf82o",
"Zj7UnCAulEk",
"2016-08-05",
"system",
"2018-08-07",
"[5.12, 1.23]",
"Ngelehun",
"OU_559",
"YuQRtpLP10I",
"Female",
"50"
],
[
"IPNa7AsCyFt",
"Zj7UnCAulEk",
"2016-06-12",
"system",
"2018-08-07",
"[5.22, 1.43]",
"Ngelehun",
"OU_559",
"YuQRtpLP10I",
"Female",
"50"
],
[
"ZY9JL9dkhD2",
"Zj7UnCAulEk",
"2016-06-15",
"system",
"2018-08-07",
"[5.42, 1.33]",
"Ngelehun",
"OU_559",
"YuQRtpLP10I",
"Female",
"50"
],
[
"MYvh4WAUdWt",
"Zj7UnCAulEk",
"2016-06-16",
"system",
"2018-08-07",
"[5.32, 1.53]",
"Ngelehun",
"OU_559",
"YuQRtpLP10I",
"Female",
"50"
]
]
}
`filter=field:OP:value&filter=field:OP:value&...` | See [dimension filters section].(#webapi_analytics_dimension_filters) | #### fields no Allows field filtering - page - no - Page number - Defaults to 1 (first page) - pageSize - no - Page size - Defaults to 50 elements per page - paging - no - Disables pagination when `false` - `true` or `false`, defaults to `true` order - no - Allows sorting on the format: `order=field:direction` - Sortable fields: `created` (default), `lastUpdated`, `code`, `uid`, `id`, `name`, `displayName`, `dimensionType`
Direction can be `ASC` (default) or `DESC` - Dimension filters { #webapi_analytics_dimension_filters } - Dimensions endpoints support filtering the output to narrow down the response to desired elements. Filters are in the format `filter=field:op:value&filter=field:op:value&...&filter=field:op:value`. - Supported `field` values are: - **id**/**uid** - dimension id - **code** - dimension code - **valueType** - dimension value type - **name** - the name of the dimension - **dimensionType** - the type of the dimension ### 事件分析维度{ #event-analytics-dimensions } #### `PROGRAM_INDICATOR` `PROGRAM_ATTRIBUTE` - `CATEGORY` - `CATEGORY_OPTION_GROUP_SET` - **displayName** - displayName of the dimension **displayShortName** - displayShortName of the dimension - Supported `op`values are: - `startsWith` - field starts with - `!startsWith` - field does not start with `endsWith` - field ends with - `!endsWith` - field does not end with- - `eq` - equals - `ieq` - equals ignoring case - `ne` - not equals - `like` - contains 除了 `IMAGE`、`FILE_RESOURCE` 和 `TRACKER_ASSOCIATE`,所有数据元素和跟踪实体属性的值类型都被视为*支持的类型*。 #### `ilike` - contains ignoring case `!ilike` - does not contain ignoring case - `eq` - equals - `ieq` - equals ignoring case - `ne` - not equals - a tracker `program` `UNIT_INTERVAL` - both `program` and `programStage` - `INTEGER` - If only `program` is specified, the resource returns data dimensions for each program stage in the provided program - If only `programStage` is specified, the resource returns data dimensions for the provided `programStage` - If both `program` and `programStage` are specified, the resource returns data dimensions for the provided `programStage` if it belongs to the provided `program`. Returns an error otherwise. - the returned data dimensions are: - **Program indicators** associated with the program (derived from programStageId) - Enrollment analytics dimensions - **Tracked entity attributes** of *supported types* associated with the program (derived from programStageId) ### 招生分析维度{ #enrollment-analytics-dimensions } #### **Category option group sets** of type `ATTRIBUTE` All value types for data elements and tracked entity attributes are considered *supported types*, except `IMAGE` and `FILE_RESOURCE`. - Event aggregate dimensions { #webapi_event_aggregate_analytics_dimension } - Data elements and tracked entity attributes are considered *supported types* if their value type is one of the following: - **Data elements** of *supported types* in the program stage 除了 `IMAGE`、`FILE_RESOURCE` 和 `TRACKER_ASSOCIATE`,所有数据元素和跟踪实体属性的值类型都被视为*支持的类型*。 #### 与项目相关联的类别组合中的**类别**(源自项目阶段 ID) **Category option group sets** of type `ATTRIBUTE` associated with program (derived from programStageId) - Data elements and tracked entity attributes are considered *supported types* if their value type is one of the following: - **Data elements** of *supported types* in the program stage `UNIT_INTERVAL` - both `program` and `programStage` - `INTEGER` - If only `program` is specified, the resource returns data dimensions for each program stage in the provided program - If only `programStage` is specified, the resource returns data dimensions for the provided `programStage` - If both `program` and `programStage` are specified, the resource returns data dimensions for the provided `programStage` if it belongs to the provided `program`. Returns an error otherwise. - the returned data dimensions are: - **Program indicators** associated with the program (derived from programStageId) - Enrollment analytics dimensions - **Tracked entity attributes** of *supported types* associated with the program (derived from programStageId) ### 跟踪实体分析维度{ #tracked-entities-analytics-dimensions } #### 与项目连接的**项目指示器** **Data elements** of *supported types* in the program, with program stage for each data element **Tracked entity attributes** of *supported types* associated with the program that are not confidential - All value types for data elements and tracked entity attributes are considered *supported types*, except `IMAGE` and `FILE_RESOURCE`. - Enrollment aggregate dimensions { #webapi_enrollment_aggregate_analytics_dimension } - **Data elements** of *supported types* in the program stage - **Data elements** of *supported types* in the program, with program stage for each data element 除了 `IMAGE`、`FILE_RESOURCE` 和 `TRACKER_ASSOCIATE`,所有数据元素和跟踪实体属性的值类型都被视为*支持的类型*。 ### 请求和答复样本{ #sample-request-and-response } `NUMBER` `UNIT_INTERVAL` ## `PERCENTAGE` `INTEGER` `INTEGER_POSITIVE` `INTEGER_NEGATIVE` ### `vr =
需要
欧
Org unit identifiers, potentially separated by a semicolon.
是的
ougs
Org unit group set identifiers, potentially separated by a semicolon.
### 价值
列
| json(应用项目/ json) | Validation report |
| ---------- | ------- |
| 响应将包含用于父组织单位的列,用于请求的每个组织单位组集部分的列以及用于计数的列。统计信息包括组织单位的数量,该组织单位是请求中指定的组织单位的子层次结构的一部分。该响应包含一个元数据部分,该元数据部分指定由其标识符引用的响应的每个组织单位和组织单位组部分的名称。 | 默认响应使用单个 `count` 列进行标准化。通过使用 `columns` 查询参数指定至少一个组织单位组集,可以在表格布局中呈现响应。 |
| Response formats | 组织单位分析端点支持以下表示格式: |
## json(应用项目/ json)
csv(应用项目/ csv)
xls(application / vnd.ms-excel)
### `vr = <UID>`以匹配验证规则的所有验证结果;提供多个参数时,多个规则组合或
例子
要获取组织单位和组织单位组集的组织单位分析,请执行以下操作:
| 默认值 | Parameter name | Potential duplicate status | 检索和删除项目通知模板 |
|---|---|---|---|
| Table: Query parameters | Constraints and validation | 下表描述了专门针对组织单位分析API的可能的验证错误。为汇总分析API指定的某些错误也相关。 | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` |
| E7228 | E7300 | 必须至少指定一个组织单位 | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 数据集报告 { #webapi_data_set_report } | 可以使用 web api 生成数据集报告
`/dataSetReport` 资源。此资源生成有关数据集的报告
并以 HTML 表格的形式返回结果。 | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` |
| 数据值 | 该请求支持以下参数: | Table: Data set report query parameters | Program notification template |
| 描述 | 类型 | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Program notification template |
Data set to create the report from.
Data set UID
是的
聚乙烯
Period(s) to create the report from. May be a comma-separated list.
ISO String
是的
### 回应格式 { #response-formats }
Organisation unit to create the report from.
- 临界点
- Property
- Table: Org unit analytics query parameters
### 自订表格 { #custom-forms }
One or more UIDs
不
selectedUnitOnly
Whether to use captured data only or aggregated data.
## Boolean
不
The data set report resource accepts `GET` requests only. The response content type is `application/json` and returns data in a grid. This endpoint works for all types of data sets, including default, section and custom forms.
An example request to retrieve a report for a monthly data set and org unit for October 2018 looks like this:
GET /api/dataSetReport?ds=BfMAe6Itzgt&pe=201810&ou=ImspTQPwCqd&selectedUnitOnly=false
An example request to retrieve a report for a monthly data set and org unit for October, November, and December 2018 looks like this:
GET /api/dataSetReport?ds=BfMAe6Itzgt&pe=201810,201811,201812&ou=ImspTQPwCqd&selectedUnitOnly=false
要获得带有过滤器的数据集报告,可以使用`filter`参数。在这种情况下,过滤器基于一个组织单位组集和两个组织单位组:
| 指标组 | Parameter name | Potential duplicate status | 检索和删除项目通知模板 |
|---|---|---|---|
| pdf(应用项目/ pdf) | xls(application / vnd.ms-excel) | Custom forms | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` |
| 技术性更强、对开发人员更友好的消息(目前尚未使用)。 | 否则,此端点的语法等于常规数据集报告端点。要检索自定义HTML数据集报告,您可以发出如下请求: | 具有以下要求: | Program notification template |
| 推送分析 API 包括用于预览推送分析的端点
报告登录用户并手动触发系统
生成和发送推送分析报告,除了正常的 CRUD
操作。使用创建和更新端点进行推送时
分析,推送分析将根据
推分析的性质。删除或更新一个
禁用推送分析,作业也将停止运行
将来。 | 要获得现有推送分析的 HTML 预览,您可以执行 GET
请求到以下端点: | /api/pushAnalysis/<id>/render | 要手动触发推送分析作业,您可以执行 POST 请求以
这个端点: |
| /api/pushAnalysis/<id>/run | 推送分析包含以下属性,其中一些是
自动运行推送分析作业所需: | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Property |
| 描述 | 类型 | 需要 | dashboard |
| Dashboard on which reports are based | Dashboard UID | 是的 | message |
## Appears after title in reports
串
不
recipientUserGroups
### A set of user groups who should receive the reports
One or more user Group UID
- No. Scheduled jobs without any recipient will be skipped.
- enabled
### Indicated whether this push analysis should be scheduled or not. False by default.
Boolean
Yes. Must be true to be scheduled.
schedulingFrequency
The frequency of which reports should be scheduled.
"DAILY", "WEEKLY", "MONTHLY"
| To send an email with an HTML body, you can simply provide the HTML content
in the `message` parameter. The email client should interpret the
HTML and render it accordingly. Note that the `Content-Type` header in
the `curl` command should be `application/x-www-form-urlencoded`, as the
data is sent as URL-encoded form data. The following example shows how
to send an email with a simple HTML table: | Parameter name |
|---|---|
| The day in the frequency the job should be scheduled. | Integer. Any value when frequency is "DAILY". 0-7 when frequency is "WEEKLY". 1-31 when frequency is "MONTHLY" |
| No. Push analysis without a valid day of frequency for the frequency set will not be scheduled. | 数据使用情况分析 { #webapi_usage_analytics } |
| 使用情况分析 API 可让您访问有关人们使用情况的信息
使用基于数据分析的 DHIS2。当用户访问收藏夹时,
事件被记录。事件由用户名、UID 组成
最喜欢的、事件发生的时间以及事件的类型。这
表中列出了不同类型的事件。 | /api/dataStatistics |
| 使用情况分析 API 可让您检索使用情况的汇总快照
基于时间间隔的分析。 API 捕获用户视图(对于
例如,图表或数据透视表被用户查看的次数
用户)和保存的分析收藏夹(例如收藏夹图表和
数据透视表)。 DHIS2 将捕获夜间快照,然后
应要求汇总。 | 请求查询参数 { #webapi_usage_analytics_request_query_parameters } |
| 使用情况分析(数据统计)API支持两种操作: | *POST:* 创建一个视图事件 |
| *GET:* 检索汇总统计信息 | 创建视图事件(POST) { #webapi_usage_analytics_create_view_events } |
| 使用情况分析 API 可让您创建事件视图。这
dataStatisticsEventType 参数描述了项目的类型
看过。最喜欢的参数表示相关的标识符
最喜欢的。 | 创建新事件视图的 URL
图表: |
| POST /api/dataStatistics?eventType=CHART_VIEW&favorite=LW0O27b7TdD | 成功的保存操作会返回 HTTP 状态代码 201。表
下面显示了支持的事件类型。 |
### Table: Supported event types
键
描述
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name | 用户设置 { #webapi_user_settings } |
|---|---|---|---|
| dueDate | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | EVENT_CHART_VIEW | Event chart view |
| lastUpdatedDate | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | DASHBOARD_VIEW | Event chart view |
| PASSIVE_DASHBOARD_VIEW | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | DATA_SET_REPORT_VIEW | Data set report view |
检索汇总的使用情况分析报告(GET) { #webapi_aggregated_usage_analytics }
使用情况分析(数据统计)API 允许您指定特定查询
请求汇总报告时的参数。
Table: Query parameters for aggregated usage analytics (data statistics)
### 查询参数
需要
描述
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name | 用户设置 { #webapi_user_settings } |
|---|---|---|---|
| Date in yyyy-MM-dd format | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | 是的 | End date for period |
| 定义每页返回的元素数量。 | Program notification template | 是的 | Type of interval to be aggregated |
| 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 [打破玻璃](#webaptrl) 获得临时所有权。
玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。
他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。
访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时
时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。
获得临时访问权。 | Program notification template | 用于创建每月查询的 API 查询
聚合: | GET /api/dataStatistics?startDate=2014-01-02&endDate=2016-01-01&interval=MONTH |
| createdBy | Program notification template | Table: Query parameters for top favorites | 查询参数 |
需要
描述
选项
eventType
### 是的
The data statistics event type
- 临界点
- E7126
- One or more headers name separated by comma
Size of the list returned
For example 5, 10, 25. Default is 25
sortOrder
不
Descending or ascending
ASC or DESC. Default is DESC.
用户名
### 不
If specified, the response will only contain favorites by this user.
For example 'admin'
API 查询可以不用用户名,然后会找到顶部
系统的最爱。
/api/dataStatistics/favorites?eventType=CHART_VIEW&pageSize=25&sortOrder=ASC
## 如果指定了用户名,则响应将仅包含该用户的最爱。
/api/dataStatistics/favorites?eventType=CHART_VIEW&pageSize=25
&sortOrder=ASC&username=admin
回应格式 { #webapi_usage_analytics_response_format }
您可以在使用情况分析响应中返回聚合数据
几种表示格式。默认格式为 JSON。这
可用的格式和内容类型有:
json(应用项目/ json)
xml(应用项目/ xml)
html(text / html)
- 请求 XML 格式的使用情况分析响应的 API 查询
格式:
- /api/dataStatistics.xml?startDate=2014-01-01&endDate=2016-01-01&interval=WEEK
要以 JSON 格式获取使用情况分析响应:
/api/dataStatistics?startDate=2016-02-01&endDate=2016-02-14&interval=WEEK
JSON响应如下所示:
```json
[
{
"year": 2016,
"week": 5,
"mapViews": 2181,
"chartViews": 2227,
"reportTableViews": 5633,
"eventReportViews": 6757,
"eventChartViews": 9860,
"eventVisualizationViews": 2387,
"dashboardViews": 10082,
"passiveDashboardViews": 0,
"totalViews": 46346,
"averageViews": 468,
"averageMapViews": 22,
"averageChartViews": 22,
"averageReportTableViews": 56,
"averageEventReportViews": 68,
"averageEventChartViews": 99,
"averageEventVisualizationViews": 10,
"averageDashboardViews": 101,
"averagePassiveDashboardViews": 0,
"savedMaps": 1805,
"savedCharts": 2205,
"savedReportTables": 1995,
"savedEventReports": 1679,
"savedEventCharts": 1613,
"savedEventVisualizations": 1231,
"savedDashboards": 0,
"savedIndicators": 1831,
"activeUsers": 99,
"users": 969
},
{
"year": 2016,
"week": 6,
"mapViews": 2018,
"chartViews": 2267,
"reportTableViews": 4714,
"eventReportViews": 6697,
"eventChartViews": 9511,
"dashboardViews": 12181,
"passiveDashboardViews": 0,
"totalViews": 47746,
"averageViews": 497,
"averageMapViews": 21,
"averageChartViews": 23,
"averageReportTableViews": 49,
"averageEventReportViews": 69,
"averageEventChartViews": 99,
"averageDashboardViews": 126,
"averagePassiveDashboardViews": 0,
"savedMaps": 1643,
"savedCharts": 1935,
"savedReportTables": 1867,
"savedEventReports": 1977,
"savedEventCharts": 1714,
"savedDashboards": 0,
"savedIndicators": 1646,
"activeUsers": 96,
"users": 953
}
]
{
"name": "Update 'Currently on treatment' data in analytics table",
"phase": "ANALYTICS_TABLE_POPULATED",
"analyticsTableType": "DATA_VALUE",
"sql": "update analytics_temp set monthly = '200212' where monthly in ('200210', '200211')"
}
SVG转换 { #webapi_svg_conversion }
| eventCreatedPeriod | Parameter name | 检索和删除项目通知模板 | Attribute identifiers |
|--------------------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------|
| Table: Query parameters | <indicator-id\> | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | 描述 |
| dueDate | 是的 | Analytics outlier detection { #webapi_analytics_outlier_detection } | ds |
| lastUpdatedDate | The file name for the returned attachment without file extension | Analytics outlier detection { #webapi_analytics_outlier_detection } | ds |
| E7228 | Request { #webapi_analytics_outlier_detection_request } | **Query parameters** | 查询参数 |
| 描述 | 需要 | Program notification template | ds |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 是的 | Program notification template | 开始日期 |
| Start date for interval tocheck for outliers | No (relative date period is mandatory in this case) | Program notification template | 结束日期 |
| End date for interval to check for outliers | No (relative date period is mandatory in this case) | Program notification template | 聚乙烯 |
| 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 [打破玻璃](#webaptrl) 获得临时所有权。
玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。
他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。
访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时
时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。
获得临时访问权。 | No (start and end date is mandatory in this case) | Program notification template | relativePeriodDate |
| Date used as basis for relative periods. | 不 | Program notification template | 欧 |
| Organisation unit, organisation unit level or groups (can be combined) | 不 | Program notification template | 标头 |
| The name of the headers to be returned as part of the response. One or more headers name separated by comma | 不 | Program notification template | 订购 |
| Sort the records on the value column | 不 | Program notification template | 500 |
| sortOrder | Sort the records on the value column in ascending or descending order | Program notification template | 跳过验证 |
算法
Algorithm to use for outlier detection
### 不
Z_SCORE, MODIFIED_Z_SCORE
- 临界点
- E7126
- 不
- 组织单位分析资源使您可以指定一系列查询参数:
- One or more headers name separated by comma
- page
不
UID, ID, CODE, NAME
### maxResults
| Maximum rows (responses) | 不 | Parameter name | Skip rounding of data values, i.e. provide fine precision (scale 10). |
|---|---|---|---|
| ```json
{
"object": {
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userAccesses": [],
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
``` | 日期时间 | **Request example** | |
| GET api/analytics/outlierDetection?ds=BfMAe6Itzgt&ou=ImspTQPwCqd&startDate=2022-07-26&endDate=2022-10-26&algorithm=Z_SCORE&maxResults=30&orderBy=value&threshold=3.0&sortOrder=asc&outputIdScheme=code | Response { #webapi_analytics_outlier_detection_response } |Response is delivered in several representation formats. The default format is JSON. The
available formats and content types are:| json(应用项目/ json) |
| xml(应用项目/ xml) | xsl (application/vnd.ms-excel) | csv(应用项目/ csv) | html(text / html) |
| html + css(text / html) | **Response example** | ```json
{
"headers":[
{
"name":"dx",
"column":"Data",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"dxname",
"column":"Data name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"pe",
"column":"Period",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"pename",
"column":"Period name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ou",
"column":"Organisation unit",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ouname",
"column":"Organisation unit name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ounamehierarchy",
"column":"Organisation unit name hierarchy",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"coc",
"column":"Category option combo",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"cocname",
"column":"Category option combo name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"aoc",
"column":"Attribute option combo",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"aocname",
"column":"Attribute option combo name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"value",
"column":"Value",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"mean",
"column":"Mean",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"stddev",
"column":"Standard deviation",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"absdev",
"column":"Absolute deviation",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"zscore",
"column":"zScore",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"lowerbound",
"column":"Lower boundary",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"upperbound",
"column":"Upper boundary",
"valueType":"NUMBER",
"hidden":false,
"meta":false
}
],
"metaData":{
"maxResults":30,
"count":3,
"orderBy":"VALUE",
"threshold":3.0,
"algorithm":"Z_SCORE"
},
"rowContext":{
},
"width":18,
"rows":[
[
"DE_22",
"Q_Early breastfeeding (within 1 hr after delivery) at BCG",
"202209",
"September 2022",
"OU_204860",
"Sandaru CHC",
"/Sierra Leone/Kailahun/Penguia/Sandaru CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"105.0",
"18.3",
"28.7",
"86.7",
"3.0",
"-67.9",
"104.4"
],
[
"DE_359706",
"BCG doses given",
"202208",
"August 2022",
"OU_595",
"Ngalu CHC",
"/Sierra Leone/Bo/Bargbe/Ngalu CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"220.0",
"41.6",
"57.4",
"178.3",
"3.1",
"-130.7",
"213.9"
],
[
"DE_35",
"Yellow Fever doses given",
"202209",
"September 2022",
"OU_1027",
"Yemoh Town CHC",
"/Sierra Leone/Bo/Kakua/Yemoh Town CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"466.0",
"48.1",
"114.2",
"417.8",
"3.6",
"-294.6",
"391.0"
]
],
"headerWidth":18,
"height":3
}
``` | Statistics in response { #webapi_analytics_outlier_detection_stats_in_response } |
| Statistical Measure | Header name | 描述 | 链接 |
| 值 | 价值 | The data set/ data element numeric value (Penta1 doses given, Measles doses given, etc.) | Mean |
| 意思是 | The average value of a set of numbers. Calculated by summing all values and dividing by the count. | https://www.khanacademy.org/math/statistics-probability/summarizing-quantitative-data | Standard Deviation |
| stddev | A measure of the amount of variation or dispersion in a set of values. | https://www.statisticshowto.com/probability-and-statistics/standard-deviation/ | |
| Absolute Deviation| absdev | The absolute difference between each data value and the middle value. | |
### https://www.mathsisfun.com/data/mean-absolute-deviation.html
Z Score
| zscore | Validation report |
|---|---|
| https://www.statisticshowto.com/probability-and-statistics/z-score/ | Modified Z Score |
| modifiedzscore | Similar to the Z score but robust to outliers. It uses the median and median absolute deviation. |
| https://www.statisticshowto.com/modified-z-scores/ | Median Absolute Deviation |
| medianabsdeviation | A robust measure of the spread of data values, calculated as the median of the absolute deviations from the median. |
| https://math.stackexchange.com/questions/2232309/median-absolute-deviation-mad-formula | Minimum |
| lowerbound | The minimum is the smallest value in a dataset. It represents the lowest observed value among all the data values. |
| Maximum | upperbound |
| The maximum is the largest value in a dataset. It represents the highest observed value among all the data values. | Error messages { #webapi_analytics_outlier_detection_error_messages } |
| All error messages are delivered with http status code 409. | 码 |
| 信息 | E2200 |
| At least one data element must be specified. | E2201 |
| Start date and end date or relative period must be specified. | E2202 |
| Start date must be before end date. | E2203 |
| 必须至少指定一个组织单位。 | E2204 |
| Threshold must be a positive number. | E2205 |
| Max results must be a positive number. | E2206 |
Max results exceeds the allowed max limit: *500*.
E2207
Data start date must be before data end date.
## 分析查询执行计划和成本,包括执行时间估算{ #analytics-query-execution-plan-and-costs-including-execution-time-estimation }
Non-numeric data values encountered during outlier value detection.
- E2209
- Data start date not allowed.
- E2210
Data end date not allowed.
E2211
Algorithm min-max values not allowed.
E2212
Specifying both a start date/end date and a relative period is not allowed.
E2213
## Value of param orderBy is not compatible with algorithm *Z_SCORE*.
E7180
## The analytics outliers data does not exist. Please ensure analytics job was run and did not skip the outliers.
E7181
## Column *dxname* specified in orderBy, is not eligible for orderBy or does not exist.
The values in error messages are examples only.
## **Error message example**
```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "Start date and end date or relative period must be specified",
"errorCode": "E2201"
}