跳转至
For the complete DHIS2 documentation index, see llms.txt.

分析工具

分析工具

要访问 DHIS2 中的分析汇总数据,您可以使用 *分析*资源。分析资源非常强大,因为它可以让您 查询和检索沿所有可用数据维度聚合的数据。 例如,您可以要求分析资源提供 一组数据元素、时间段和 组织单位。此外,您可以检索聚合数据 基于数据元素的任意数量维度的组合和 组织单位组集。

/api/分析

请求查询参数

分析资源可让您指定一系列查询参数:

表:查询参数

查询参数 需要 描述 选项(默认为默认)
方面 是的 要检索的维度和维度项目,每个维度都重复。 任何维度
筛选 应用于查询的过滤器和过滤项,对每个过滤器和过滤项重复。 任何维度
聚合类型 聚合过程中使用的聚合类型。 总和|平均水平AVERAGE_SUM_ORG_UNIT |最后| LAST_AVERAGE_ORG_UNIT |计数|标准差值方差|敏|最大限度
衡量标准 过滤数据/度量。 情商| GT|通用电气LT| LE
预聚合测量标准 数据/度量的过滤器,在执行聚合之前应用。 情商| GT|通用电气LT| LE
开始日期 日期范围的开始日期。将用作过滤器。不能与周期维度或过滤器一起使用。 日期
结束日期 日期范围的结束日期。将用作过滤器。不能与周期维度或过滤器一起使用。 日期
跳过元数据 排除响应的元数据部分(提高性能)。 假的|真的
跳过数据 排除响应的数据部分。 假的|真的
跳过舍入 跳过数据值的舍入,即提供完整的精度。 假的|真的
层级元 在元数据中包括组织单位祖先的名称和组织单位的层次结构路径。 假的|真的
忽略限制 日期 假的|真的
表格布局 使用纯数据源或表布局进行响应。 假的|真的
隐藏空行 隐藏响应中的空行,适用于表布局为 true 的情况。 假的|真的
隐藏空列 隐藏响应中的空列,适用于表布局为 true 的情况。 假的|真的
显示层次结构 显示完整的组织单位层次结构路径以及组织单位名称。 假的|真的
包含编号 包括用于计算响应中的值的分子和分母。 假的|真的
包含元数据详细信息 将元数据详细信息包含到原始数据响应中。 假的|真的
显示属性 要显示元数据的属性。 姓名 |简称
输出IdScheme 用于查询响应中元数据项的标识符方案。它接受标识符、代码或属性。 UID | UUID |代码|姓名 |属性:<ID>
输出组织单位 ID 方案 false | true UUID |代码|姓名 |属性:<ID>
输出数据元素Id方案 false | true UUID |代码|姓名 |属性:<ID>
输入IdScheme 用于查询请求中的元数据项的标识符方案可以是标识符、代码或属性。 UID |代码|属性:<ID>
审批级别 包括至少已被批准达到给定批准级别的数据,指批准级别的标识符。 批准级别标识符
相对期间日期 用作相对期间基础的日期。 日期
用户组织单位 显式定义要使用的用户组织单位,覆盖与当前用户关联的组织单位,多个标识符可以用分号分隔。 outputDataElementIdScheme
UUID | CODE | NAME | ATTRIBUTE:<ID> 任意维度(必须是查询维度)
UID | CODE | ATTRIBUTE:<ID> 任意维度(必须是查询维度)
命令 根据值指定行的顺序。 ASC | DESC
时间字段 事件聚合所依据的时间字段。仅适用于事件数据项。可以是预定义选项或具有基于时间的值类型的属性或数据元素的 ID。 EVENT_DATE | ENROLLMENT_DATE | INCIDENT_DATE | DUE_DATE | COMPLETED_DATE | CREATED | LAST_UPDATED | <Attribute ID> | <Data element ID>
组织单位字段 事件聚合所依据的组织单位字段。仅适用于事件数据项。可以是具有组织单位值类型的属性或数据元素的 ID。默认选项指定为省略查询参数。 <Attribute ID> | <Data element ID> |注册|注册| OWNER_AT_START | OWNER_AT_END
增强条件 Any dimension (must be query dimension) 假的|真的

dimension 查询参数定义了哪些维度应该是 包含在分析查询中。可以是任意数量的维度 指定的。每个维度都应该重复维度参数 包含在查询响应中。查询响应可能 包含指定的所有组合的聚合值 维度项。

filter 参数定义应将哪些维度用作 在分析查询中检索到的数据的过滤器。任意数量 可以指定过滤器。过滤器参数应该重复 要在查询中使用的每个过滤器。过滤器与维度的不同之处在于 过滤器维度不会成为查询响应的一部分 内容,并且响应中的聚合值将是 在过滤器尺寸上折叠。换句话说,数据在 响应将在过滤器维度上聚合,但过滤器 不会作为维度包含在实际响应中。作为 例如,查询按句点过滤的某些数据元素和 您可以使用以下 URL 的组织单位:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&filter=pe:2014Q1;2014Q2
  &filter=ou:O6uvpzGd5pu;lc3eMKXaEfw

aggregationType 查询参数允许您定义哪个聚合 运算符应该用于查询。默认情况下,聚合 将使用为查询中包含的数据元素定义的运算符。 如果您的查询不包含任何数据元素但包含数据 元素组,第一个数据元素的聚合运算符 将使用第一组。组和数据元素的顺序是 不明确的。此查询参数允许您覆盖默认值和 指定特定的聚合运算符。例如,您可以设置 使用以下 URL 进行“计数”的聚合运算符:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2014Q1&dimension=ou:O6uvpzGd5pu
  &聚合类型=COUNT

measureCriteria 查询参数可让您过滤掉数据范围 要返回的记录。您可以指示系统仅返回记录 其中聚合数据值等于、大于、大于或 等于、小于或小于或等于某些值。您可以指定任何 以下格式的标准数量,其中 criteriavalue 应替换为实际值:

/api/analytics?measureCriteria=标准:值;标准:值

例如,以下查询将仅返回以下记录 数据值大于或等于 6500 且小于 33000:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014
  &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&measureCriteria=GE:6500;LT:33000

类似于 measureCriteriapreAggregationMeasureCriteria 查询 参数让你过滤掉数据,只有在聚合之前 执行。例如,以下查询仅聚合数据,其中 原始值在定义的标准内:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014
  &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&preAggregationMeasureCriteria=GE:10;LT:100

startDateendDate 参数可用于指定自定义 要汇总的日期范围。指定日期范围时,您不能 将相对或固定期间指定为维度或过滤器。日期范围 将过滤分析响应。你可以这样使用它:

/api/analytics.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=ou:ImspTQPwCqd&startDate=2018-01-01&endDate=2018-06-01

为了让分析资源生成形状中的数据 一个现成的表格,你可以提供 tableLayout 参数 true 作为值。而不是生成一个普通的、规范化的数据源, 分析资源现在将生成表格布局中的数据。你 可以将 columnsrows 参数与维度标识符一起使用 用分号分隔作为值以指示使用哪些值 表格列和行。列和行维度必须存在 作为查询中的数据维度(不是过滤器)。这样的请求可以看 像这样:

/api/analytics.html?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014Q1;2014Q2
  &dimension=ou:O6uvpzGd5pu&tableLayout=true&columns=dx;ou&rows=pe

order 参数可用于分析资源生成 有序数据。数据将按升序(或降序)排序 值。以降序对值进行排序的示例请求 顺序是:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:LAST_12_MONTHS
  &dimension=ou:O6uvpzGd5pu&order=DESC

尺寸和项目

DHIS2 采用多维数据模型,有多个固定和动态数据维度。 动态数据维度。固定维度是数据元素、 期间(时间)和组织单位维度。您可以通过类别、类别选项组 维度、 组织单位组组集、数据元素组组集和组织单位组组集来动态添加维度。 单位组集。下表显示了 DHIS2 中可用的数据维度。 下表显示了 DHIS2 中可用的数据维度。每个数据维度都有相应的*维度 标识符*,每个维度可以有一组*维度项*:

表:尺寸和尺寸项目

尺寸 维度 ID 维度项目
数据元素、指标、数据集报告率度量、数据元素操作数、程序指标、程序数据元素、程序属性、验证规则 dx 数据元素、指示器、数据集报告率度量、数据元素操作数、程序指示器、程序属性标识符、关键字 DE_GROUP-<group-id>、IN_GROUP-<group-id> ,使用 <dataelement-id>。<optioncombo-id> 作为数据元素操作数,<program-id>.<dataelement-id> 用于程序数据元素,<program-id>.<attribute-id> 用于程序属性, <validationrule-id> 用于验证结果。
期间(时间) 聚乙烯 ISO 周期和相对周期,请参阅“日期和周期格式”
组织单位层次结构 组织部门标识符和关键字 USER_ORGUNIT、USER_ORGUNIT_CHILDREN、USER_ORGUNIT_GRANDCHILDREN、LEVEL-<level> 和 OU_GROUP-<group-id>
类别选项组合 类别选项组合标识符(省略以获取所有项目)
属性选项组合 类别选项组合标识符(省略以获取所有项目)
分类目录 <category id> 类别选项标识符(省略以获取所有项目)
数据元素组集 <group set id> 数据元素组标识符(省略以获取所有项目)
组织单位组集 <group set id> 组织单位组标识符(省略以获取所有项目)
类别选项组集 <group set id> 类别选项组标识符(省略以获取所有项目)

没有必要知道哪些对象用于 设计分析查询时的各种动态维度。你可以得到 通过访问 Web API 中的此 URL 获得动态维度的完整列表:

/api/尺寸

如果只想检索给定动态维度的维度项,可以使用下面的示例。 使用下面的示例。分页默认为禁用。可通过在 URL 中添加 分页参数 paging=true 来启用。

/api/dimensions/J5jldMd8OHv/items?paging=true

Attribute option combinations

/api/33/dimensions/recommendations?fields=id&dimension=dx:fbfJHSPpUQD

Category option combo identifiers (omit to get all items)

端点支持多个数据元素。如果希望发送多个数据元素,则应以;分隔。例如

/api/33/dimensions/recommendations?fields=id&dimension=dx:fbfJHSPpUQD;JuTpJ2Ywq5b

注意事项

此端点仅返回当前登录用户可以读取的维度。它将检查当前用户是否可以读取相应推荐维度的数据或元数据。列表中省略了非授权尺寸。

分析资源的基本 URL 是/api/analytics。请求 您可以在其上使用查询字符串的特定维度和维度项目 以下格式,其中 dim-iddim-item 应替换为实际值:

/api/analytics?dimension=dim-id:dim-item;dim-item&dimension=dim-id:dim-item;dim-item

如上所示,维度标识符后跟一个冒号 而维度项之间用分号分隔。例如,一个 查询两个数据元素,两个期间和两个组织单位可以 使用以下 URL 完成:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &维度=pe:2016Q1;2016Q2&维度=ou:O6uvpzGd5pu;lc3eMKXaEfw

查询按类别选项组合细分的数据,而不是 您可以在查询中包含类别维度的数据元素总计 字符串,例如像这样:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &尺寸=co&尺寸=pe:201601&尺寸=ou:O6uvpzGd5pu;lc3eMKXaEfw

Category option group sets

/api/analytics?dimension=dx:DE_GROUP-h9cuJOkOwY2
  &维度=pe:201601&维度=ou:O6uvpzGd5pu

选择数据集报告率时,语法包含数据 设置标识符后跟报告率指标:

/api/analytics?dimension=dx:BfMAe6Itzgt.REPORTING_RATE;BfMAe6Itzgt.ACTUAL_REPORTS
  &维度=pe:201601&维度=ou:O6uvpzGd5pu

要查询程序数据元素(跟踪器域类型),您可以获得 通过使用以下命令为每个数据元素指定程序 <program-id>.<dataelement-id> 语法:

/api/analytics.json?dimension=dx:eBAyeGv0exc.qrur9Dvnyt5;eBAyeGv0exc.GieVkTxp4HH
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

要查询程序属性(跟踪实体属性),您可以获得 通过使用以下命令为每个属性指定程序 <program.id>.<attribute-id> 语法:

/api/analytics.json?dimension=dx:IpHINAT79UW.a3kGcGDCuk6;IpHINAT79UW.UXz7xuGCEhU
  &dimension=pe:LAST_4_QUARTERS&dimension=ou:ImspTQPwCqd

要查询可以使用的组织单位组集和数据元素 以下网址。请注意如何将组集标识符用作 维度标识符和作为维度项的组:

/api/analytics?dimension=Bpx0589u8y0:oRVt7g429ZO;MAs88nJc9nL
  &维度=pe:2016&维度=ou:ImspTQPwCqd

要查询数据元素和类别,您可以使用此 URL。使用 类别标识符作为维度标识符,类别选项作为 维度项目:

/api/analytics?dimension=dx:s46m5MS0hxu;fClA2Erf6IO&dimension=pe:2016
  &dimension=YNZyaJHiHYq:btOyqprQ9e8;GEqzEKCHoGA&filter=ou:ImspTQPwCqd

使用相关期间和组织单位进行查询 当前用户可以使用这样的 URL:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=pe:LAST_12_MONTHS&dimension=ou:USER_ORGUNIT

When selecting organisation units for a dimension you can select an entire level optionally constrained by any number of boundary organisation units with the LEVEL-<level> syntax. Boundary refers to a top node in a sub-hierarchy, meaning that all organisation units at the given level below the given boundary organisation unit in the hierarchy will be included in the response, and is provided as regular organisation unit dimension items. The level value can either be a numerical level or refer to the identifier of the organisation unit level entity. A simple query for all org units at level three:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016&dimension=ou:LEVEL-3

具有两个边界组织单位的三级和四级查询可以是 指定如下:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016
  &dimension=ou:LEVEL-3;LEVEL-4;O6uvpzGd5pu;lc3eMKXaEf

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=co&dimension=pe:201601&dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016
  &dimension=ou:OU_GROUP-w0gFTTmsUcF;OU_GROUP-EYbopBOJWSW;O6uvpzGd5pu;lc3eMKXaEf

您可以将标识符方案用于元数据部分 具有 outputIdScheme 属性的分析响应,如下所示。你可以 使用 ID、代码和属性作为标识符方案:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=pe:2017Q1;2017Q2&dimension=ou:O6uvpzGd5pu&outputIdScheme=CODE

列出了使用分析资源时需要注意的一些事项 以下。

  • 数据元素、指标、数据集报告率、计划数据 要素和计划指标是共同数据维度的一部分, 标识为“dx”。这意味着您可以使用任何数据 元素、指标和数据集标识符以及“dx” 查询中的维度标识符。

  • 对于类别、数据元素组集和组织单元组 设置维度,如果没有,将在查询中使用所有维度项 维度项目被指定。

  • 对于期间维度,维度项为 ISO 期间 标识符和/或相对周期。请参阅部分 上面称为“日期和期间格式”的期间格式和 可用的相对时期。

  • 对于组织单位维度,可以将项目指定为 的组织单位或其下属单位。 When selecting organisation units you can also select all organisation units in an organisation unit group to be included as dimension items using the OU_GROUP-<id> syntax. The organisation units in the groups can optionally be constrained by any number of boundary organisation units. Both the level and the group items can be repeated any number of times: /api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016 &dimension=ou:OU_GROUP-w0gFTTmsUcF;OU_GROUP-EYbopBOJWsW;O6uvpzGd5pu;lc3eMKXaEf 直接使用组织单位标识符,或将两者结合使用。 通过身份验证的用户必须拥有导出和分析数据的权限 指定的组织单位。

  • 标识为“dx”。这意味着您可以使用任何数据 元素、指标和数据集标识符以及“dx” 查询中的维度标识符。 对于类别、数据元素组集和组织单元组 设置维度,如果没有,将在查询中使用所有维度项

  • 维度项目被指定。 对于期间维度,维度项为 ISO 期间 标识符和/或相对周期。请参阅部分 上面称为“日期和期间格式”的期间格式和

  • 可用的相对时期。 For the organization unit dimension, you can specify items as either the organization unit or its sub-units associated with the currently

authenticated user. Use the keys USER_ORGUNIT for the organization unit

itself or USER_ORGUNIT_CHILDREN for its sub-units. You may also specify

organization unit identifiers directly or use a combination of both.

Potential duplicate status for the designated organization units. If no organization unit permissions Parameter name will be applied instead.
对于组织单位维度,您可以指定组织 层次结构级别和用于请求的边界单元 格式LEVEL-<level>-<boundary-id>;举个例子 类型
层次结构中第 3 级的边界单元。 对于组织单位维度,维度项是 组织单位及其子层次结构 - 数据将被聚合 类型
描述 您不能为类别选项指定维度项目 组合维度。相反,响应将包含项目 类型
dx尺寸 { #webapi_analytics_dx_dimension } dx 维度是一个特殊的维度,它可以包含所有的
以下数据类型。 Table: Data dx dimension types 类型
Syntax 描述 数据源 指示符
<indicator-id> Indicator identifier. 汇总数据 Indicator grop
IN_GROUP-<indicatorgroup-id> Keyword followed by an indicator group identifier. Will include all indicators in the group in the response. 汇总数据 数据元素
<dataelement-id> 数据元素标识符。 汇总数据 数据元素组
DE_GROUP-<dataelementgroup-id> Keyword followed by a data element group identifier. Will include all data elements in the group in the response. 汇总数据 数据元素操作数

<dataelement-id>.<categoryoptcombo-id>.<attributeoptcombo-id>

Data element identifier followed by one or both of category option combination and attribute option combo identifier. Wildcard "*" symbol can be used to indicate any option combination value. The attribute option combination identifier can be completely left out.

汇总数据

资料集

<dataset-id>.<reporting-rate-metric>

Data set identifier followed by reporting rate metric. Can be REPORTING_RATE | REPORTING_RATE_ON_TIME | ACTUAL_REPORTS | ACTUAL_REPORTS_ON_TIME | EXPECTED_REPORTS.

Data set completeness registrations

项目数据元素

<program-id>.<dataelement-id>

  • 临界点

  • Not like, ignoring case (free text match)

  • E7126

  • 组织单位分析资源使您可以指定一系列查询参数:

  • One or more headers name separated by comma

  • page

  • Table: Org unit analytics query parameters

<validationrule-id>

Validation rule identifier. Will include validation rule violations for the validation rule, requires that validation results are generated and persisted.

Validation results

Items from all of the various dx types can be combined in an analytics request. An example looks like this:

/api/analytics.json
  ?dimension=dx:Uvn6LCg7dVU;BfMAe6Itzgt.REPORTING_RATE;IpHINAT79UW.a3kGcGDCuk6
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

组语法也可以与任何其他项目一起使用。一个 示例如下所示:

/api/analytics.json
  ?dimension=dx:DE_GROUP-qfxEYY9xAl6;IN_GROUP-oehv9EO3vP7;BfMAe6Itzgt.REPORTING_RATE
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

数据元素操作数可以选择性地指定属性选项 组合并使用通配符,例如指定所有类别选项 组合值:

/api/analytics.json

  ?dimension=dx:Uvn6LCg7dVU.*.j8vBiBqGf6O;Uvn6LCg7dVU.Z4oQs46iTeR
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

Tip

A great way to learn how to use the analytics API is to use the DHIS2 Data Visualizer web app and create a pivot table. You can play around with pivot tables using the various dimensions and items and click Download > Plain data source > JSON to see the resulting analytics API calls in the address bar of your web browser.

回应格式 { #webapi_analytics_response_formats }

包含聚合数据的分析响应可以在 各种表现形式。像往常一样,您可以表示对某个项目感兴趣 通过将文件扩展名附加到 URL,通过 Accept HTTP 标头或通过 format 查询参数。这 默认格式为 JSON。可用的格式和内容类型是 下面列出。

json(应用项目/ json) Validation report
xml(应用项目/ xml) csv(应用项目/ csv)
html(text / html) html + css(text / html)
xls(application / vnd.ms-excel) 例如,要请求 XML 格式的分析响应,您可以
使用以下网址:
/api/analytics.xml?dimension=dx:fbfJHSPpUQD
&dimension=pe:2016&dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw JSON响应如下所示:
```json
{
"headers": [
{
"name": "dx",
"column": "Data",
"valueType": "TEXT",
"meta": true
},
{
"name": "pe",
"column": "Period",
"valueType": "TEXT",
"meta": true
},
{
"name": "value",
"column": "Value",
"valueType": "NUMBER",
"meta": false
}
],
"height": 4,
"metaData": {
"pe": [
"2016Q1",
"2016Q2"
],
"ou": [
"ImspTQPwCqd"
],
"names": {
"2016Q1": "Jan to Mar 2016",
"2016Q2": "Apr to Jun 2016",
"FbKK4ofIv5R": "Measles Coverage <1 y",
"ImspTQPwCqd": "Sierra Leone",
"eTDtyyaSA7f": "Fully Immunized Coverage"
}
},
"rows": [
[
"eTDtyyaSA7f",
"2016Q2",
"81.1"
],
[
"eTDtyyaSA7f",
"2016Q1",
"74.7"
],
[
"FbKK4ofIv5R",
"2016Q2",
"88.9"
],
[
"FbKK4ofIv5R",
"2016Q1",
"84.0"
]
],
"width": 3
}
``` 响应表示维度数据表。 headers 数组
概述了表中包含哪些列以及哪些列
列包含。 column 属性显示列维度
标识符,或者如果列包含度量,则为“值”一词。这
meta 属性为 true 如果列包含维度项或
false 如果列包含度量(聚合数据值)。这
name 属性类似于 column 属性,不同之处在于它显示
如果列包含度量,则为“值”。 type 属性
表示列值的 Java 类类型。
heightwidth 属性表示有多少数据列和
行分别包含在响应中。 metaData period 属性包含一个唯一的有序数组
响应中包含的时间段。 metaData ou 属性包含一个
响应中包含的组织单位标识符数组。
metaData names 属性包含标识符之间的映射
用于数据响应和它们代表的对象的名称。
客户端可以使用它来替换数据中的标识符
响应名称以提供更有意义的数据视图
桌子。
rows 数组包含维度数据表。它包含
具有维度项(对象或期间标识符)和一列的列
具有聚合数据值。上面的示例响应有一个
数据/指标列、期间列和值列。首先
列包含指标标识符,第二列包含 ISO 句点
标识符,第三个包含聚合数据值。 约束与验证 { #webapi_analytics_constraints }
您可以提供给
分析资源。如果违反任何约束,API 将
返回一个 409 Conflict 响应和一个类似于下面的响应消息: ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "Only a single indicator can be specified as filter",
"errorCode": "E7108"
}
```
httpStatushttpStatusCode 字段表示 HTTP 状态和
根据 HTTP 规范的状态代码。 message 字段提供了一个
验证错误的人类可读描述。 errorCode 字段
提供一个机器可读的代码,客户端可以使用它来处理
验证错误。聚合分析的可能验证错误
API 如下表所述。 错误代码
信息 E7100
查询参数不能为空 E7101
必须至少指定一个尺寸 事件聚类分析 { #webapi_event_clustering_analytics }
必须至少指定一个数据维项目或数据元素组集合维项目 E7103
尺寸不能同时指定为尺寸和过滤器 E7104
必须至少指定一个期间作为维度或过滤器,或者开始和日期 E7105
不能同时指定期间,开始日期和结束日期 E7106
开始日期不能晚于结束日期 E7107
无法为报告费率指定开始日期和结束日期 E7108
只能将一个指标指定为过滤器 E7109
只能将单个报告率指定为过滤器 E7110
类别选项组合不能指定为过滤器 E7111
尺寸不能多次指定 E7112
只能与类型的尺寸一起指定报告率 E7113
未指定数据元素时无法指定分配的类别 E7114
指定的类别只能与数据元素一起指定,不能与指标或报告率一起指定 E7115
数据元素必须具有允许聚合的值和聚合类型 E7116
指标表达式不能包含循环引用 E7117
当输出格式为DATA_VALUE_SET时,必须指定数据尺寸“ dx” E7118
当输出格式为DATA_VALUE_SET时,必须指定期间尺寸“ pe” E7119
当输出格式为DATA_VALUE_SET时,必须指定组织单位维度“ ou” E7120
不允许用户查看组织单位 E7121
不允许用户读取对象的数据 E7122

数据批准级别不存在

E7123

当前用户受维度限制,但无权访问任何维度项目

E7124

维度存在于查询中,没有任何有效的维度选项

您可以从原始数据值集格式中检索数据 数据值集资源:

  • 临界点

  • E7126

列必须作为查询中的维存在

  • E7127

  • 行必须作为查询中的维存在

  • E7128

查询结果集超出最大限制

E7129

项目已指定但不存在

E7130

已指定项目阶段,但不存在

E7131

查询失败,可能是因为查询超时

数据值设定格式

分析 dataValueSet 资源允许返回聚合 数据值集格式的数据。这种格式代表原始数据 值,而不是按照各种方式汇总的数据 方面。将聚合数据导出为常规数据值很有用 当目标系统包含数据时,用于系统之间的数据交换 与目标系统存储的内容相比具有更精细的粒度。

例如,可以在目标系统中指定一个指标来 汇总多个数据元素的数据并将此数据导入 目标系统中的单个数据元素。再举一个例子,一个 可以汇总在目标的组织单位级别 4 收集的数据 系统级别 2 并将该数据导入目标系统。

您可以从原始数据值集格式中检索数据 数据值集资源:

  • 临界点

  • 组织单位分析资源使您可以指定一系列查询参数:

json(应用项目/ json)

选项值

eventCreatedPeriod 资料(dx)
周期(pe) ```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 A request which aggregates data for data element operands and uses CODE
as output identifier scheme looks like the below. When defining the
output identifier scheme, all metadata objects part of the response are
affected:
lastUpdatedDate 否 / 年-月-日
Program notification template
stage
Custom period on incidentDate. See "custom date periods" section.
Custom period on lastUpdated. See "custom date periods" section.
```json
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"response": {
"responseType": "ObjectReport",
"uid": "pG4bBTMiCqO",
"klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange",
"errorReports": []
}
}
```
Required / Notes
是的
The name of the headers to be returned as part of the response. One or more headers name separated by comma

skipData

hierarchyMeta

showHierarchy

displayProperty

outputIdScheme

outputOrgUnitIdScheme

outputDataElementIdScheme

inputIdScheme

userOrgUnit

dimension 查询参数定义了哪些维度(表列) 应包含在响应中。它可以选择性地受到约束 与项目。 filter 查询参数定义了哪些项目和 维度(表格列)应用作响应的过滤器。

| /api/analytics/enrollments/query/WSGAb5XwJ3Y.xls ?dimension=ou:ImspTQPwCqd &dimension=WZbXY0S00lP.de0FEHSIoxh &columns=w75KJ2mc4zz &dimension=WZbXY0S00lP.sWoqcoByYmD &dimension=pe:LAST_MONTH &stage=WZbXY0S00lP &pageSize=10&page=1 &asc=ENROLLMENTDATE &ouMode=DESCENDANTS | 值不引用数字元素或项目一部分的数据元素或属性 | Parameter name | |---|---|---| | startDateendDate 参数允许获取链接的数据 到这些日期之间的任何时间段。这避免了定义所有 期间明确在 要求: | 维度不是有效的查询项目 | filter 参数可用于过滤响应,而无需 包括该维度作为响应的一部分,这次是在 CSV 中 格式: | | createdAtClient | 维度不是有效的查询项目 | E7227 | | 来自 rawData 资源的响应看起来与 定期分析资源;不同之处在于响应包含 原始的、非聚合的数据,适合进一步聚合 第三方系统。 | E7228 | Fallback coordinate field is invalid | | E7229 | Filter on whether the current user can manage the returned users through the managed user group relationships. | 组织单位标识符和关键字 USER_ORGUNIT、USER_ORGUNIT_CHILDREN、USER_ORGUNIT_GRANDCHILDREN、LEVEL-<level> 和 OU_GROUP-<group-id> 。它可以分阶段运行,即:A03MvHHogjR.ou。 | | /api/analytics/events | 尺寸和项目 { #webapi_event_analytics_dimensions_items } | 事件维度包括数据元素、属性、组织单位 和时期。聚合的事件分析资源将返回 聚合信息,例如计数或平均值。查询分析 资源将简单地返回匹配一组条件的事件,并且不会 不执行任何聚合。您可以在表单中指定维度项 来自选项集的选项和来自数据图例集的图例 与此相关的元素和属性。事件 尺寸如下表所示。 | | Table: Dimensions and dimension items | 尺寸 | Dimension id |

描述

资料元素

<id>

eventCreatedPeriod 检索和删除项目通知模板 Parameter name Attribute identifiers
{ "periodFrom": -15, "periodTo": 15} ```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"
]
}
``` LT 组织单位
Program notification template Organisation unit group sets <org unit group set id>
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"
]
}
``` <category id> 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"
]
}
``` Table: Query parameters for both event query and aggregate analytics Event chart view
周期(pe) ```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: Query parameters for enrollment query endpoint 查询参数
数据值 Program notification template 任何项目标识符
stage Program notification template Program stage identifier.
"displayOrderColumns": ["enrollmentDate", "program"] Program notification template Start date for events. outputIdScheme
结束日期 Program notification template NAME | SHORTNAME includeMetadataDetails
描述 不区分大小写的字符串结尾匹配 Program notification template Date in yyyy-MM-dd format
Program notification template 维度标识符包括数据元素、属性、期间、组织单位和组织单位组集。参数可以重复任意次数。项目过滤器可以应用于维度,格式为<item-id>:<operator>:<filter>。过滤器值不区分大小写。 hierarchyMeta
Program notification template false | true hierarchyMeta
Program notification template ACTIVE | COMPLETED | SCHEDULE | OVERDUE | SKIPPED. Can be comma separated (for query only). 项目状态

** 在某些情况下,可以通过 dimension 参数请求特定字段。它们不是真正的维度,但提供了更好的灵活性。它们是

事件日期 (EVENT_DATE){ #event-date-event_date }

根据事件发生的日期进行筛选。可用作根级维度或特定阶段的范围。

价值形式 描述 意义
{stageUid}.event_date:{period} dimension=A03MvHHogjR.EVENT_DATE:202205. 阶段 "A03MvHHogjR "中的事件,事件发生日期为 2022 年 5 月。
{stageUid}.event_date:{start}_{end} dimension=A03MvHHogjR.EVENT_DATE:2022-05-01_2022-05-10 该阶段中事件日期在给定包含日期范围内的事件。
event_date:{period} dimension=EVENT_DATE:2022Sep(事件日期:2022 年 9 月) 使用财政年度过滤根级事件日期。

预定日期 (SCHEDULED_DATE){ #scheduled-date-scheduled_date }

根据事件的计划日期(而不是实际发生日期)进行筛选。此外,它还可以扩展到特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
scheduled_date:{period} dimension=SCHEDULED_DATE:202107 活动处于既定阶段,预定日期为 2021 年 7 月。

创建日期 (CREATED){ #created-date-created }

根据报名记录在系统中创建的时间进行筛选。此外,它还可以针对特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
CREATED:{period} dimension=CREATED:2016Sep 自 2016 年 9 月起的财政年度内创建的注册人数。

完成日期 (COMPLETED){ #completed-date-completed }

根据注册被标记为完成的时间进行筛选。 此外,它还可以扩展到特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
完成:{period}` 尺寸=COMPLETED:2022年9月 自 2022 年 9 月起的财政年度内完成的注册。

事件状态 (EVENT_STATUS){ #event-status-event_status }

根据阶段内事件的状态进行筛选。

价值形式 描述 意义
{stageUid}.event_status:{status} dimension=A03MvHHogjR.EVENT_STATUS:ACTIVE. 阶段中状态为 "ACTIVE "的事件。
{stageUid}.event_status:{s1};{s2} dimension=edqlbukwRfQ.EVENT_STATUS:COMPLETED;ACTIVE. 状态为 COMPLETED ACTIVE 的事件(OR 逻辑)。

有效状态值:活动"、"已完成"、"已排定"、"逾期"、"已跳过"。

程序状态 (PROGRAM_STATUS){ #program-status-program_status }

根据注册本身的状态(而不是单个事件)进行筛选。

价值形式 描述 意义
program_status:{status} dimension=PROGRAM_STATUS:ACTIVE 仅指具有指定计划状态的注册人数。

有效状态值:激活"、"已完成"、"已取消"。

eventCreatedPeriod 检索和删除项目通知模板 Parameter name 用户设置 { #webapi_user_settings }
{"type":"RELATIVE","period":"TODAY"} Program notification template
Dimensions to use as columns for table layout. Program notification template rows
filter Program notification template timeField
Program notification template Table: Query parameters for event query analytics only
需要 Program notification template 选项
Program notification template DESCENDANTS, CHILDREN, SELECTED pageSize
Start date for interval tocheck for outliers Program notification template 选项(默认为默认) ouMode
定义要返回的页码。 Program notification template ouname | programstatus | eventstatus | createdbydisplayname | lastupdatedbydisplayname | eventdate | enrollmentdate | incidentdate | lastupdated | item identifier asc
定义每页返回的元素数量。 Program notification template false | true coordinateOuFallback
"assignedUsers": ["a3kGcGDCuk7", "a3kGcGDCuk8"] Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions false | true pageSize
The analytics/trackedEntities/query endpoint provides queries for captured TEs, allowing querying and filtering for information related to TEs, along with their respective enrollments and events. It does not perform any aggregation. Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions NAME | CODE | UID pageSize
You can specify any number of dimensions and any number of filters in a query. Dimension item identifiers can refer to any of the data elements in program stages, program attributes, tracked entity attributes, fixed and relative periods, and organization units. Dimensions can optionally have a query operator and a filter. TEs queries should be in the format described below. Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions One or more headers name separated by comma pageSize
For example, to retrieve TEs of type Person from the "Child Program" and "Antenatal care" programs, where the "First name" is "James": Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions Numeric positive value pageSize
Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions Numeric zero or positive value pageSize

no

eventCreatedPeriod 检索和删除项目通知模板 Parameter name 用户设置 { #webapi_user_settings }
日期时间 Program notification template scheduledDate 数据元素或属性标识符。它可以是阶段范围,即:value=stageId.dimensionid
Events resource only. Custom period on scheduledDate. See "custom date periods" section. Program notification template incidentDate no
Custom period on incidentDate. See "custom date periods" section. Program notification template lastUpdated
Custom period on lastUpdated. See "custom date periods" section. Program notification template DESCENDANTS, CHILDREN, SELECTED 查询参数
这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 打破玻璃 获得临时所有权。
玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。
他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。
访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时
时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。
获得临时访问权。 Program notification template 选项 价值
Program notification template Data element or attribute identifier asc
Program notification template SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | LAST | LAST_AVERAGE_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX showHierarchy
Program notification template false | true
Program notification template NAME | SHORTNAME
Program notification template ASC | DESC
sortOrder Program notification template Numeric positive value
Program notification template EVENT | ENROLLMENT | TRACKED_ENTITY_INSTANCE
事件聚合资源不返回事件信息
本身,而不是与请求匹配的事件总数
询问。事件维度包括数据元素、人员属性、人员
标识符、期间和组织单位。聚合事件查询
应该是下面描述的格式。 Program notification template false | true skipMeta

eventCreatedPeriod 检索和删除项目通知模板 Parameter name 用户设置 { #webapi_user_settings }
Exclude the data part of the response. ```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"
]
}
``` skipRounding asc
Skip rounding of aggregate data values. Program notification template aggregateData
Produce aggregate values for the data dimensions (as opposed to dimension items). ```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"
]
}
``` orgUnitField 具有以下要求:
The organisation unit field to base event aggregation on. Applies to event data items only. Can be the ID of an attribute or data element with the Organisation unit value type. The default option is specified as omitting the query parameter. Program notification template Table: Query parameters for cluster event analytics only

需要

描述

选项

clusterSize

是的

Size of clusters in meters.

Numeric positive value

coordinateField

Field to base geospatial event analytics on. Default is event. Can be set to identifiers of attributes and data elements of value type coordinate.

EVENT | <attribute-id> | <dataelement-id>

bbox

是的

筛选

includeClusterPoints

Include information about underlying points for each cluster, be careful if cluster represent a very high number of points.

false | true

注册查询分析 { #webapi_enrollment_query_analytics }

analytics/events/query 资源可让您查询捕获的 事件。此资源不执行任何聚合,而是让 您查询和过滤有关事件的信息。

/api/analytics/enrollments/query

例如,您可以过滤“ Weight”数据元素以获取大于2000且小于4000的值,如下所示:

/api/analytics/events/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>
所需值 Parameter name
检索“Child”的“Birth”项目阶段的事件
2016 年 3 月至 12 月期间的“计划”计划,其中“重量”
数据元素,过滤大于
2000年: /api/analytics/events/query/IpHINAT79UW?stage=A03MvHHogjR&startDate=2016-03-01
&endDate=2016-12-31&dimension=ou:O6uvpzGd5pu&dimension=UXz7xuGCEhU:GT:2000
排序可以应用于查询事件的事件日期和
任何尺寸。按事件日期降序和升序排序
您可以使用的“年龄”数据元素维度
用: /api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
&dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&desc=EVENTDATE&asc=qrur9Dvnyt5
分页可以通过指定页码和
页面大小参数。如果指定了页码但未指定页面大小,
将使用 50 的页面大小。如果指定了页面大小但页面
number 不是,将使用页码 1。获取第三页
页面大小为 20 的响应,您可以使用类似的查询
这: /api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
&dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&page=3&pageSize=20
Filtering 过滤器可以应用于数据元素,人员属性和人员标识符。过滤是通过以下格式的查询参数值完成的:
&dimension = :: 字符串、布尔值、整数、浮点、集合(检查大小)、日期
&dimension = UXz7xuGCEhU:GT:2000&dimension = UXz7xuGCEhU:LT:4000 您可以使用以下方法过滤多个特定年龄的“年龄”数据元素
像这样的 IN 运算符:
&dimension = qrur9Dvnyt5:IN:18; 19; 20 字符串、布尔值、整数、浮点、集合(检查大小)、日期
&dimension = qrur9Dvnyt5:GT:5:LT:15 Filter by AGE is not null
&dimension=qrur9Dvnyt5:NE:NV /api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
&dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&desc=EVENTDATE&asc=qrur9Dvnyt5
&dimension=qrur9Dvnyt5:IN:18;19;NV NV can be used with EQ, NE and IN operators
Equal to !EQ
Not equal to IEQ
Equal to, ignoring case !IEQ
Operators GT

时间字段过滤{ #time-field-filtering }

GE

Greater than or equal to

强化条件{ #enhanced-conditions }

Less than

LE

!LIKE

NE

Not equal to

<attribute id>

Like (free text match)

!LIKE

Not like (free text match)

回应格式

Like, ignoring case (free text match)

  • 临界点

  • Not like, ignoring case (free text match)

  • Table: Org unit analytics query parameters

Equal to one of multiple values separated by ";"

Time Field Filtering

By default, the query endpoints filter periods based on eventDate. However, it is possible to filter entries based on lastUpdated or schedule instead, by using the timeField query parameter. For example:

&timeField=LAST_UPDATED
&timeField=SCHEDULED_DATE

Numeric positive value

By default enhancedConditions flag is set to false. This means all conditions expressed in dimension and filter are meant as AND conditions. For example:

dimension=a:GT:20:LT:40&dimension=b:GT:1:LT:5

translates into the following logical condition:

a>20 and a<40 and b>1 and b<5

However, there are cases in which more control on conditions might be needed and can be enabled by setting enhancedConditions query parameter to true. By doing so, a client can use a special _OR_ separator to join conditions using OR logical operator.

例:

dimension=a:GT:20:LT:40_OR_b:GT:1:LT:5&dimension=c:EQ:test

translates into the following logical condition:

((a>20 and a<40) or (b>1 and b<5)) and c = "test"

Response formats

默认的响应表示格式是 JSON。请求必须使用 HTTP GET 方法。支持以下响应格式。

json(应用项目/ json)

jsonp(应用项目/ javascript)

xls(application / vnd.ms-excel)

例如,要获得Excel格式的响应,可以在请求URL中使用文件扩展名,如下所示:

/api/analytics/events/query/eBAyeGv0exc.xls?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu&dimension=oZg33kd9taw&dimension=qrur9Dvnyt5

您可以将hierarchyMeta 查询参数设置为true,以便 在元部分中包括所有祖先组织单位的名称 响应:

/api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:YuQRtpLP10I&dimension=qrur9Dvnyt5:EQ:50&hierarchyMeta=true

默认响应JSON格式将类似于以下内容:

{
  "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"
    ]
  ]
}

响应的* header *部分描述了查询的内容 结果。事件唯一标识符,项目阶段标识符, 活动日期,组织单位名称,组织单位代码和 组织单位标识符显示为的前六个维度 回应,并将永远存在。接下来是数据元素 指定为的人员属性和人员标识符 请求中的尺寸,在这种情况下,为“性别”和“年龄”数据 元素尺寸。标头部分包含 “名称”属性中的尺寸项目和可读尺寸 “列”属性中的说明。

metaData 部分,ou 对象包含映射到表示层次结构的字符串的响应中存在的所有组织单位的标识符。此层次结构字符串从根开始列出组织单位的祖先(父)的标识符。 names 对象包含响应中映射到其名称的所有项目的标识符。

rows 部分包含查询产生的事件。每一行 正好代表一个事件。

为了让事件分析资源在 一个现成的表格的形状,你可以提供*行*和*列* 具有请求的维度标识符的参数以分号分隔 作为值来指示哪些用作表列和行。 事件不是生成一个普通的、规范化的数据源 分析资源现在将生成表格布局中的数据。这 列和行维度必须作为数据维度出现在 查询(不是过滤器)。这样的请求可能如下所示:

/api/analytics.html+css?dimension=dx:cYeuwXTCPkU;fbfJHSPpUQD&dimension=pe:WEEKS_THIS_YEAR
  &filter=ou:ImspTQPwCqd&displayProperty=SHORTNAME&columns=dx&rows=pe

事件汇总分析 { #webapi_event_aggregate_analytics }

/analytics/events/aggregate 资源可让您检索 aggregated DHIS2 中捕获的事件数量。此资源可让您检索 基于项目和可选的项目阶段聚合数据,以及 允许您过滤任何事件维度。

/api/analytics/events/aggregate

| 事件聚合资源不返回事件信息 本身,而不是与请求匹配的事件总数 询问。事件维度包括数据元素、人员属性、人员 标识符、期间和组织单位。聚合事件查询 应该是下面描述的格式。 | Parameter name | | --- | --- | | 例如,要从 1 月至 10 月期间的“住院发病率和死亡率”计划 2016 年,其中包含“性别”和“年龄”数据元素,“年龄” 维度项目在“18”上过滤,“性别”项目在过滤上 “女性”,您可以使用以下查询: | /api/analytics/events/aggregate/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31 &dimension=ou:O6uvpzGd5pu&dimension=oZg33kd9taw:EQ:Female&dimension=qrur9Dvnyt5:GT:50 | | 检索固定和相对时期的数据,而不是开始和结束 日期,在本例中为 2016 年 5 月和过去 12 个月,以及组织 与当前用户关联的单位,可以使用以下查询: | /api/analytics/events/aggregate/eBAyeGv0exc?dimension=pe:201605;LAST_12_MONTHS &dimension=ou:USER_ORGUNIT;fdc6uOvgo7ji&dimension=oZg33kd9taw | | 为了将“女性”指定为数据的“性别”过滤器 响应,意思是“性别”不会是响应的一部分,但会 过滤其中的聚合数字,您可以使用以下语法: | /api/analytics/events/aggregate/eBAyeGv0exc?dimension=pe:2016; &dimension=ou:O6uvpzGd5pu&filter=oZg33kd9taw:EQ:Female | | PERIOD_STRUCTURE | /api/analytics/events/aggregate/eBAyeGv0exc?filter=pe:2016&filter=ou:O6uvpzGd5pu &dimension=fWIAEtYVEGk&dimension=oZg33kd9taw:EQ:Male | | 要为_出院模式_创建“前 3 名报告”,您可以使用限制 和 sortOrder 查询参数类似: | /api/analytics/events/aggregate/eBAyeGv0exc?filter=pe:2016&filter=ou:O6uvpzGd5pu &dimension=fWIAEtYVEGk&limit=3&sortOrder=DESC | | 要指定具有相应聚合类型的值维度,您 可以使用 value 和aggregationType 查询参数。指定一个 值维度将使分析引擎返回聚合值 对于响应中该维度的值,而不是计数 事件。 | /api/analytics/events/aggregate/eBAyeGv0exc.json?stage=Zj7UnCAulEk &dimension=ou:ImspTQPwCqd&dimension=pe:LAST_12_MONTHS&dimension=fWIAEtYVEGk &value=qrur9Dvnyt5&aggregationType=AVERAGE |

范围/图例集

/api/analytics/events/aggregate/IpHINAT79UW.json?dimension=ou:ImspTQPwCqd
  &dimension=pe:LAST_12_MONTHS&dimension=cejWyOfXge6&stage=A03MvHHogjR
  &timeField=ENROLLMENT_DATE

基于特定数据元素或属性的事件分析聚合 对于值类型的组织单元,您可以使用 orgUnitField 参数:

/api/analytics/events/aggregate/eBAyeGv0exc.json?dimension=ou:ImspTQPwCqd
  &dimension=pe:THIS_YEAR&dimension=oZg33kd9taw&stage=Zj7UnCAulEk
  &orgUnitField=S33cRBsnXPo

The orgUnitField parameter value may be one of the following:

回应格式

描述

<Attribute ID>

ID of an attribute with the organisation unit value type

<Data element ID>

ID of a data element with the organisation unit value type

REGISTRATION

The organization unit at which the tracked entity instance was registered (created)

注册

The organization unit at which the tracked entity instance was enrolled in the program

OWNER_AT_START

The tracked entity instance's owning organisation unit at the start of the reporting period

OWNER_AT_END

The tracked entity instance's owning organisation unit at the end of the reporting period

Ranges / legend sets

对于聚合查询,您可以为数值指定范围/图例集 数据元素和属性维度。目的是将 数值范围内。举个例子,而不是生成数据 对于不同年份的“年龄”数据元素,您可以将 年龄组的信息。为了实现这一点,数据元素或 属性必须与图例集相关联。格式是 如下面所描述的:

?dimension = <item-id>-<legend-set-id>

一个示例如下所示:

json(应用项目/ json) Validation report
默认的响应表示格式是 JSON。请求必须是
使用 HTTP GET 方法。响应将类似于以下内容: 默认响应使用单个 count 列进行标准化。通过使用 columns 查询参数指定至少一个组织单位组集,可以在表格布局中呈现响应。
请注意,单个响应中返回的行的最大限制为 10 000。
如果查询产生超过最大限制,409 Conflict 状态代码
将被退回。 事件聚类分析 { #webapi_event_clustering_analytics }
analytics/events/cluster 资源提供集群地理空间
事件数据。请求如下所示: /api/analytics/events/cluster/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
&dimension=ou:LEVEL-2&clusterSize=100000
&bbox=-13.2682125,7.3721619,-10.4261178,9.904012&includeClusterPoints=false
集群响应提供基础点的计数,中心
每个集群的点和范围。如果 includeClusterPoints 查询
参数设置为 true,以逗号分隔的字符串与标识符
包括基础事件。示例响应如下所示: ```json
{
"headers": [
{
"name": "count",
"column": "Count",
"valueType": "INTEGER",
"meta": false
},
{
"name": "center",
"column": "Center",
"valueType": "TEXT",
"meta": false
},
{
"name": "extent",
"column": "Extent",
"valueType": "TEXT",
"meta": false
},
{
"name": "points",
"column": "Points",
"valueType": "TEXT",
"meta": false
}
],
"width": 3,
"height": 4,
"rows": [
[
"3",
"POINT(-13.15818 8.47567)",
"BOX(-13.26821 8.4St7215,-13.08711 8.47807)",
""
],
[
"9",
"POINT(-13.11184 8.66424)",
"BOX(-13.24982 8.51961,-13.05816 8.87696)",
""
],
[
"1",
"POINT(-12.46144 7.50597)",
"BOX(-12.46144 7.50597,-12.46144 7.50597)",
""
],
[
"7",
"POINT(-12.47964 8.21533)",
"BOX(-12.91769 7.66775,-12.21011 8.49713)",
""
]
]
}
```
事件计数和范围分析 { #webapi_event_count_extent_analytics } The analytics/events/count resource is suitable for geometry-related
requests for retrieving the count and extent (bounding box) of events
for a specific query. The query syntax is equal to the events/query
resource. A request looks like this:
/api/analytics/events/count/eBAyeGv0exc?startDate=2016-01-01
&endDate=2016-10-31&dimension=ou:O6uvpzGd5pu 响应将以JSON格式提供计数和范围:
```json
{
"extent": "BOX(-13.2682125910096 7.38679562779441,-10.4261178860988 9.90401290212795)",
"count": 59
}
``` 约束与验证 { #webapi_event_analytics_constraints }
您可以提供给
事件分析资源。如果违反任何约束,API 将
返回一个 409 Conflict 响应和一个类似于下面的响应消息: ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "At least one organisation unit must be specified",
"errorCode": "E7200"
}
```
描述了事件分析 API 的可能验证错误
在下表中。 错误代码
信息 E7200
必须至少指定一个组织单位 E7201
尺寸不能多次指定 E7202
不能多次指定查询项 E7203
值维也不能指定为项目或项目过滤器 E7204
指定聚合类型时,必须指定值维或聚合数据 E7205
必须指定开始和结束日期或至少一个期间 E7206
开始日期晚于结束日期 E7207
页码必须为正数 E7208
页面大小必须为零或正数 E7209
限制大于最大限制 E7210
时间字段无效 E7211
组织单位字段无效 E7212
群集大小必须为正数 E7213
Bbox无效,必须采用以下格式:'min-lng,min-lat,max-lng,max-lat' E7214
当指定bbox或集群大小时,必须指定集群字段 E7215
查询项目不能同时指定图例集和选项集 E7216
在汇总查询中使用时,查询项必须是可汇总的 E7217
不允许用户查看事件分析数据 E7218
未启用空间数据库支持 E7219
数据元素必须是值类型坐标才能用作坐标字段 E7220
E7230 页眉参数不存在
E7231 遗产只能通过事件可视化进行更新
E7232 E7219
E7234 查询过滤器对查询项目值类型无效
E7235 必须指定 programId 或 programStageId
E7236 程序阶段与程序无关
E7237 排序必须有有效的维度和方向
E7238 排序维度不是列
E7239 空 "值的运算符无效
E7240 具有组织单位所有权的事件查询不支持时间字段
E7241 阶段参数不能与特定阶段的维度标识符一起使用
E7242 周期维度不能与特定阶段的日期维度(即:EVENT_DATE、SCHEDULED_DATE)一起使用
E7243 重复的阶段标注标识符
E7244 不允许在特定阶段的尺寸中设置多个阶段
E7245 程序阶段不属于程序

属性必须是坐标值类型,才能用作坐标域

E7221

座标栏位无效

E7222

查询项目或过滤器无效

| /api/analytics/enrollments/query/WSGAb5XwJ3Y.xls ?dimension=ou:ImspTQPwCqd &dimension=WZbXY0S00lP.de0FEHSIoxh &columns=w75KJ2mc4zz &dimension=WZbXY0S00lP.sWoqcoByYmD &dimension=pe:LAST_MONTH &stage=WZbXY0S00lP &pageSize=10&page=1 &asc=ENROLLMENTDATE &ouMode=DESCENDANTS | 值不引用数字元素或项目一部分的数据元素或属性 | Parameter name | |---|---|---| | 项目标识符未引用项目的任何数据元素,属性或指标部分 | E7225 | 计划阶段对于注册分析查询中的数据元素维度是必需的 | | createdAtClient | 维度不是有效的查询项目 | E7227 | | 来自 rawData 资源的响应看起来与 定期分析资源;不同之处在于响应包含 原始的、非聚合的数据,适合进一步聚合 第三方系统。 | E7228 | Fallback coordinate field is invalid | | E7229 | Filter on whether the current user can manage the returned users through the managed user group relationships. | 入学分析 { #webapi_enrollment_analytics } |

可重复阶段{ #repeatable-stages }

尺寸和项目 { #webapi_enrollment_analytics_dimensions }

注册维度包括数据元素,属性,组织单位和期间。查询分析资源将仅返回符合一组条件的注册,并且不执行任何汇总。

| /api/analytics/enrollments/query/WSGAb5XwJ3Y.xls ?dimension=ou:ImspTQPwCqd &dimension=WZbXY0S00lP.de0FEHSIoxh &columns=w75KJ2mc4zz &dimension=WZbXY0S00lP.sWoqcoByYmD &dimension=pe:LAST_MONTH &stage=WZbXY0S00lP &pageSize=10&page=1 &asc=ENROLLMENTDATE &ouMode=DESCENDANTS | 尺寸 | Dimension id | |--------------------------------------------|------------------------------|--------------------------------------------------------------------------------------------| | 描述 | Relationship Type {0} constraint requires a {1} but a {2} was found. | 属性 | | Data element identifiers must include the program stage when querying data for enrollments. dimension=edqlbukwRfQ.vANAXwtLwcT | 0 | 属性 | | <id> | -2 | Attribute identifiers | | 句号 | 1 | 聚乙烯 | | ISO periods and relative periods, see "date and period format" | 3 | 组织单位 |

Organisation unit identifiers and keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>

Repeatable stages

数据元素标识符必须包括计划阶段。项目阶段可以重复。例如,维度 edqlbukwRfQ.vANAXwtLwcT 可指可重复的项目阶段。可通过索引参数(用 [ ]括起来)访问该阶段的数据元素。

Table: Possible indexing of repeatable stages

尺寸

Index parameters

DataElement value refers to

edqlbukwRfQ.vANAXwtLwcT

不适用

last execution date

edqlbukwRfQ[0].vANAXwtLwcT

最后执行日期

dqlbukwRfQ[-2].vANAXwtLwcT

筛选

dqlbukwRfQ[1].vANAXwtLwcT

includeClusterPoints

dqlbukwRfQ[3].vANAXwtLwcT

third execution date

警告:对不可重复的项目阶段进行索引会导致参数验证错误。

注册查询分析 { #webapi_enrollment_query_analytics }

The analytics/enrollments/query resource lets you query for captured enrollments. This resource does not perform any aggregation, rather it lets you query and filter for information about enrollments.

/api/analytics/enrollments/query

时间字段过滤{ #time-field-filtering }

/api/analytics/enrollments/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>

例如,要从2019年1月起从“产前护理”计划中检索入学申请,该计划从属性中提取“名字”,则在第一个计划阶段包括“慢性病”和“吸烟”数据元素,并且来自以下项目阶段的“血红蛋白值”,并且仅包括具有“疯子病”的女性,您可以使用以下查询:

NV 关键字{ #nv-keyword }

要从上个月(相对于执行查询的时间点)的“产前护理”项目中检索入学登记,其中“慢性病”和“吸烟”数据元素包含在第一项目阶段,而“后续计划阶段的“血红蛋白价值”,仅包括吸烟的血红蛋白少于20岁的女性:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json
  ?dimension=ou:ImspTQPwCqd
  &dimension=WZbXY0S00lP.de0FEHSIoxh&dimension=w75KJ2mc4zz
  &dimension=WZbXY0S00lP.sWoqcoByYmD:eq:1
  &dimension=edqlbukwRfQ.vANAXwtLwcT:lt:20
  &dimension=pe:LAST_MONTH

可以将排序应用于注册的查询和注册的事件日期:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.xls
  ?dimension=ou:ImspTQPwCqd
  &columns=w75KJ2mc4zz&dimension=WZbXY0S00lP.sWoqcoByYmD
  &dimension=pe:LAST_MONTH
  &stage=WZbXY0S00lP&pageSize=10
  &page=1
  &asc=ENROLLMENTDATE
  &ouMode=DESCENDANTS

通过指定页码和页面大小参数,可以将分页应用于查询。如果指定了页码,但未指定页码,则将使用50页码。如果指定了页面大小,但未指定页面号,则将使用页面号1。要获得页面大小为10的响应的第二页,可以使用如下查询:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json
  ?dimension=ou:ImspTQPwCqd
  &dimension=WZbXY0S00lP.de0FEHSIoxh
  &dimension=w75KJ2mc4zz
  &dimension=pe:LAST_MONTH
  &dimension=WZbXY0S00lP.sWoqcoByYmD&pageSize=10
  &page=2

Filtering

过滤器可以应用于数据元素,人员属性和人员标识符。过滤是通过以下格式的查询参数值完成的:

操作员{ #operators }

例如,您可以过滤“ Weight”数据元素以获取大于2000且小于4000的值,如下所示:

/api/analytics/events/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>
所需值 Parameter name
检索“Child”的“Birth”项目阶段的事件
2016 年 3 月至 12 月期间的“计划”计划,其中“重量”
数据元素,过滤大于
2000年: /api/analytics/events/query/IpHINAT79UW?stage=A03MvHHogjR&startDate=2016-03-01
&endDate=2016-12-31&dimension=ou:O6uvpzGd5pu&dimension=UXz7xuGCEhU:GT:2000
&dimension = :: 字符串、布尔值、整数、浮点、集合(检查大小)、日期
&dimension = UXz7xuGCEhU:GT:2000&dimension = UXz7xuGCEhU:LT:4000 您可以使用以下方法过滤多个特定年龄的“年龄”数据元素
像这样的 IN 运算符:
&dimension = qrur9Dvnyt5:IN:18; 19; 20 字符串、布尔值、整数、浮点、集合(检查大小)、日期
&dimension = qrur9Dvnyt5:GT:5:LT:15 Filter by AGE is not null
&dimension=qrur9Dvnyt5:NE:NV /api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
&dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&desc=EVENTDATE&asc=qrur9Dvnyt5
&dimension=qrur9Dvnyt5:IN:18;19;NV NV can be used with EQ, NE and IN operators
Operators GT

Table: Filter operators

Operator

描述

eventCreatedPeriod 检索和删除项目通知模板 Parameter name Attribute identifiers
{ "periodFrom": -15, "periodTo": 15} ```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"
]
}
``` LT 组织单位
dueDate Program notification template NE Event chart view
lastUpdatedDate Program notification template IN Event chart view
周期(pe) ```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: Query parameters for enrollment query endpoint 查询参数
数据值 Program notification template 任何项目标识符
结束日期 Program notification template Program identifier. 任何项目标识符
描述 不区分大小写的字符串结尾匹配 Program notification template Date in yyyy-MM-dd format
{"type":"RELATIVE","period":"TODAY"} Program notification template End date for enrollments.
Dimensions to use as columns for table layout. Program notification template 维度标识符包括数据元素、属性、项目指标、期间、组织单元和组织单元组集。参数可以重复任意次数。项目过滤器可以应用于维度的格式<item-id>:<operator>:<filter>。过滤器值不区分大小写。 项目状态
filter Program notification template 维度标识符包括数据元素、属性、期间、组织单位和组织单位组集。参数可以重复任意次数。项目过滤器可以应用于维度,格式为<item-id>:<operator>:<filter>。过滤器值不区分大小写。 项目状态
Program notification template ACTIVE | COMPLETED | CANCELLED
Start date for interval tocheck for outliers Program notification template 选项(默认为默认) ouMode
定义要返回的页码。 Program notification template ouname | programstatus | eventstatus | createdbydisplayname | lastupdatedbydisplayname | eventdate | enrollmentdate | incidentdate | lastupdated | item identifier asc
定义每页返回的元素数量。 Program notification template false | true coordinateOuFallback
Program notification template ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | item identifier coordinatesOnly

** 在某些情况下,可以通过 dimension 参数请求特定字段。它们不是真正的维度,但提供了更好的灵活性。它们是

事件日期 (EVENT_DATE){ #event-date-event_date }

根据事件发生的日期进行筛选。可用作根级维度或特定阶段的范围。

价值形式 描述 意义
{stageUid}.event_date:{period} dimension=A03MvHHogjR.EVENT_DATE:202205. 阶段 "A03MvHHogjR "中的事件,事件发生日期为 2022 年 5 月。
{stageUid}.event_date:{start}_{end} dimension=A03MvHHogjR.EVENT_DATE:2022-05-01_2022-05-10 该阶段中事件日期在给定包含日期范围内的事件。
event_date:{period} dimension=EVENT_DATE:2022Sep(事件日期:2022 年 9 月) 使用财政年度过滤根级事件日期。

预定日期 (SCHEDULED_DATE){ #scheduled-date-scheduled_date }

根据事件的计划日期(而不是实际发生日期)进行筛选。此外,它还可以扩展到特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
scheduled_date:{period} dimension=SCHEDULED_DATE:202107 活动处于既定阶段,预定日期为 2021 年 7 月。

创建日期 (CREATED){ #created-date-created }

根据报名记录在系统中创建的时间进行筛选。此外,它还可以针对特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
CREATED:{period} dimension=CREATED:2016Sep 自 2016 年 9 月起的财政年度内创建的注册人数。

完成日期 (COMPLETED){ #completed-date-completed }

根据注册被标记为完成的时间进行筛选。 此外,它还可以扩展到特定阶段(如 EVENT_DATE)。

价值形式 描述 意义
完成:{period}` 尺寸=COMPLETED:2022年9月 自 2022 年 9 月起的财政年度内完成的注册。

事件状态 (EVENT_STATUS){ #event-status-event_status }

根据阶段内事件的状态进行筛选。

价值形式 描述 意义
{stageUid}.event_status:{status} dimension=A03MvHHogjR.EVENT_STATUS:ACTIVE. 阶段中状态为 "ACTIVE "的事件。
{stageUid}.event_status:{s1};{s2} dimension=edqlbukwRfQ.EVENT_STATUS:COMPLETED;ACTIVE. 状态为 COMPLETED ACTIVE 的事件(OR 逻辑)。

有效状态值:活动"、"已完成"、"已排定"、"逾期"、"已跳过"。

程序状态 (PROGRAM_STATUS){ #program-status-program_status }

根据注册本身的状态(而不是单个事件)进行筛选。

价值形式 描述 意义
program_status:{status} dimension=PROGRAM_STATUS:ACTIVE 仅指具有指定计划状态的注册人数。

有效状态值:激活"、"已完成"、"已取消"。

回应格式

Whether to only return enrollments which have coordinates.

  • 临界点
  • E7126
  • Table: Org unit analytics query parameters
  • 作为响应的一部分返回的标头的名称。
  • One or more headers name separated by comma
  • page

The page number. Default page is 1.

Numeric positive value

pageSize

The page size. Default size is 50 items per page.

Numeric zero or positive value

跨技术教育指标(TEI)与计划指标关系的分析{ #analytics-across-tei-relationships-with-program-indicators }

Time field used in aggregations/queries on enrollments. Applies to enrollment data items only. Can be a predefined option or the ID of an attribute or data element with a time-based value type. For "/analytics/enrollments/" endpoints, the default "timeField" is ENROLLMENT_DATE.

ENROLLMENT_DATE | LAST_UPDATED | <Attribute ID> | <Data element ID>

Response formats

默认的响应表示格式是 JSON。请求必须使用 HTTP GET 方法。支持以下响应格式。

json(应用项目/ json)

xml(应用项目/ xml)

xls(application / vnd.ms-excel)

csv(应用项目/ csv)

html(text / html)

html + css(text / html)

例如,要获得Excel格式的响应,可以在请求URL中使用文件扩展名,如下所示:

| /api/analytics/enrollments/query/WSGAb5XwJ3Y.xls ?dimension=ou:ImspTQPwCqd &dimension=WZbXY0S00lP.de0FEHSIoxh &columns=w75KJ2mc4zz &dimension=WZbXY0S00lP.sWoqcoByYmD &dimension=pe:LAST_MONTH &stage=WZbXY0S00lP &pageSize=10&page=1 &asc=ENROLLMENTDATE &ouMode=DESCENDANTS | 值不引用数字元素或项目一部分的数据元素或属性 | Parameter name | |------------------------------------|-------------------------------------------------------------|---| | 响应的 headers 部分描述了查询结果的内容。注册唯一标识符、被跟踪实体实例标识符、注册日期、事件日期、几何形状、纬度、经度、组织单位名称和组织单位代码作为响应中的第一个维度出现并且将始终存在。接下来是数据元素和在请求中指定为维度的跟踪实体属性,在本例中为“WHOMCH 慢性条件”和“WHOMCH 吸烟”数据元素维度。标题部分在“名称”属性中包含维度项的标识符,在“列”属性中包含可读的维度描述。 | metaData 部分,ou 对象包含映射到表示层次结构的字符串的响应中存在的所有组织单位的标识符。此层次结构字符串从根开始列出组织单位的祖先(父)的标识符。 names 对象包含响应中映射到其名称的所有项目的标识符。 | rows 部分包含查询生成的注册。每一行正好代表一个注册。 | 项目标识符未引用项目的任何数据元素,属性或指标部分 | 非汇总注册分析API还支持将项目指示器链接到关系类型,以显示应用于所列出的跟踪实体实例的相关实体的特定项目指示器的计算结果。 | | | 来自 rawData 资源的响应看起来与 定期分析资源;不同之处在于响应包含 原始的、非聚合的数据,适合进一步聚合 第三方系统。 | /api/analytics/enrollments/query/ ?dimension=. | 例如,要从“ WHO RMNCH Tracker”项目中检索2019年1月的注册列表,并按“与人相关的疟疾病例”类型的关系显示与该注册相关的疟疾病例数,则可以使用以下查询 | | /api/analytics/enrollments/query/WSGAb5XwJ3Y.json?dimension=mxZDvSZYxlw.nFICjJluo74 &startDate=2019-01-01&endDate=2019-01-31 | API 支持使用与“主”项目(即在/query/ 之后指定的项目 ID)无关的项目指示符。 | Dimension id | | The tracked entity (TE) analytics API allows querying TEs with their enrollments and event data captured in DHIS2. This resource retrieves data from TE, enrollments, events, and data elements across multiple programs, for a given tracked entity type. | Dimensions and items { #webapi_te_analytics_dimensions } | Dimension id | | Table: TE dimensions | 尺寸 | Dimension id |

偏移{ #offset }

项目属性(TE 属性)

<attribute id>

项目属性的标识符。

Data elements in program stages

<program id>.<program stage id>[offset].<data element id>

数据元素标识符必须包括项目和项目阶段,即:dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO

句号

N.A.

There's no direct support for period dimension. Periods are supported through several different specific parameters. See the Periods section below.

TEI Organisation units

ou

Organisation unit identifiers, and also the keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>.

筛选

<program id>.ou

includeClusterPoints

Event Organisation units

<program id><program stage id>.ou

时期{ #periods }

Offset

默认值 Parameter name
"assignedUsers": ["a3kGcGDCuk7", "a3kGcGDCuk8"] Tracked entity (TE) query analytics { #webapi_te_query_analytics }
The analytics/trackedEntities/query endpoint provides queries for captured TEs, allowing querying and filtering for information related to TEs, along with their respective enrollments and events. It does not perform any aggregation. /api/41/analytics/trackedEntities/query
You can specify any number of dimensions and any number of filters in a query. Dimension item identifiers can refer to any of the data elements in program stages, program attributes, tracked entity attributes, fixed and relative periods, and organization units. Dimensions can optionally have a query operator and a filter. TEs queries should be in the format described below. /api/41/analytics/trackedEntities/query/?dimension=ou:;&
dimension=&dimension=::
For example, to retrieve TEs of type Person from the "Child Program" and "Antenatal care" programs, where the "First name" is "James": /api/41/analytics/trackedEntities/query/nEenWmSyUEp?program=IpHINAT79UW,WSGAb5XwJ3Y&dimension=IpHINAT79UW.w75KJ2mc4zz:eq:James
/api/41/analytics/trackedEntities/query/nEenWmSyUEp?program=IpHINAT79UW,WSGAb5XwJ3Y&dimension=IpHINAT79UW.w75KJ2mc4zz:eq:James
&pageSize=10&page=2
GET /api/metadata/proposals?filter=status:eq:ACCEPTED Filters can be applied to data elements, tracked entity attributes, and tracked entity identifiers. The filtering is done through a query parameter in the following format:
&dimension = <item-id>:<operator>:<filter-value>

For example, you can filter the "MCH Infant Weight (g)" data element, of the program "Child Program" and program stage "Baby Postnatal" looking for values greater than 2000 and lower than 4000. The filter is defined like this:

  • &dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO:GT:2000&dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO:LT:4000

Periods

  • Unlike enrollment and event query endpoints, the TE endpoint supports multiple ways to specify the period the data belongs to. They are based on different date params as shown below:

Parameter

  • 描述

eventDate

  • TEs will be filtered based on the date the event occurred.

enrollmentDate

TEs will be filtered based on the date of enrollment.

scheduledDate

TEs will be filtered based on the date the event was scheduled.

eventCreatedPeriod 检索和删除项目通知模板 Parameter name Attribute identifiers
{"organisationUnit": "a3kGcGDCuk7"} ```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"
]
}
``` Some periods, mentioned above, can be applied to Tracked Entities, Enrollments, or Events, depending on the way they are expressed. 例子:
{ "periodFrom": -15, "periodTo": 15} Program notification template filtering TEs whose latest enrollment in the program "Child Program" has been updated during the last year: lastUpdated=IpHINAT79UW.LAST_YEAR
周期(pe) Program notification template filtering TEs whose latest enrollment in the "Child Program" occurred in the last year: 查询参数
数据值 Program notification template Table: Query parameters for the TE query endpoint 查询参数
Start date for interval tocheck for outliers Program notification template 选项(默认为默认) trackedEntityType
描述 Program notification template Any tracked entity type identifier. 项目
{"type":"RELATIVE","period":"TODAY"} Program notification template 任何项目标识符。接受多个逗号分隔的标识符。 维度
Dimensions to use as columns for table layout. Program notification template Operators: EQ | IEQ | GT | GE | LT | LE | NE | LIKE | ILIKE | IN filter
filter Program notification template Operators: EQ | IEQ | GT | GE | LT | LE | NE | LIKE | ILIKE | IN filter
定义要返回的页码。 Program notification template One or more header names (separated by a comma). relativePeriodDate
定义每页返回的元素数量。 Program notification template Example: "2016-01-01" ouMode
Custom period on lastUpdated. See "custom date periods" section. Program notification template DESCENDANTS, CHILDREN, SELECTED 查询参数
Program notification template ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier>
```json
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"response": {
"responseType": "ObjectReport",
"uid": "pG4bBTMiCqO",
"klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange",
"errorReports": []
}
}
``` Program notification template ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier> page
Program notification template Numeric positive value. pageSize
结束日期 Program notification template Numeric zero or positive value. includeMetadataDetails
DateTime Program notification template NAME | SHORTNAME includeMetadataDetails
"displayOrderColumns": ["enrollmentDate", "program"] Program notification template false | true outputIdScheme
Program notification template UID | UUID | CODE | NAME | ATTRIBUTE:<ID>
Program notification template NAME | CODE | UID
Program notification template ACTIVE | COMPLETED | CANCELLED. Can be comma separated (for query only). enrollmentStatus
Program notification template ACTIVE | COMPLETED | CANCELLED. Can be comma separated (for query only).
Program notification template ACTIVE | COMPLETED | SCHEDULE | OVERDUE | SKIPPED. Can be comma separated (for query only).
sortOrder Program notification template false | true
Program notification template false | true
Common request parameters Program notification template Any organization unit identifier.
Custom period on lastUpdated. See "custom date periods" section. Program notification template DESCENDANTS, CHILDREN, SELECTED 查询参数

Skip data in the response.

  • false | true
  • skipRounding
  • Skip rounding of data values.
  • false | true

skipHeaders

eventCreatedPeriod Skip headers in the response. Parameter name 用户设置 { #webapi_user_settings }
数据值 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions false | true displayProperty
默认过滤器是id,displayName Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions NAME | SHORTNAME
定义要返回的页码。 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions Event Query data dimensions/analytics/events/query/dimensions Event Aggregate data dimensions /analytics/events/aggregate/dimensions
定义每页返回的元素数量。 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions Tracked Entities query data dimensions) /analytics/teis/query/dimensions Resources mentioned above share the following request parameter:
true Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 描述 选项
iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions Allows field value filtering on the format:
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 opvalues 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

Tracked entity attributes of supported types associated with the program that are not confidential

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:
  • 程序中*受支持类型*的**受追踪实体属性**,且未被标记为在Analytics中跳过。

Tracked entity attributes of supported types associated with the program that are not confidential

与项目相关联的类别组合中的**类别**(源自项目阶段 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:
  • 程序中*受支持类型*的**受追踪实体属性**,且未被标记为在Analytics中跳过。

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 } - P 中*受支持类型*的**受追踪实体属性**,且未被标记为应从 Analytics 中跳过。 - 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

请求和答复样本{ #sample-request-and-response }

NUMBER

UNIT_INTERVAL

PERCENTAGE

INTEGER

INTEGER_POSITIVE

INTEGER_NEGATIVE

vr = <UID>以匹配验证规则的所有验证结果;提供多个参数时,多个规则组合或

BOOLEAN

TRUE_ONLY

指标组 Parameter name 检索和删除项目通知模板
Filter on whether the current user can manage the returned users through the managed user group relationships. Program indicators associated to P ```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"
]
}
```
Tracked entity attributes of supported types associated with the program that are not confidential Program attributes of P ```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"
]
}
```
GET /api/analytics/teis/query/dimensions?programStageId=A03MvHHogjR&order=code&filter=name:ilike:weight Program notification template

组织单位分析 { #webapi_org_unit_analytics }

组织单位分析API提供有关按组织单位组集分类的组织单位的统计信息,即组织单位组集中每个组织单位组的组织单位计数。

回应格式

该API需要至少一个组织单位和至少一个组织单位组集。可以提供多个组织单位和组集,以分号分隔。

  • 临界点
  • 组织单位分析资源使您可以指定一系列查询参数:
  • Table: Org unit analytics query parameters
  • Property

```

/api/dataElements.csv?fields=id,displayName,dataElementGroups

需要

欧

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
  }
]
指标组 Parameter name
Two mappings for the Referrals Age category. A program indicator can choose which mapping /api/dataStatistics/favorites/{favorite-id}.json
响应将包含给定收藏的观看次数和
看起来像这样: ```json
{
"views": 3
}
```
地理空间特征 { #webapi_geospatial_features } geoFeatures 资源可让您从中检索地理空间信息
DHIS2。地理空间特征与组织单位一起存储。
检索特征的语法与用于检索特征的语法相同
分析资源的组织单位维度。这是
建议在继续之前阅读分析 api 资源
阅读本节。您必须使用 GET 请求类型,并且只能使用 JSON
支持响应格式。
例如,在以下位置检索所有组织单位的地理特征
组织单位层次结构中的第 3 级,您可以使用 GET 请求
使用以下网址: /api/geoFeatures.json?ou=ou:LEVEL-3
true /api/geoFeatures.json?ou=ou:LEVEL-4;O6uvpzGd5pu
The response coordinates value can be read from two properties which is decided by the parameter coordinateField. The geometry property of the OrganisationUnit: this is the default behaviour which is applied when parameter coordinateField is not provided.
The OrgansationUnit attribute of value type GeoJSON: the api will use the provided coordinateField={attributeId} to get the GeoJSON coordinates from this attribute value. For example, to retrieve geo features for all organisation units at level 3 as above but get the coordinates from OrganisationUnit attribute tJqtSV4quLb
/api/geoFeatures.json?ou=ou:LEVEL-3&coordinateField=tJqtSV4quLb 响应属性的语义描述如下
桌子。
Table: Geo features response Property
描述 id

GeoJSON{ #geojson }

na

Organisation unit / geo feature name

hcd

Has coordinates down, indicating whether one or more children organisation units exist with coordinates (below in the hierarchy)

hcu

Has coordinates up, indicating whether the parent organisation unit has coordinates (above in the hierarchy)

le

Level of this organisation unit / geo feature.

pg

Parent graph, the graph of parent organisation unit identifiers up to the root in the hierarchy

pi

Parent identifier, the identifier of the parent of this organisation unit

pn

| The manual merge is suitable when there are resolvable conflicts or when not all the data needs to be moved during the merge. For example, if an attribute has different values in both tracked entities , the user can specify whether to keep the original value or move over the duplicate's value. Since the manual merge involves the user explicitly requesting to move data, there are some additional checks: | 用户设置 { #webapi_user_settings } | Parameter name | |---|---|---| | displayColumnOrder | TRACKER_EVENT | GeoJSON | | 要导出 GeoJSON,您只需添加 .geosjon 作为扩展名 端点 /api/organisationUnits,或者您可以使用 Accept 标头 应用项目/json+geojson。 | 支持两个参数:level(默认为 1)和 parent(默认为根组织单位)。两者都可以多次包含。一些例子: | 获得第2级和第4级的所有功能: | | /api/organisationUnits.geojson?level=2&level=4 | Analytics 表挂钩提供了一种调用 SQL 脚本的机制 在分析表生成过程的不同阶段。这 对于自定义资源和分析表中的数据很有用,例如在 以实现计算和聚合的特定逻辑。 可以在以下 API 端点操作分析表挂钩: | /api/organisationUnits.geojson?parent=fdc6uOvgoji&level=3 | | 分析表挂钩 { #webapi_analytics_table_hooks } | Analytics 表挂钩提供了一种调用 SQL 脚本的机制 在分析表生成过程的不同阶段。这 对于自定义资源和分析表中的数据很有用,例如在 以实现计算和聚合的特定逻辑。 可以在以下 API 端点操作分析表挂钩: | / api / analyticsTableHooks | | 分析表钩子 API 支持标准的 HTTP CRUD 操作 用于创建(POST)、更新(PUT)、检索(GET)和删除 (删除)实体。 | TRACKER_EVENT | Analytics表挂钩具有以下字段: |

Table: Analytics table hook fields

领域

选项

描述

名称

文本

Name of the hook. phase RESOURCE_TABLE_POPULATED, ANALYTICS_TABLE_POPULATED
The phase for when the SQL script should be invoked. resourceTableType See column "Table type" in table "Phases, table types and temporary tables" below
The type of resource table for which to invoke the SQL script. Applies only for hooks defined with the RESOURCE_TABLE_POPULATED phase. analyticsTableType
See column "Table type" in table "Phases, table types and temporary tables" below The type of analytics table for which to invoke the SQL script. Applies only for hooks defined with the ANALYTICS_TABLE_POPULATED phase.
sql 文本
The SQL script to invoke. The ANALYTICS_TABLE_POPULATED phase takes place after the analytics
table has been populated, but before indexes have been created and the
temp table has been swapped with the main table. As a result, the SQL
script should refer to the analytics temp table, e.g. analytics_temp,
analytics_completeness_temp, analytics_event_temp_ebayegv0exc.
这也适用于 RESOURCE_TABLE_POPULATED 阶段,它需要
放置在资源表被填充之后,索引之前
已创建并且临时表已与主表交换
桌子。因此,SQL 脚本应参考资源临时
表,例如*_orgunitstructure_temp*,_categorystructure_temp 您应该只定义 resourceTableType
analyticsTableType 字段,取决于定义的 phase
可以参考匹配的临时数据库表
仅指定挂钩表类型(其他临时表不会
可用的)。例如,如果您指定 ORG_UNIT_STRUCTURE 作为
资源表类型,可以参考*_orgunitstructure_temp*
仅临时数据库表。 下表显示了阶段、表格类型的有效组合
和临时表。
Table: Phases, table types and temporary tables
Table type Temporary table
RESOURCE_TABLE_POPULATED ORG_UNIT_STRUCTURE
_orgunitstructure_temp DATA_SET_ORG_UNIT_CATEGORY
_datasetorgunitcategory_temp CATEGORY_OPTION_COMBO_NAME
_categoryoptioncomboname_temp DATA_ELEMENT_GROUP_SET_STRUCTURE _dataelementgroupsetstructure_temp
INDICATOR_GROUP_SET_STRUCTURE _indicatorgroupsetstructure_temp
ORG_UNIT_GROUP_SET_STRUCTURE _organisationunitgroupsetstructure_temp
CATEGORY_STRUCTURE _categorystructure_temp
DATA_ELEMENT_STRUCTURE _dataelementstructure_temp
PERIOD_STRUCTURE _periodstructure_temp
DATE_PERIOD_STRUCTURE _dateperiodstructure_temp

DATA_ELEMENT_CATEGORY_OPTION_COMBO

_dataelementcategoryoptioncombo_temp

DATA_APPROVAL_MIN_LEVEL

_dataapprovalminlevel_temp

ANALYTICS_TABLE_POPULATED

DATA_VALUE

analytics_temp

COMPLETENESS

analytics_completeness_temp

COMPLETENESS_TARGET

analytics_completenesstarget_temp

ORG_UNIT_TARGET

analytics_orgunittarget_temp

EVENT

选项值

eventCreatedPeriod 检索和删除项目通知模板 Parameter name
analytics_validationresult_temp ```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"
]
}
``` 您可以使用维护项目或应用项目接口创建钩子。
To create a hook which should run after the resource tables have been populated you can do a POST request like this using JSON as content type: Program notification template ```json
{
"name": "Update 'Area' in org unit group set resource table",
"phase": "RESOURCE_TABLE_POPULATED",
"resourceTableType": "ORG_UNIT_GROUP_SET_STRUCTURE",
"sql": "update _organisationunitgroupsetstructure_temp set \"uIuxlbV1vRT\" = 'b0EsAxm8Nge'"
}
```

To create a hook which should run after the data value analytics table has been populated you can do a POST request like this using JSON format:

{
  "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')"
}
  • To create a hook which should run after the event analytics tables are populated you can do a POST request like this using JSON format:

```json

{ "name": "Delete data for a data element", "phase": "ANALYTICS_TABLE_POPULATED", "analyticsTableType": "EVENT", "sql": "delete from analytics_event_temp_lxaq7zs9vyr where dx = 'uDX9LKGRwaH'" }

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"
}