DHIS2 Documentation Team

Copyright © 2008-2023 DHIS2 Team
source.revision.date: 2026-04-01
Warranty: THIS DOCUMENT IS PROVIDED BY THE AUTHORS ‘’AS IS’’ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS MANUAL AND PRODUCTS MENTIONED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the source of this documentation, and is available here online: http://www.gnu.org/licenses/fdl.html
Web API 是一个组件,它使外部系统成为可能 访问和操作存储在 DHIS2 实例中的数据。更多的 准确地说,它为广泛的 为第三方等应用项目公开数据和服务方法 软件客户端、门户网站和内部 DHIS2 模块。
Web API 遵循 REST 架构风格背后的许多原则。以下是一些重要原则:
获取当前已通过身份验证用户的授权列表。
GET /api/me/authorization
检查当前已通过身份验证的用户是否拥有指定权限。
GET /api/me/authorization/{authority}
例如,检查用户是否拥有 F_CONSTANT_ADD 权限。
GET /api/me/authorization/F_CONSTANT_ADD
响应将以 JSON 格式显示为true或 false。
基本认证 { #webapi_basic_authentication }
DHIS2 Web API 支持*基本身份验证*。基本身份验证 是一种客户端通过 HTTP 将登录凭据发送到 Web 服务器的技术。从技术上讲,用户名后附有冒号和 密码,经过 Base64 编码,前缀 Basic 并作为值提供给 Authorization HTTP 标头。更正式的格式是:
Authorization: Basic base64encode(username:password)
身份验证,例如 Apache HttpClient 和 Spring RestTemplate。 一个重要的注意事项是此身份验证方案不提供安全性, 因为用户名和密码是以纯文本形式发送的,可以很容易地 被攻击者截获。仅当服务器 使用 SSL/TLS (HTTPS) 加密与客户端的通信时才应使用。请将此 视为与 Web API 进行安全交互的硬性要求。
两因素验证 { #webapi_2fa }
DHIS2 支持两因素身份验证。这可以为每个用户启用。 启用后,用户将被要求在登录时输入 2FA 代码。您 可以在此处阅读更多关于 2FA 的信息。
个人访问令牌{ #webapi_pat_authentication }
个人访问令牌(PAT)是使用 API 时对 DHIS2 进行身份验证的另一种方式。
PAT 可作为 HTTP 基本身份验证的一种更安全的替代方式。 在创建新应用或脚本等时,PAT 应该是您的首选。
它会以明文发送用户名和密码。在 未来的 DHIS2 版本中,基本身份验证可能会被弃用或改为选择启用,这意味着需要在配置中明确启用基本身份验证。 重要的安全问题! { #important-security-concerns }
您的 PAT 将自动继承用户拥有的所有权限和授权。 因此,根据您打算使用令牌的方式,限制授予令牌的访问权限极为重要。 请参阅 配置您的令牌 部分。
如果您只想让令牌访问服务器的某一特定部分,建议您创建一个新的专用用户,并只分配您希望它访问的角色/权限。 如果您只想让令牌访问服务器的一个狭窄且特定的部分,建议您创建一个新的专用用户,并只分配您希望它访问的角色/权限。
要创建新的 PAT,您有两个选择:
A. 在账户个人资料页面的用户界面上创建令牌。
A. 在账户页面上创建令牌 { #a-creating-a-token-on-the-account-page } * 使用用户名和密码登录,进入个人资料页面 (点击右上角,从下拉菜单中选择 "编辑个人资料")。 在用户配置文件页面,从左侧菜单中选择 "个人访问令牌"。 现在您应该在 "管理个人访问令牌" 页面上看到 文本:"您没有任何有效的个人访问令牌"。 点击 "生成新令牌" 创建新令牌。 弹出 "生成新令牌" 窗口,为您提供两种选择: * 1. 服务器/脚本上下文 { #1-serverscript-context }
如果您计划在应用、脚本或类似文件中使用令牌,则应选择此类型。
"这种类型适用于将通过 Web 浏览器访问的应用,如公共门户网站"。
如果您需要在网页上链接到 DHIS2,或嵌入 iframe, 这可能就是您需要的令牌类型。
选择需要的令牌类型后,可以为令牌配置不同的访问限制。 所谓限制,是指如何限制和缩小令牌的使用范围。 如果计划在公共环境中使用令牌,这一点至关重要, 例如,在其他网站的公共仪表板上嵌入 iframe。 由于令牌总是拥有与用户相同的访问权限/授权,因此如果您打算在公共环境中使用令牌,或者在任何您无法 100% 控制的环境中使用它,就需要特别小心。
注意:如果其他人获取了您的令牌,他们可以执行您的用户可以执行的任何操作。 无法区分使用令牌执行的操作和用户执行的其他操作。
例如,在您无法 100% 控制的 PC 或服务器上,或 "嵌入" 到另一台服务器的网页中。
限制类型 { #constraint-types }
到期时间
允许的 IP 地址
重要:IP 地址验证依赖于 X-Forwarded-For 标头,该标头可能被伪造。 为了安全起见,请确保负载平衡器或反向代理会覆盖该标头。
以逗号分隔的 HTTP 方法列表,您希望令牌能够使用这些方法。 如果您只需要令牌来查看数据,而不是修改或删除数据,那么只选择 GET HTTP 方法 是合理的。
HTTP 引用来源 { #http-referrers }
点击此处了解有关 HTTP 引用来源头的更多信息: https://en.wikipedia.org/wiki/HTTP_referer
这可用于限制使用嵌入到其他网站页面上的 "公共" 令牌。 确保引用来源标头与网站主机名相匹配,有助于避免令牌被滥用, 例如,如果有人在公共论坛上发布令牌。
Referer 标头很容易被欺骗。此设置旨在阻止未经授权的第三方开发人员连接 到公共访问实例。
保存令牌 { #saving-a-token }
完成令牌配置后,点击弹出窗口右下方的 "生成新令牌" 按钮保存。 这样,令牌将被保存,并在服务器上生成一个秘密令牌密钥。 新的密钥将显示在 PAT 令牌列表底部,背景为绿色 和文本 "新创建的令牌"。 秘密令牌密钥的外观与此类似:
d2pat_5xVA12xyUbWNedQxy4ohH77WlxRGVvZZ1151814092
现在就复制令牌密钥,并将其保存在安全的地方,以便以后使用。 秘密令牌密钥将在服务器上安全散列,只有该秘密令牌密钥的散列才会保存到数据库中。 这样做的目的是在有人未经授权访问数据库时,最大限度地减少安全影响。 这与处理密码的方式类似。
使用应用项目接口{ #creating-a-token-with-the-api } 创建令牌 示例说明如何使用 API 创建新的个人访问令牌:
POST /api/apiToken
Content-Type: application/json
Authorization: Basic admin
{}
{})!这将返回一个包含类似令牌的响应:
{
"httpStatus": "已创建",
"httpStatusCode": 201,
"status": "正常",
"response": {
"responseType": "ApiTokenCreationResponse",
"key": "d2pat_5xVA12xyUbWNedQxy4ohH77WlxRGVvZZ1151814092",
"uid": "jJYrtIVP7qU",
"klass": "org.hisp.dhis.security.apikey.ApiToken",
"errorReports": []
}
}
令牌本身由三部分组成:
前缀: (d2pat_) 表示这是什么类型的令牌。
随机字节 Base64 编码: (5xVA12xyUbWNedQxy4ohH77WlxRGVvZZ)
CRC32 校验和:(1151814092) 校验和部分以 0 填充,因此长度始终为 10 个字符。 1. 使用 API { #configure-token-with-the-api } 配置令牌 2. 要更改令牌上的任何限制条件,可发出以下 HTTP API 请求。 3. 注意:创建令牌后,只能修改约束条件。
PUT /api/apiToken/jJYrtIVP7qU Content-Type: application/json Authorization: Basic admin
```json
{
"version": 1,
"type": "PERSONAL_ACCESS_TOKEN",
"expires": 163465349603200,
"attributes": [
{
"type": "IpAllowedList",
"allowedIps": ["192.168.0.1"]
},
{
"type": "MethodAllowedList",
"allowedMethods": ["GET"]
}
]
}
使用个人访问令牌 { #using-a-personal-access-token }
要使用新创建的令牌发出请求,请使用相应的授权标头 。授权标头格式如下:
Authorization: ApiToken [YOUR_SECRET_API_TOKEN_KEY]
GET /api/apiToken/jJYrtIVP7qU
Content-Type: application/json
Authorization: ApiToken d2pat_5xVA12xyUbWNedQxy4ohH77WlxRGVvZZ1151814092
删除个人访问令牌{ #deleting-a-personal-access-token }
您可以在创建 PAT 的个人资料页面的用户界面中删除 PAT、 或像这样通过应用项目接口删除:
DELETE /api/apiToken/jJYrtIVP7qU
Content-Type: 应用项目/json
授权:ApiToken d2pat_5xVA12xyUbWNedQxy4ohH77WlxRGVvZZ1151814092
DHIS2支持* OAuth2 身份验证协议。OAuth2是开放的 授权标准,允许第三方客户端代表DHIS2用户进行连接,并为对Web API的后续请求获取*bearer token。DHIS2不支持细粒度 OAuth2角色,而是根据用户角色提供应用访问权限,基于 DHIS2用户的身份。
您要允许其使用OAuth 2身份验证的每个客户端都必须 在DHIS2中注册。要添加新的OAuth2客户端,请转到应用>设置> OAuth2客户端。 在用户界面中,单击*添加新*,然后输入所需的客户端名称和授权类型。
可以通过Web API添加OAuth2客户端。例如,我们可以 发送这样的有效载荷:
{
"name": "OAuth2 Demo Client",
"cid": "demo",
"secret": "1e6db50c-0fee-11e5-98d0-3c15c2c6caf6",
"grantTypes": [
"password",
"refresh_token",
"authorization_code"
],
"redirectUris": [
"http://www.example.org"
]
}
SERVER="https://play.dhis2.org/dev"
curl -X POST -H "Content-Type: application/json" -d @client.json
-u admin:district "$SERVER/api/oAuth2Clients"
该客户端将作为下一个授权类型示例的基础。
授权类型:密码 { #webapi_oauth2_password }
所有授权类型中最简单的是*password*授权类型。这 种授权类型类似于基本身份验证,因为它 要求客户端收集用户的用户名和密码。作为 示例,我们可以使用我们的演示服务器:
SERVER="https://play.dhis2.org/dev"
SECRET="1e6db50c-0fee-11e5-98d0-3c15c2c6caf6"
curl -X POST -H "Accept: application/json" -u demo:$SECRET "$SERVER/uaa/oauth/token"
-d grant_type=password -d username=admin -d password=district
{
"expires_in": 43175,
"scope": "ALL",
"access_token": "07fc551c-806c-41a4-9a8c-10658bd15435",
"refresh_token": "a4e4de45-4743-481d-9345-2cfe34732fcc",
"token_type": "bearer"
}
现在,我们将专注于access_token,这就是我们 将用作身份验证(承载)令牌的内容。例如,我们将获取 使用我们的令牌访问所有数据元素:
SERVER="https://play.dhis2.org/dev"
curl -H "Authorization: Bearer 07fc551c-806c-41a4-9a8c-10658bd15435" "$SERVER/api/33/dataElements.json"
授权类型:refresh_token { #webapi_refresh_token }
通常,访问令牌的有效性有限。您可以查看 上一个示例中响应的expires_in属性, 了解令牌何时到期。要获得新的access_token,您 可以再次访问服务器并使用refresh_token, 这允许您获得更新的令牌而无需要求 再次使用用户凭据。
SERVER="https://play.dhis2.org/dev"
SECRET="1e6db50c-0fee-11e5-98d0-3c15c2c6caf6"
REFRESH_TOKEN="a4e4de45-4743-481d-9345-2cfe34732fcc"
curl -X POST -H "Accept: application/json" -u demo:$SECRET "$SERVER/uaa/oauth/token"
-d "grant_type=refresh_token" -d "refresh_token=$REFRESH_TOKEN"
授权类型:authorization_code { #webapi_authorization_code }
如果您不想在外部存储用户凭据,建议使用授权码授权类型。 它允许DHIS2直接从用户收集用户名/密码,而不是由客户端 收集,然后代表用户进行身份验证。请注 意这种方法使用了客户端有效载荷中的redirectUris部分。
第 1 步:使用 Web 浏览器访问以下 URL。如果您有多个 重定向 URI,可能需要添加 &redirect_uri=http://www.example.org 到 URL:
SERVER="https://play.dhis2.org/dev" $SERVER/uaa/oauth/authorize?client_id=demo&response_type=code
第 2 步:在用户成功登录并接受您的
客户端访问后,它将重定向回您的重定向 URI,如下所示:
http://www.example.org/?code=XYZ
第 3 步:这一步类似于我们在密码授权类型中所做的,
使用获得的代码,我们现在将请求访问令牌:
```bash
SERVER="https://play.dhis2.org/dev"
SECRET="1e6db50c-0fee-11e5-98d0-3c15c2c6caf6"
curl -X POST -u demo:$SECRET -H "Accept: application/json" $SERVER/uaa/oauth/token
-d "grant_type=authorization_code" -d "code=XYZ"
错误和信息消息 { #webapi_error_info_messages }
Web API 使用统一的格式返回所有错误/警告和 信息性消息:
{
"httpStatus": "Forbidden",
"message": "You don't have the proper permissions to read objects of this type.",
"httpStatusCode": 403,
"status": "ERROR"
}
无法访问的资源。它使用了 HTTP 状态代码 403、HTTP 状态信息 forbidden 和描述性消息。
WebMessage 属性
名称
描述
httpStatus
| 此响应的 HTTP 状态信息,更多信息请参见 RFC 2616(第 10 节)。 | httpStatusCode |
|---|---|
| 此响应的 HTTP 状态代码,更多信息请参见 RFC 2616(第 10 节)。 | status |
DHIS2状态,可能的值为*OK*、WARNING 或 ERROR,其中OK表示一切顺利,ERROR表示操作未完成,WARNING表示操作部分成功,如果消息包含response属性,请在那里查找更多信息。 | message |
| 用户友好型消息,说明操作是否成功。 | devMessage |
| 技术性更强、对开发人员更友好的消息(目前尚未使用)。 | response |
WebMessage格式未来扩展的扩展点。 | 日期和期间格式 { #webapi_date_period_format } |
| 在整个 Web API 中,我们会引用日期和期间。日期格式 | |
| 如下: | ``` |
| 年-月-日 | |
| ``` |
2014-03-20。
下表描述了期间格式(也可通过 API 端点/api/periodTypes获取)
期间格式
期间类型
格式
示例
| 描述 | 日 | yyyyMMdd | 2004 年 3 月 15 日 |
|---|---|---|---|
| 周 | yyyyWn | 20040315 | 2004W10 |
| 2004 年第 10 周 | 周三开始的周 | yyyyWedWn | 2015WedW5 |
| 第 5 周,周三开始 | 周四开始的周 | yyyyThuWn | 2015ThuW6 |
| 第 6 周,周四开始 | 周六开始的周 | yyyySatWn | 2015SatW7 |
| 第 7 周,周六开始 | 周日开始的周 | yyyySunWn | 2015SunW8 |
| 第 8 周,周日开始 | 双周 | yyyyBiWn | 2015BiW1 |
| 2015 年第 1-2 周 | 月份 | yyyyMM | 2004 年 3 月 |
| 双月 | yyyyMMB | 200403 | 200401B |
| 2004 年 1-2 月 | 季度 | yyyyQn | 2004Q1 |
| 2004 年 1-3 月 | 六个月 | yyyySn | 2004S1 |
| 2004 年 1 月至 6 月 | 4月开始的六个月 | yyyyAprilSn | 2004AprilS1 |
| 2004 年 4 月至 9 月 | 年份 | yyyy | 2004 年 |
| 4月开始的财政年度 | yyyyApril | 2004 | 2004 |
| 2004April | 2004 年 4 月至 2005 年 3 月 | 7月开始的财政年度 | yyyyJuly |
| 2004July | 2004 年 7 月至 2005 年 6 月 | 10月开始的财政年度 | yyyyOct |
| 2004Oct | 2004 年 10 月至 2005 年 9 月 | 相对时期 { #webapi_date_relative_period_values } | 在应用项目接口的某些部分,如分析资源,您可以 |
| 除固定时间段(如上定义)外,还可以使用相对时间段。 | |||
| 相对时间段是相对于当前日期而言的,可用于创建动态报告等。 | |||
| 创建动态报告。可用的相对周期值如下表所示 | |||
| 如下表所示。 |
关键词
| 今天 | 今天 |
|---|---|
| 昨天 | 昨天 |
| 最近 3 天 | LAST_3_DAYS |
| 最近 7 天 | LAST_7_DAYS |
| 最近 14 天 | LAST_14_DAYS |
| 最近 30 天 | LAST_30_DAYS |
| 最近 60 天 | LAST_60_DAYS |
| 最近 90 天 | LAST_90_DAYS |
| 最近 180 天 | LAST_180_DAYS |
| 本月 | THIS_MONTH |
| 本双月 | THIS_BIMONTH |
| 上双月 | LAST_BIMONTH |
| 本季度 | THIS_QUARTER |
| 上一季度 | LAST_QUARTER |
| 本六个月 | THIS_SIX_MONTHS |
| 上六个月 | LAST_SIX_MONTHS |
| 今年的周 | WEEKS_THIS_YEAR |
| 今年的月 | MONTHS_THIS_YEAR |
| 今年的双月 | BIMONTHS_THIS_YEAR |
| 今年的季度 | QUARTERS_THIS_YEAR |
| 今年 | THIS_YEAR |
| 去年的月 | MONTHS_LAST_YEAR |
| 去年的季度 | QUARTERS_LAST_YEAR |
| 去年 | LAST_YEAR |
| 最近 5 年 | LAST_5_YEARS |
| 最近 10 年 | LAST_10_YEARS |
| 最近 12 个月 | LAST_12_MONTHS |
| 最近 6 个月 | LAST_6_MONTHS |
| 最近 3 个月 | LAST_3_MONTHS |
| 最近 6 个双月 | LAST_6_BIMONTHS |
| 最近 4 个季度 | LAST_4_QUARTERS |
| 最近 2 个六个月 | LAST_2_SIX_MONTHS |
| 本财政年度 | THIS_FINANCIAL_YEAR |
| 上一财政年度 | LAST_FINANCIAL_YEAR |
| 最近 5 个财政年度 | LAST_5_FINANCIAL_YEARS |
| 最近 10 个财政年度 | LAST_10_FINANCIAL_YEARS |
| 本周 | THIS_WEEK |
| 上周 | LAST_WEEK |
| 本双周 | THIS_BIWEEK |
| 上双周 | LAST_BIWEEK |
| 最近 4 周 | LAST_4_WEEKS |
| 最近 4 个双周 | LAST_4_BIWEEKS |
| 最近 12 周 | LAST_12_WEEKS |
| 最近 52 周 | LAST_52_WEEKS |
| 自定义日期时段 { #webapi_date_custom_date_periods } | 分析 query 资源支持额外的参数来表达时段。 |
可以通过以下方式检索这些相对周期的 ISO 表示法 向 /api/relativePeriods/{RELATIVE_PERIOD_KEYWORD} 提出 GET 请求。
该终端支持以下参数: - startDate"(开始日期): 代表计算相对周期的起始日期。格式为yyyyy-MM-dd`。如果没有提供,默认为今天。 - financialYearStart"(财务年度开始):应为 FINANCIAL_YEAR_APRIL、FINANCIAL_YEAR_JULY、FINANCIAL_YEAR_OCTOBER 中的一个。如果未提供,则默认为 FINANCIAL_YEAR_OCTOBER。
例如,要获取从 2021-08-15 日开始的相对周期 "LAST_3_MONTHS "的 ISO 表示值,可以发出以下请求 的 ISO 表示,可以发出以下请求: GET /api/relativePeriods/LAST_3_MONTHS?startDate=2021-08-15
在这种情况下的回答是
``json { [ "202105", "202106", "202107" ] }
### 这些参数会替代默认的 `pe` 维度:
用于 `/analytics/events/query` 的 `eventDate`
用于 `/analytics/enrollments/query` 的 `enrollmentDate`
- 允许在一个或多个日期字段上添加条件并将它们合并。
- 自定义日期时段的使用 { #usage-of-custom-date-periods }
在支持自定义日期时段的资源中,有一些额外的查询参数,这些参数将被组合起来,以表达时间维度上的条件。
#### 自定义日期周期
事件查询资源
| 注册查询资源 | `eventDate` | [x] |
|--------------------|------------------------|---------------------------|
| [ ] | `lastUpdated` | [x] |
| [x] | [x] | `lastUpdated` |
| [ ] | `/api/analytics/events/query/...?..&eventDate=2021&...` | [x] |
| [x] | `lastUpdated` | `lastUpdated` |
| [x] | `lastUpdated` | `lastUpdated` |
可以在同一查询中合并多个时间字段:
`/api/analytics/events/query/...?..&eventDate=2021&incidentDate=202102&...`
所有这些条件都可以与 `pe` 维度相结合:
`/api/analytics/events/query/...?..&dimension=pe:TODAY&enrollmentDate=2021&incidentDate=202102&...`
支持的格式见上文 "日期和期间格式"。还提供了一种额外的格式来表达一系列日期:`yyyyMMdd_yyyyMMdd` 和 `yyyy-MM-dd_yyyy-MM-dd`。
在下面的示例中,端点将返回计划在 20210101 和 20210104 之间发生的事件:
`/api/analytics/events/query/...?..&dimension=pe:TODAY&enrollmentDate=2021&incidentDate=202102&scheduledDate=20210101_20210104&...`
当局 { #authorities }
所有可用的系统授权都可以通过以下端点列出其标识符和名称:
## GET /api/authorities
返回格式如下:
```json
{
"systemAuthorities": [
{
"id": "ALL",
"name": "ALL"
},
{
"id": "F_ACCEPT_DATA_LOWER_LEVELS",
"name": "Accept data at lower levels"
}
]
}
元数据 { #webapi_metadata }
标识符方案 { #webapi_identifier_schemes }
在导入过程中,标识符方案用于将元数据对象映射到其他元数据对象, 并将元数据作为导出的一部分。请注意, 并非所有方案都适用于所有 API 调用,也并非所有方案都能同时用于输入和输出。 在后续章节中会解释各种 API 端点支持的方案。
使用在查询中使用的属性名称:
idScheme
dataElementIdScheme
VALIDATE which will report errors in the payload without making changes to the database or COMMIT (default) which will validate the payload and make changes to the database.UID.表:标识符方案值
方案
描述
| ID, UID | Parameter name |
|---|---|
| CODE | 与 DHIS2 编码匹配,主要用于与外部系统交换数据。 |
| NAME | 在 DHIS2 名称上匹配,请注意这使用的是可用的 object.name,而不是翻译后的名称。还请注意,名称并不总是唯一的,在这种情况下,不能使用它们。 |
| ATTRIBUTE:ID | 根据元数据属性进行匹配,需要将此属性分配给要匹配的类型,同时将唯一属性设置为 true。它的主要用途是与外部系统交换数据,与 CODE 相比,它有一些优势,因为可以添加多个属性,所以可以用于与多个系统同步。 |
| 请注意,标识符方案不是一个独立的功能,需要与数据值导入、元数据导入和 | |
| GeoJson 导入等资源结合使用。 | 例如,指定 CODE 作为通用 id 方案并覆盖 |
| 使用 UID 作为组织单位 ID 方案,您可以使用这些查询 | |
| 参数: |
?idScheme=CODE&orgUnitIdScheme=UID
再举一个例子,为组织单位 id 指定一个属性 方案,数据元素 id 方案的代码并使用默认 UID id 作为所有其他对象的方案,您可以使用这些参数:
?orgUnitIdScheme=ATTRIBUTE:j38fk2dKFsG&dataElementIdScheme=CODE
浏览Web API { #webapi_browsing_the_web_api }
浏览 Web API 的入口点是 /api。这个资源 提供所有可用资源的链接。四种资源表示 格式始终适用于所有资源:HTML、XML、JSON 和 JSONP。某些资源将具有其他可用格式,例如 MS Excel、PDF、CSV 和 PNG。要从 Web 浏览器探索 API,请导航 到 /api 入口点并按照链接访问您想要的 资源,例如/api/dataElements。对于所有返回元素列表的资源, 某些查询参数可用于修改响应:
参数
选项值
| 默认值 | 描述 | paging | Parameter name |
|---|---|---|---|
| true | 表示是否返回分页的元素列表。 | Tracked Entity UIDS | 数字 |
| 定义要返回的页码。 | order | 1 | 数字 |
| 定义每页返回的元素数量。 | order | 50 | property:asc/iasc/desc/idesc |
| iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 | 如何使用这些参数获取完整列表的示例 | ||
| XML 响应格式的数据元素组: | /api/dataElementGroups.xml?links=false&paging=false |
您可以在 name 属性上查询元素,而不是返回 使用 query 查询参数的完整元素列表。在这个例子中 我们查询名称中带有“贫血”一词的所有数据元素:
/api/dataElements?query=贫血
您可以像这样获取特定页码和页面大小的对象:
/api/dataElements.json?page=2&pageSize=20
您可以像这样完全禁用分页:
/api/indicatorGroups.json?paging=false
要基于特定属性对结果进行排序:
/api/indicators.json?order=shortName:desc
首先根据创建的日期时间属性排序(降序),然后根据名称属性排序(升序):
/api/indicators.json?order=created:desc,name:asc
您可以通过以下方式在所有对象类型中根据对象的 ID 查找对象 identifiableObjects 资源:
/ api / identifiableObjects / <id>
翻译 { #webapi_translation }
DHIS2 支持数据库内容的翻译,如数据元素、指标和计划、 指标和项目。网络应用项目接口中的所有元数据对象都有 属性,这些属性包括 displayName, displayShortName, displayDescription 和 displayFormName(用于数据元素和跟踪实体属性)。
参数
价值观
| 默认值 | 译 | Parameter name |
|---|---|---|
| 启用翻译。请注意,默认情况下这是关闭的(在其他端点,默认情况下是打开的)。 | 表示是否返回分页的元素列表。 | 使用的本地语言 |
| 从用户本地语言更改为自定义本地语言。 | 翻译API { #webapi_translation_api } | 对象的翻译呈现为对象本身的一部分 |
| 在* translation *数组中。请注意, | ||
| JSON / XML有效负载的*翻译*数组通常为您预先过滤,这意味着它们不能直接用于导入/导出翻译(因为那样会 | ||
| 通常会覆盖当前用户以外的语言环境)。 |
{
"id": "FTRrcoaog83",
"displayName": "Accute French",
"translations": [
{
"property": "SHORT_NAME",
"locale": "fr",
"value": "Accute French"
},
{
"property": "NAME",
"locale": "fr",
"value": "Accute French"
}
]
}
转换关闭的数据元素示例:
{
"id": "FTRrcoaog83",
"displayName": "Accute Flaccid Paralysis (Deaths < 5 yrs)",
"translations": [
{
"property": "FORM_NAME",
"locale": "en_FK",
"value": "aa"
},
{
"property": "SHORT_NAME",
"locale": "en_GB",
"value": "Accute Flaccid Paral"
},
{
"property": "SHORT_NAME",
"locale": "fr",
"value": "Accute French"
},
{
"property": "NAME",
"locale": "fr",
"value": "Accute French"
},
{
"property": "NAME",
"locale": "en_FK",
"value": "aa"
},
{
"property": "DESCRIPTION",
"locale": "en_FK",
"value": "aa"
}
]
}
请注意,即使您得到未过滤的结果,并且正在使用 适当的类型端点,即我们不允许的 /api/dataElements 更新,因为这样做很容易犯错误并覆盖 其他可用的语言环境。
要阅读和更新翻译,您可以使用特殊翻译 每个对象资源的端点。可以通过*GET*或访问 在适当的/ api / <object-type> / <object-id> / translations端点上* PUT *。
例如,对于标识符为 FTRrcoaog83 的数据元素,您可以使用 /api/dataElements/FTRrcoaog83/translations来获取和更新翻译。 翻译。可用的字段有:property (可选 NAME、SHORT_NAME、FORM_NAME、DESCRIPTION)、locale(支持任何有效的 locale"(支持任何有效的 locale ID)和已翻译的属性 value。
法语语言环境的NAME属性示例:
{
"property": "NAME",
"locale": "fr",
"value": "Paralysie Flasque Aiguë (Décès <5 ans)"
}
然后将此有效负载添加到翻译数组中,并发回 到适当的端点:
{
"translations": [
{
"property": "NAME",
"locale": "fr",
"value": "Paralysie Flasque Aiguë (Décès <5 ans)"
}
]
}
对于ID为* FTRrcoaog83 的数据元素,您可以 PUT *此代码为 / api / dataElements / FTRrcoaog83 / translations。确保发送全部 特定对象的翻译,而不仅仅是单个语言环境的翻译 (否则,您可能会覆盖其他区域的现有语言环境 语言环境)。
如果数据值已成功保存或更新,则状态代码将为204 No Content,如果存在验证错误(例如,同一语言环境有多个SHORT_NAME),则状态代码将为404 Not Found。
Web API版本 { #webapi_api_versions }
网络 API /api可与 DHIS2 版本号一起使用,例如
支持版本 28-43。调用带有或不带版本的端点不会改变 API 的行为。无论使用哪种方法,行为都是一样的。我们的目标是不再支持带版本的 API 调用,因此请使用不带版本号的 API 调用。
支持使用版本是由于传统的设计,并没有按照最初的设想发展。
元数据对象过滤器 { #webapi_metadata_object_filter }
要过滤元数据,可以对返回的元数据列表应用多种过滤操作。 过滤器的格式很简单,遵循以下模式: property:operator:value,其中 property 是要过滤的元数据属性, operator 是要执行的比较运算符,value 是要匹配的值。
除列出的属性外,筛选器还可应用于自定义属性 值,方法是使用属性的 ID 作为属性名。
还支持递归过滤,即对关联对象或对象集合进行过滤。
表:可用操作符
操作符
类型
| 所需值 | 描述 | eq | Parameter name |
|---|---|---|---|
| true | 不等于 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、枚举、集合(检查大小)、日期 |
| true | 不等于 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、枚举、集合(检查大小)、日期 |
| true | 不等于 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 |
| true | 小于 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 |
| true | 小于 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 |
| true | 小于 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 |
| true | 小于 | Tracked Entity UIDS | 所有 |
| false | * | subjectTemplate | 所有 |
| false | * | subjectTemplate | 集合 |
| false | 集合为空 | subjectTemplate | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串 |
| true | 不区分大小写的字符串结尾匹配 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、日期 |
| 描述 | 查找匹配 1 个或多个值的对象 | Tracked Entity UIDS | 字符串、布尔值、整数、浮点、日期 |
| true | 查找匹配 1 个或多个值的对象 | Tracked Entity UIDS | 获取ID属性为ID1或ID2的数据元素: |
/api/dataElements?filter=id:eq:ID1&filter=id:eq:ID2
获取名称属性为 MyDataElement 的数据元素,忽略大小写:
/api/dataElements?filter=name:ieq:mydataelement
获取具有 ID1 数据集的所有数据元素:
/api/dataElements?filter=dataSetElements.dataSet.id:eq:ID1
获取所有使用聚合运算符 sum 和值类型为 int 的数据元素:
/api/dataElements.json?filter=aggregationOperator:eq:sum&filter=type:eq:int
您可以在集合内进行筛选,例如,要获取属于 ANC 数据元素组的数据元素, 可以使用相关数据元素组的 id 属性进行查询:
/api/dataElements.json?filter=dataElementGroups.id:eq:qfxEYY9xAl6
要获取元数据属性中具有特定属性值的数据元素, 可使用相同的集合查询语法指定属性 ID 和属性值的过滤器:
/api/dataElements.json?filter=attributeValues.attribute.id:eq:n2xYlNbsfko&filter=attributeValues.value:eq:AFP
获取已设置选项集的数据元素:
/api/dataElements?filter=optionSet:!null
由于默认情况下所有运算符都是 AND,因此您无法直接找到匹配 多个 id 的数据元素,为此您可以使用 in 操作符:
/api/dataElements.json?filter=id:in:[fbfJHSPpUQD,cYeuwXTCPkU]
逻辑运算符 { #webapi_metadata_logical_operator }
如前一节所述,过滤器应用的默认逻辑运算符 是 AND,这意味着所有对象过滤器必须都 匹配。但是,在某些情况下,您希望匹配其中之一 几个过滤器(可能是 id 和 code 字段),在这些情况下,它是 可以将根逻辑运算符从 AND 切换为 OR 使用 rootJunction 参数。
结果返回
/api/dataElements.json?filter=id:in:[id1,id2]&filter=code:eq:code1
示例:过滤逻辑运算符已切换为 OR 的位置 现在只有一个过滤器必须匹配才能产生结果 回
/api/dataElements.json?filter=id:in:[id1,id2]&filter=code:eq:code1&rootJunction=OR
可识别的令牌过滤器 { #identifiable-token-filter }
除了上述基于特定属性的过滤之外, 我们还通过* token 基于 AND 过滤了一组 属性:ID,代码和名称(如果可用,还包括shortName)。这些 属性通常称为*可识别。这个想法是为了 过滤ID,名称,代码或简称中包含某些内容的元数据。
如下: id,name,code,shortName
/api/dataElements.json?filter=identifiable:token:2nd
也可以指定多个过滤值。
示例:获取在任何 identifiable 属性中找到 ANC visit 的所有数据元素。系统返回所有数据元素,其中在可识别属性中的任何地方都可以找到令牌(ANC 和访问)。
/api/dataElements.json?filter=identifiable:token:ANC访问
也可以将可识别过滤器与基于属性的过滤器结合起来,并期望应用 rootJunction。
/api/dataElements.json?filter=identifiable:token:ANC visit&filter = displayName:ilike:tt1
/api/dataElements.json?filter=identifiable:token:ANC访问
&filter = displayName:ilike:tt1&rootJunction = OR
元数据字段过滤器 { #webapi_metadata_field_filter }
在许多情况下,元数据的默认视图可能过于冗长。 冗长。客户可能只需要每个对象中的几个字段,并希望从响应中删除不必要的字段。 从响应中删除不必要的字段。要了解每个对象有哪些字段 请参阅 "模式"部分。 除了列出的属性外,还可以通过使用属性 属性 ID 作为属性名称。
例如,?fields=id,name 只显示每个对象的id和name字段。对于集合或复杂对象,可以使用以下格式 ?fields=id,name,dataSets[id,name],这将返回根对象的name和id字段。并且包括该对象的所有数据集的 id and name
可以使用感叹号操作符进行否定操作,我们有一组字段选择预设。支持 XML 和 JSON 格式。
示例:在指标资源上获取id和name:
/ api / indicators?fields = id,名称
示例:从数据元素中获取 id 和 name,并从相关数据集中获取 id 和 name:
/ api / dataElements?fields = id,name,dataSets [id,name]
示例:获取用户定义属性的 id、name 和值 ID 为 DnrLSdo4hMl 的组织单位的用户定义属性值:
/api/organisationUnits?fields=id,name,DnrLSdo4hMl
然后,该属性将作为每个匹配对象的属性 DnrLSdo4hMl 包含在响应中。 属性。可以使用 rename 转换器进行重命名,如下一节所示。
要从输出中排除字段,可以使用感叹号!。 操作符。这是在查询中的任何地方都允许的,而根本不会 包括该属性,因为它可能已经插入了某些 预设。
一些预设(选定的字段组)可用并且可以应用 使用: 运算符。
表格属性操作符
操作员
描述
| 所需值 | Parameter name |
|---|---|
| <object>[<field-name>, ...] | 包含一个集合中的字段(将应用于该集合中的每个对象),或只包含一个对象上的字段。 |
| !<field-name>,<object>[!<field-name> | 请勿包含此字段名称,它也适用于对象/集合内部。在使用预设包含字段时非常有用。 |
| *,<object>[*] | 包括某个对象上的所有字段,如果应用于某个集合,则会包括该集合中所有对象上的所有字段。 |
| :<preset> | 别名,用于选择多个字段。目前有三种预设,请参阅下表了解说明。 |
| 表格字段预设 | 预设 |
描述
| 一应俱全 | Parameter name |
|---|---|
| * | 所有的别名 |
| 可识别 | 包括 id、名称、代码、创建、最后更新和最后更新由字段 |
| 可命名 | 包括 id、名称、简称、代码、描述、创建和最后更新字段 |
| 持续 | 返回对象的所有持久化属性,不考虑对象是否是关系的所有者。 |
| 所有者 | 返回对象上的所有持久化属性,其中该对象是所有属性的所有者,此有效负载可用于通过 API 进行更新。 |
| 示例:包括数据集中除组织单位以外的所有字段: | / api / dataSets?fields =:all,!organizationUnits |
示例:仅包含ID,名称和数据集中的组织单位集合,但不包含组织单位中的ID:
/ api / dataSets / BfMAe6Itzgt?fields = id,name,organisationUnits [:all,!id]
示例:包括所有指标的可命名属性:
/api/indicators.json?fields=:nameable
字段转换器 { #webapi_field_transformers }
字段转换器可用于转换属性。语法说明如下:
这会将 id 属性重命名为 i,将 name 属性重命名为 n。
/api/dataElementGroups?fields=id,displayName,dataElements~paging(1;20)
/api/dataElementGroups.json?fields=id,displayName,dataElements~isNotEmpty~rename(haveDataElements)
下表列出了支持的转换器操作符。
表:可用转换器
名称
参数
| 类型 | size | Parameter name |
|---|---|---|
| isEmpty | 字符串或集合是否为空 | |
| isNotEmpty | 字符串或集合是否不为空 | |
| rename | 参数 1:名称 | |
| 重命名属性名称 | paging | 参数 1:页码,参数 2:页面大小 |
| true | pluck | 可选参数 1:字段名 |
| 将对象数组转换为对象选定字段的数组。默认情况下,使用集合返回的第一个字段(通常是 ID)。 | keyBy | 可选参数 1:字段名 |
| 将对象数组转换为以字段名(默认 id)为键的对象。这对 JavaScript 中的快速查找非常有用。 | keyBy | 变压器使用示例如下。 |
/api/dataElements?fields=dataSets~size
测试集合是否为空:
/api/dataElements?fields=dataSets~isEmpty
测试集合是否为空:
/api/dataElements?fields=dataSets~isNotEmpty
重命名属性
/api/dataElements/ID?fields=id~rename(i),name~rename(n)
对集合进行分页:
/api/dataElementGroups?fields=id,displayName,dataElements~paging(1;20)
获取包含组织单位 ID 的数组:
/api/categoryOptions.json?fields=id,organisationUnits~pluck
获取包含组织单位名称的数组:
/api/categoryOptions.json?fields=id,organisationUnits~pluck[name]。
通过d字段键入 dataElements 数组:
/api/dataElementGroups.json?fields=id,name,dataElements~keyBy[id,name,valueType]。
通过valueType字段键入 dataElements 数组,因为多次点击这将生成(数据元素的)数组:
/api/dataElementGroups.json?fields=id,name,dataElements~keyBy(valueType)[id,name,valueType]。
元数据创建,读取,更新,删除,验证 { #webapi_metadata_crud }
DHIS2 中的所有元数据实体都有自己的 API 端点,支持 CRUD 操作(创建、读取、更新和删除)。端点 URL 遵循以下格式:
entityName 使用驼峰命名法。例如,端点 对于_数据元素_是:
/ api / dataElements
** 注意: ** 更新对象时,所有现有属性值都将被覆盖,即使新值为空。如果要对对象进行部分更新,请使用 JSON Patch API。
创建/更新参数 { #webapi_metadata_create_update }
以下请求查询参数可用于所有元数据端点。
参数
类型
| 需要 | Potential duplicate status | 检索和删除项目通知模板 | Attribute identifiers | Parameter name |
|---|---|---|---|---|
| 假 | 项目阶段 | subjectTemplate | 表示是否返回分页的元素列表。 | 枚举 |
Sets import strategy, CREATE_AND_UPDATE will try and match on identifier, if it doesn't exist, it will create the object. | 创建_并_更新|创建|更新|删除 | subjectTemplate | 创建和更新对象 { #webapi_creating_updating_objects } | 要创建新对象,您需要知道端点、类型 |
| 格式,并确保您拥有所需的权限。作为 | ||||
| 例如,我们将创建和更新一个*常量*。为了弄清楚 | ||||
| 格式,我们可以使用新的 schema 端点来获取格式 | ||||
| 描述。因此,我们将从获取该信息开始: |
从输出中,您可以看到创建所需的权限 是F_CONSTANT_ADD,重要的属性是:name 和 价值。由此,我们可以创建一个 JSON 负载并将其保存为文件 称为constant.json:
{
"name": "PI",
"value": "3.14159265359"
}
与XML有效内容相同的内容:
<constant name="PI" xmlns="http://dhis2.org/schema/dxf/2.0">
<value>3.14159265359</value>
</constant>
我们现在准备通过发送 POST 请求来创建新的*常量* 使用curl 的带有JSON 有效负载的constants端点:
curl -d @constant.json "http://server/api/constants" -X POST
-H "Content-Type: application/json" -u user:password
将常量发布到演示中的具体示例 服务器:
curl -d @constant.json "https://play.dhis2.org/api/constants" -X POST
-H "Content-Type: application/json" -u admin:district
如果一切顺利,您应该看到类似以下的输出:
{
"status": "SUCCESS",
"importCount": {
"imported": 1,
"updated": 0,
"ignored": 0,
"deleted": 0
},
"type": "Constant"
}
更新过程将完全相同,您进行更改 到 JSON/XML 负载,找出常量的 ID,然后 向端点发送包含 ID 的 PUT 请求:
curl -X PUT -d @pi.json -H "Content-Type: application/json"
-u user:password "http://server/api/constants/ID"
删除物件 { #webapi_deleting_objects }
删除对象非常简单,您需要知道 ID 和你要删除的类型的端点,让我们继续我们的 上一节中的示例并使用*常量*。让我们假设 id 是 abc123,那么你需要做的就是发送 DELETE 对端点的请求 + id:
curl -X DELETE -u user:password "http://server/api/constants/ID"
成功删除应返回HTTP状态204(无内容)。
在集合中添加和删除对象 { #webapi_adding_removing_objects_collections }
集合资源允许您修改集合
对象。
### 添加或删除单个对象 { #webapi_collections_adding_removing_single_objects }
为了在对象集合中添加或删除对象,您
可以使用以下
图案:
#### / api / {collection-object} / {collection-object-id} / {collection-name} / {object-id}
应该使用POST方法添加,使用DELETE方法删除
一个东西。当对象之间存在多对多关系时,
您必须首先确定哪个对象拥有该关系。如果不是
清除这是哪个对象,尝试两种方式调用以查看哪个有效。
模式的组成部分是:
集合对象:拥有您的集合的对象类型
想修改。
- 集合对象 id:拥有该对象的对象的标识符
要修改的集合。
- 集合名称:您要修改的集合的名称。
object id:要添加或删除的对象的标识符
- 从集合。
- 例如,为了删除标识符为 IDB 的数据元素
从具有标识符 IDA 的数据元素组中,您可以执行 DELETE
要求:
删除/ api / dataElementGroups / IDA / dataElements / IDB
将带有标识符 IDB 的类别选项添加到带有
标识符 IDA 你可以做一个 POST
要求:
POST / api / categories / IDA / categoryOptions / IDB
添加或删除多个对象 { #webapi_collections_adding_removing_multiple_objects }
您可以在一个请求中从集合中添加或删除多个对象
具有这样的有效载荷:
#### ```json
{
"identifiableObjects": [{
"id": "IDA"
}, {
"id": "IDB"
}, {
"id": "IDC"
}
]
}
使用此有效负载,您可以添加,替换或删除项目:
添加项目:
POST / api / categories / IDA / categoryOptions
更换物品:
{
"additions": [{
"id": "IDA"
}, {
"id": "IDB"
}, {
"id": "IDC"
}
],
"deletions": [{
"id": "IDD"
}, {
"id": "IDE"
}, {
"id": "IDF"
}
]
}
删除 项目:
删除/ api / categories / IDA / categoryOptions
在单个请求中添加和删除对象 { #webapi_collections_adding_removing_objects_single_request }
您可以在单个 POST 中从集合中添加和删除对象 请求到以下 URL:
有效负载格式为:
{
"additions": [{
"id": "IDA"
}, {
"id": "IDB"
}, {
"id": "IDC"
}
],
"deletions": [{
"id": "IDD"
}, {
"id": "IDE"
}, {
"id": "IDF"
}
]
}
验证有效载荷 { #webapi_validating_payloads }
DHIS 2 支持元数据有效载荷的系统范围验证,这意味着 将检查 API 端点上的创建和更新操作 允许进行更改之前的有效负载。找出哪些验证 为特定端点准备好了,看看/api/schemas 端点,即要找出数据元素具有哪些约束,您 会去/api/schemas/dataElement。
架构端点。如果您想从创建中验证常量 之前的部分,您可以这样发送:
POST / api / schemas / constant
一个简单的(非验证)示例为:
curl -X POST -d "{\"name\": \"some name\"}" -H "Content-Type: application/json"
-u admin:district "https://play.dhis2.org/dev/api/schemas/dataElement"
这样就能得到结果:
[
{
"message" : "Required property missing.",
"property" : "type"
},
{
"property" : "aggregationOperator",
"message" : "Required property missing."
},
{
"property" : "domainType",
"message" : "Required property missing."
},
{
"property" : "shortName",
"message" : "Required property missing."
}
]
部分更新 { #webapi_partial_updates }
对于处理元数据的 API 端点,我们支持使用 JSON 补丁 标准 进行部分更新 (PATCH)。有效负载基本上概述了您想要应用于现有元数据对象的一组操作。有关 JSON 补丁的详细信息和示例,请参阅 jsonpatch.com。支持三个运算符:添加、删除和替换。
JSON 补丁的默认 importReportMode(导入报告模式)是 ERRORS_NOT_OWNER,这意味着在更新任何不属于该特定对象的属性时(例如,试图将指标组直接添加到指标中),会出现错误。
根据 JSON 补丁规范,发送补丁时必须始终使用 mimetype application/json-patch+json。
例子 { #examples }
更新数据元素的名称和值类型{ #update-name-and-value-type-of-data-element }
/api/dataElements.csv?fields=id,displayName,dataElementGroups
##### ```json
[
{"op": "add", "path": "/name", "value": "New Name"},
{"op": "add", "path": "/valueType", "value": "INTEGER"}
]
从 orgUnit 组中删除特定 orgUnit{ #remove-a-specific-orgunit-from-an-orgunit-group }
PATCH /api/dataElementGroups/{id}
[ {"op": "add", "path": "/dataElements/-", "value": {"id": "data-element-id"}} ]
更改数据元素的域和值类型{ #change-domain-and-value-type-of-a-data-element }
##### ```json
[
{"op": "remove", "path": "/dataElements"}
]
更改数据元素的域和值类型{ #change-domain-and-value-type-of-a-data-element }
PATCH /api/dataElements/{id}
[ {"op": "add", "path": "/domainType", "value": "TRACKER"}, {"op": "add", "path": "/valueType", "value": "INTEGER"} ]
从 orgUnit 组中删除特定 orgUnit{ #remove-a-specific-orgunit-from-an-orgunit-group }
##### ```json
[
{"op": "remove", "path": "/organisationUnits/1"}
]
受阻 将 dataElementGroup 添加到 dataElement{ #blocked-add-dataelementgroup-to-dataelement }
PATCH /api/dataElements/{id}?importReportMode=ERRORS_NOT_OWNER
[ {"op": "add", "path": "/dataElementGroups/-", "value": {"id": "data-element-group-id"}} ]
按 id 删除收藏项{ #remove-collection-item-by-id }
#### ```json
[
{"op": "add", "path": "/dataElementGroups/0", "value": {"name": "new-name"}}
]
按 id 删除收藏项{ #remove-collection-item-by-id }
补丁 /api/dataSets/{id}?importReportMode=ERRORS_NOT_OWNER
[ {"op": "remove-by-id", "path": "/organisationUnits", "id": "u6CvKyF0Db5"} ]
回应
如果`path`属性无效或不存在,则修补服务将返回如下错误。
#### ```
补丁 /api/dataSets/{id}?importReportMode=ERRORS_NOT_OWNER
[
{"op": "remove-by-id", "path": "/test", "id": "u6CvKyF0Db5"}
]
回应
{
"httpStatus": "Bad Request",
"httpStatusCode": 400,
"status": "ERROR",
"message": "Invalid path /test"
}
/api/metadata端点上使用CSV不受支持)几乎相同,但字段转换尚不支持。 /api/dataElements /api/organisationUnits等我们的元数据端点),您可以使用Accept头部和值text/csv,或者您可以使用扩展名.csv。请注意,不支持复杂对象,我们仅支持id-object集合(因此将返回一个UID列表)。名称
选项
| 类型 | 用户设置 { #webapi_user_settings } | Parameter name |
|---|---|---|
默认过滤器是id,displayName | skipHeader | 假/真 |
| 标题(包含列名)是否应包括在内 | 下载 | 默认值: . |
| 立柱分离器 | 数组分隔符 | 默认值:; |
| 如果其中一个字段是一个 ID 对象集合,该分隔符将分隔所有 UID | 例子 { #examples } | 获取包括组关联在内的所有数据元素{ #get-all-data-elements-including-their-group-associations } |
/api/dataElements.csv?fields=id,displayName,dataElementGroups
#### 获取所有组织单位,包括几何(将被忽略){ #get-all-org-units-including-geometry-which-will-get-ignored }
#### 元数据导出 { #webapi_metadata_export }
本节介绍了可在以下位置获得的元数据 API
`/api/元数据`。支持 XML 和 JSON 资源表示。
## / api /元数据
最常用的参数在下面的“导出参数”中描述
桌子。您还可以使用以下方法将其应用于所有可用类型
`type:fields=<filter>` 和 `type:filter=<filter>`。你也可以
通过设置 `type=true|false` 启用/禁用某些类型的导出。
表:导出参数
名称
选项
| 类型 | 用户设置 { #webapi_user_settings } | Parameter name |
|---|---|---|
| 默认过滤器是`id,displayName` | 过滤 | 与元数据对象过滤器相同 |
| 数据值 | 订单 | 与元数据顺序相同 |
| iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 | 译 | 假/真 |
| 启用翻译。请注意,默认情况下这是关闭的(在其他端点,默认情况下是打开的)。 | 下载 | <locale\> |
| 从用户本地语言更改为自定义本地语言。 | 默认 | 包括/排除 |
| 是否应在有效载荷中包含自动生成的类别对象。如果您要在两个非同步实例之间移动元数据,可能需要将其设置为 EXCLUDE,以方便处理这些生成的对象。 | 跳过共享 | 假/真 |
| 跳过共享属性,更新时不合并共享,创建新对象时不添加用户组访问权限。 | 下载 | NON_NULL, ALWAYS, NON_EMPTY |
| *NON_NULL* 包括非空属性,*ALLWAYS* 包括所有属性,*NON_EMPTY* 包括非空属性(不包括长度为 0 的字符串或空集合)。 | 下载 | 假/真 |
| 启用此功能将添加 HTTP 标头 Content-Disposition,指定数据应作为附件处理,并由网络浏览器提供下载。 | 下载 | 导出所有元数据。小心,因为响应可能非常大,具体取决于
关于您的元数据配置: |
### / api /元数据
导出由lastUpdated降序排列的所有元数据:
表:导出参数
导出仅包括指标和指标组的元数据:
/ api / metadata?indicators = true&indicatorGroups = true
导出所有数据元素的id和displayName,按displayName排序:
/ api / metadata?dataElements:fields = id,name&dataElements:order = displayName:desc
导出名称以“ ANC”开头的数据元素和指示符:
/ api / metadata?filter = name:^ like:ANC&dataElements = true&indicators = true
具有依赖项的元数据导出 { #webapi_dataset_program_export_dependencies }
当您想交换数据集、项目、类别组合、仪表盘、选项集或数据元素组的元数据时、
仪表板、选项集或数据元素组的元数据时
时,有六个专用端点可供使用:
### ```
/api/dataSets/{id}/metadata.json
/api/programs/{id}/metadata.json
/api/categoryCombos/{id}/metadata.json
/api/dashboards/{id}/metadata.json
/api/optionSets/{id}/metadata.json
/api/dataElementGroups/{id}/metadata.json
然后可以使用/ api / metadata导入这些导出。
这些端点还支持以下参数:
表:导出参数
名称
选项
| 类型 | 用户设置 { #webapi_user_settings } | Parameter name |
|---|---|---|
| 跳过共享属性,更新时不合并共享,创建新对象时不添加用户组访问权限。 | 下载 | NON_NULL, ALWAYS, NON_EMPTY |
| 启用此功能将添加 HTTP 标头 Content-Disposition,指定数据应作为附件处理,并由网络浏览器提供下载。 | 下载 | 导出所有元数据。小心,因为响应可能非常大,具体取决于 |
| 关于您的元数据配置: |
导入器允许您导入元数据有效负载,其中可能包括许多 不同的实体和每个实体的任意数量的对象。元数据导出 元数据导出API生成的可以直接导入。
表:导出参数
表:导入参数
名称
选项(第一项为默认值)
| 类型 | 导入模式 | Parameter name |
|---|---|---|
设置整体导入模式,决定是否仅 VALIDATE 或也 COMMIT 元数据,这与我们旧的 dryRun 标志具有相似的功能。 | 标识符 | uid、代码、自动 |
设置用于引用匹配的标识符方案。AUTO表示先尝试UID,再尝试 CODE。 | 导入报告模式 | 错误、全部、调试 |
设置 ImportReport 模式,控制导入完成后报告的内容。ERRORS只包含有错误的对象的 ObjectReport 报告。FULL返回所有已导入对象的 ObjectReport ,而 DEBUG则返回相同对象名称(如果有)。 | 预热模式 | 参考、全部、无 |
设置预热器模式,用于指示是否应该对 ALL 进行预热(就像以前使用 preheatCache=true 一样)或对对象进行更智能的扫描以查看要预热的内容(现在是默认设置),将其设置为不推荐使用无。 | 导入策略 | CREATE_AND_UPDATE, CREATE, UPDATE, DELETE |
Sets import strategy, CREATE_AND_UPDATE will try and match on identifier, if it doesn't exist, it will create the object. | 原子模式 | 全部,无 |
设置原子模式,在旧的导入器中,我们总是进行*best effort*导入,这意味着即使某些引用不存在,我们仍然会导入(即数据元素组导入时缺少数据元素)。新进口商的默认设置是不允许这样做,并且类似地拒绝任何验证错误。设置 NONE 模式模拟了旧的行为. | 冲洗模式 | 自动,目标 |
设置刷新模式,控制何时刷新内部缓存。*强烈*建议将其保留为AUTO(这是默认设置)。仅将 OBJECT 用于调试目的,您会看到休眠异常并想查明堆栈发生的确切位置(休眠只会在刷新时抛出,因此很难知道哪个对象有问题)。 | 跳过共享 | 假,真 |
| 跳过共享属性,更新时不合并共享,创建新对象时不添加用户组访问权限。 | 跳过验证 | 假,真 |
跳过导入的验证。不推荐。 | 跳过验证 | 假,真 |
| 异步导入时,会立即返回一个 Location 标头,指向 importReport 的位置。有效载荷还包含一个已创建任务的 json 对象。 | 跳过验证 | 无、当前、选定 |
| 允许你覆盖正在导入的每个对象的用户属性,选项包括 NONE(不做任何操作)、CURRENT(使用导入用户)、SELECTED(使用 overrideUser=X 选择特定用户)。 | 覆盖用户 | 用户 ID |
| 如果 userOverrideMode 为 SELECTED,则使用此参数选择要覆盖的用户。 | > NOTE When updating objects, all property values will be overwritten even if the new values are null. Please use JSON Patch API in case you want do partial update to an object. | 要导入的元数据负载的示例如下所示。注意如何 |
| 每个实体类型都有自己的属性和一个对象数组: |
{
"dataElements": [
{
"name": "EPI - IPV 3 doses given",
"shortName": "EPI - IPV 3 doses given",
"aggregationType": "SUM",
"domainType": "AGGREGATE",
"valueType": "INTEGER_ZERO_OR_POSITIVE"
},
{
"name": "EPI - IPV 4 doses given",
"shortName": "EPI - IPV 4 doses given",
"aggregationType": "SUM",
"domainType": "AGGREGATE",
"valueType": "INTEGER_ZERO_OR_POSITIVE"
}
],
"indicators": [
{
"name": "EPI - ADS stock used",
"shortName": "ADS stock used",
"numerator": "#{LTb8XeeqeqI}+#{Fs28ZQJET6V}-#{A3mHIZd2tPg}",
"numeratorDescription": "ADS 0.05 ml used",
"denominator": "1",
"denominatorDescription": "1",
"annualized": false,
"indicatorType": {
"id": "kHy61PbChXr"
}
}
]
}
将此有效负载发布到元数据端点时,响应将包含 有关导入过程中使用的参数的信息和每个摘要 实体类型,包括创建、更新、删除和 忽略:
{
"importParams": {
"userOverrideMode": "NONE",
"importMode": "COMMIT",
"identifier": "UID",
"preheatMode": "REFERENCE",
"importStrategy": "CREATE_AND_UPDATE",
"atomicMode": "ALL",
"flushMode": "AUTO",
"skipSharing": false,
"skipTranslation": false,
"skipValidation": false,
"metadataSyncImport": false,
"firstRowIsHeader": true,
"username": "UNICEF_admin"
},
"status": "OK",
"typeReports": [
{
"klass": "org.hisp.dhis.dataelement.DataElement",
"stats": {
"created": 2,
"updated": 0,
"deleted": 0,
"ignored": 0,
"total": 2
}
},
{
"klass": "org.hisp.dhis.indicator.Indicator",
"stats": {
"created": 1,
"updated": 0,
"deleted": 0,
"ignored": 0,
"total": 1
}
}
],
"stats": {
"created": 3,
"updated": 0,
"deleted": 0,
"ignored": 0,
"total": 3
}
}
GeoJSON 导入 { #geojson-import }
GeoJSON 导入用于将几何数据附加到组织单位。
该集合中的每个地物都需要指向其应链接到的组织单位的引用。 的引用。
默认情况下,文件中的几何图形存储为组织单位的几何图形属性。要存储额外的几何图形,可以创建GEOJSON类型的属性。当使用属性时,文件中的所有几何图形都存储为相同的属性,该属性提供了一个附加参数attributeId。
GeoJSON 批量数据导入{ #webapi_geojson_bulk_import }
表:导入参数
类型
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住 仪表板对象是共享的,因此列表将受 当前已验证的用户。您可以检索有关一个的更多信息 特定的仪表板,请点击其链接,类似于: | Parameter name | |-------------------|--------------------------------|---|-----------------------------------------------------------------------------------------------------------------------------------| | true | Field Presets { #field-presets } | Tracker import { #webapi_tracker_import } | String | | 未定义 | JSON格式 | dryRun | enum:[id、code、name] | | id | GeoJSON 文件中使用的标识符所指向的组织单位属性 | attributeId | String | | 未定义 | JSON格式 | dryRun | boolean | | false | Field Presets { #field-presets } | flushMode | boolean | | false | Field Presets { #field-presets } | flushMode | POST /api/organisationUnits/geometry |
The post body is the GeoJSON file. Content type should be application/json or application/geo+json. The file may be .zip or .gzip compressed.
For example, a default file where id is used to refer to an organisation unit id has this structure:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "O6uvpzGd5pu",
"geometry": { ... }
},
...
]
}
一个使用特征属性来引用组织单位代码的文件 将采用这种结构:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": { "code": "OU1_CODE" },
"geometry": { ... }
},
...
]
}
几何体中的 坐标可以是成对的,也可以是三维的。 如果存在第三个维度,则会在导入时去除。
几何图形也可以是空,以有效清除或删除特定组织单位的几何图形。 删除。下一节将介绍一种特殊的批量删除 API。 将在下一节中介绍。 同步运行时,会直接返回导入报告。 HTTP 状态代码总是 OK,消息有效载荷中的 status表示是否所有记录都已成功导入。 表示是否成功导入了所有行。 报告中包含的导入计数统计信息可提供更多信息:
imported(导入的):成功更新了几何图形的组织单位数量,该组织单位在更新属性之前没有几何图形
updated: number of organisation units that were successfully updated with a geometry that did have value for the updated property already
ignored: number of organisation units that failed to updatedeleted: number of organisation units that where successfully update with a empty geometryOK and job configuration response that contains a relative reference to the task endpoint that allows to track the status of the asynchronous import. For example:同步执行时直接返回的摘要见
/api/system/taskSummaries/GEOJSON_IMPORT/{job-id}
一旦导入完成。
GeoJSON 批量数据删除{ #webapi_geojson_bulk_deletion }
要清除或取消设置所有组织单位的几何数据,请使用:
要清除或取消设置所有组织单位的特定 GEOJSON 属性的几何体数据,请使用 所有组织单位使用:
DELETE /api/organisationUnits/geometry?attributeId={attr-id}
Clearing is always synchronous and returns a similar report as the bulk import. It does not support any other parameters. No dry-run can be performed. Bulk clearing requires the F_PERFORM_MAINTENANCE authority.
GeoJSON 单一数据导入{ #webapi_geojson_single_import }
单次导入可以更新单个组织单元的几何图形。
例如,帖子正文只包含 GeoJSON geometry 值:
{
"type": "Polygon",
"coordinates": [...]
}
单次导入只支持 attributeId 和 dryRun 参数。 GeoJSON 单一数据删除{ #webapi_geojson_single_deletion } 要清除单个组织单位的 geometry GeoJSON 数据,请使用
同样,要清除单个组织的 GEOJSON 属性值 单位使用:
DELETE /api/organisationUnits/{id}/geometry?attributeId={attr-id}
Clearing is always synchronous returns a similar report as single import. The dry-run parameter is supported as well. The performing user requires authority to modify the target organisation unit.
架构图 { #webapi_schema }
可用于内省所有可用 DXF 2 对象的资源 可以在/api/schemas 上找到。对于特定资源,您可以拥有 查看/api/schemas/<type>。
GET /api/schemas.xml
要获取JSON中所有可用的模式,请执行以下操作:
GET /api/schemas.json
要获取特定类的JSON模式:
GET /api/schemas/dataElement.json
图示 { #webapi_icons }
DHIS2 包含一系列图标,可用于为元数据提供可视化语境。 元数据的上下文。有两种不同的图标:
自定义图标:可任意创建、更新和删除。 - 它们都可以通过图标资源访问。 - GET /api/icons
此端点返回有关可用默认图标和自定义图标的信息列表。 默认情况下,关键字、描述、关键字和 href 将包含在响应中。但可以使用字段参数来改变这种行为。
{
key: "mosquito_outline",
description: "Mosquito outline",
keywords: [
"malaria",
"mosquito",
"dengue"
],
"created": "2024-02-12T09:50:11.794",
"lastUpdated": "2024-02-12T09:50:11.794",
href: "<dhis server>/api/icons/mosquito_outline/icon.svg"
}
也可以通过关键字过滤直接获取特定图标,在下面的例子中,关键字是 mosquito_outline。
GET /api/icons/mosquito_outline
自定义图标操作{ #webapi_icons_custom }
可通过某些请求参数获取自定义图标列表
请求参数
类型
| 允许值 | Potential duplicate status | order | Parameter name |
|---|---|---|---|
| jobType | search | keys | Text |
| 应检索的自定义图标键列表 | createdStartDate | Text | |
| 应检索自定义图标的关键字列表 | createdStartDate | Text | |
| 在图标键和关键字中搜索给定文本,并检索键或关键字中包含该文本的所有图标。 | createdStartDate | Date | |
| 创建日期的起点 | createdEndDate | Date | |
| 创建日期的终点 | createdEndDate | Date | |
| 最后更新日期的起点 | createdEndDate | Date | |
| 最后更新日期的终点 | createdEndDate | 请求参数 |
| 允许值 | Potential duplicate status | order | Parameter name |
|---|---|---|---|
| comma separated list of fields or presets to include | 要返回的页码。如果缺少,默认为 1 | paging | Integer |
| 默认 | 要返回的页码。如果缺少,默认为 1 | paging | Boolean |
true|false | 表示是否应忽略分页并返回所有行。默认为 true,即默认情况下所有请求都分页,除非 paging=false. | 用于订购{ #request-parameters-for-ordering } 的请求参数 | 请求参数 |
| 允许值 | Potential duplicate status | order | Parameter name |
|---|---|---|---|
extent of fields selected by * field selector | createdStartDate | 用于过滤响应的请求参数{ #request-parameter-to-filter-responses } | The endpoints accept a fields parameter which controls which fields will be returned in the |
JSON response. fields parameter accepts a comma separated list of field names. If nothing is specified, default fields will be used and those are |
key,keywords,description,fileResourceUid,createdByUserUid,href可通过提供图标密钥下载自定义图标资源:
GET /api/icons/{key}/icon
自定义图标可以创建、修改和删除。 要创建自定义图标,请使用下面的资源。
POST /api/icons
它需要一个包含图标关键字、描述、关键字列表和文件资源 uid 的有效载荷来链接数据。
{
"key": "iconKey",
"description": "description",
"keywords": ["keyword 1","keyword 2"],
"fileResourceUid": "ARsqBjfB2cf"
}
只能使用以下资源更新自定义图标。
PUT /api/icons
通过以下有效载荷,图标的描述和关键字将被更新。
{
"key": "iconKey",
"description": "new description",
"keywords": ["new keyword 1", "new keyword 2"]
}
请注意,也可以只更新其中一个。也就是说,如果我们想更新描述,同时保留关键字,只需提供图标键和描述 json 字段即可。反之亦然,更新关键字的同时保留原始描述。
只能使用以下资源删除自定义图标。
DELETE /api/icons/{icon_key}
渲染类型 { #webapi_render_type }
某些元数据类型具有名为 renderType 的属性。渲染类型 属性是 device 和 renderingType 之间的映射。应用 可以使用此信息作为有关如何呈现对象的提示 在特定设备上。例如,移动设备可能想要渲染 与台式计算机不同的数据元素。
值类型渲染
项目阶段部分渲染
还提供2种设备类型:
移动
桌面
下表列出了可用的元数据和呈现类型。 值类型呈现具有基于元数据的附加约束 配置,这将显示在第二个表中。
表格元数据和渲染类型概览
元数据类型
可用的渲染类型
| 项目阶段部分 | * 列表(默认) * 序列 * 矩阵 |
|---|---|
| 跟踪实体属性 | * DEFAULT * DROPDOWN * VERTICAL_RADIOBUTTONS * HORIZONTAL_RADIOBUTTONS * VERTICAL_CHECKBOXES * HORIZONTAL_CHECKBOXES * SHARED_HEADER_RADIOBUTTONS * ICONS_AS_BUTTONS * SPINNER * ICON * TOGGLE * VALUE * SLIDER * LINEAR_SCALE * AUTOCOMPLETE * QR_CODE * BAR_CODE * GS1_DATAMATRIX |
| 描述 | 表:根据值类型允许的渲染类型 |
值类型
对象是一个选项集吗?
| false | true | TRUE_ONLY | 不 |
|---|---|---|
| 单个变更建议可通过以下方式查看 | Program notification template | 不 |
JSON object for ADD proposal, JSON array for UPDATE proposal, nothing for REMOVE proposal | Program notification template | |
Note that synthetic fields displayName and displayShortName are always | ||
returning the translated value independent of the translate parameter. | ```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" | ||
| ] | ||
| } | ||
| ``` | 不 | |
验证基于此 regex ^[0-9+\(\)#\.\s\/ext-]{6,50}$.最大长度为 50。 例如+4733987937, (+47) 3398 7937, (47) 3398 7937.123 | Program notification template | 不 |
| 创建提案的日期时间 | 不 | 不 |
| 一般电子邮件格式 abc@email.com | Program notification template | |
true or false | Program notification template | |
| 数字 | Program notification template | |
| 没有 | Program notification template | |
| 没有 | Program notification template | |
| 数值长度 = 1 并且是字母 | Program notification template |
值类型渲染也有一些额外的属性,可以 设置,通常在渲染某些特定类型时需要:
表:renderType 对象属性
财产
描述
| 指标组 | Parameter name | Potential duplicate status |
|---|---|---|
| 枚举(参见元数据和渲染类型表中的列表) | 分钟 | 仅用于值类型渲染。表示该字段可以具有的最小值。 |
| 整数 | 最大 | Enrollments |
| 最小-最大数据元素 { #webapi_min_max_data_elements } | 步骤 | Enrollments |
| 整数 | 小数点 | Enrollments |
| 整数 | renderingType 可以在创建或更新第一个表中列出的元数据时设置。项目阶段部分的渲染类型的示例负载如下所示: | Enrollments |
对于数据元素和跟踪的实体属性:
{
"renderingType": {
"type": "SLIDER",
"min": 0,
"max": 1000,
"step": 50,
"decimalPoints": 0
}
}
对象样式 { #webapi_object_style }
大多数元数据都有一个属性名称“样式”。可以使用此属性 由客户以某种方式表示对象。属性 目前支持的样式如下:
财产
描述
| 指标组 | Parameter name | Potential duplicate status |
|---|---|---|
| 字符串 (#000000) | 图标 | 图标,由图标名称表示。 |
| 串 | 目前,没有官方列表或对图标库的支持,所以 | |
| 这目前由客户提供。下面的列表显示 | ||
| 所有支持样式的对象: | 具有以下要求: |
数据元素类别选项
描述
指示符
<indicator-id>
对于组织单位维度,您可以指定组织
Validation rule
IndicatorGroup
项目阶段
项目阶段部分
关系(跟踪器)
跟踪实体属性
追踪实体类型
在创建或更新任何这些对象时,您可以包括 以下有效负载更改样式:
```json { "style": { "color": "#ffffff", "icon": "my-beautiful-icon" } }
类别选项{ #category-option }
合并类别选项{ #category_option_merge }
## 类别{ #category }
### 合并类别{ #category_merge }
类别合并端点允许您将多个类别(源)合并为一个目标类别。
> **注**
>
> 类别只能在以下情况下合并
>
> 1. 它们具有相同的类别选项<br>
> 源类别和目标类别不共享类别组合<br>
> 3. 源类别之间不共享类别组合<br>
>
> 这些限制确保只有重复的类别才能被合并,并有助于保持系统的完整性。
#### 请求{ #request }
执行类别合并所需的主要权限是 `F_CATEGORY_MERGE`。
#### /api/33/programs/orgUnits?programs={programIdA} 、{programIdB}
通过 POST 请求合并类别:
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | ```json
{
"object": {
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userAccesses": [],
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
``` |
|---------------|----------|----------------------------------------------------------------------------------|
| 要合并的类别选项(源类别选项)的标识符数组 | ```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"
]
}
``` | 要合并的类别(源类别)的标识符数组 |
| 将来源合并为指标(目标指标)的标识符 | ```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"
]
}
``` | 将来源合并为类别(目标类别)的标识符 |
| 是否在操作后删除源类别选项。默认为假。 | Program notification template | 是否在操作后删除源类别。默认为假。 |
合并操作将把源类别合并到目标类别中。可以指定一个或多个源类别。只能指定一个目标。
合并操作会将所有源类别元数据关联转移到目标类别。
以下元数据将被更新:
| 采取的行动 | 指标组 | 类别选项组合 |
|-------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 删除来源 | 类别 | 类别选项组合 |
| 删除来源 | 类别 | 成员 |
| 删除来源,添加目标 | 周期(pe) | 选项组合 |
| Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | catDimensionConstraints | - 用户有一个或多个源和目标 -> 删除所有源约束<br/> - 用户有一个或多个源,无目标 -> 将一个源更新为目标,删除其他源约束 |
#### 删除源
错误代码
描述
| json(应用项目/ json) | Parameter name |
|------------|--------------------------------------------------------------------------------------|
| E1531 | 必须指定至少一个来源类别 |
| E1532 | 必须指定目标类别 |
| E1533 | 目标类别不能是源类别 |
| 回复{ #response } | 源/目标类别不存在: `{uid}` |
| E1535 | 源类别选项与目标类别选项不匹配 |
| E1536 | 源类别和目标类别不能共享一个类别组合 |
| E1537 | 源类别不能共享类别组合 |
#### 成功响应示例如下
##### ```json
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"response": {
"mergeReport": {
"mergeErrors": [],
"mergeType": "IndicatorType",
"sourcesDeleted": [
"vQ0dGV9EDrw"
],
"message": "IndicatorType merge complete"
}
}
}
``json { "httpStatus":"OK"、 "httpStatusCode":200, "status":"确定"、 "响应":{ "mergeReport":{ "mergeErrors":[], "mergeType":"类别"、 "sourcesDeleted":[ "FbLZS3ueWbQ"、"dPSWsKeAZNw" ], "消息":"类别合并完成" } } }
##### ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source DataElement must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target DataElement does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "DataElement",
"sourcesDeleted": [],
"message": "DataElement merge has errors"
}
}
}
`json { "httpStatus":"冲突"、 "httpStatusCode":409, "status":"WARNING"、 "消息":"发生了一个或多个错误,请查看合并报告中的全部详情。"、 "响应":{ "mergeReport":{ "mergeErrors":[ { "message":"必须指定至少一个源类别"、 "errorCode":"E1530", "args":[] }, { "message":"目标类别不存在:abcdefg1221`"、 "errorCode":"E1533", "args":[ "目标"、 "abcdefg1221" ] } ], "合并类型":"类别"、 "sourcesDeleted":[], "消息":"类别合并有错误" } } }
## 通过类别选项合并端点,可以将多个类别选项(源)合并为一个目标类别选项。
### 授权{ #authorisation }
执行类别选项合并所需的主要权限是 `F_CATEGORY_OPTION_MERGE`。
其他所需的权限涉及类别选项的一般共享和访问,即 `F_CATEGORY_OPTION_PUBLIC_ADD` 和 `F_CATEGORY_OPTION_DELETE`。
#### 请求{ #request }
通过 POST 请求合并类别选项:
#### /api/33/programs/orgUnits?programs={programIdA} 、{programIdB}
JSON 格式的有效载荷如下所示:
```json
{
"sources": [
"FbLZS3ueWbQ",
"dPSWsKeAZNw"
],
"target": "rEq3Hkd3XXH",
"deleteSources": true
}
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |-------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 是的 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 不 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | 合并操作会将所有源类别选项元数据关联转移到目标类别选项。 以下元数据将被更新: |
元数据
财产
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
The status code will be 204 No Content if the data value was successfully saved or updated, or 409 Conflict if there was a validation error (e.g. more than one SHORT_NAME for the same locale). | 类别选项组 | 成员 |
| 删除来源,添加目标 | 类别选项组合 | 成员 |
| 删除来源,添加目标 | 类别选项组 | 成员 |
| 删除来源,添加目标 | 组织单位 | 成员 |
| DataElementCategory | 类别选项组 | 成员 |
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定目标类别选项 |
| E1532 | 目标类别选项不能是源类别选项 |
| E1533 | 源/目标类别选项不存在: {uid} |
| 回复{ #response } | 成功{ #success } |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
错误响应示例如下
##### ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source DataElement must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target DataElement does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "DataElement",
"sourcesDeleted": [],
"message": "DataElement merge has errors"
}
}
}
进口验证{ #category_option_combo_import_validation }
CategoryOptionCombos are unique in that they are auto-generated by the system, most of the time (imports are allowed with specific expectations, mentioned below). They are generated based on their category model:CategoryOptionCategory (has category options) - CategoryCombo (has categories) - 将为 Category``CategoryOption 的每个组合创建一个 CategoryOptionCombo。 - 生成的 CategoryOptionCombo 示例{ #gen_category_option_combo_example }
有 1 个 CategoryCombo [CC1]
Category has 2 CategoryOptions C1=[CO1, CO2], C2=[CO3, CO4]CategoryOptionCombos 将产生 4 个 CategoryOptionCombos: CategoryOptionCombos 时,理解这一点非常重要。导入 CategoryOptionCombos 时会执行验证,以确保提供的 CategoryOptionCombos 集与预期生成的 CategoryOptionCombos 集一致。这是为了确保不会有无效的状态/关系进入系统,从而防止出现各种问题(孤儿数据、数据库中未在 API 中公开的隐藏关系等)。Note
This validation is performed using the
UIDs of theCategoryOptionCombos. No otheridSchemeis supported.
合并类别选项组合{ #category_option_combo_merge }
类别选项组合合并端点允许你将一些类别选项(源)合并到一个目标类别选项中。这可用于清理系统,例如删除重复内容。
只能合并重复的类别选项组合。有关这方面的更多信息,请参阅下面的验证部分。
授权{ #authorisation } 执行类别选项组合合并所需的主要权限是 F_CATEGORY_OPTION_COMBO_MERGE。
通过 POST 请求合并类别选项组合:
JSON 格式的有效载荷如下所示:
{
"sources": [
"FbLZS3ueWbQ",
"dPSWsKeAZNw"
],
"target": "rEq3Hkd3XXH",
"dataMergeStrategy": "DISCARD"
}
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |-------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 是的 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 是的 | | 如何处理数据值的合并。选项有 "DISCARD "或 "LAST_UPDATED"。DISCARD 将删除所有源数据值。LAST_UPDATED 会合并所有数据值,并在出现重复时使用最后更新的值。 | 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" ] } | 合并操作将把所有源类别选项组合元数据关联转移到目标类别选项组合。 |
注
在合并过程中,所有源类别选项组合都会被删除。这是因为在处理完所有源引用后,会留下空的类别选项组合。系统认为这些选项组合无效。
更新以下元数据
元数据
财产
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
| 删除来源 | 类别组合 | 类别选项组合 |
| 删除来源 | 数据元素操作数 | 类别选项组合 |
| 设定为目标 | 数据值审计 | 表情 |
| 设定为目标 | 表达 | 表情 |
| 以目标取代源 | 指示符 | 选项组合 |
| 对于组织单位维度,您可以指定组织 | 指示符 | 选项组合 |
| 对于组织单位维度,您可以指定组织 | 最小最大数据元素 | 选项组合 |
| 设定为目标 | 预测变量 | 表情 |
| 选项 | SMSCode | 表情 |
| 设定为目标 | 类别标识 | 表情 |
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
| 根据合并策略(DISCARD / LAST_UPDATED)进行操作。DISCARD 将删除所有源数据值。LAST_UPDATED 将使用最后更新的数据值(如果存在多个数据值)。 | 数据值审计 | 属性选项组合 |
| 根据合并策略(DISCARD / LAST_UPDATED)进行操作。DISCARD 将删除所有源数据值。LAST_UPDATED 将使用最后更新的数据值(如果存在多个数据值)。 | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 | |
| 合并策略(DISCARD 或 LAST_UPDATED) | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 | |
| DISCARD 或离开,取决于是否删除信息源 | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 | |
| 合并策略(DISCARD 或 LAST_UPDATED) | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 | |
| DISCARD 或离开,取决于是否删除信息源 | 数据值审计 | 属性选项组合 |
| DISCARD 或离开,取决于是否删除信息源 | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 | |
| 合并策略(DISCARD 或 LAST_UPDATED) | > 注 | |
| > | ||
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | ||
| > | ||
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | ||
| > | ||
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 属性选项组合 |
适用以下限制和错误代码。其中一个主要验证点是关于重复的 CategoryOptionCombos。 一个重复的 CategoryOptionCombo 就是一个满足条件的 CategoryOptionCombo:
具有相同的类别选项 - 有不同的 UID - 表:限制条件和错误代码 - 错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定目标 CategoryOptionCombo |
| E1532 | 目标 CategoryOptionCombo 不能是源 CategoryOptionCombo |
| E1533 | 源/目标 CategoryOptionCombo 不存在: {uid} |
| 回复{ #response } | 必须指定 dataMergeStrategy 字段。值为 DISCARD 或 LAST_UPDATED 时 |
| 数据库约束{ #database-constraints } | 类别选项组合必须重复(相同的类别组合、相同的类别选项、不同的 UID)才能合并 |
| 数据库约束{ #database-constraints } | 有一些独特的制约因素可能会妨碍成功合并。这些限制由 DHIS2 设置,以维持一个逻辑域模型。 |
| 以下是撰写本文时已知的数据库唯一键约束列表。例如 | |
| 只能有 1 个具有相同组织单位、数据元素和类别选项组合的最大最小数据元素。 |
表格
唯一键约束
| 最小数据元素 | orgunit, dataelement, categoryoptioncombo |
|---|---|
| 计划阶段 | 项目阶段、数据元素 |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
错误响应示例如下
##### ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source DataElement must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target DataElement does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "DataElement",
"sourcesDeleted": [],
"message": "DataElement merge has errors"
}
}
}
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "ERROR: duplicate key value violates unique constraint \"minmaxdataelement_unique_key\"\n Detail: Key (sourceid, dataelementid, categoryoptioncomboid)=(193236, 1148617, 167661) already exists."
}
数据元素 { #data-elements }
本节介绍指标和指标表达式。
类别组合合并端点允许您将多个类别组合(源)合并为一个目标类别组合。
注
类别组合只有在以下情况下才能合并:
源类别组合和目标类别组合具有相同的类别
属于所涉类别组合的所有类别选项组合都是有效的(选项数量正确,选项成员有效)
所涉及的类别组合中不存在重复的类别选项组合这些约束条件确保只有等同的类别组合才能被合并,并有助于维护系统的完整性。
警告
类别组合合并会产生重复的类别选项组合。在类别组合合并后,应立即合并这些组合,以保持系统的完整性。可以使用数据完整性检查 "category_option_combos_have_duplicates "发现重复。
执行类别组合合并所需的主要权限是 F_CATEGORY_COMBO_MERGE。
通过 POST 请求合并类别组合:
POST /api/categoryCombos/merge
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |---------------|----------|------------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 要合并的类别组合(源类别组合)的标识符数组 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 将来源合并为类别组合(目标类别组合)的标识符 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | 是否在操作后删除源类别组合。默认为假。 |
合并操作将把源类别组合合并到目标类别组合中。可以指定一个或多个源类别组合。只能指定一个目标。
合并操作会将所有源类别组合元数据关联转移到目标类别组合。 以下元数据将被更新:
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
The status code will be 204 No Content if the data value was successfully saved or updated, or 409 Conflict if there was a validation error (e.g. more than one SHORT_NAME for the same locale). | 类别组合 | 类别选项组合 |
| 删除来源,添加目标 | 类别组合 | 表情 |
| Property name | 类别组合 | 表情 |
| 设定为目标 | 类别组合 | 表情 |
| DataElementGroup | 类别组合 | 表情 |
| IndicatorGroup | 类别组合 | 表情 |
| IndicatorGroup | 注册类别组合 | 表情 |
| 以目标取代源 | 类别组合 | 表情 |
| 以目标取代源 | 属性类别组合 | 表情 |
| 数据审批工作流程 | 类别组合 | 表情 |
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定至少一个源 CategoryCombo |
| E1532 | 必须指定目标类别组合 |
| E1533 | 目标分类组合不能是源分类组合 |
| 回复{ #response } | 源/目标 CategoryCombo 不存在: {uid} |
| E1545 | 源和目标类别组合必须具有相同的类别:源 {uid} 具有 {categories} |
| E1546 | CategoryOptionCombo 的 CategoryOptions 数量不正确。本应是 {n},但发现 {m} 的 COC: {uid}。 |
| E1547 | CategoryOptionCombo 具有对 CategoryCombo 类别无效的 CategoryOptions:{uid} |
| E1548 | 为 CategoryCombo {uid} 找到重复的 CategoryOptionCombo {uid}。请在尝试合并前修复此问题。 |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
``json
{
"httpStatus":"OK"、
"httpStatusCode":200,
"status":"确定"、
"响应":{
"mergeReport":{
"mergeErrors":[],
"mergeType":"CategoryCombo"、
"sourcesDeleted":[
"FbLZS3ueWbQ"、"dPSWsKeAZNw"
],
"消息":"类别组合合并完成。合并后会出现重复的 CategoryOptionCombos。应立即合并,以保持系统完整性。可以使用数据完整性检查 "category_option_combos_have_duplicates "发现重复。
}
}
}
{ "httpStatus": "Conflict", "httpStatusCode": 409, "status": "WARNING", "message": "One or more errors occurred, please see full details in merge report.", "response": { "mergeReport": { "mergeErrors": [ { "message": "At least one source DataElement must be specified", "errorCode": "E1530", "args": [] }, { "message": "Target DataElement does not exist: abcdefg1221", "errorCode": "E1533", "args": [ "Target", "abcdefg1221" ] } ], "mergeType": "DataElement", "sourcesDeleted": [], "message": "DataElement merge has errors" } } }
数据库约束样本错误响应:
``json
{
"httpStatus":"冲突"、
"httpStatusCode":409,
"status":"WARNING"、
"消息":"发生了一个或多个错误,请查看合并报告中的全部详情。"、
"响应":{
"mergeReport":{
"mergeErrors":[
{
"message":"必须指定至少一个源 CategoryCombo"、
"errorCode":"E1530",
"args":[]
},
{
"message":"目标 CategoryCombo 不存在:`abcdefg1221`"、
"errorCode":"E1533",
"args":[
"目标"、
"abcdefg1221"
]
}
],
"合并类型":"CategoryCombo"、
"sourcesDeleted":[],
"信息":"类别组合合并有错误
}
}
}
合并 DataElements 时应格外小心。特别注意 应特别注意合并涉及数据元素引用的数据值。 合并。在执行合并之前,应充分了解合并的潜在副作用。 合并。数据元素的合并具有深远的影响。以下信息 数据元素合并的内容。数据元素合并 涉及系统的所有主要部分(元数据、数据、跟踪器、分析和审计)。
如果源 DataElements 与大量数据/审计记录链接,系统性能可能会受到影响。
授权{ #authorisation }
执行数据元素合并所需的主要权限是 F_DATA_ELEMENT_MERGE。
所需的其他权限涉及数据元素的一般共享和访问,即 F_DATAELEMENT_PUBLIC_ADD 和 F_DATAELEMENT_DELETE。
通过 POST 请求合并数据元素:
JSON 格式的有效载荷如下所示:
{
"sources": [
"jNb63DIHuwU",
"WAjjFMDJKcx"
],
"target": "V9rfpjwHbYg",
"deleteSources": true,
"dataMergeStrategy": "DISCARD"
}
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |-------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 是的 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 不 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | 是的 | | 如何处理数据值的合并。选项有 "DISCARD "或 "LAST_UPDATED"。DISCARD 将删除所有源数据值。LAST_UPDATED 会合并所有数据值,并在出现重复时使用最后更新的值。 | 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" ] } | 合并操作将把所有源类别选项组合元数据关联转移到目标类别选项组合。 |
元数据
物业
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 项目阶段数据元素 | 数据元素 |
| 删除来源,添加目标 | 最小最大数据元素 | 数据元素 |
| 项目 | 项目规则变量 | 数据元素 |
| Points to note { #points-to-note } | 最小最大数据元素 | 数据元素 |
| fromToName, toFromName | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 选项 | 数据集元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 设定为目标 | 最小最大数据元素 | 数据元素 |
| 删除来源,添加目标 | 数据元素组 | 成员 |
| 删除源指标,增加目标指标 | 数据元素组 | 成员 |
| 删除来源,添加目标 | 组织单位 | 成员 |
| 合并策略(DISCARD 或 LAST_UPDATED) | 数据值 | 成员 |
| 对于组织单位维度,您可以指定组织 | 指示符 | 选项组合 |
| 对于组织单位维度,您可以指定组织 | 最小最大数据元素 | 选项组合 |
| 选项 | 预测变量 | 选项组合 |
| 选项 | 数据条目表格 | 选项组合 |
| 以目标取代源 | 计划指示器 | 选项组合 |
| 以目标取代源 | 指示符 | 选项组合 |
| 以目标取代源 | 数据值 | 选项组合 |
| 根据合并策略(DISCARD / LAST_UPDATED)进行操作。DISCARD 将删除所有源数据值。LAST_UPDATED 将使用最后更新的数据值(如果存在多个数据值)。 | 最小最大数据元素 |
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
| 合并策略(DISCARD 或 LAST_UPDATED) | 数据值 | 数据元素 |
| 根据合并策略(DISCARD / LAST_UPDATED)进行操作。DISCARD 将删除所有源数据值。LAST_UPDATED 将使用最后更新的数据值(如果存在多个数据值)。 | 最小最大数据元素 | 如果要删除信息源,则删除,否则不做任何操作。 |
| 数据值审计 | 适用以下限制条件和错误代码。 | |
| DISCARD 或离开,取决于是否删除信息源 | 适用以下限制条件和错误代码。 |
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定目标数据元素 |
| E1532 | 目标数据元素不能是源指示符 |
| E1533 | 源/目标数据元素不存在: {uid} |
| 回复{ #response } | All source ValueTypes must match target ValueType: ValueType. Other ValueTypes found: ValueType |
| E1551 | 所有源 DataElementDomain 必须与目标 DataElementDomain 匹配:DataElementDomain。找到的其他 DataElementDomain:DataElementDomain。 |
| E1534 | 必须指定 dataMergeStrategy 字段。值为 DISCARD 或 LAST_UPDATED 时 |
| 数据库约束{ #database-constraints } | 类别选项组合必须重复(相同的类别组合、相同的类别选项、不同的 UID)才能合并 |
表格
唯一键约束
| 最小数据元素 | orgunit, dataelement, categoryoptioncombo |
|---|---|
| 计划阶段 | 项目阶段、数据元素 |
| 数据元素 | 数据集、数据元素 |
| 回复{ #response } | 成功{ #success } |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
错误响应示例如下
##### ```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source DataElement must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target DataElement does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "DataElement",
"sourcesDeleted": [],
"message": "DataElement merge has errors"
}
}
}
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "All source ValueTypes must match target ValueType: `TEXT`. Other ValueTypes found: `NUMBER`",
"errorCode": "E1550",
"args": []
}
],
"mergeType": "DataElement",
"sourcesDeleted": [],
"message": "DataElement merge has errors"
}
}
}
数据库约束样本错误响应:
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "ERROR: duplicate key value violates unique constraint \"minmaxdataelement_unique_key\"\n Detail: Key (sourceid, dataelementid, categoryoptioncomboid)=(193236, 1148617, 167661) already exists."
}
数据元素 { #data-elements }
本节介绍指标和指标表达式。
要检索指标,您可以向指标发出 GET 请求 像这样的资源:
指标表示可以计算和呈现的表达式 因此。指标表达式分为分子和 分母。分子和分母是数学的 可以包含对数据元素、其他指标、常量和 组织单位组。变量将替换为数据 使用时的值,例如在报告中。允许的变量 表达式在下表中描述。
表:指标变量
变量
目的
| #{<programstage-id>.<dataelement-id>} | UID \ | Parameter name |
|---|---|---|
| 指集合数据元素和类别选项组合的组合。类别和属性选项组合 id 都是可选的,可以使用通配符"*"来表示任何值。 | Syntax | 类别 选项组 |
| 指一个综合数据元素和一个类别选项组,包含多个类别选项组合。 | #{<data-element-id>} | 汇总数据元素 |
| 指所有类别选项组合中的聚合数据元素的总值。 | D{<program-id>.<data-element-id>} | 项目数据元素 |
| 引用项目中跟踪器数据元素的值。 | IN_GROUP-<indicatorgroup-id> | 指所有类别选项组合中的聚合数据元素的总值。 |
| 指项目中被跟踪实体属性的值。 | I{<program-indicator-id>} | 计划指标 |
| 指项目指示器的值。 | <dataelement-id> | 引用项目中跟踪器数据元素的值。 |
| 指报告率指标。指标可以是REPORTING_RATE,REPORTING_RATE_ON_TIME,ACTUAL_REPORTS,ACTUAL_REPORTS_ON_TIME,EXPECTED_REPORTS。 | C{<constant-id>} | 指项目中被跟踪实体属性的值。 |
| 指恒定值。 | N{<indicator-id>} | 指示符 |
| 指现有指标。 | 对于组织单位维度,您可以指定组织 | 组织单位组 |
| 指组织单位组内组织单位的数量。 | Category combination | 项目 |
值
| 响应示例: | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | Parameter name | |---|---|---| | 数据元素组中的所有汇总数据元素 | 数据元素组中的所有汇总数据元素 | deGroup:data-element-group-id | | 数据元素组中的所有汇总数据元素 | 类别-选项-组合-id | 类别-选项-组合-id | | 类别选项组合 | 类别选项组合 | co:category-option-id | | 类别选项组合 | 类别-选项-组合-id | coGroup:category-option-group-id | | 类别选项组合 | 类别-选项-组合-id | coGroup:co-group-id1&co-group-id2... | | 类别选项组合 | 语法看起来像 这: | #{
一个相应的例子看起来像 这:
请注意,对于数据元素变量,类别选项组合 标识符可以省略。该变量将代表总数 对于数据元素,例如在所有类别选项组合中。例子:
数据元素操作数可以包括任何类别选项组合和 属性选项组合,并使用通配符表示任何 价值:
#{P3jJH5Tu5VC.S34ULMcHMca} + #{P3jJH5Tu5VC.*.j8vBiBqGf6O} + #{P3jJH5Tu5VC.S34ULMcHMca.*}
使用数据元素组的示例
#{deGroup:oDkJh5Ddh7d}+ #{deGroup:GBHN1a1Jddh.j8vBiBqGf6O}
使用类别选项、数据元素组和类别选项组的示例:
#{P3jJH5Tu5VC.co:FbLZS3ueWbQ}+ #{deGroup:GBHN1a1Jddh.coGroup:OK2Nr4wdfrZ.j8vBiBqGf6O}
使用多个类别选项组的示例:
#{P3jJH5Tu5VC.coGroup:OK2Nr4wdfrZ&j3C417uW6J7&ddAo6zmIHOk}
使用项目数据元素和项目属性的示例:
(D {eBAyeGv0exc.vV9UWAZohSf} * A {IpHINAT79UW.cejWyOfXge6})/ D {eBAyeGv0exc.GieVkTxp4HH}
结合计划指标和综合指标的示例:
I {EMOt6Fwhs1n} * 1000 /#{WUg3MYWQ7pt}
以报告率为例:
R {BfMAe6Itzgt.REPORTING_RATE} *#{P3jJH5Tu5VC.S34ULMcHMca}
另一个使用实际数据集报告和预期报告的报告率示例:
R {BfMAe6Itzgt.ACTUAL_REPORTS} / R {BfMAe6Itzgt.EXPECTED_REPORTS}
使用现有指标的示例
N {Rigf2d2Zbjp} *#{P3jJH5Tu5VC.S34ULMcHMca}
表达式可以是任何类型的有效数学表达式,作为 例子:
(2 *#{P3jJH5Tu5VC.S34ULMcHMca})/(#{FQ2o8UBlcrS.S34ULMcHMca}-200)* 25
计划指标 { #webapi_program_indicators }
要检索项目指标,您可以向项目发出 GET 请求 像这样的指标资源:
项目指示器可以包含在项目中收集的信息。 指标有一个表达式,可以包含对数据的引用 元素、属性、常量和项目变量。变量 下表中描述了允许在表达式中使用。
表:计划指标变量
变量
描述
| #{<programstage-id>.<dataelement-id>} | Parameter name |
|---|---|
| A{<attribute-id>} | 指跟踪的实体属性。 |
| V{<variable-id>} | 指项目变量。 |
| C{<constant-id>} | 指一个常数。 |
| 指恒定值。 | #{ |
一个相应的例子看起来像 这:
#{A03MvHHogjR.a3kGcGDCuk6} + A{OvY4VVhSDeJ} + V{incident_date} + C{bCqvfPR02Im}
表达方式 { #webapi_expressions }
表达式是数学公式,可以包含对 数据元素、常量和组织单元组。验证和 获取表达式的文本描述,您可以发出 GET 请求 到表达式资源:
响应遵循标准的 JSON Web 消息格式。 状态 属性表示验证的结果,如果 成功和“错误”如果失败。 message 属性将为“有效” 如果成功并提供原因的文字描述 如果不是,则验证失败。 *描述*提供了文字说明 表达式的描述。
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Valid",
"description": "Acute Flaccid Paralysis"
}
合并指标{ #webapi_indicator_merge }
通过指标合并端点,可以将多个指标(源)合并为一个目标指标。
执行指标合并需要使用权限 F_INDICATOR_MERGE。
通过 POST 请求合并指标:
JSON 格式的有效载荷如下所示:
{
"sources": [
"jNb63DIHuwU",
"WAjjFMDJKcx"
],
"target": "V9rfpjwHbYg",
"deleteSources": true
}
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |---------------|----------|-------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 是的 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 不 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | 合并操作将把所有源指标元数据关联转移到目标指标。 以下元数据将被更新: |
元数据
物业
| 采取的行动 | 指标组 | 类别选项组合 |
|---|---|---|
| 删除源指标,增加目标指标 | 组织单位 | 基础设施指标(指标组) |
| DataElementGroup | 组态 | 基础设施指标(指标组) |
| 任何有来源的链接数据项都将与目标数据项链接 | 部门 | 指标 |
| 删除源指标,增加目标指标 | 组态 | 基础设施指标(指标组) |
| The reference is present and not null in the payload. | 指示符 | 基础设施指标(指标组) |
| 对于组织单位维度,您可以指定组织 | 数据条目表格 | htmlCode |
| 以目标取代源 | 计划指示器 | htmlCode |
| 将任何源引用替换为目标引用作为排序维度 | 验证{ #validation } | 适用以下限制条件和错误代码。 |
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定目标指标 |
| E1532 | 目标指标不能是源指标 |
| E1533 | 源/目标指标不存在: {uid} |
| 回复{ #response } | 成功{ #success } |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source Indicator must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target Indicator does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "Indicator",
"sourcesDeleted": [],
"message": "Indicator merge has errors"
}
}
}
数据库约束样本错误响应:
合并指标类型 { #webapi_indicator_type_merge}
执行指示符类型合并需要使用权限 F_INDICATOR_TYPE_MERGE。
通过 POST 请求合并指标类型:
JSON 格式的有效载荷如下所示:
{
"sources": [
"jNb63DIHuwU",
"WAjjFMDJKcx"
],
"target": "V9rfpjwHbYg",
"deleteSources": true
}
下表描述了 JSON 属性。
表格合并有效载荷字段
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | |---------------|----------|-----------------------------------------------------------------------------------------| | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 是的 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 不 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | 合并操作将把源指标类型的所有指标元数据关联转移到目标指标类型。 |
验证{ #validation }
适用以下限制条件和错误代码。
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| E1531 | 必须指定目标指标类型 |
| E1532 | 目标指标类型不能是源指标类型 |
| E1533 | 源/目标指标类型不存在: {uid} |
| 回复{ #response } | 成功{ #success } |
{ "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "mergeReport": { "mergeErrors": [], "mergeType": "IndicatorType", "sourcesDeleted": [ "vQ0dGV9EDrw" ], "message": "IndicatorType merge complete" } } }
错误响应示例如下
```json
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "WARNING",
"message": "One or more errors occurred, please see full details in merge report.",
"response": {
"mergeReport": {
"mergeErrors": [
{
"message": "At least one source IndicatorType must be specified",
"errorCode": "E1530",
"args": []
},
{
"message": "Target IndicatorType does not exist: `abcdefg1221`",
"errorCode": "E1533",
"args": [
"Target",
"abcdefg1221"
]
}
],
"mergeType": "IndicatorType",
"sourcesDeleted": [],
"message": "IndicatorType merge has errors"
}
}
}
数据库约束样本错误响应:
organisationUnits 资源遵循标准约定,如 DHIS2 中的其他元数据资源。该资源支持一些 附加查询参数。
要获取组织单位的列表,可以使用以下资源。
表:组织单位查询参数
查询参数
选项
| eventCreatedPeriod | 用户设置 { #webapi_user_settings } | Parameter name |
|---|---|---|
| 真 | 假 | 仅 userDataView |
| 假 | 假 | 数据视图组织单位只与当前用户相关。 |
| userDataViewFallback | 假 | 真 |
| 仅与当前用户相关联的数据视图组织单位,可退回到数据采集组织单位。 | 不区分大小写的字符串结尾匹配 | 字符串 |
| 查询名称、代码和 ID 属性。 | 查询参数 | 整数 |
| 层次结构中指定级别的组织单位。 | 查询参数 | 整数 |
| 在给定的最大级别或更高级别上的组织单位。 | 假 | 假 |
| 真 | 假 | withinUserSearchHierarchy |
| 假 | 不区分大小写的字符串结尾匹配 | 将搜索和检索限制在当前用户搜索范围内的组织单位。注意:"in withinUserHierarchy"(如果为 true)优先级更高。 |
| 会员收藏 | 串 | 对于显示集合内成员的计数,指的是与组织单位相关联的集合名称。 |
用户标识
用于显示集合中成员的计数,指集合对象成员的标识符。
获取带有子层次结构的组织单位{ #webapi_organisation_units_with_sub_hierarchy }
| eventCreatedPeriod | 用户设置 { #webapi_user_settings } | Parameter name |
|---|---|---|
| 查询参数 | 假 | 描述 |
| 包括儿童 | 假 | 真 |
| 包括指定组织单位的直属子单位,即子层次结构中下一级的直属单位。 | 假 | 假 |
| 查询名称、代码和 ID 属性。 | 查询参数 | 包括祖先 |
真
包括指定组织单位的所有家长。
夷为平地
整数
包括子层次结构中指定级别的指定组织单位的子机构。这是相对于组织单位而言的,从 1 开始为紧接组织单位之下的层级。
专门用于检索类别选项与组织单位之间关联的端点。该端点是检索项目组织单位关联的首选方式。
/api/33/categoryOptions/orgUnits?categoryOptions={categoryOptionIdA} 、{categoryOptionIdB}
夷为平地
{
"<categoryOptionIdA>": [
"<orgUnitUid>",
"<orgUnitUid>"
],
"<categoryOptionIdB>": [
"<orgUnitUid>",
"<orgUnitUid>"
],
"<categoryOptionIdC>": []
}
所有组织单位都能访问的类别选项会以组织单位的空数组([])返回。
专用端点,用于检索项目与组织单位之间的关联。该端点是检索项目与组织单位关联的首选方式。
答复的格式如下
{
"<programIdA>": [
"<orgUnitUid>",
"<orgUnitUid>"
],
"<programIdB>": [
"<orgUnitUid>",
"<orgUnitUid>"
],
"<programIdC>": []
}
下表描述了 JSON 属性。
分体式组织单位{ #webapi_organisation_unit_split }
领域
请求{ #request }
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | | ------------- | -------- |------ | | json { "source": "rspjJHg4WY1", "targets": [ "HT0w9YLMLyn", "rEpnzuNpRKM" ], "primaryTarget": "HT0w9YLMLyn", "deleteSource": true } | 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" ] } | 表格分割有效载荷字段 | | 领域 | 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" ] } | 值 | | 消息来源 | Program notification template | 要拆分的组织单位(源组织单位)的标识符。 | | 目标 | Program notification template | 要将源代码分割成的组织单位(目标组织单位)的标识符数组。 |
主要目标
不
要将与源相关的汇总数据、事件和跟踪实体转移到的组织单位的标识符。如果未指定,将使用第一个目标。
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
| 该操作将把源组织单位的所有数据记录转移到指定为主要目标的组织单位,如果没有指定,则转移到第一个指定的目标组织单位。这包括汇总数据值、数据批准记录、事件、跟踪实体等。 | 验证{ #validation } |
| 适用以下限制条件和错误代码。 | 表:限制条件和错误代码 |
| 错误代码 | 描述 |
| E1510 | 必须指定来源网络单位 |
| E1511 | 必须指定至少两个目标组织单位 |
| E1512 | 源组织单位不能是目标组织单位 |
必须指定主要目标
主要目标必须是目标组织单位
目标组织单位不存在
合并组织单位 { #webapi_organisation_unit_merge}
下表描述了 JSON 属性。
授权{ #authorisation }
领域
需要
| 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: | 检索和删除项目通知模板 | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | | ------------------------- | -------- | ----- | | 要合并的类别选项(源类别选项)的标识符数组 | 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" ] } | 表格合并有效载荷字段 | | 将来源合并为指标(目标指标)的标识符 | 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" ] } | 值 | | 资源 | Program notification template | 要合并的组织单位(源组织单位)的标识符数组。 | | 目标 | Program notification template | 要将数据源合并到的组织单位(目标组织单位)的标识符。 | | 是否在操作后删除源类别选项。默认为假。 | Program notification template | Strategy for merging data values. Options: LAST_UPDATED (default), DISCARD. |
数据审批合并策略
不
Strategy for merging data approval records. Options: LAST_UPDATED (default), DISCARD.
错误代码
描述
| json(应用项目/ json) | Parameter name |
|---|---|
指定的数据值合并策略定义了如何处理数据值。对于LAST_UPDATED策略,所有源组织单位的数据值都将转移到目标组织单位,并且在相同参数存在数据值的情况下,将使用最后更新或创建的数据值。这样做是为了避免数据重复。对于DISCARD策略,数据值不会转移到目标组织单位,而是简单地删除。指定的数据审批合并策略定义了数据审批记录的处理方式,并遵循与数据值相同的逻辑。 | 验证{ #validation } |
| 适用以下限制条件和错误代码。 | 表:限制条件和错误代码 |
| 错误代码 | 描述 |
| E1500 | 必须指定至少两个来源组织单位 |
必须指定目标组织单位
E1502
目标组织单位不能是源组织单位
E1503
源机构单位不存在
数据集 { #webapi_data_sets }
DHIS2 中的元数据资源。此资源支持一些额外的 查询参数。
/ api / 33 / dataSets
要检索数据集的版本,您可以发出GET请求:
GET /api/33/dataSets/<uid>/version
要提高(增加一个)数据集的版本,您可以发出 POST 要求:
POST / api / 33 / dataSets / <uid> / version
数据集通知模板{ #webapi_dataset_notifications }
*数据集通知模板*资源遵循标准 DHIS2 中其他元数据资源的约定。
GET /api/33/dataSetNotficationTemplates
要检索数据集通知模板,您可以发出GET请求:
GET /api/33/dataSetNotficationTemplates/<uid>
要添加数据集通知模板,您可以发出POST请求: - POST / api / 33 / dataSetNotficationTemplates - 要删除数据集通知模板,您可以发出DELETE请求:
JSON有效负载示例如下:
{
"name": "dataSetNotificationTemplate1",
"dataSetNotificationTrigger": "DATA_SET_COMPLETION",
"relativeScheduledDays": 0,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"dataSets": [{
"id": "eZDhcZi6FLP"
}],
"deliveryChannels": ["SMS","EMAIL"],
"subjectTemplate": "V{data_set_name}",
"messageTemplate": "V{data_set_name}V{registration_period}",
"sendStrategy": "SINGLE_NOTIFICATION"
}
notificationRecipient can be one of:
USER_GROUP for internal messages
ORGANISATION_UNIT_CONTACT for external messages填充的组织单位级别 { #webapi_filled_organisation_unit_levels }
fillOrganisationUnitLevels 资源提供了一个有序的列表 组织单元级别,其中生成的级别被注入到 列表以填充不存在持久级别的位置。
GET /api/33/filledOrganisationUnitLevels
内容类型为 application/json 的 POST 请求:
{
"organisationUnitLevels": [{
"name": "National",
"level": 1,
"offlineLevels": 3
}, {
"name": "District",
"level": 2
}, {
"name": "Chiefdom",
"level": 3
}, {
"name": "Facility",
"level": 4
}]
}
预测变量 { #webapi_predictors }
预测器允许您根据表达式生成数据值。 这可以用于例如生成目标、阈值、 或估计值。
要检索预测器,您可以向预测器发出 GET 请求 像这样的资源:
/ api / predictors
您可以使用对预测器的 POST 请求创建预测器 资源:
POST / api / predictors
| #{<programstage-id>.<dataelement-id>} | UID \ | Parameter name |
|---|---|---|
| 预测表达式 { #webapi_predictor_expressions } | D{<program-id>.<data-element-id>} | 项目数据元素 |
| 变量 | Syntax | 描述 |
| #{ | IN_GROUP-<indicatorgroup-id> | 指所有类别选项组合中的聚合数据元素的总值。 |
| #{ | I{<program-indicator-id>} | 计划指标 |
| D{ | <dataelement-id> | 引用项目中跟踪器数据元素的值。 |
| A{ | C{<constant-id>} | 指项目中被跟踪实体属性的值。 |
| I{ | N{<indicator-id>} | 指示符 |
| R{ | Category combination | 项目 |
| C{ | 不变 | 指恒定值。 |
组织单位组
指组织单位组内组织单位的数量。
[天]
天数
生成预测值 { #webapi_generating_predicted_values }
要运行所有预测器(生成预测值),您可以进行 POST 请求运行资源:
要运行单个预测器,您可以向运行发出 POST 请求 预测器的资源:
POST / api / predictors / AG10KUJCrRk / run
计划{ #webapi_programs }
要检索项目,可以像这样向项目资源发出 GET 请求:
/api/programs
项目类别映射{ #webapi_program_category_mappings }
从 2.42 版开始,项目可选择定义一个或多个类别映射。 这些映射可用于为该计划的计划指标添加分类。 该计划的计划指标可以选择在其类别组合和/或属性组合中使用哪种映射。 类别组合和/或属性组合中的类别。
这样就可以按类别和类别选项查看计划指标数据 例如在数据展示台中。 它还允许聚合数据交换从计划指标中生成包含类别选项组合和/或属性选项组合的值。 生成包含类别选项组合和/或属性选项组合的值。 - 这些类别映射可由维护(预览)应用项目生成 生成,也可以使用 Web API 添加。 如果使用 Web API,本节将介绍类别映射的格式。 - 新项目没有类别映射。 在网络应用项目接口中,这看起来像 - ```json "categoryMappings": []
要在项目中添加类别映射,可编辑项目定义的这一部分,然后将结果导入 DHIS2。
定义,然后将结果导入 DHIS2。
以下是编辑字段的示例:
```json
"categoryMappings": [
{
"id": "goor7Li4See",
"categoryId": "cX5k9anHEHd",
"mappingName": "standard Gender mapping",
"optionMappings": [
{
"optionId": "apsOixVZlf1",
"filter": "#{Zj7UnCAulEk.oZg33kd9taw} == 'Female'"
},
{
"optionId": "jRbMi0aBjYn",
"filter": "#{Zj7UnCAulEk.oZg33kd9taw} == 'Male'"
}
]
},
{
"id": "ESesheeva1i",
"categoryId": "VPqYge5RB93",
"mappingName": "standard Outcome mapping",
"optionMappings": [
{
"optionId": "e3oqm527jBS",
"filter": "#{Zj7UnCAulEk.sAg4Niej9bo} == 'Managed at PHU'"
},
{
"optionId": "rSdQZYDmHJm",
"filter": "#{Zj7UnCAulEk.sAg4Niej9bo} == 'Referred'"
}
]
},
{
"id": "laiHaid9eit",
"categoryId": "fkAkrdC7eJF",
"mappingName": "Referrals Age at event",
"optionMappings": [
{
"optionId": "K4gwuiVvW3z",
"filter": "d2:yearsBetween(#{wYTF0YCHMWr.AZLp9Shoab9},V{event_date})<5"
},
{
"optionId": "oaFqxkefkPs",
"filter": "d2:yearsBetween(#{wYTF0YCHMWr.AZLp9Shoab9},V{event_date})>=5"
}
]
},
{
"id": "SeNg0bohFah",
"categoryId": "fkAkrdC7eJF",
"mappingName": "Referrals Age at analyitcs period start",
"optionMappings": [
{
"optionId": "K4gwuiVvW3z",
"filter": "d2:yearsBetween(#{wYTF0YCHMWr.AZLp9Shoab9},V{analytics_period_start})<5"
},
{
"optionId": "oaFqxkefkPs",
"filter": "d2:yearsBetween(#{wYTF0YCHMWr.AZLp9Shoab9},V{analytics_period_start})>=5"
}
]
}
]
在此示例中,该计划定义了四个类别映射,可用于 的项目指标:
| displayColumnOrder | dataFilters |
|---|---|
Two mappings for the Referrals Age category. A program indicator can choose which mapping | 取决于是否要在事件日期显示年龄 |
| 或分析期开始时的年龄。 | The categoryMappings fields are: |
| 名称 | 描述 |
| 本我 | 唯一标识映射的 11 个字符的 UID。第一个字符必须是大写或小写字母,然后是 10 个字符,每个字符都是大写或小写字母或数字。应选择唯一的 ID。项目指示符选择映射时会使用该 UID。 |
| 类别标识 | 要映射的类别的 UID。在本例中,它们是性别、结果和转介年龄的 UID。 |
| 数据值 | 您为映射指定的名称。如果您为一个类别定义了多个映射,则该名称必须在该项目中该类别的映射中是唯一的。 |
选项映射
这些指定了类别内每个类别选项的过滤器。
optionId
该过滤器适用的类别选项的 UID。
用于该类别选项的筛选器。过滤器的语法必须与项目中项目指示符的过滤器表达式相同。提示: 可以使用维护应用项目生成并验证该过滤器:将其构建为节目中新的或现有节目指示符的过滤器表达式,确保其有效,然后复制并粘贴到元数据中。(你不必保存带有该过滤器的计划指标)。
categoryMappingIds 字段中选择要使用的项目映射。新的项目指示符没有类别映射 id。 在 Web API 中,这看起来像
"categoryMappingIds": [],
You can replace this with the category mappings that you want the program indicator to use. For example, if the program indicator has selected a category combination that combines Gender and Outcome, this field could be edited to contain the mapping ids for these categories such as defined in the above categoryMappings example:
"categoryMappingIds": [ "goor7Li4See", "ESesheeva1i" ],
计划规则 { #webapi_program_rules }
本节是关于发送和读取项目规则,并解释
项目规则数据模型。项目规则赋予功能
在 DHIS2 项目中配置动态行为。
| displayColumnOrder | dataFilters | 表:项目规则操作 |
|---|---|---|
| `{ "periodFrom": -15, "periodTo": 15}` | 下表给出了项目规则的详细概述
模型。 | 表:项目规则操作 |
| displayColumnOrder | 描述 | 表:项目规则操作 |
| dataFilters | 执行项目规则的项目。 | 表:项目规则操作 |
| See an example payload below. | 项目规则显示给 dhis2 配置器的名称。项目最终用户看不到。 | 强制性 |
| 描述 | 项目规则的描述,配置器可用于描述规则。项目的最终用户看不到。| 表:项目规则操作 |
| 项目阶段 | 如果为项目规则设置了项目阶段(programStage),则该规则只能在指定的项目阶段内进行评估。 | 强制性 |
#### 健康)状况
为使项目规则触发其子操作,需要求值为 true 的表达式。表达式使用运算符、函数调用、硬编码值、常量和项目规则变量编写。`d2:hasValue('hemoglobin') && #{hemoglobin} <= 7 `.
强制性
| displayColumnOrder | dataFilters | 表:项目规则操作 |
|---|---|---|
| 计划规则操作模型详细信息 { #program-rule-action-model-details } | 下表给出了对 programRuleAction 的详细概述
模型。 | 表:项目规则操作 |
| 名称 | 描述| 表:项目规则操作 |
| 项目规则 | 该操作的父项目规则。 | 强制性 |
| 项目规则--动作类型 | The type of action that is to be performed.<br> * `DISPLAYTEXT` - Displays a text in a given widget.<br> * `DISPLAYKEYVALUEPAIR` - Displays a key and value pair(like a program indicator) in a given widget.<br> * `HIDEFIELD` - Hide a specified dataElement or trackedEntityAttribute.<br> - *content* - if defined, the text in *content* will be displayed to the end user in the instance where a value is previously entered into a field that is now about to be hidden (and therefore blanked). If *content* is not defined, a standard message will be shown to the user in this instance.<br> - *dataElement* - if defined, the HIDEFIELD action will hide this dataElement when the rule is effective.<br> - *trackedEntityDataValue* - if defined, the HIDEFIELD action will hide this trackedEntityDataValue when the rule is effective.<br> * `HIDESECTION` - Hide a specified section.<br> - *programStageSection* - must be defined. This is the programStageSection that will be hidden in case the parent rule is effective.<br> * `ASSIGN` - Assign a value to either a dataElement or trackedEntityAttribute or a ProgramRuleVariable. Intended to help the user calculate something or fill in an obvious value somewhere.<br> - *content* - if defined, the value in *data* is assigned to this variable. If content id defined, and thus a variable is assigned for use in other rules, it is important to also assign a *programRule.priority* to make sure the rule with an ASSIGN action runs before the rule that will in turn evaluate the assigned variable.<br> - *data* - must be defined, data forms an expression that is evaluated and assigned to either a variable(#{myVariable}), a dataElement, or both.<br> - *dataElement* - if defined, the value in *data* is assigned to this data element.<br> Either the content or dataElement must be defined for the ASSIGN action to be effective.<br> * `SHOWWARNING` - Show a warning to the user, not blocking the user from completing the event or registration.<br> - *content* - if defined, content is a static part that is displayed at the end of the error message.<br> - *data* - if defined, data forms an expression that is evaluated and added to the end of the warning message.<br> - *dataElement* - if defined, the warning message is displayed next to this data element.<br> - *trackedEntityAttribute* - if defined, the warning message is displayed next to this tracked entity attribute.<br> Either dataElement or trackedEntityAttribute must be specified.<br> * `SHOWERROR` - Show an error to the user, blocking the user from completing the event or registration.<br> - *content* - if defined, content is a static part that is displayed in the start of the error message.<br> - *data* - if defined, data forms an expression that is evaluated and added to the end of the error message.<br> - *dataElement* - if defined, the error message is linked to this data element.<br> - *trackedEntityAttribute* - if defined, the error message is linked to this tracked entity attribute.<br> Either dataElement or trackedEntityAttribute must be specified.<br> * `WARNINGONCOMPLETE` - Show a warning to the user on the "Complete form" dialog, but allowing the user to complete the event.<br> - *content* - if defined, content is a static part that is displayed at the end of the error message.<br> - *data* - if defined, data forms an expression that is evaluated and added to the end of the warning message.<br> - *dataElement* - if defined, the warning message prefixed with the name/formName of the data element.<br> * `ERRORONCOMPLETE` - Show an error to the user on in a modal window when the user tries to complete the event. The user is prevented from completing the event.<br> - *content* - if defined, content is a static part that is displayed in the start of the error message.<br> - *data* - if defined, data forms an expression that is evaluated and added to the end of the error message.<br> - *dataElement* - if defined, the error message is linked to this data element.<br> * `CREATEEVENT` - Create an event within the same enrollment.<br> - *content*<br> - *data* - if defined, contains data values to assign the created event. The format is <uid\>:<data value\>. Where several values is specified, these are separated with comma.<br> AcMrnleqHqc:100,AqK1IHqCkEE:'Polyhydramnios'<br> - *programStage* - must be defined, and designates the program stage that the rule shall create an event of.<br> * `SETMANDATORYFIELD` - Set a field to be mandatory.<br> - *dataElement* - if defined, this data element will be set to be mandatory in the data entry form.<br> - *trackedEntityAttribute* - if defined, this tracked entity attribute will be set to mandatory in the registration form or profile.<br> * `SENDMESSAGE` - To send message at completion of event/enrollment or at data value update.<br> - *messageTemplate* - if defined, this template will be delivered either as SMS or EMAIL depending upon DeliveryChannel value in message template.<br> * `SCHEDULEMESSAGE` - To schedule message at completion of event/enrollment or at data value update.<br> - *messageTemplate* - if defined, this template will be delivered either as SMS or EMAIL depending upon DeliveryChannel value in message template.<br> - *Date to send message* - Expression which is going to be used for evaluation of scheduled date. This expression should result in Date, any other resultant will be discarded and notification will not get scheduled. <br> * `HIDEPROGRAMSTAGE` - Prevent adding new events to stage. <br> * `HIDEOPTION` - Hide option (from an optionSet). <br> * `HIDEOPTIONGROUP` - Hide option group (hide the options that belong to that option group). <br> * `SHOWOPTIONGROUP` - Show option group (show the options that belong to that option group). | 强制性 |
| 地点 | 用于动作类型 DISPLAYKEYVALUEPAIR 和 DISPLAYTEXT,以指定在哪个部件中显示文本或按键对。必须用于 DISPLAYKEYVALUEPAIR 和 DISPLAYTEXT。 | 强制性 |
| 最小最大数据元素 | 用于不同操作中的用户信息。有关在每种操作类型中如何使用的详细说明,请参阅操作类型概述。SHOWWARNING、SHOWERROR、WARNINGONCOMPLETE、ERRORONCOMPLETE、DISPLAYTEXT 和 DISPLAYKEYVALUEPAIR 必须使用。HIDEFIELD 和 ASSIGN 可选。 | 强制性 |
| 数据 | 用于不同操作中的表达式。有关各操作类型中如何使用该表达式的详细说明,请参阅操作类型概述。ASSIGN 必须使用。SHOWWARNING、SHOWERROR、WARNINGONCOMPLETE、ERRORONCOMPLETE、DISPLAYTEXT、CREATEEVENT 和 DISPLAYKEYVALUEPAIR 可选。 | 强制性 |
| 数据元素 | 用于将规则操作链接到数据元素。有关在每种操作类型中如何使用的详细说明,请参阅操作类型概述。SHOWWARNING、SHOWERROR、WARNINGONCOMPLETE、ERRORONCOMPLETE、ASSIGN 和 HIDEFIELD 的可选项。 | 强制性 |
| 跟踪属性 | 用于将规则操作链接到跟踪实体属性(trackedEntityAttributes)。有关在每种操作类型中如何使用的详细说明,请参阅操作类型概述。SHOWWARNING、SHOWERROR 和 HIDEFIELD 的可选项。 | 强制性 |
| See an example payload below. | 用于将规则操作链接到选项。有关在每种操作类型中如何使用的详细说明,请参阅操作类型概述。HIDEOPTION 的可选项 | 强制性 |
| 选项组 | 用于将规则操作链接到选项组。有关在每种操作类型中如何使用的详细说明,请参阅操作类型概述。SHOWOPTIONGROUP 和 HIDEOPTIONGROUP 必须使用。 | 强制性 |
##### 项目阶段
仅用于 CREATEEVENT 规则操作。必须用于 CREATEEEVENT。
参见说明
| displayColumnOrder | 仅用于 HIDESECTION 规则操作。必须用于 HIDESECTION |
|---|---|
|参见说明| 项目规则行动验证{ #programruleaction-validation } |
|2.37 中为 ProgramRuleAction 模型添加了一些验证。主要目的是防止用户创建错误的项目规则,以保持数据库的一致性。这些验证取决于项目规则动作类型。每种操作类型都有各自的验证。 | 项目规则行动验证{ #programruleaction-validation } |
|名称| 验证检查 ID 是否存在 |
|短信| 通知模板 ID |
|日程消息| 选项 id |
|隐藏| ProgramStage 段落 ID |
|隐藏计划阶段| 数据元素或跟踪实体属性 id |
|希德菲尔德| 数据元素或跟踪实体属性 id |
|隐藏选项| 选项 id |
|隐藏选项组| 选项组 ID |
|显示选项组| 选项组 ID |
|设置必填字段| 选项 id |
|淋浴器||
|始终有效| 选项 id |
|始终有效| 选项 id |
|数据元素或跟踪实体属性 id| 选项 id |
分配
数据元素或跟踪实体属性 id
完成警告
#### 数据元素或跟踪实体属性 id
erroroncomplete
数据元素或跟踪实体属性 id
| displayColumnOrder | dataFilters | 表:项目规则操作 |
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
| displayColumnOrder | 下表详细概述了
项目规则变量模型。 | 表:项目规则操作 |
| 名称 | 描述 | 表:项目规则操作 |
| 名称 | programRuleVariable 的名称 - 该名称用于表达式中。#{myVariable} \> 5 | 表:项目规则操作 |
| 最小最大数据元素 | Defines how this variable is populated with data from the enrollment and events.<br> *DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE - This source type works the same way as DATAELEMENT_NEWEST_EVENT_PROGRAM, except that it only evaluates values from one program stage. This source type can be useful in program rules where the same data element is used in several program stages, and a rule needs to evaluate the newest data value from within one specific stage. In order to know what event is the newest, the report date (event date) is used. If you have many events with the same report date, the system choose the one with the latest `createdAt` property of the event. <br>*DATAELEMENT_NEWEST_EVENT_PROGRAM - This source type is used when a program rule variable needs to reflect the newest known value of a data element, regardless of what event the user currently has open.<br>**NB** Future dates are "newer" than current or past dates.<br>In order to know what event is the newest, the report date (event date) is used. If you have many events with the same report date, the system choose the one with the latest `createdAt` property of the event.<br>*DATAELEMENT_CURRENT_EVENT - Program rule variables with this source type will contain the data value from the same event that the user currently has open. This is the most commonly used source type, especially for skip logic (hide actions) and warning/error rules.<br>*DATAELEMENT_PREVIOUS_EVENT - Program rule variables with this source type will contain the value from a specified data element from a previous event. Only older events is evaluated, not including the event that the user currently has open. This source type is commonly used when a data element only should be collected once during an enrollment, and should be hidden in subsequent events. Another use case is making rules for validating input where there is an expected progression from one event to the next - a rule can evaluate whether the previous value is higher/lower and give a warning if an unexpected value is entered.<br>*CALCULATED_VALUE - Program rule variable with this source type is not connected directly to any form data - but will be populated as a result of some other program rules **ASSIGN** action. This variable will be used for making preliminary calculations, having a **ASSIGN** program rule action and assigning a value, this value can be used by other program rules - potentially making the expressions simpler and more maintainable. These variables will not be persisted and will stay in memory only during the execution of the set of program rules. Any program rule that assigns a data value to a preliminary calculated value would normally also have a **priority** assigned - to make sure that the preliminary caculation is done before the rule that consumes the calculated value.<br>*TEI_ATTRIBUTE - Populates the program rule variable with a specified tracked entity attribute for the current enrollment. Use this is the source type to create program rules that evaluate data values entered during registration. This source type is also useful when you create program rules that compare data in events to data entered during registration. This source type is only used for tracker programs (programs with registration). | 强制性 |
| 数据 | valueType 参数定义此 ProgramRuleVariable 可包含的值的类型。其值取决于 sourceType 参数。如果源是 DataElement 或 TrackedEntityAttribute<br> ,那么 valueType 将从源的 valueType 派生。当 sourceType 为 CALCULATED_VALUE 时,valueType 应由用户提供,否则<br> 将默认为 ValueType.TEXT | 强制性 |
| 数据元素 | 用于将项目规则变量链接到数据元素。必须用于所有以 DATAELEMENT_ 开头的源类型。 | |
| See an example payload below. | 跟踪属性 | 强制性 |
### 参见说明
- useCodeFor- 选项集
如果选中,变量将使用任何链接选项集的代码(而不是名称)。默认值为未选中,即输入选项名称。
项目阶段
用于指定从哪个特定项目阶段获取 programRuleVariable 值。DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE 必须使用。
/ api / programRules
创建项目规则 { #webapi_creating_program_rules }
/ api / programRules
要检索programRules的列表,您可以执行GET请求,如下所示:
/ api / programRules
要检索单个programRule,您可以执行GET请求,如下所示:
/ api / programRules
要保存/添加单个programRule,您可以执行POST请求,如下所示:
/ api / programRules / <program_rule_uid>
## 要更新单个programRule,您可以执行如下PUT请求:
/ api / programRules / <program_rule_uid>
要删除单个programRule,您可以执行以下DELETE请求:
| 默认值 | Validation rule | Parameter name |
|---|---|---|
| E7228 | To retrieve information about a form (which corresponds to a data set
and its sections) you can interact with the `form` resource. The form
response is accessible as XML and JSON and will provide information
about each section (group) in the form as well as each field in the
sections, including labels and identifiers. By supplying period and
organisation unit identifiers the form response will be populated with
data values. | 表格表单查询参数 |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 串 | 描述 |
| 聚乙烯 | 假 | 填入表格数据值的时间段。 |
欧
用户标识
用于填充表单数据值的组织单位。
元数据
假
真
是否包含表格各部分每个数据元素的元数据。
要检索数据集的表单,您可以执行GET请求,如下所示:
/ api / dataSets / <dataset-id> /form.json
检索具有标识符“BfMAe6Itzgt”的数据集的表单
XML:
## / api / dataSets / BfMAe6Itzgt / form
要检索包含JSON中的元数据的表单,请执行以下操作:
/api/dataSets/BfMAe6Itzgt/form.json?metaData=true
| 检索填充了特定时期数据值的表单,并
XML 中的组织单位: | Parameter name |
|---|---|
| displayColumnOrder | ```bash
curl -d @form.html "localhost/api/dataSets/BfMAe6Itzgt/form"
-H "Content-Type:text/html" -u admin:district -X PUT
``` |
| 文件资料 { #webapi_documents } | 对文件的引用可以与文档资源一起存储。 |
| 表格文件字段 | 字段名称 |
描述
名称
文件唯一名称
外部
标识文件位置的标志。外部文件为 TRUE,内部文件为 FALSE
网址
文件的位置。外部文件的 URL。内部文件的文件资源 ID(请参阅 [文件资源](developer-manual.md#webapi_file_resources))。
对文档端点的GET请求将返回所有文档:
/ api / documents
## 对文档端点的POST请求将创建一个新文档:
```bash
curl -X POST -d @document.json -H "Content-type: application/json"
"http://dhis.domain/api/documents"
{
"name": "dhis home",
"external": true,
"url": "https://www.dhis2.org"
}
带有附加文档 ID 的 GET 请求将返回信息 关于文件。对同一端点的 PUT 请求将更新 文档的字段:
/ api / documents / <documentId>
将 /data 附加到 GET 请求将返回实际文件内容 文件的:
/ api / documents / <documentId> / data
| CSV元数据导入 { #webapi_csv_metadata_import } | DHIS2支持以CSV格式导入元数据,例如数据元素,组织单位和验证规则。根据列顺序/列索引来标识各种元数据对象的属性(有关详细信息,请参见下文)。您可以省略不需要的对象属性/列,但是由于列顺序很重要,因此必须包括一个空列。换句话说,如果您要指定在列顺序中排在后面的属性/列,但不指定在列顺序中排在较早的位置的某些列,则可以为它们添加空白/空白列。 |
|---|---|
| startDate 和 endDate 参数允许获取链接的数据 | |
| 到这些日期之间的任何时间段。这避免了定义所有 | |
| 期间明确在 | |
| 要求: | 要上传CSV格式的元数据,您可以向元数据端点发出POST请求: |
| POST / api / metadata?classKey = CLASS-KEY | 支持以下对象类型。 classKey 查询参数是强制性的,可以在下表中的每个对象类型旁边找到。 |
| 表格对象类型和关键字 | 对象类型 |
| 类键 | 资料元素 |
| E7229 | Use fornat HH:mm |
| DATA_ELEMENT_GROUP | 类别选项 |
| CATEGORY_OPTION | 类别选项组 |
| CATEGORY_OPTION_GROUP | 组织单位 |
| ORGANISATION_UNIT | 组织单位组 |
ORGANISATION_UNIT_GROUP
验证规则
VALIDATION_RULE
选项集
翻译
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 索引 | |||
| 2 | 串 | Program notification template | 串 | OptionSetUid |
| 3 | zscore | Program notification template | 是的 | |
| 4 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | Program notification template | 指标{ #webapi_csv_indicators } | 稳定的标识符。正好 11 个字母数字字符,以字母开头。如果未指定,将由系统生成。 |
| 5 | Parameter name | Program notification template | 不 | |
| 6 | 简称 | Program notification template | 名称 | |
| 7 | 如果未指定,将返回姓名的前 50 个字符。最多 50 个字符。唯一。 | Program notification template | 不 | 自由文本描述。 |
| 8 | false | true | Program notification template | 最大 230 字符。 | 域名类型 |
| 9 | 不 | Program notification template | 数据元素的域类型,可以是聚合或跟踪。最多 16 个字符。 | 值类型 |
| 10 | 不 | Program notification template | 串 | 聚集类型 |
| 11 | 不 | Program notification template | 聚合类型,表示如何按不同维度聚合数据。最多 16 个字符。 | |
| 12 | 类别组合 | Program notification template | 假 | 类别组合的 UID。如果未指定,将默认为默认类别组合。 |
| 13 | 网址 | Program notification template | 串 | 零具有重要意义 |
| 14 | 不 | Program notification template | 串 | 表示该数据元素是否存储零值。 |
选项集
不
要用于数据的选项集的 UID。
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 表格:组织单位 CSV 格式 | |||
| 2 | 串 | Program notification template | 串 | 需要 |
| 3 | zscore | Program notification template | 是的 | |
| 4 | 姓名。最多 230 个字符。唯一。 | Program notification template | 串 | 用户标识 |
| 5 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | Program notification template | 指标{ #webapi_csv_indicators } | 稳定代码。最多 50 个字符。 |
| 6 | Parameter name | Program notification template | 不 | |
| 7 | 上级组织单位的 UID。 | Program notification template | 不 | 50 名字的第一个字符 |
| 8 | 如果未指定,将返回姓名的前 50 个字符。最多 50 个字符。唯一。 | Program notification template | 不 | |
| 9 | async | Program notification template | 不 | |
| 10 | 1970-01-01 | Program notification template | 关闭日期 | 不 |
| 11 | 组织单位的关闭日期,格式为 YYYY-MM-DD,如果当前开放,则跳过。 | Program notification template | 不 | |
| 12 | Text. | Program notification template | 不 | |
| 13 | NONE | MULTI_POLYGON | POLYGON | POINT | SYMBOL | Program notification template | 坐标 | |
| 14 | 不 | Program notification template | 网址 | |
| 15 | ``` | |||
| / api / userLookup | ||||
| ``` | Program notification template | 联系人 | ||
| 16 | 不 | Program notification template | 地址 |
不
组织单位地址。最多 255 个字符。
不
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 表格:组织单位 CSV 格式 | |||
| 2 | 串 | Program notification template | 串 | 需要 |
| 3 | zscore | Program notification template | 是的 | |
| 4 | Parameter name | Program notification template | 不 | |
| 5 | 用户标识 | Program notification template | 码 | |
| 6 | 不 | Program notification template | 描述 | 不 |
| 7 | 自由文本描述。 | Program notification template | 不 | 自由文本教学。 |
| 8 | 所需值 | Program notification template | 中 | 高 |
| 9 | Retrieve the id property of the returned file resource. | Program notification template | 规则类型(忽略) | 不 |
| 10 | 验证 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 操作员 | |||
| 11 | 不 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 左侧表达 | |||
| 12 | 期间类型 | Program notification template | 月刊 | 日刊 |
| 13 | 周刊 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 操作员 | |||
| 14 | 年刊 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 左侧表达 | |||
| 15 | 是的 | Program notification template | 月刊 | 是的 |
左侧缺失值策略
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 右侧表达 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 基于数据元素和选项组合 UID 的数学公式。 | |||
| 2 | 右侧表达描述 | Program notification template | 串 | 右侧缺失值策略 |
| 3 | 不 | Program notification template | 是的 | |
| 4 | never_skip | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 选项集 { #webapi_csv_option_sets } | |||
| 5 | 表:选项集 CSV 格式 | Program notification template | 串 | 需要 |
| 6 | 描述 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 是的 |
是的
姓名。最多 230 个字符。唯一。每个选项都应重复。
不
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 选项名称 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 基于数据元素和选项组合 UID 的数学公式。 | |||
| 2 | 选项 UID | Program notification template | 右侧缺失值策略 | |
| 3 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | Program notification template | 是的 | |
| 4 | 稳定代码。最多 50 个字符。 | ```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" | ||||
| ] | ||||
| } | ||||
||csv | ||||
| optionsetname,optionsetuid,optionsetcode,optionname,optionuid,optioncode | ||||
| “颜色”,“颜色”,“蓝色”,“蓝色” | ||||
| “颜色”,“颜色”,“绿色”,“绿色” | ||||
| “颜色”,“颜色”,“黄色”,“黄色” | ||||
| “性别”,“男”,“男” | ||||
| “性别”,“女性”,“女性” | ||||
| “性别”,“未知”,“未知” | ||||
| “结果”,“高”,“高” | ||||
| “结果”,“中”,“中” | ||||
| “结果”,“低”,“低” | ||||
| “ Impact”,“ cJ82jd8sd32”,“ IMPACT”,“ Great”,“ GREAT” | ||||
| “影响”,“ cJ82jd8sd32”,“影响”,“中等”,“中等” | ||||
| “影响”,“ cJ82jd8sd32”,“影响”,“不良”,“不良” | ||||
| ``` | ||||
| 5 | 柱 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 索引 | |||
| 6 | 柱 | Program notification template | 值(默认为第一位) | |
| 7 | 描述 | Program notification template | 是的 |
姓名。最多 230 个字符。唯一。每个选项都应重复。
OptionGroupUid
稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。每个选项都应重复。
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 简称。最多 50 个字符。唯一。每个选项都应重复。 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 基于数据元素和选项组合 UID 的数学公式。 | |||
| 2 | 稳定的标识符。最多 11 个字符。每个选项都应重复。 | Program notification template | 右侧缺失值策略 | |
| 3 | 稳定的标识符。最多 11 个字符。 | Program notification template | 是的 | |
| 4 | 稳定代码。最多 50 个字符。 | Program notification template | ```csv | |
| optionGroupName,optionGroupUid,optionGroupCode,optionGroupShortName,optionSetUid,optionUid,optionCode | ||||
| optionGroupA,groupA,xmRubJIhmaK,OptionA | ||||
| optionGroupA,groupgroup,xmRubJIhmaK,OptionB | ||||
| optionGroupB 、、 groupB,QYDAByFgTr1,OptionC | ||||
| ``` | ||||
| 5 | 选项组集 { #option-group-set } | Program notification template | 索引 | |
| 6 | 柱 | Program notification template | 值(默认为第一位) |
描述
选项组设置名称 是的
OptionGroupSetUid
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 索引 | |||
| 2 | 串 | Program notification template | 串 | OptionSetUid |
| 3 | zscore | Program notification template | 是的 | |
| 4 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 指标{ #webapi_csv_indicators } | 稳定的标识符。正好 11 个字母数字字符,以字母开头。如果未指定,将由系统生成。 | ||
| 5 | 最小最大数据元素 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 用户标识 | |||
| 6 | 值(默认为第一位) | Program notification template | 名称 | |
| 5 | 指示符 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 用户标识 | |||
| 6 | 不 | Program notification template | 名称 | |
| 6 | 码 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 索引 | |||
| 6 | 简称 | Program notification template | 50 名字的第一个字符 | |
| 6 | 如果未指定,将返回姓名的前 50 个字符。最多 50 个字符。唯一。 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 串 | 指标表达。 |
分母描述
不
分子
是的
指标表达。
分子描述
不
最大 230 字符。
年化
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 串 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 串 | 指标类型的 UID。 | ||
| 2 | 串 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 串 | 除了导入对象,您还可以选择只导入对象 | ||
| 对象和组之间的组成员关系。目前,该 | ||||
| 支持以下组和对象对 |
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 表格:组织单位 CSV 格式 | |||
| 2 | 串 | Program notification template | 串 | 是的 |
| 3 | zscore | Program notification template | 是的 | |
| 4 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | Program notification template | 要添加到集合中的对象的 UID | |
| 5 | 类别 选项组{ #category-option-group } | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 柱 |
值(默认为第一位)
| 是的 | Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | 姓名。最多 230 个字符。唯一。 | Parameter name |
|---|---|---|---|---|
| 1 | 类型 | ```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" | ||||
| ] | ||||
| } | ||||
| ``` | 表格:组织单位 CSV 格式 | |||
| 2 | 串 | Program notification template | 串 | 是的 |
| 3 | zscore | Program notification template | 是的 | |
| 4 | 稳定的标识符。最多 11 个字符。如果未指定,将由系统生成。 | Program notification template | 要添加到集合中的对象的 UID |
表格数据元素组、类别选项、组织单位组 CSV 格式
索引
需要
值(默认为第一位)
描述
名称
是的
姓名。最多 230 个字符。唯一。
用户标识
用户标识
稳定标识符。最多 11 个字符。如果未指定,将由系统生成。
码
不
稳定代码。最多 50 个字符。
简称
简称。最多 50 个字符。
类别选项的示例如下所示:
名称,uid,代码,简称
“男”,“男”
“女性”,“女性”
删除的对象 { #webapi_deleted_objects }
GET /api/deletedObjects.json?klass=DataElement
/ api / deletedObjects
每当删除元数据类型的对象时,都会保留日志 uid、代码、类型和删除时间。这个 API 是 在/api/deletedObjects 字段过滤和对象过滤中可用 与其他元数据资源类似。
获取类型为数据元素的已删除对象:
GET /api/deletedObjects.json?klass=DataElement
获取在 2015 年删除的指标类型的已删除对象和 向前:
GET /api/deletedObjects.json?klass=Indicator&deletedAt=2015-01-01
收藏夹 { #webapi_favorites }
当前登录的用户。这目前适用于仪表板。
/ api / dashboards / <uid> /收藏
要使仪表板成为收藏夹,您可以发出 POST 请求(无内容 type required) 到这样的 URL:
/ api /仪表板/ iMnYyBfSxmM /收藏
要将仪表板删除为收藏夹,您可以发出 DELETE 请求 使用与上面相同的 URL。
收藏夹状态将显示为布尔值 收藏夹 字段 元数据响应中的对象(例如仪表板)。 订阅内容 { #webapi_subscription } 已登录的用户可以订阅某些类型的对象。目前 可订阅的对象类型包括 EventChart、EventReport.Map、Visualization 和 EventVisualization、 地图、可视化和事件可视化类型的对象。
注
事件图表(EventChart)和事件报告(EventReport)对象已被弃用。请使用 EventVisualization 代替。
要获取对象的订阅者(返回用户 ID 数组),您 可以发出 GET 请求:
/ api / <object-type> / <object-id> /订阅者
请参见以下示例:
/api/visualizations/DkPKc1EUmC2/subscribers
检查当前用户是否订阅了一个对象(返回一个 boolean) 您可以执行 GET 调用:
/ api / <object-type> / <object-id> /已订阅
请参见以下示例:
/api/visualizations/DkPKc1EUmC2/subscribed
要订阅/取消订阅对象,请执行 POST/DELETE 请求(不需要内容类型):
/api/fileResources 发送多部分上传: bash curl "https://server/api/fileResources" -X POST -F "file=@/path/to/file/name-of-file.png" - 文件资源的` uid `可以在创建时提供,例如:
```bash
curl "https://server/api/fileResources?uid=0123456789x" -X POST
-F "file=@/path/to/file/name-of-file.png"
创建文件资源和引用文件的数据值、 在 DHIS 2.36 或更高版本中,POST 到 `/api/dataValues/file` 端点:bash curl "https://server/api/dataValues/file?de=xPTAT98T2Jd &pe=201301&ou=DiszpKrYNg8&co=Prlt0C1RF0s" -X POST -F "file=@/path/to/file/name-of-file.png" For the `api/fileResources` endpoint, the only form parameter required is
*file*, which is the file to upload. For the `api/dataValues/file`
endpoint, the parameters required are the same as for a post to
`api/dataValues`, with the addition of *file*.
文件名和内容类型也应包含在请求中,但
如果没有提供,将用默认值代替。
- 成功创建文件资源后,返回的数据将包含
一个 `response` 字段,它又包含这样的 `fileResource`:
```json
{
"httpStatus": "Accepted",
"httpStatusCode": 202,
"status": "OK",
"response": {
"responseType": "FileResource",
"fileResource": {
"name": "name-of-file.png",
"created": "2015-10-16T16:34:20.654+0000",
"lastUpdated": "2015-10-16T16:34:20.667+0000",
"externalAccess": false,
"publicAccess": "--------",
"user": { ... },
"displayName": "name-of-file.png",
"contentType": "image/png",
"contentLength": 512571,
"contentMd5": "4e1fc1c3f999e5aa3228d531e4adde58",
"storageStatus": "PENDING",
"id": "xm4JwRwke0i"
}
}
}
资源已提交后台处理(持续到 在这种情况下是外部文件存储)。另外,请注意 storageStatus 字段 指示内容是否已存储。在这 点,到外部存储的持久化还没有完成(它是 可能会上传到某个地方的基于云的商店) PENDING 状态。
即使内容尚未完全存储,文件资源 现在可以使用,例如作为数据值中的引用内容(参见 使用文件数据值)。如果我们需要检查 更新的 storageStatus 或以其他方式检索 文件,可以查询fileResources端点。
curl "https://server/api/fileResources/xm4JwRwke0i" -H "Accept: application/json"
| 此请求将返回 FileResource 对象,如 上面例子的反应。 | 此请求将返回 FileResource 对象,如 上面例子的反应。 | | ------------------------------------- | ---- | | 文件资源*必须*从另一个对象引用(分配) | 以便长期坚持。一个文件资源是 | | 创建但未被其他对象(例如数据值)引用 | 被认为处于*分期*。此中的任何文件资源 | | 状态并且超过*两个小时*将被标记为删除 | 并将最终从系统中清除。 | | 文件资源初始创建返回的ID不是 | 可从任何其他位置检索,除非文件资源具有 | | 已被引用(其中 ID 将被存储为引用), | 所以丢失它需要重复 POST 请求和一个新的 | | 要创建的对象。 孤立*文件资源将被清理 | 自动起来。 | | 文件资源对象是*不可变的,意味着修改不是 | 允许并需要创建一个全新的资源。 | | 文件资源阻止列表 { #file-resource-blocklist } | |
出于安全原因,某些类型的文件被阻止上传。
| 以下内容类型被阻止。 | 以下内容类型被阻止。 | 以下内容类型被阻止。 |
|---|---|---|
| 文字/ HTML | 应用项目/ x-ms-dos-可执行 | 文字/ css |
| application / vnd.microsoft.portable-executable | 文字/ javascript | application / vnd.apple.installer + xml |
| 字体/ otf | application / vnd.mozilla.xul + xml | 应用项目/ x-shockwave-flash |
| 应用项目/ x-httpd-php | application / vnd.debian.binary-package | 应用项目/ x-sh |
| 应用/ x-rpm | 应用项目/ x-csh | 应用项目/ Java归档 |
| 以下文件扩展名被阻止。 | 文件扩展名 | 文件扩展名 |
| 文件扩展名 | 网页 |
ul
名称
| 类型 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| js | subjectTemplate | SH |
可执行项目
/api/metadata/version/create:这个端点将创建元数据
OTF
响应:
蝙蝠
瑞士法郎
/api/metadata/version/create:这个端点将创建元数据
元数据版本控制 { #webapi_metadata_versioning }
响应:
/api/metadata/version:这个端点将返回当前的元数据
名称
| 类型 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| 假 | subjectTemplate | 获取元数据版本示例 { #webapi_metadata_versioning_examples } |
请求:
/api/metadata/version/create:这个端点将创建元数据
响应:
响应:
**示例:**获取名称为“ Version_2”的版本的详细信息
请求:
/api/metadata/version/create:这个端点将创建元数据
响应:
响应:
/api/metadata/version/history:这个端点将返回所有
名称
| 类型 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| 枚举(参见元数据和渲染类型表中的列表) | Tracked Entity UIDS | 获取所有元数据版本的列表 { #webapi_get_list_of_metadata_versions } |
**示例:**获取此系统中所有版本的列表
响应:
- ```json
{
"metadataversions": [{
"name": "Version_1",
"type": "BEST_EFFORT",
"created": "2016-06-30T05:54:41.139+0000",
"id": "SjnhUp6r4hG",
"hashCode": "fd1398ff7ec9fcfd5b59d523c8680798"
}, {
"name": "Version_2",
"type": "BEST_EFFORT",
"created": "2016-06-30T05:59:33.238+0000",
"id": "SaNyhusVxBG",
"hashCode": "8050fb1a604e29d5566675c86d02d10b"
}, {
"name": "Version_3",
"type": "BEST_EFFORT",
"created": "2016-06-30T06:01:23.680+0000",
"id": "FVkGzSjAAYg",
"hashCode": "70b779ea448b0da23d8ae0bd59af6333"
}]
}
/ api / metadata / version / history?baseline = Version_2
{
"metadataversions": [{
"name": "Version_3",
"type": "BEST_EFFORT",
"created": "2016-06-30T06:01:23.680+0000",
"id": "FVkGzSjAAYg",
"hashCode": "70b779ea448b0da23d8ae0bd59af6333"
}, {
"name": "Version_4",
"type": "BEST_EFFORT",
"created": "2016-06-30T06:01:28.684+0000",
"id": "Ayz2AEMB6ry",
"hashCode": "848bf6edbaf4faeb7d1a1169445357b0"
}]
}
/api/metadata/version/create:这个端点将创建元数据
version 参数中指定的版本类型。
响应:
名称
需要 描述 类型
真正 描述 用户可以选择需要创建的元数据类型。 元数据版本类型决定了进口商应该如何对待给定的 版本。导入元数据时将使用此类型。有 两种类型的元数据。
BEST_EFFORT:这种类型表明丢失的引用可以
| 类型 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| js | Tracked Entity UIDS | > 注意 |
| > | ||
| > 建议有一个 ATOMIC 类型的版本,以确保所有 | ||
| > 系统(中央和本地)具有相同的元数据。任何遗漏 | ||
| > 引用在验证阶段本身被捕获。请参阅 | ||
| > 进口商详细信息的完整解释。 |
示例: 创建类型为 BEST_EFFORT 的元数据版本
/api/metadata/version/create:这个端点将创建元数据
curl -X POST -u admin:district "https://play.dhis2.org/dev/api/metadata/version/create?type=BEST_EFFORT"
响应:
{
"name": "Version_1",
"created": "2016-06-30T05:54:41.139+0000",
"lastUpdated": "2016-06-30T05:54:41.333+0000",
"externalAccess": false,
"publicAccess": "--------",
"user": {
"name": "John Traore",
"created": "2013-04-18T17:15:08.407+0000",
"lastUpdated": "2016-04-06T00:06:06.571+0000",
"externalAccess": false,
"displayName": "John Traore",
"id": "xE7jOejl9FI"
},
"displayName": "Version_1",
"type": "BEST_EFFORT",
"hashCode": "fd1398ff7ec9fcfd5b59d523c8680798",
"id": "SjnhUp6r4hG"
}
/api/metadata/version/{versionName}/data:这个端点将下载特定于作为路径传递的版本名称的实际元数据
/api/metadata/version/{versionName}/data.gz:这个端点将下载 特定于作为路径传递的版本名称的实际元数据 压缩格式(gzipped)的参数。选项值
| 类型 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| js | Tracked Entity UIDS | 格式为 "Version_<id>"的路径参数,以便 API 下载特定版本 |
下载版本元数据 { #webapi_download_version_metadata } **示例:**获取“版本5”的实际元数据 请求: ``bash curl -u admin:district "https://play.dhis2.org/dev/api/metadata/version/Version_5/data" /api/metadata/sync`:此端点执行元数据同步 通过下载和在查询参数中传递的版本名称 从远程服务器导入指定的版本,如定义 设置应用项目。 响应:
- ```json
{
"date": "2016-06-30T06:10:23.120+0000",
"dataElements": [
{
"code": "ANC 5th Visit",
"created": "2016-06-30T06:10:09.870+0000",
"lastUpdated": "2016-06-30T06:10:09.870+0000",
"name": "ANC 5th Visit",
"id": "sCuZKDsix7Y",
"shortName": "ANC 5th Visit ",
"aggregationType": "SUM",
"domainType": "AGGREGATE",
"zeroIsSignificant": false,
"valueType": "NUMBER",
"categoryCombo": {
"id": "p0KPaWEg3cf"
},
"user": {
"id": "xE7jOejl9FI"
}
}
]
}
表格查询参数 名称 需要 描述 版本名称 真正
使用此 API 时应格外小心。请注意,有
/api/metadata/version/create:这个端点将创建元数据
利用“数据管理”中的元数据同步任务
关于元数据同步任务。
此同步 API 也可用于同步元数据
从元数据同步调度项目失败的版本。由于
它依赖于给定的元数据版本号,应该注意
为调用 this 的顺序而采用。例如。如果这个api是
用于从中央实例同步一些更高版本,然后
同步可能会失败,因为元数据依赖项不存在于
本地实例。
假设本地实例在 Version_12 并且如果使用这个端点
从中央同步Version_15(类型BEST_EFFORT)
例如,调度项目将从以下位置开始同步元数据
Most notably the sequence has only a single item. Information on top level object and the object in the sequence both originate from the job configuration.
Version_12 和 Version_15 之间的版本。你需要手动仅使用这些端点同步丢失的版本。
同步元数据版本 { #webapi_metadata_synchronization_version }
**示例:**将Version_6从中央系统同步到该系统
请求:
curl -u admin:district "https://play.dhis2.org/dev/api/metadata/sync?versionName=Version_6"
元数据存储库 { #webapi_metadata_repository }
DHIS2 提供了一个包含元数据包的元数据存储库
各种内容。元数据包是符合 DHIS2 的 JSON 文档
它描述了一组元数据对象。
### 要检索可用元数据包的索引,您可以发出
对 *metadataRepo* 资源的 GET 请求:
GET /api/synchronization/metadataRepo
元数据包条目包含有关包的信息和
相关包的 URL。索引可能如下所示:
```json
{
"packages": [
{
"id": "sierre-leone-demo",
"name": "Sierra Leone demo",
"description": "Sierra Leone demo database",
"version": "0.1",
"href": "https://dhis2.org/metadata-repo/221/sierra-leone-demo/metadata.json"
},
{
"id": "trainingland-org-units",
"name": "Trainingland organisation units",
"description": "Trainingland organisation units with four levels",
"version": "0.1",
"href": "https://dhis2.org/metadata-repo/221/trainingland-org-units/metadata.json"
}
]
}
curl "localhost:8080/api/synchronization/metadataPull" -X POST
-d "https://dhis2.org/metadata-repo/221/trainingland-org-units/metadata.json"
-H "Content-Type:text/plain" -u admin:district
注
提供的 URL 将根据
dhis.conf文件中的配置属性metadata.sync.remote_servers_allowed进行检查。 如果基本 URL 不在允许的配置服务器之列,则不允许执行操作。请看下面的失败示例。
配置集为metadata.sync.remote_servers_allowed=https://server1.org/,https://server2.org/的一些示例 - 提供https://server1.org/path/to/resource-> 这将被接受 - 提供https://server2.org/resource/path-> 这将被接受 - 提供https://oldserver.org/resource/path-> 这将被拒绝 JSON 格式的故障响应示例。
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "Provided URL is not in the remote servers allowed list",
"errorCode": "E1004"
}
参考用户创建的{ #reference-to-created-by-user } Each object created in DHIS2 will have a property named user which is linked to User who created the object.
From version 2.36 we have changed the name of this property to createdBy to avoid confusion.
不过,为了保持向后兼容性,传统的 user 属性仍包含在有效载荷中,并像以前一样正常工作。
{
"createdBy": {
"displayName": "John Kamara",
"name": "John Kamara",
"id": "N3PZBUlN8vq",
"username": "district"
},
"user": {
"displayName": "John Kamara",
"name": "John Kamara",
"id": "N3PZBUlN8vq",
"username": "district"
}
}
元数据提案工作流程{ #webapi_metadata_proposal_workflow }
/api/metadata/proposals
提议更改元数据{ #webapi_metadata_proposal_propose }
一个提案总是针对一个元数据对象,使用
POST /api/metadata/proposals
添加一个新的元数据对象。
按 ID 更新现有元数据对象引用。
删除 ID 引用的现有元数据对象。
要提议添加新的元数据对象,请发送类似下面的 JSON 有效载荷:
{ "type": "ADD", "target": "ORGANISATION_UNIT", "change": {"name":"My Unit", "shortName":"MyOU", "openingDate": "2020-01-01"} }
`change` 属性包含相同的 JSON 对象,可直接发布到相应的端点以创建对象。
要提议更新现有元数据对象,请发送一个 JSON 有效载荷,如下例所示:
```json
{
"type": "UPDATE",
"target": "ORGANISATION_UNIT",
"targetId": "<id>",
"change": [
{"op": "replace", "path": "/name", "value": "New name"}
]
}
The targetId refers to the object by its ID which should be updated. The change property here contains a JSON patch payload. This is the same patch payload that could be posted to the corresponding endpoint to directly apply the update. 要提议删除现有对象,请发送一个有效载荷,如上一个示例:
{ "type": "REMOVE", "target": "ORGANISATION_UNIT", "targetId": "The `targetId` refers to the object by its ID which should be removed. A free text `comment` can be added to any type of comment.
Only `target` type `ORGANISATION_UNIT` is supported currently.
接受元数据更改建议{ #webapi_metadata_proposal_accept }
### 要接受一个开放的提案,请在提案资源上使用`POST`
POST /api/metadata/proposals/<uid>
成功后,提案的状态变为`接受`状态。一旦被接受,提案就不能再被拒绝。
Should a proposal fail to apply it changes to status `NEEDS_UPDATE`. The `reason` field contains a summary of the failures when this information is
available.
反对元数据变更提案{ #webapi_metadata_proposal_oppose }
如果提案不太正确并且需要调整,可以通过发送提案资源的`PATCH`来反对提案
PATCH /api/metadata/proposals/<uid>
可选地,可以在其中添加纯文本正文,以给出提案遭到反对的`原因`。
反对的提案必须处于`PROPOSED`状态,并将更改为`NEEDS_UPDATE`状态。
| 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: | Parameter name |
| ----------- | -------------------------------------------------------------- |
| Two mappings for the `Referrals Age` category. A program indicator can choose which mapping | 这种调整既可以不带正文,也可以使用 JSON 正文,其中包含一个对象,该对象包含更新后的 `change` 和 `targetId` 内容。
调整: |
| 枚举(参见元数据和渲染类型表中的列表) | The JSON type of the `change` value depends on the proposal `type` analogous to when a proposal is initially made. |
| 用户友好型消息,说明操作是否成功。 | 要拒绝打开的提案,请在提案资源上使用`DELETE` |
| 将来源合并为指标(目标指标)的标识符 | 这最终将提案的状态更改为`拒绝`。不能对此提案进行进一步的更改。它作为事件的文档保存。 |
| 元数据变更建议清单{ #webapi_metadata_proposal_list } | 所有提案均可列入清单: |
| GET /api/metadata/proposals/ | 可以使用`filter`参数过滤结果列表。
例如,要只列出已接受的提案,请使用 |
| GET /api/metadata/proposals?filter=status:eq:ACCEPTED | 同样,只显示公开提案的使用情况: |
| GET /api/metadata/proposals?filter=status:eq:PROPOSED | 过滤器也可应用于除 `change` 以外的任何字段。支持的过滤器操作符是 Gist Metadata API 中描述的操作符。这也包括 Gist API 中描述的属性转换器。 |
| 可用字段列表如下 | 领域 |
| 描述 | 本我 |
| 提案的唯一标识符 | 类型 |
| `ADD` a new object, `UPDATE` an existing object, `REMOVE` an existing object | 地位 |
### `PROPOSED` (open proposal), `ACCEPTED` (successful), `NEEDS_UPDATE` (accepting caused error or opposed), `REJECTED`
目标
type of metadata object to add/update/remove; currently only `ORGANISATION_UNIT`
targetId
更新或删除对象的 UID,未为`添加`定义
## 创建人
| Potential duplicate status | 创建
|---| --- |
| 创建提案的日期时间 | 时间
| 接受或拒绝建议的用户 | 时间
| 提案转为接受或拒绝的决定性状态的日期时间 | 评论
| 为初步建议提供可选的纯文本注释 | 理由
| 可选的纯文本,在提案被反对或接受提案失败时出现的错误时给出 | 改变
| JSON object for `ADD` proposal, JSON array for `UPDATE` proposal, nothing for `REMOVE` proposal | `order`
| 单个变更建议可通过以下方式查看 | GET /api/metadata/proposals/<uid>
| 参数 `fields` 可用来缩小显示对象所包含字段的范围。例如 | GET /api/metadata/proposals/<uid>?fields=id,type,status,change
| 元数据 属性值 类型和验证{ #metadata-attribute-value-type-and-validations } | 类型
| 验证 | 文本
| 没有 | LONG_TEXT
| 没有 | 信
| 数值长度 = 1 并且是字母 | PHONE_NUMBER
| 验证基于此 regex `^[0-9+\(\)#\.\s\/ext-]{6,50}$`.最大长度为 50。 <br /> 例如+4733987937, (+47) 3398 7937, (47) 3398 7937.123 | 电子邮件
| 一般电子邮件格式 abc@email.com | BOOLEAN
| `true` or `false` | TRUE_ONLY
| 数字 | 日期
| Use format `yyyy-MM-dd` | 日期
| 使用格式`yyyy-MM-dd HH:mm:ssZ` 或`yyyy-MM-dd'T'HH:mm:ss`。 | 时间
| Use fornat `HH:mm` | 数字
| 数值必须是数字,最大长度 = 250 | 时间
| 数值为数字,包含 0 和 1 之间的值 | 百分比
| Text. | 整数
| 值为整数 | INTEGER_NEGATIVE
| 值为正整数 | INTEGER_NEGATIVE
| 值为负整数 |INTEGER_ZERO_OR_POSITIVE
| 数值为正整数或零整数 | 时间
## Value is a username of an existing `User`
### COORDINATE
没有
### ORGANISATION_UNIT
#### Value is a valid UID of an existing `OrganisationUnit`
REFERENCE
没有
AGE
Value is date of birth. Use format as in DATE type.
网址
Value is a valid URL
#### FILE_RESOURCE
Value is a valid UID of existing `FileResource`
| UID \ | 指标组 | GEOJSON |
|------------------|-----------|------------------------------------------|
| IndicatorGroup | displayColumnOrder | 没有 |
| 以目标取代源 | displayColumnOrder | POST /api/programs/{uid}/copy |
| 以目标取代源 | Get translations | POST /api/programs/{uid}/copy |
Example with a `Program` with a `UID` of `Program123a`
POST /api/programs/Program123a/copy
Successful response will include the new `Program` `UID` and will look like this:
```json
{
"httpStatus": "Created",
"httpStatusCode": 201,
"status": "OK",
"message": "Program created: 'Program456b'"
}
| 指标组 | Copy options { #copy-options } |
|---|---|
| displayColumnOrder | 230 |
| Get translations | 50 |
Property
Info
项目 名称
名称
Database constraint - needs to be unique
Program with a name of My Simple Program would be copied to a new Program with the name my prefix My Simple Program Copy of prefix will be used for the above properties.prefix like so: Note
The database does have limits for the number of characters allowed for properties. At the time of writing these limits are noted in the table below. Bear these in mind.
Property
shortName
{
"httpStatus": "Conflict",
"httpStatusCode": 409,
"status": "ERROR",
"message": "ERROR: value too long for type character varying(230)",
"errorCode": "E1004"
}
Referrals Age category. A program indicator can choose which mappingAuthorisation { #authorisation }
##### Authorities { #authorities }
A `User` will need the following authorities to be able to copy a `Program`:
#### F_PROGRAM_PUBLIC_ADD
F_PROGRAM_INDICATOR_PUBLIC_ADD
| UID \ | A `Program` needs one of the following states for it to be able to be copied: |
|--------------------------------|--------------|
| IndicatorGroup | |
| A specific `User` to have sharing `read` & `write` access | IndicatorGroup |
| 以目标取代源 | IndicatorGroup |
| Points to note { #points-to-note } | IndicatorGroup |
| Indicator group set | IndicatorGroup |
| A deep copy in this context means that a completely new instance of a `Program` or `Program` property has been created with its own unique identifiers. These include amongst others: | Indicator group set |
| uid | Indicator group set |
| Shallow copy { #shallow-copy } | |
A shallow copy in this context means that an existing `Program` property will be reused by the newly-created `Program` or `Program` property.
| UID \ | 指标组 |
|-------------------------------|-------------------|
| 以目标取代源 | Property of |
| A deep copy in this context means that a completely new instance of a `Program` or `Program` property has been created with its own unique identifiers. These include amongst others: | ProgramSection |
| Shallow copy { #shallow-copy } | 用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。 |
# 项目
项目规则变量
项目
项目阶段
* 项目
ProgramStageSection
* 项目阶段
ProgramStageSectionDataElement
* 项目阶段
注册
## > **Note**
>
> The following properties have been set as empty as an initial approach. This approach should keep things simple to start off with.
目的
Property
ProgramIndicator
groups
ProgramStageSection
programIndicators
* 注册
events
* Metadata Gist API { #gist_api }
* <!--DHIS2-SECTION-ID:gist_api-->
The Metadata Gist API is a RESTful read-only JSON API to fetch and browse
metadata. Items in this API contain the gist of the same item in the Metadata API.
* 应用项目接口是专门为避免以下情况而设计的:
* Large response payloads because of the inclusion of partial nested object
graphs.
* Resource intensive in memory processing of requests
(e.g. in memory filtering or object graph traversal).
_n + 1_ database queries as a result of object graph traversal while rendering
* the response.
* 与元数据应用项目接口{ #gist_vs_metadata_api } 的比较
<!--DHIS2-SECTION-ID:gist_vs_metadata_api-->
* 标准元数据应用项目接口是一个灵活而强大的应用项目接口,可为任何
用例。
但这样做的缺点是,并非所有功能和组合都能在扩展的同时
同时保持良好的性能。
特别是带有项目的列表,其中每个项目本身都有一个属性,而这个属性是一个复杂对象的大集合。
的大量复杂对象的集合,这已被证明是个问题,因为它们会很快
引用整个对象图的很大一部分。
添加`/gist`应用项目接口是为了提供一个元数据应用项目接口,其中良好的扩展性是我们的
的首要任务。这样做的弊端是对
技术上合理的功能,这意味着并非标准元数据 API 的所有功能都适用于 Gist API。
标准元数据 API 的所有功能都适用于 Gist API。
* The Gist API uses a divide and conquer strategy to avoid responses with large
partial object graphs. Instead of including nested objects or lists it provides
a `/gist` endpoint URI where this object or list can be viewed in isolation.
* **The `/gist` API refers to nested data using URIs rather than including it.**
This means if a client is interested in this nested information more requests
are required but each of them is kept reasonable small and will scale
well in context of huge number of potential items.
* Known Differences:
items only includes fields of referenced identifiable objects if these do not
* have an endpoint on their own
it never includes identifiable collections of objects directly
items by default do not include all available fields, but a subset that depends
* on context and parameters
* lists cannot be used without pager (therefore there is no `pager` parameter)
* fields with collections are not paged using the `pager`-transformer but through
* a paged API endpoint for the particular collection property
* items in a list, a collection property size or boolean transformer result
* always considers object sharing (the set of considered items is always the set
visible to the user)
Gist offers `member(<id>)` and `not-member(<id>)` collection field transformers
## Gist offers `canRead` and `canWrite` access check filter instead of filtering
on the `access` property
Gist offers using attribute UIDs as field and filter property names to allow
* listing or filtering based on custom attribute values
* Gist offers filter grouping
* Gist offers renaming the enrty list in a paged response using `pageListName`
Gist offers to pluck multiple simple properties
## Known Limitations:
by default only persisted are included; a handful of special
non-persistent fields (synthetic fields) can be added explicitly; other
non-persistent fields might be possible to extract using `from` transformation
## filters can only be applied to persisted fields
orders can only be applied to persisted fields
token filters are not available
### order is always case-sensitive
`pluck` transformer limited to text properties (or simple properties for multi-pluck)
| 默认值 | 用户设置 { #webapi_user_settings } | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
| -------------- | --------------------- |------------------------------------| ---------------------|
| <!--DHIS2-SECTION-ID:gist_endpoints--> | `order` | flushMode | <code>/api/<object-type>/<object-id><b>/gist</b></code>: view single object by ID (implicit `auto=L`) |
| <code>/api/<object-type>/<object-id>/<field-name><b>/gist</b></code>: paged list of all known and visible items in the collection of owner object's field (implicit `auto=M`; in case this is a simple field just the field value) | These endpoints correspond to the endpoints of the standard metadata API without
the `/gist` suffix and share the majority of parameters and their options with
that API. | Browsing Data { #gist_browse } | <!--DHIS2-SECTION-ID:gist_browse--> |
| The API supports CSV and JSON response for `GET /api/tracker/events`. | To manually browse data it can be handy to use the `absoluteUrls=true` parameter.
Linkage between parts of the gist can now be followed directly in browsers that
render JSON responses. | Parameters { #gist_parameters } | <!--DHIS2-SECTION-ID:gist_parameters--> |
| All endpoints of the `/gist` API accept the same set of parameters.
Parameters and their options that do not make sense in the endpoint context are
ignored. | 总览 { #overview } | | Parameters in alphabetical order: |
| Parameter | `order` | flushMode | 描述 |
| `absoluteUrls` | `order` | flushMode | `true` use relative paths in links, `false` use absolute URLs in links |
| `auto` | | `XS`, `S`, `M`, `L`, `XL` | (context dependent) |
| extent of fields selected by `*` field selector | `fields` | (depends on endpoint) | `*` |
| comma separated list of fields or presets to include | `filter` | 1 | `<field>:<operator>` or `<field>:<operator>:<value>` |
| 默认 | `headless` | 50 | `true` or `false` |
| `false` | `true` skip wrapping result in a pager (ignores `total`), `false` use a pager wrapper object around the result list | `inverse` | `true` or `false` |
| `false` | `true` return items **not** in the list, `false` return items in the list | `locale` | (user account configured language) |
| translation language override | `order` | flushMode | `:asc` |
| comma separated list of query order fields (can be used more than once) | `order` | Tracker import { #webapi_tracker_import } | page number |
### `pageSize`
1-1000
number of items on a page
`pageListName`
`<text>`
(object type plural)
overrides the property name of the result entry list
`rootJunction`
`与`或`或`
### `AND`
logical combination of `filter`s, `AND`= all must match, `OR`= at least one must match
* `total`/`totalPages`
* `true` or `false`
* `false`
`true` add total number of matches to the pager, `false` skip counting total number of matches
`translate`
* `true` or `false`
* `true`
* `true` translate all translatable properties, `false` skip translation of translatable properties (no effect on synthetic display names)
* The `absoluteUrls` Parameter { #gist_parameters_absoluteUrls }
* <!--DHIS2-SECTION-ID:gist_parameters_absoluteUrls-->
By default, URIs in `apiEndpoints`, `href` and the `pager` `prev` and `next`
members are relative, starting with `/<object-type>/` path.
### 可以使用 `absoluteUrls` 参数将 URI 更改为绝对 URL。
For example, `/api/users/rWLrZL8rP3K/gist?fields=id,href` returns:
```json
{
"id": "rWLrZL8rP3K",
"href": "/users/rWLrZL8rP3K/gist"
}
whereas /api/users/rWLrZL8rP3K/gist?fields=id,href&absoluteUrls=true returns:
{
"id": "rWLrZL8rP3K",
"href": "http://localhost:8080/api/users/rWLrZL8rP3K/gist?absoluteUrls=true"
}
As the example shows the absoluteUrls parameter is also forwarded or carried over to the included URLs so allowing to browse the responses by following the provided URLs.
The auto Parameter { #the-auto-parameter }
Each endpoint implicitly sets a default for the extent of fields matched by the * / :all fields selector:
/api/<object-type>/gist: implies auto=S
/api/<object-type>/<object-id>/gist: implies auto=L
/api/<object-type>/<object-id>/<field-name>/gist: implies auto=M
The auto parameter is used to manually override the default to make list items include more or less fields. This setting again acts as a default which can be further overridden on a per field basis using an explicit transformation.
Possible options for auto are ("t-shirt sizes"):
XS: includes only IDs and textual properties
S: excludes complex (object) properties, collection are only linked (not counted)
M: complex included as reference URL, references and collections as count and reference URL
L: like M but references and collections included as IDs (OBS! unbound in size)
XL: like L but references and collections included as ID objects: { "id": <id> } For example, /api/users/gist would list items with fields id, surname, firstName, phoneNumber, email, lastUpdated whereas /api/users/gist?auto=XS only lists id, surname, firstName, phoneNumber, email. Using /api/users/gist?auto=L would also include organisationUnits, dataViewOrganisationUnits, teiSearchOrganisationUnits and userGroups each with the list of IDs of the members in the lists/sets.
The fields Parameter { #gist_parameters_fields }
Specifies the list of fields to include for each list item.
Fields are included in the result JSON objects for an item in the provided order. A preset in the list of fields is expanded to the fields it contains at the position in the fields list it appears. Fields within the preset are ordered from simple to complex.
If no fields parameter is provided fields=* is assumed. Note that the fields of the * preset also depend on the auto parameter
To remove a field use either !<name> or -<name> in the list of fields. For example to remove the userGroups from a user, use:
The same principle can also be used to specify the transformer to use for a field. For example, to include the IDs of the user's user groups use:
/api/users/gist?fields=*,userGroups::ids
The fields parameter does allow listing fields of nested objects. For example to add userCredentials with id and name of a user use:
/api/users/gist?fields=*,userCredentials[id,username]
When including nested fields of collections the nested field must be a text
property.
* 例如,通过以下方式包含用户的`userGroups`的所有`名称`:
* /api/users/gist?fields=*,userGroups[name]
* This lists the `userGroups` as:
```json
{
"userGroups": {
"name": [
"_PROGRAM_Inpatient program",
"_PROGRAM_TB program",
"_DATASET_Superuser",
"_PROGRAM_Superuser",
"_DATASET_Data entry clerk",
"_DATASET_M and E Officer"
]
}
}
| The above is functional identical to: | Parameter name |
|---|---|
| GET /api/dataStore/ | ```json |
| { | |
| "pager": { | |
| "page": 1, | |
| "pageSize": 50 | |
| }, | |
| "users": [ | |
| "Kamara", | |
| "Wakiki", | |
| "Nana", | |
| "Malai", | |
| ... | |
| ] | |
| } | |
| ``` | |
| GET /api/dataStore/ | ```json |
| "Wakiki" | |
| ``` | |
| In summary, order can be one of the following: | The filter Parameter { #gist_parameters_filter } |
desc:: alphanumeric descending order | 要过滤返回的项目列表,请添加一个或多个过滤器参数。 |
Multiple filters can either be specified as comma-separated list of a single filter parameter or as multiple filter parameters each with a single filter.
| There are two types of filters: | Parameter name |
|---|---|
To filter entries within the query API context add one or more filter parameters | |
while also using the fields parameter. | A field can be: |
| a persisted field of the listed item type | a persisted field of a directly referenced object (1:1 relation) |
| a UID of an attribute | Available unary operators are: |
set operators: <path>:<operator>:[<value>,<value>,...] | 描述 |
null | field is null (undefined) |
null | field is not null (defined) |
empty | field is a empty collection or string |
!ilike | field is a non-empty collection or string |
$like | Binary Operator |
描述
eq
field equals value
ieq
| There are two types of filters: | Parameter name |
|---|---|
| field is not equal value | lt |
| 字段_小于_值 | le, lte |
| field is less than or equal to value | gt |
| field is greater than value | ge, gte |
| field is greater than or equal to value | in |
| field is a collection and value is an item contained in the collection | !in |
field is a collection and value is an item not contained in the collection
If the <value> of an in or !in filter is a list it is given in the form [value1,value2,...], for example: userGroups:in:[fbfJHSPpUQD,cYeuwXTCPkU].
Any >, >=, < <=, == or != comparison applied to a collection field with a numeric value will compare the size of the collection to the value, for example: userGroups:gt:0.
Any >, >=, < <=, == or != comparison applied to a text field with a integer number value will compare the text length to the value, for example: name:eq:4 (name has length 4).
Available binary pattern matching operators are:
Binary Operator
描述
like, ilike
| There are two types of filters: | Parameter name |
|---|---|
field does not contain <value> or field does not match pattern <value> (when wildcards * or ? in value) | $like, $ilike, startsWith |
field starts with <value> | !$like, !$ilike, !startsWith |
field does not start with <value> | like$, ilike$, endsWith |
field ends with <value> | !like$, !ilike$, !endsWith |
field does not end with <value> | The like and !like operators can be used by either providing a search term |
| in which case a match is any value where the term occurs anywhere, or they can | |
be used by providing the search pattern using * as any number of characters | |
and ? as any single character. |
All pattern matching operators named like are case-sensitive. All others are case-insensitive.
Note that filters on attribute values use text based comparison which means all text filters are supported.
For example, to only list organisations on second level use
/api/organisationUnits/gist?filter=level:eq:2
Similarly, when listing the children of a particular organisation unit the collection can be filtered. To only list those children that are connected to a program one would use:
/api/organizationUnits/rZxk3S0qN63/children/gist?filter=项目:gt:0
Binary operators for access (sharing) based filtering:
Binary Operator
描述
canRead
Has user <value> metadata read permission to the object
canWrite<value> metadata write permission to the objectcanDataRead
Has user <value> data read permission to the object
canDataWrite
Has user <value> data write permission to the object
canAccess
Has user <value0> permission <value1> to the object
When the user ID <value> is omitted the check is performed for the currently logged-in user. Similarly, if <value0> is ommitted for canAccess filter the check is performed for the currently logged-in user.
When applied to a simple value property, here code, the filter restricts the response to those data elements (owner object) the user can read/write:
/api/dataElements/gist?filter=code:canWrite:OYLGMiazHtW
categoryCombo, the filter restricts the responseto those data elements having a category combo that the user can read/write: /api/dataElements/gist?filter=categoryCombo:canWrite:OYLGMiazHtW
When applied to a reference collection property, here dataElementGroups, the filter restricts the response to those data elements where a data element group exists in the collection property and which the user can read/write:
/api/dataElements/gist?filter=dataElementGroups:canWrite:OYLGMiazHtW
The canAccess expects two arguments, 1st is user ID, 2nd the access pattern, for example to check metadata read and write access the pattern is rw%:
/api/dataElements/gist?filter=code:canAccess:[OYLGMiazHtW,rw%]
logical OR when the general filter combinator is logical AND, or vice-versa with logical AND when the general combinator is logical OR. For groups the filter pattern is extended as following:
unary: <group>:<field>:<operator>
binary: <group>:<field>:<operator>:<value>
The group is an arbitrary number between 0 and 9 (when omitted 0 is assumed).
The behaviour is best explained with a small example for an imaginary object type with an age and name property.
?filter=1:age:eq:50&filter=2:name:eq:foo&filter=2:name:eq:bar
The above filter has two groups 1 and 2, and the 2 group has 2 members. This is equivalent to the SQL (note the and and or as well as the grouping braces):
现在,如果将相同的过滤器与rootJunction=OR结合使用
?filter=1:age:eq:50&filter=2:name:eq:foo&filter=2:name:eq:bar&rootJunction=OR
the effect would be equivalent to the following SQL instead:
e.age = 50 or (e.name = 'foo' and e.name = 'bar')
The headless Parameter { #gist_parameters_headless }
Endpoints returning a list by default wrap the items with an envelope containing the pager and the list, which is named according to the type of object listed.
For example /api/organisationUnits/gist returns:
{
"pager": {
"page": 1,
"pageSize": 50,
"nextPage": "/organisationUnits/gist?page=2"
},
"organisationUnits": [
...
]
}
With headless=true the response to /api/organisationUnits/gist?headless=true is just the [...] list part in above example.
The inverse Parameter { #the-inverse-parameter }
The inverse can be used in context of a collection field gist of the form /api/<object-type>/<object-id>/<field-name>/gist to not list all items that are contained in the member collection but all items that are not contained in the member collection.
/api/organisationUnits/rZxk3S0qN63/children/gist
将列出作为rZxk3S0qN63子级的所有组织单位
/api/organisationUnits/rZxk3S0qN63/children/gist?inverse=true
would list all organisation units that are not children of rZxk3S0qN63. This would e.g. be used to compose a list of all units that can be made a child of a particular unit.
not contained in the member collection. The locale Parameter { #gist_parameters_locale }
The locale parameter is usually used for testing purposes to ad-hoc switch translation language of display names.
If not specified the translation language is the one configured in the users account settings.
Examples:
/api/organisationUnits/gist?locale=en
/api/organisationUnits/gist?locale=en_GB
order ParameterTo sort the list of items one or more order expressions can be given.
name followed by :asc (ascending order - the default) or :desc (descending order). For example, to sort organisation units alphabetically by name use:
/api/organisationUnits/gist?order=name
To sort organisation units first by level, then by name use:
This would start with root(s) at level 1. To start with the leaf units use:
/api/organisationUnits/gist?order=level:desc,name
If no order is specified the result list will have a stable order based on internal data organisation.
The page Parameter { #gist_parameters_page }
指在分页列表中查看的页面,以1开头的第一页。
如果不存在page参数,则等于page=1。
The page is always in relation to the pageSize. If a page is given beyond the number of existing matches an empty item list is returned.
pageSize Parameter指的是页面上的项目数。最多 1000 个项目。
如果没有pageSize参数,则等于pageSize=50。
The rootJunction Parameter { #gist_parameters_rootJunction }
The rootJunction parameter can be used to explicitly set the logic junction used between filters. Possible are:
AND: all filters have to match an entry for it to be included in the results
OR: any of the filters matches an entry for it to be included in the results
默认为与。
pageListName ParameterThe array property in a paged response that contains the matching entry list is named after the object type contained in the list. For /api/organisationUnits/gist it would be named organisationUnits.
This default naming can be customized using the pageListName parameter. For example, /api/organisationUnits/gist?pageListName=matches returns a response root object with the format:
{
"pager": {},
"matches": []
}
total or totalPages ParameterBy default, a gist query will not count the total number of matches should those exceed the pageSize limit. Instead, we opt-in to the additional costs the total count implicates.
When not counting the total matches (total=false) the response pager will assume that there is a next page in case pageSize items were found. This could however turn out to be false when browsing to the page. Also, the total field stating the number of total matches is not included in the pager.
For example, /api/organisationUnits/gist returns a pager:
{ "pager": { "page": 1, "pageSize": 50, "nextPage": "/organisationUnits/gist?page=2" } }
* When counting the total matches (`total=true`) the response `pager` will
contain the `total` field with the actual number of total matches at the cost
of an additional database operation.
* The response to `/api/organisationUnits/gist?total=true` now returns this `pager`:
* ```json
{
"pager": {
"page": 1,
"pageSize": 50,
"total": 1332,
"nextPage": "/organisationUnits/gist?total=true&page=2",
"pageCount": 27
}
}
translate Parameter { #gist_parameters_translate } * name或shortName这样的字段可以被翻译(国际化)。By default, any translatable field that has a translation is returned translated given that the user requesting the gist has an interface language configured.
要返回普通的非翻译字段,请使用 translate=false。
| For example, /api/organisationUnits/gist returns items like this: | json { "name": "A translated name", ... } | Parameter name | |----------------------|------------------------|-------------------------------------------------------------------------------------------------------| | json { "name" "Plain field name", ... } | Note that synthetic fields displayName and displayShortName are always returning the translated value independent of the translate parameter. | Fields { #gist_fields } | | | The fields included by default (without fields parameter) correspond to fields=*. This means the list of fields shown depends on object type, endpoint context as well as the auto parameter. | Note that the /gist API always excludes certain fields that usually are of no interest to clients, like for example the translations or sharing fields. These can be added explicitly. | | When not explicitly provided by name in the fields parameters the list of fields is computed from a preset. A preset can be used in the list of fields like a field name. It expands to zero, one or many fields depending on the object type, used endpoint and selector. | Field Presets { #field-presets } | * / :all: default fields depend on the context and auto parameter | | :identifiable: all persisted fields of the IdentifiableObject interface | Field Presets { #field-presets } | :nameable: all persisted fields of the NameableObject interface | | :persisted: literally all persisted fields | isEmpty | A transformer or transformation can be applied to a field by appending any of the indicators ::, ~ or @ followed by the transformer expression. | | Available transformer expressions are: | Transformer | JSON Result Type | | 描述 | Field Presets { #field-presets } | -- | | renames the field in the response to <name> | Field Presets { #field-presets } | number | | number of items in the collection field | isEmpty | boolean | | emptiness of a collection field | isNotEmpty | boolean |
non-emptiness of a collection field
ids
string or [string]
ID of an object or IDs of collection items
id-objects
[{ "id": <id> }]
IDs of collection items as object
member(<id>)
boolean
具有<id>的成员用于集合字段
not-member(<id>)boolean
集合字段中没有具有<id>的成员
pluck(<field>,...)
string or [string]
from(<field>,...)
| 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: | Parameter name | | ------------------ | ------------------------------------------------------- | | A field can receive both the rename transformer and one of the other transformers, for example: | /api/organisationUnits/gist?fields=,children::size~rename(child-count) | | The returned items now no longer have a children member but a child-count member instead. Note that rename also affects the member name of the URI reference given in apiEndpoints. | The from transformation can be used with one or more persistent fields as parameter. These will be loaded from the database, set in an instance of the listed element object before the non-persistent property transformed with from is extracted from that instance by calling the getter. This allows to extract derived fields while using the same logic that is used in usual metadata API. | | For example, a user's (non-persistent property) name is composed of the persistent property firstName and surname. It can be fetched like this: | /api/users/gist?fields=id,name~from(firstName,surname) | | Since a user's name is such a common case an auto-detection was added so that in this special case the from transformation is added automatically to name. We are allowed to just use the following which internally adds the from transformation: | /api/users/gist?fields=id,name | | While this makes non-persistent properties accessible in general these always have to be included in the fields explicitly. For a user this could be done using the following: | /api/users/gist?fields=,name |
The /gist API is tightly coupled to properties that exist the database. This means properties that aren't stored in the database usually aren't available. The exception to this are the "synthetic" properties which are dynamically computed on the basis of one or more database stored properties.
Synthetic properties are available for all endpoints where the persisted properties needed to compute the synthetic property exist.
Except for the apiEndpoints property which is automatically added when needed all other synthetic properties are not included by default and have to be requested explicitly in the list of fields.
Synthetic fields in alphabetical order:
领域
描述
apiEndpoints
contains links to browse nested complex objects or collections
hreflink to the list item itself (single item view)
displayName
已翻译的名称(始终已翻译)
displayShortName
translated shortName (always translated)
access
summary on ability of current user to read/write/modify the entry
The href Field { #gist_syntheticFields_href }
Each item in a /gist response can link to itself. This link is given in the href property.
access
/api/<object-type>/gist?fields=*,href
displayName and displayShortName FieldBy definition the displayName is the translated name and the displayShortName is the translated shortName.
To add displayName or displayShortName add it to the list use (for example):
/api/<object-type>/gist?fields=*,displayName
/api/<object-type>/gist?fields=*,displayShortName
Note that by default all translatable properties like name and shortName would also be translated. When translate=false is used to disable this displayName and displayShortName stay translated.
apiEndpoints FieldThis property provides the links to further browse complex objects or list of items that are included in the /gist response in form of a transformed simple value like an item count.
The apiEndpoints object will have a member of the same name for every member in the item that was transformed to a simple value.
For example,
/api/users/gist?fields=id,userGroups::size,organisationUnits::size
returns items in the form:
{
"id": "rWLrZL8rP3K",
"userGroups": 0,
"organisationUnits": 1,
"apiEndpoints": {
"organisationUnits": "/users/rWLrZL8rP3K/organisationUnits/gist",
"userGroups": "/users/rWLrZL8rP3K/userGroups/gist"
}
}
The list of userGroups and organisationUnits are included as their size. Each has a corresponding member in apiEndpoints with the path to browse the list.
The paths can be changed to URLs by using the absoluteUrls parameter.
returns items in the form:
{
"id": "rWLrZL8rP3K",
"userGroups": 0,
"organisationUnits": 1,
"apiEndpoints": {
"organisationUnits": "http://{host}/api/users/rWLrZL8rP3K/organisationUnits/gist?absoluteUrls=true",
"userGroups": "http://{host}/api/users/rWLrZL8rP3K/userGroups/gist?absoluteUrls=true"
}
}
The access Field { #the-access-field }
The access summary is based on the sharing and the current user. This means it is only applicable for objects that have a sharing property.
For example, when listing data elements with access field
/api/dataElements/gist?fields=*,access
返回的数据元素项包含一个访问成员,如下所示:
"access": {
"manage": false,
"externalize": false,
"write": false,
"read": true,
"update": false,
"delete": false
}
Attributes as Fields { #gist_attributeFields }
DHIS2 allows creating and adding custom attributes to metadata objects. Their values are contained in the attributeValues property of a metadata object in form of a map with the attribute UID as the map's key.
To directly list one or more specific attribute values from this map as if they were usual fields of the metadata object the attribute UID can be used as if it was a name of a usual field.
For example, to include the value of the attribute with UID Y1LUDU8sWBR as the property unit-of-measure in the list use:
/api/dataElements/gist?fields=id,name,Y1LUDU8sWBR::rename(unit-of-measure)
This results in list items of the form:
{
"id": "qrur9Dvnyt5",
"name": "Age in years",
"unit-of-measure": "years"
}
By default, the values are fetched as JSON and extracted from the map of attribute values. This means the listing will contain the proper JSON type for the type of attribute value. This comes at the overhead of fetching all attribute values. To single out the value within the database the PLUCK transformation can be used.
/api/dataElements/gist?fields=id,name,Y1LUDU8sWBR::rename(unit-of-measure)~pluck
The result will look the same but now the value is extracted as text in the database turning any JSON value to a string in the property output.
例子 { #gist_examples }
A few examples starting from simple listings moving on to very specific use cases.
fields so this sectionwill do so.
/api/organisationUnits/gist?fields=id,name
List organisation units with id and name and total count:
List users with id and username:
/api/users/gist?fields=id,userCredentials.username
List users with id, username and last login date:
/api/users/gist?fields=id,userCredentials[username,lastLogin]
List only organisation units on second level with id, name and level:
/api/organisationUnits/gist?fields=id,name,level&filter=level:eq:2
List only organisation units that have more than 1 child with id, name and number of children:
/api/organisationUnits/gist?fields=id,name,children::size&filter=children:gt:1
List only organisation units that are not yet a children of another unit zFDYIgyGmXG:
/api/organisationUnits/zFDYIgyGmXG/children/gist?fields=id,name&inverse=true
List users and flag whether they are a member of a specific user group NTC8GjJ7p8P and name that field is-member in the response:
/api/users/gist?fields=id,userCredentials.username,userGroups::member(NTC8GjJ7p8P)~rename(is-member)
List links to all users in pages of 10 items:
/api/users/gist?fields=href&absoluteUrls&pageSize=10
数据 { #data }
“ dataelement”,“ period”,“ orgunit”,“ catoptcombo”,“ attroptcombo”,“ value”,“ strby”,“ lstupd”,“ cmt”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 1”,“用户名”,“ 2015-04-01”,“ comment1”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 2”,“用户名”,“ 2015-04-01”,“ comment2”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 3”,“用户名”,“ 2015-04-01”,“ comment3”
本节关于发送和读取数据值。
/api/dataValueSets
发送数据值 { #webapi_sending_data_values }
To send data values you can make a POST request to the following resource.
POST /api/dataValueSets
A common use-case for system integration is the need to send a set of data values from a third-party system into DHIS. In this example, we will use the DHIS2 demo on http://play.dhis2.org/demo as basis. We assume that we have collected case-based data using a simple software client running on mobile phones for the Mortality <5 years data set in the community of Ngelehun CHC (in Badjia chiefdom, Bo district) for the month of January 2014. We have now aggregated our data into a statistical report and want to send that data to the DHIS2 instance. The base URL to the demo API is http://play.dhis2.org/demo/api. The following links are relative to the base URL.
最适合我们发送数据的资源 values 是 /api/dataValueSets 资源。一个数据值集代表一个 一组具有关系的数据值,通常来自 从相同的数据输入表单中捕获。格式看起来像 这:
JSON支持以下格式:
```json
{
"dataSet": "dataSetID",
"completeDate": "date",
"period": "period",
"orgUnit": "orgUnitID",
"attributeOptionCombo": "aocID",
"dataValues": [
{
"dataElement": "dataElementID",
"categoryOptionCombo": "cocID",
"value": "1",
"comment": "comment1"
},
{
"dataElement": "dataElementID",
"categoryOptionCombo": "cocID",
"value": "2",
"comment": "comment2"
},
{
"dataElement": "dataElementID",
"categoryOptionCombo": "cocID",
"value": "3",
"comment": "comment3"
}
]
}
CSV支持以下格式:
“ dataelement”,“ period”,“ orgunit”,“ catoptcombo”,“ attroptcombo”,“ value”,“ strby”,“ lstupd”,“ cmt”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 1”,“用户名”,“ 2015-04-01”,“ comment1”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 2”,“用户名”,“ 2015-04-01”,“ comment2”
“ dataElementID”,“ period”,“ orgUnitID”,“ cocID”,“ aocID”,“ 3”,“用户名”,“ 2015-04-01”,“ comment3”
Note
Please refer to the date and period section above for time formats.
Note
Any imported data value which is seen as unchanged will be ignored and the import summary will reflect this. An unchanged data value is classed as one which has the same value for all 3 of these properties: - value - comment - followUp
从这个例子中,我们可以看出我们需要识别周期, 数据集、组织单位(设施)和数据元素 报告。
To obtain the identifier for the data set we make a request to the /api/dataSets resource. From there we find and follow the link to the Mortality < 5 years data set which leads us to /api/dataSets/pBOMPrpg1QX. The resource representation for the Mortality < 5 years data set conveniently advertises links to the data elements which are members of it. From here we can follow these links and obtain the identifiers of the data elements. For brevity we will only report on three data elements: Measles with id f7n9E0hX8qk, Dysentery with id Ix2HsbDMLea and Cholera with id eY5ehpbEsB7.
剩下的就是掌握组织的标识符 单元。 dataSet 表示方便地提供了到组织的链接 报告它的单位,所以我们搜索 Ngelehun CHC 并按照 链接到 /api/organisationUnits/DiszpKrYNg8 中的 HTML 表示,其中 告诉我们这个组织单位的标识符是DiszpKrYNg8。
发送数据值 { #webapi_sending_data_values }
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="pBOMPrpg1QX"
completeDate="2014-02-03" period="201401" orgUnit="DiszpKrYNg8">
<dataValue dataElement="f7n9E0hX8qk" value="12"/>
<dataValue dataElement="Ix2HsbDMLea" value="14"/>
<dataValue dataElement="eY5ehpbEsB7" value="16"/>
</dataValueSet>
JSON格式:
{
"dataSet": "pBOMPrpg1QX",
"completeDate": "2014-02-03",
"period": "201401",
"orgUnit": "DiszpKrYNg8",
"dataValues": [
{
"dataElement": "f7n9E0hX8qk",
"value": "1"
},
{
"dataElement": "Ix2HsbDMLea",
"value": "2"
},
{
"dataElement": "eY5ehpbEsB7",
"value": "3"
}
]
}
To perform functional testing we will use the curl tool which provides an easy way of transferring data using HTTP. First, we save the data value set XML content in a file called datavalueset.xml. From the directory where this file resides we invoke the following from the command line:
curl -d @datavalueset.xml "https://play.dhis2.org/demo/api/dataValueSets"
-H "Content-Type:application/xml" -u admin:district
因此:
curl -d @datavalueset.json "https://play.dhis2.org/demo/api/dataValueSets"
-H "Content-Type:application/json" -u admin:district
选项(第一项为默认值)
| 默认值 | 发送大量数据值 { #webapi_sending_bulks_data_values } | Parameter name |
|---|---|---|
| DateTime | CSV格式: | JSON格式: |
| programStageIdScheme | CSV格式: | ```csv |
| “ dataelement”,“ period”,“ orgunit”,“ categoryoptioncombo”,“ attributeoptioncombo”,“ value” | ||
| “ f7n9E0hX8qk”,“ 201401”,“ DiszpKrYNg8”,“ bRowv6yZOF2”,“ bRowv6yZOF2”,“ 1” | ||
| “ Ix2HsbDMLea”,“ 201401”,“ DiszpKrYNg8”,“ bRowv6yZOF2”,“ bRowv6yZOF2”,“ 2” | ||
| “ eY5ehpbEsB7”,“ 201401”,“ DiszpKrYNg8”,“ bRowv6yZOF2”,“ bRowv6yZOF2”,“ 3” | ||
| ``` | ||
| End date for the time span of the values to export | orgUnitIdScheme | 请注意,使用 CSV 格式时,您必须使用二进制数据选项 |
| 保留 CSV 文件中的换行符: | ||
| programIdScheme | CSV格式: | ```xml |
| ``` | ||
| outlining how to resolve identified issues | orgUnitIdScheme | The import process can be customized using a set of import parameters. |
| Table: Import parameters | orgUnitIdScheme | Values (default first) |
UID, CODE, NAME, ATTRIBUTE:{uid} | orgUnitIdScheme | uid | name | code | attribute:ID |
| 描述 | orgUnitIdScheme | uid | name | code | attribute:ID |
| 假 | 假 | uid | name | code| attribute:ID |
| 总览 | 假 | source.target.request.categoryOptionComboIdScheme |
Sets import strategy, CREATE_AND_UPDATE will try and match on identifier, if it doesn't exist, it will create the object. | dataSetIdScheme | id | name | code | attribute:ID |
| Property of the data set to use to map the complete registrations. | 假 | uid | name | code| attribute:ID |
| Property of the category object to use to map the data values (ADX only). | 假 | source.target.request.orgUnitIdScheme |
| 异步导入时,会立即返回一个 Location 标头,指向 importReport 的位置。有效载荷还包含一个已创建任务的 json 对象。 | 假 | id | name | code | attribute:ID |
| Property of any of the above objects if they are not specified, to use to map the data values. | 假 | false | true |
| 描述 | storedByDataValue | false | true |
Whether to save changes on the server or just return the import summary.
importStrategy
CREATE | UPDATE | CREATE_AND_UPDATE | DELETE
Save objects of all, new or update import status on the server.
skipExistingCheck
Skip checks for existing data values. Improves performance. Only use for empty databases or when the data values to import do not exist already.
skipAudit
| false | true | Skip audit, meaning audit values will not be generated. Improves performance at the cost of ability to audit changes. Requires authority "F_SKIP_DATA_IMPORT_AUDIT". | async |
|---|---|---|
JSON object for ADD proposal, JSON array for UPDATE proposal, nothing for REMOVE proposal | Indicates whether the import should be done asynchronous or synchronous. The former is suitable for very large imports as it ensures that the request does not time out, although it has a significant performance overhead. The latter is faster but requires the connection to persist until the process is finished. | force |
Indicates whether the import should be forced. Data import could be rejected for various reasons of data set locking for example due to approval, data input period, expiry days, etc. In order to override such locks and force data input one can use data import with force=true. However, one needs to be a *superuser* for this parameter to work.
dataSet
uid
Provide the data set ID for CSV import where the ID cannot be provided in the file itself 所有参数都是可选的,可以作为查询参数提供 请求 URL 是这样的:
/api/dataValueSets?dataElementIdScheme=code&orgUnitIdScheme=name &dryRun=true&importStrategy=CREATE 它们也可以作为数据值集上的 XML 属性提供 元素如下。 XML 属性将覆盖查询字符串 参数。
```xml
请注意,`preheatCache` 参数会对
表现。对于小的导入文件,将其设置为 false 会很快。
对于包含大量不同数据的大型导入文件
元素和组织单位,将其设置为 true 将是
幅度更快。
数据值要求 { #webapi_data_values_import_requirement }
- storedByDataValue
- 是的
- displayColumnOrder
- 要求
评论
#### BOOLEAN
true | True | TRUE | false | False | FALSE | 1 | 0 | t | f |
Used when the value is a boolean, true or false value. The import service does not care if the input begins with an uppercase or lowercase letter, or if it's all uppercase.
标识符方案 { #webapi_data_values_identifier_schemes }
Regarding the id schemes, by default the identifiers used in the XML
messages use the DHIS2 stable object identifiers referred to as `UID`.
In certain interoperability situations we might experience that an external
system decides the identifiers of the objects. In that case we can use
the `code` property of the organisation units and other objects to set
fixed identifiers. When importing data values we hence need to reference
the code property instead of the identifier property of these metadata
objects. Identifier schemes can be specified in the XML message as well
as in the request as query parameters. To specify it in the XML payload
you can do this:
```xml
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0"
dataElementIdScheme="CODE" orgUnitIdScheme="UID" idScheme="CODE">
</dataValueSet>
作为查询参数。以下规则适用于 优先级:
XML 或 JSON 负载中定义的 ID 方案优先于
id 方案定义为 URL 查询参数。
| Specific id schemes such as dataElementIdScheme or | 检索和删除项目通知模板 | Parameter name |
| 描述 | ```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" | ||
| ] | ||
| } | ||
| ``` | uid | |
| 码 | ```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" | ||
| ] | ||
| } | ||
| ``` | 属性(后跟属性的UID) | |
| 属性选项是特殊的,指的是元数据属性 | ||
已被标记为*独特*。使用此选项时,attribute 必须 | ||
| 紧随其后的是属性的标识符,例如 | ||
| “属性:DnrLSdo4hMl”。 | ```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" | ||
| ] | ||
| } | ||
| ``` | uid | |
| /api/dataValueSets?async=true | Program notification template | ```json |
| { | ||
| "httpStatus": "OK", | ||
| "httpStatusCode": 200, | ||
| "status": "OK", | ||
| "message": "Initiated dataValueImport", | ||
| "response": { | ||
| "name": "dataValueImport", | ||
| "id": "YR1UxOUXmzT", | ||
| "created": "2018-08-20T14:17:28.429", | ||
| "jobType": "DATAVALUE_IMPORT", | ||
| "relativeNotifierEndpoint": "/api/system/tasks/DATAVALUE_IMPORT/YR1UxOUXmzT" | ||
| } | ||
| } | ||
| ``` | ||
| 请阅读有关*异步任务状态*的部分了解更多信息 | ||
| 信息。 | Program notification template | 以下部分描述了 DHIS2 中使用的 CSV 格式。首先 |
| 行被假定为标题行,在导入期间将被忽略。 | ||
| ```json | ||
| { | ||
| "object": { | ||
| "publicAccess": "rw------", | ||
| "externalAccess": false, | ||
| "user": {}, | ||
| "userAccesses": [], | ||
| "userGroupAccesses": [ | ||
| { | ||
| "id": "hj0nnsVsPLU", | ||
| "access": "rw------" | ||
| }, | ||
| { | ||
| "id": "qMjBflJMOfB", | ||
| "access": "r-------" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | Program notification template | 需要 |
| 描述 | Program notification template | 是的 |
| Refers to ID by default, can also be name and code based on selected id scheme | Program notification template | 是的 |
| async | Program notification template | 是的 |
| Refers to ID by default, can also be name and code based on selected id scheme | Program notification template | 不 |
Refers to ID
Attribute option combo
Refers to ID (from version 2.16)
值
不
您还可以请求CSV格式的数据,如下所示:
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| eventDate | Program notification template | Date in ISO format |
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} | Program notification template | Free text comment |
| 描述 | Program notification template | true or false |
| programStageIdScheme | Program notification template | 生成数据值集模板 { #webapi_data_values_template } |
| DateTime | Program notification template | 描述了可用于进一步调整输出的参数 |
| 以下: |
查询参数
需要
描述
Whether to save changes on the server or just return the import summary.
| 默认值 | Parameter name |
|---|---|
| 描述 | 不 |
| Organisation unit to use, supports multiple orgUnits, both id and code can be used. | comment |
| 最小最大数据元素 | Should comments be include, default: Yes. |
| eventDate | 不 |
| dueDate | 数据元素标识方案 |
| lastUpdatedDate | Data-element scheme to use, supports id | code. |
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} | To read data values you can make a GET request to the following resource. |
| Table: Data value set query parameters | Data values can be retrieved in XML, JSON, CSV, and ADX format. Since we want to read data we will use the GET HTTP verb. We will also specify that we are |
interested in the XML resource representation by including an Accept HTTP header with our request. The following query parameters are | |
| available. | |
| 读取完整的数据集注册 { #webapi_reading_complete_data_sets } | Parameter |
| > 注 | |
| > | |
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | |
| > | |
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | |
| > | |
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | dataSet |
| 串 | dataElementGroup |
| 不 | dataElement |
| Data element identifier. Can be repeated any number of times. | period |
| 不 | 开始日期 |
| DateTime | 结束日期 |
| programStageIdScheme | orgUnit |
| programIdScheme | children |
| End date for the time span of the values to export | orgUnitGroup |
| outlining how to resolve identified issues | attributeOptionCombo |
| Table: Import parameters | includeDeleted |
UID, CODE, NAME, ATTRIBUTE:{uid} | lastUpdated |
| 描述 | lastUpdatedDuration |
| Include only data values which are updated within the given duration. The format is <value><time-unit>, where the supported time units are "d" (days), "h" (hours), "m" (minutes) and "s" (seconds). | limit |
| The max number of results in the response. | 数据元素标识方案 |
| Property of the data element object to use for data values in response. | orgUnitIdScheme |
| Property of the org unit object to use for data values in response. | categoryOptionComboIdScheme |
| The name of the headers to be returned as part of the response. One or more headers name separated by comma | attributeOptionComboIdScheme |
| Property of the attribute option combo objects to use for data values in response. | dataSetIdScheme |
| Property of the data set object to use in the response. | categoryIdScheme |
Property of the category object to use in the response (ADX only). - categoryOptionIdScheme - Property of the category option object to use in the response (ADX only). - 方案
Property of any of the above objects if they are not specified, to use in the response. If not specified, the default idScheme for ADX is code, and for all other formats is uid.
E7126
临界点
组织单位分析资源使您可以指定一系列查询参数:
Identifier property used for the provided dataSet parameter values; id or code
inputDataElementGroupIdScheme
Identifier property used for the provided dataElementGroup parameter values; id or code
inputDataElementIdScheme
Identifier property used for the provided dataElement parameter values; id or code
inputIdScheme
General identifier property used for all object types, specific identifier schemes will override the general scheme; id or code
The following parameters from the list above are required:
Whether to compress the response payload; none, gzip or zip
attachment
File name to use for the response, a non-blank value indicates rendering the response as an attachment.
The following parameters from the list above are required:
either dataSet or dataElementGroup (for ADX this must be dataSet)
either period, both startDate and endDate, lastUpdated, or lastUpdatedDuration
either orgUnit or orgUnitGroup
支持以下响应格式:
xml(应用项目/ xml)
The following parameters from the list above are required:
csv(应用项目/ csv)
adx(应用项目/ adx + xml)
假设我们已经根据 上一节称为 发送数据值 我们现在可以放在一起 我们对单个数据值集的请求并使用 cURL 请求它:
curl "https://play.dhis2.org/demo/api/dataValueSets?dataSet=pBOMPrpg1QX&period=201401&orgUnit=DiszpKrYNg8"
-H "Accept:application/xml" -u admin:district
我们还可以使用开始和结束日期查询参数来请求一个 大量的数据值。 IE。您还可以请求数据值 多个数据集和组织单位以及一个时间跨度以便导出 更大的数据块。请注意,期间查询参数采用 优先于开始和结束日期参数。一个例子看起来像 这:
```bash curl "https://play.dhis2.org/demo/api/dataValueSets?dataSet=pBOMPrpg1QX&dataSet=BfMAe6Itzgt &startDate=2013-01-01&endDate=2013-01-31&orgUnit=YuQRtpLP10I&orgUnit=vWbkYPRmKyS&children=true" -H "Accept:application/xml" -u admin:district
- 检索已创建或更新的数据值
过去 10 天,您可以提出这样的请求:
/ api / dataValueSets?dataSet = pBOMPrpg1QX&orgUnit = DiszpKrYNg8&lastUpdatedDuration = 10d
- A robust measure of the spread of data values, calculated as the median of the absolute deviations from the median.
- ```xml
<?xml version='1.0' encoding='UTF-8'?>
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="pBOMPrpg1QX"
completeDate="2014-01-02" period="201401" orgUnit="DiszpKrYNg8">
<dataValue dataElement="eY5ehpbEsB7" period="201401" orgUnit="DiszpKrYNg8"
categoryOptionCombo="bRowv6yZOF2" value="10003"/>
<dataValue dataElement="Ix2HsbDMLea" period="201401" orgUnit="DiszpKrYNg8"
categoryOptionCombo="bRowv6yZOF2" value="10002"/>
<dataValue dataElement="f7n9E0hX8qk" period="201401" orgUnit="DiszpKrYNg8"
categoryOptionCombo="bRowv6yZOF2" value="10001"/>
</dataValueSet>
/api/dataValueSets.json?dataSet=pBOMPrpg1QX&period=201401&orgUnit=DiszpKrYNg8
{
"dataSet": "pBOMPrpg1QX",
"completeDate": "2014-02-03",
"period": "201401",
"orgUnit": "DiszpKrYNg8",
"dataValues": [
{
"dataElement": "eY5ehpbEsB7",
"categoryOptionCombo": "bRowv6yZOF2",
"period": "201401",
"orgUnit": "DiszpKrYNg8",
"value": "10003"
},
{
"dataElement": "Ix2HsbDMLea",
"categoryOptionCombo": "bRowv6yZOF2",
"period": "201401",
"orgUnit": "DiszpKrYNg8",
"value": "10002"
},
{
"dataElement": "f7n9E0hX8qk",
"categoryOptionCombo": "bRowv6yZOF2",
"period": "201401",
"orgUnit": "DiszpKrYNg8",
"value": "10001"
}
]
}
请注意,数据值是软删除的,即删除的值具有 deleted 属性设置为 true 而不是被永久删除。 这在集成多个系统以进行通信时很有用 删除。您可以在响应中包含已删除的值,如下所示:
/api/dataValueSets.json?dataSet=pBOMPrpg1QX&period=201401
&orgUnit=DiszpKrYNg8&includeDeleted=true
您还可以请求CSV格式的数据,如下所示:
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| Any delete operation will require the authority Perform maintenance tasks. | ```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" | ||
| ] | ||
| } | ||
| ``` | / api / 33 / system / flags | |
| E7228 | ```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. | ```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" | ||
| ] | ||
| } | ||
| ``` | / api / 33 / system / taskSummaries / {task-category-id} | |
| 描述 | Program notification template | 发送,读取和删除单个数据值 { #webapi_sending_individual_data_values } |
| ```bash | ||
| GET /api/33/completeDataSetRegistrations?dataSet=pBOMPrpg1QX | ||
| &startDate=2014-01-01&endDate=2014-01-31&orgUnit=YuQRtpLP10I | ||
| &orgUnit=vWbkYPRmKyS&children=true | ||
| ``` | POST /api/dataValues | 此资源支持以下查询参数: |
| 本节说明如何取消注册数据的完整性 | ||
| 放。要取消完成数据集,您将与 | ||
| completeDataSetRegistrations 资源: | 查询参数 | 需要 |
| Table: Query parameters | Program notification template | 是的 |
| 日期时间 | Program notification template | 是的 |
| 描述 | Program notification template | 是的 |
| Table: Program Stage Query Criteria | Program notification template | 不 |
Category option combo identifier, default will be used if omitted
cc
No (must be combined with cp)
Attribute category combo identifier
cp
No (must be combined with cc)
Attribute category option identifiers, separated with ; for multiple values
不
Data set, to check if POST or DELETE is allowed for period and organisation unit. If specified, the data element must be assigned to this data set. If not specified, a data set containing the data element will be chosen to check if the operation is allowed.
价值
不
Data value. For boolean values, the following will be accepted: true | True | TRUE | false | False | FALSE | 1 | 0 | t | f |
comment
不
跟进
不
Follow up on data value, will toggle the current boolean value 如果给定的任何标识符无效,如果数据值或 评论无效或如果数据被锁定,响应将包含 409 Conflict 状态代码和描述性文本消息。如果 操作导致保存或更新的值,200 OK 将被返回。 请求的示例如下所示:
```bash curl "https://play.dhis2.org/demo/api/dataValues?de=s46m5MS0hxu &pe=201301&ou=DiszpKrYNg8&co=Prlt0C1RF0s&value=12" -X POST -u admin:district
此资源还允许使用特殊语法将值关联到
一个属性选项组合。这可以通过发送
属性类别组合的标识符,连同标识符
值代表的属性类别选项
组合。类别组合由 `cc` 参数指定,而
类别选项被指定为分号分隔的字符串,带有`cp`
范围。有必要确保类别选项都是部分
的类别组合。一个示例如下所示:
1. ```bash
curl "https://play.dhis2.org/demo/api/dataValues?de=s46m5MS0hxu&ou=DiszpKrYNg8
&pe=201308&cc=dzjKKQq0cSO&cp=wbrDrL2aYEc;btOyqprQ9e8&value=26"
-X POST -u admin:district
```bash curl "https://play.dhis2.org/demo/api/dataValues?de=s46m5MS0hxu &pe=201301&ou=DiszpKrYNg8&co=Prlt0C1RF0s" -u admin:district
3. 您可以使用 *DELETE* 方法通过请求删除数据值。
Sending individual data values as payload { #webapi_sending_individual_data_values_as_payload }
You can send individual data values as a JSON payload using the following resource using `Content-Type: application/json`.
The resource will create a new data value or update a data value if it already exists. The JSON payload format is defined below.
## ```json
{
"dataElement": "fbfJHSPpUQD",
"categoryOptionCombo": "PT59n8BQbqM",
"period": "202201",
"orgUnit": "DiszpKrYNg8",
"value": "10",
"comment": "OK"
}
The endpoint supports specifying attribute option combos in a nested structure.
{
"dataElement": "BOSZApCrBni",
"categoryOptionCombo": "TkDhg29x18A",
"attribute": {
"combo": "O4VaNks6tta",
"options": [
"C6nZpLKjEJr", "i4Nbp8S2G6A"
]
},
"dataSet": "lyLU2wR22tC",
"period": "202201",
"orgUnit": "DiszpKrYNg8",
"value": "15",
"comment": "Good"
}
如果数据值已成功保存或更新,则状态代码将为201 Created,如果存在验证错误,则状态代码将为409 Conflict。
处理具有 file 类型数据元素的数据值时 与上述方法存在一些偏差。这些数据 值的特殊之处在于值的内容是一个 UID 引用 到 FileResource 对象而不是自包含常量。这些 数据值的行为就像其他存储文本的数据值一样 内容,但应以不同方式处理以产生 有意义的输入和输出。
Upload the file to the /api/dataValues/file endpoint as
described in the file resource section. This works on versions 2.36 and later.
If you are writing code that needs to be compatible
如所述将文件上传到 /api/fileResources 端点
在文件资源部分。
| Retrieve the id property of the returned file resource. | Store the retrieved identifier using the value property of the data value using any | 上面描述的方法。 | 数据值和文件资源之间只有一对一的关系 允许。这是在内部强制执行的,以便保存文件资源 ID 在多个数据值中是不允许的,并且会返回错误。删除 数据值将删除引用的文件资源。直接删除 的文件资源是不可能的。 | |---|---|---|---| | 数据值现在可以作为除返回数据以外的任何其他值进行检索 将是文件资源的 UID。为了检索实际 内容(意味着存储在映射的文件资源中的文件 到数据值)必须向 /api/dataValues/files 发出 GET 请求 镜像查询参数,因为它们将用于数据值 本身。 /api/dataValues/files 端点仅支持 GET 请求。 | 值得注意的是,由于底层存储机制工作 异步文件内容可能不会立即准备好 从/api/dataValues/files 端点下载。这是特别真实的 对于可能需要耗时上传的大文件 外部文件存储的背景(取决于系统 配置)。从文件资源元数据中检索 /api/fileResources/ <id> 端点允许检查 storageStatus 在尝试下载内容之前。 | Oct 04 2017-Oct 10-2017 | From version 2.20 we have included support for an international standard for aggregate data exchange called ADX. ADX is developed and maintained by the Quality Research and Public Health committee of the IHE (Integrating the HealthCare Enterprise). The wiki page detailing QRPH activity can be found at wiki.ihe.net. ADX is still under active development and has now been published for trial implementation. Note that what is implemented currently in DHIS2 is the functionality to read and write ADX formatted data, i.e. what is described as Content Consumer and Content Producer actors in the ADX profile. | | ADX 数据消息的结构与您可能的结构非常相似 从前面描述的 DXF 2 数据中已经熟悉了。有一个 几个重要的区别。我们将描述这些差异 参考一个小例子: | Unlike dxf2, ADX requires that the datavalues are grouped according to orgUnit, period and dataSet. The example above shows a data report for the "(TB/HIV) VCCT" dataset from the online demo database. This example is using codes as identifiers instead of dhis2 uids. Codes are the preferred form of identifier when using ADX. | The ADX root element { #the-adx-root-element } | The ADX root element has only one mandatory attribute, which is the exported timestamp. In common with other ADX elements, the schema is extensible in that it does not restrict additional application specific attributes. | | The ADX group element { #the-adx-group-element } | Unlike dxf2, ADX requires that the datavalues are grouped according to orgUnit, period and dataSet. The example above shows a data report for the "(TB/HIV) VCCT" dataset from the online demo database. This example is using codes as identifiers instead of dhis2 uids. Codes are the preferred form of identifier when using ADX. | The orgUnit, period and dataSet attributes are mandatory in ADX. The group element may contain additional attributes. In our DHIS2 implementation any additional attributes are simply passed through to the underlying importer. This means that all attributes which currently have meaning in dxf2 (such as completeDate in the example above) can continue to be used in ADX and they will be processed in the same way. | A significant difference between ADX and dxf2 is in the way that periods are encoded. ADX makes strict use of ISO8601 and encodes the reporting period as (date|datetime)/(duration). So the period in the example above is a period of 1 month (P1M) starting on 2015-06-01. So it is the data for June 2015. The notation is a bit more verbose, but it is very flexible and allows us to support all existing period types in DHIS2 | | ADX期间定义 { #adx-period-definitions } | Unlike dxf2, ADX requires that the datavalues are grouped according to orgUnit, period and dataSet. The example above shows a data report for the "(TB/HIV) VCCT" dataset from the online demo database. This example is using codes as identifiers instead of dhis2 uids. Codes are the preferred form of identifier when using ADX. | Table: ADX Periods | 期间类型 | | Duration notation | Unlike dxf2, ADX requires that the datavalues are grouped according to orgUnit, period and dataSet. The example above shows a data report for the "(TB/HIV) VCCT" dataset from the online demo database. This example is using codes as identifiers instead of dhis2 uids. Codes are the preferred form of identifier when using ADX. | Duration(s) | 日常 | | P1D | Unlike dxf2, ADX requires that the datavalues are grouped according to orgUnit, period and dataSet. The example above shows a data report for the "(TB/HIV) VCCT" dataset from the online demo database. This example is using codes as identifiers instead of dhis2 uids. Codes are the preferred form of identifier when using ADX. | Oct 01 2017 | Weekly | | P7D | 2017-10-02/P7D | Oct 02 2017-Oct 08-2017 | Weekly Wednesday | | P7D | 2017-10-04/P7D | Oct 04 2017-Oct 10-2017 | Weekly Thursday | | P7D | 2017-10-05/P7D | Oct 05 2017-Oct 011-2017 | Weekly Saturday | | P7D | 2017-10-07/P7D | Oct 07 2017-Oct 13-2017 | Weekly Sunday | | P7D | 2017-10-01/P1M | Oct 01 2017-Oct 07-2017 | Bi-weekly | | P14D | 2017-10-01/P1M | Oct 02 2017-Oct 15 2017 | Monthly | | P1M | 2017-10-01/P1M | Oct 01 2017-Oct 31 2017 | 双月刊 | | P2M | 2017-01-01/P6M
2017-07-01/P6M | Nov 01 2017-Dec 31 2017 | Quarterly | | P3M | 2017-01-01/P6M
2017-07-01/P6M | Sep 01 2017-Dec 31 2017 | Six-monthly | | P6M | 2017-01-01/P6M
2017-07-01/P6M | Jan 01 2017-Jun 30 2017
Jul 01 2017-Dec 31 2017 | Six-monthly April | | P6M | 2017-01-01/P6M
2017-07-01/P6M | Apr 01 2017-Sep 30 2017
Oct 01 2017-Mar 31 2018 | Six-monthly November | | P6M | 2017-01-01/P6M
2017-07-01/P6M | Nov 01 2017-Apr 30 2018
May 01 2018-Oct 31 2018 | Yearly |
2017-01-01/P1Y
Jan 01 2017-Dec 31 2017
Financial April
P1Y
2017-04-01/P1Y April 1 2017-Mar 31 2018
Financial July P1Y 2017-07-01/P1Y July 1 2017-June 30 2018
Financial October
P1Y
Oct 01 2017-Sep 30 2018
Financial November
P1Y
Nov 01 2017-Oct 31 2018
ADX Data values { #adx-data-values }
The dataValue element in ADX is very similar to its equivalent in DXF. The mandatory attributes are dataElement and value. The orgUnit and period attributes don't appear in the dataValue as they are required at the group level.
represented. DXF uses the categoryOptionCombo to indicate the disaggregation of data. In ADX the disaggregations (e.g. AGE_GROUP and SEX) are expressed explicitly as attributes. If you use code as the id scheme for category, not that you must assign a code to all the categories used for dataElements in the dataSet, and further, that code must be of a form which is suitable for use as an XML attribute. The exact constraint on an XML attribute name is described in the W3C XML standard - in practice, this means no spaces, no non-alphanumeric characters other than '_' and it may not start with a letter. The example above shows examples of 'good' category codes ('GENDER' and 'HIV_AGE'). The same restrictions apply if you use name or attribute as id schemes.
In ADX, only category identifiers are used as XML attributes; identifiers for other metadata types do not have to be usalbe as XML attributes. Note that this syntax is not enforced by DHIS2 when you are assigning names, codes, or DHIS2 attributes, but you will get an informative error message if you try to import ADX data and the category identifiers are either not assigned or not suitable.
那
生成数据的系统不必与
DHIS2 中的 categoryOptionCombo。
生产者和消费者可以将他们的代码与第三方进行匹配
权威来源,例如 vterminology 服务。请注意,在
上面的性别和年龄组代码示例使用的是代码列表
来自世卫组织全球卫生观察站。
Note that this feature may be extremely useful, for example when producing disaggregated data from an EMR system, but there may be cases where a categoryOptionCombo mapping is easier or more desirable. The DHIS2 implementation of ADX will check for the existence of a categoryOptionCombo attribute and, if it exists, it will use that in preference to exploded dimension attributes. Similarly, an attributeOptionCombo attribute on the group element will be processed in the legacy way. Otherwise, the attributeOptionCombo can be treated as exploded categories just as on the dataValue.
In the simple example above, each of the dataElements in the dataSet have the same dimensionality (categorycombo) so the data is neatly rectangular. This need not be the case. dataSets may contain dataElements with different categoryCombos, resulting in a ragged-right ADX data message (i.e. values for different dataElements may have different numbers of categories.)
Importing ADX data { #importing-adx-data }
DHIS2 exposes an endpoint for POST ADX data at /api/dataValueSets using application/xml+adx as content type. So, for example, the following curl command can be used to POST the example data above to the DHIS2 demo server:
curl -u admin:district -X POST -H "Content-Type: application/adx+xml"
-d @data.xml "https://play.dhis2.org/demo/api/dataValueSets?dataElementIdScheme=code&orgUnitIdScheme=code"
Note the query parameters are the same as are used with DXF data. The ADX endpoint should interpret all the existing DXF parameters with the same semantics as DXF.
Exporting ADX data { #exporting-adx-data }
DHIS2 exposes an endpoint to GET ADX data sets at /api/dataValueSets using application/xml+adx as the accepted content type. So, for example, the following curl command can be used to retrieve the ADX data:
curl -u admin:district -H "Accept: application/adx+xml" "https://play.dhis2.org/demo/api/dataValueSets?dataValueSets?orgUnit=M_CLINIC&dataSet=MALARIA&period=201501"
## Note the query parameters are the same as are used with DXF data. An
important difference is that the identifiers for dataSet and orgUnit may
be either uids or codes.
后续行动 { #webapi_follow_up }
本节介绍了后续的标记数据。
数据值跟踪 { #data-value-follow-up }
数据值跟踪端点允许标记数据值以进行跟踪。
The payload in `JSON` format looks like this:
```json
{
"dataElement": "s46m5MS0hxu",
"period": "202005",
"orgUnit": "DiszpKrYNg8",
"categoryOptionCombo": "psbwp3CQEhs",
"attributeOptionCombo": "HllvX50cXC0",
"followup": true
}
The categoryOptionCombo and attributeOptionCombo fields are optional. A minimal JSON payload looks like this:
| json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | Parameter name | |---|---| | 如果操作成功,响应状态代码将为200 OK,如果请求出错,则响应状态代码为409 Conflict。 | /api/analytics/events/query/IpHINAT79UW?stage=A03MvHHogjR&startDate=2016-03-01 &endDate=2016-12-31&dimension=ou:O6uvpzGd5pu&dimension=UXz7xuGCEhU:GT:2000 | | PUT /api/dataValues/followups | /api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31 &dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&desc=EVENTDATE&asc=qrur9Dvnyt5 | | json { "values": [ { "dataElement": "s46m5MS0hxu", "period": "202005", "orgUnit": "DiszpKrYNg8", "categoryOptionCombo": "psbwp3CQEhs", "attributeOptionCombo": "HllvX50cXC0", "followup": true } ] } | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 | | Bulk update equally confirms with a 200 OK on success or returns a 409 Conflict in case of input errors. | 您可以使用以下方法过滤多个特定年龄的“年龄”数据元素 像这样的 IN 运算符: | | 验证方式 { #webapi_validation } | 字符串、布尔值、整数、浮点、集合(检查大小)、日期 | | GET /api/33/validation/dataSet/QX4ZTUbOt3a.json?pe=201501&ou=DiszpKrYNg8 | Filter by AGE is not null | | 第一个路径变量是引用数据集的标识符 证实。支持 XML 和 JSON 资源表示。这 响应包含违反验证规则。这将延长 在即将到来的版本中有更多的验证类型。 | 要检索与特定数据集相关的验证规则, 意思是所有数据元素都是一部分的带有公式的验证规则 的特定数据集,您可以向 validationRules 资源如下: | | GET /api/validationRules?dataSet=
Table: Operators
值
描述
equal_to
| json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | Parameter name | |---|---| | Not equal to | greater_than | | Greater than | greater_than_or_equal_to | | Greater than or equal to | less_than |
less_than_or_equal_to
Less than or equal to
compulsory_pair If either side is present, the other must also be
exclusive_pair If either side is present, the other must not be
左边和右边的表达式是数学表达式 其中可以包含对数据元素和类别选项的引用 以下格式的组合: $ {
左侧和右侧表达式有一个 missing 值 战略。这是指系统应该如何处理数据值 缺少数据元素/类别选项组合引用 在公式中是否应该检查验证规则 为有效性或跳过。有效的缺失值策略见于 下表。
值
描述
SKIP_IF_ANY_VALUE_MISSING
Skip validation rule if any data value is missing
SKIP_IF_ALL_VALUES_MISSING
Validation results { #webapi_validation_results }
验证结果是在执行期间发现的违规的持久结果 验证分析。如果您在开始时选择“持久结果”或 安排验证分析,发现的任何违规将存储在 数据库。当结果存储在数据库中时,它将被使用 对于 3 件事:
根据存储的结果生成分析。
未生成通知的持久结果将这样做,
一次。
跟踪结果是否产生了
通知。
跳过运行时已经检查过的规则
这意味着如果你不坚持你的结果,你将无法 为验证结果生成分析,如果选中,结果将 每次找到并运行验证时生成通知 分析可能会更慢。
Query validation results { #query-validation-results }
持久化的验证结果可以在下面查看 端点:
您还可以使用验证结果 ID 检查单个结果 在这个端点:
GET /api/33/validationResults/<id>
验证结果也可以通过以下属性过滤:
组织单位:ou = <UID>
验证规则:vr = <UID>
pe = <ISO-expression>对于时段过滤器,匹配结果必须与任何指定的时段重叠。
此外,验证结果还可以按其创建日期进行过滤:
GET /api/36/validationResults?createdDate=<date>
该过滤器可以与其他任何过滤器结合使用。
Trigger validation result notifications { #trigger-validation-result-notifications }
Validation results are sent out to the appropriate users once every day, but can also be manually triggered to run on demand using the following API endpoint:
POST / api / 33 / validation / sendNotifications
Delete validation results { #delete-validation-results }
验证结果可以通过ID手动删除,
删除/ api / 36 / validationResults / <id>
ou = <UID>以匹配组织单位的所有验证结果;提供多个参数时,多个单元组合或
vr = <UID>以匹配验证规则的所有验证结果;提供多个参数时,多个规则组合或Start date for the timespan
| eventCreatedPeriod | Parameter name | Accept: application/json | Attribute identifiers | | --------------- | ------------------------------------------------------------ | --------- | ----------------------------------------- | | Table: Query parameters | DELETE /api/36/validationResults?ou=NqwvaQC1ni4&pe=2020Q1 | Follow-up data analysis | 要基于最小/最大值来识别数据离群值: | | Any delete operation will require the authority Perform maintenance tasks. | 支持的查询参数等于基于 std dev 的异常值 上面描述的分析*资源。 | Follow-up data analysis | 组合维度。相反,响应将包含项目 | | dueDate | At least one data set or data element, start date and end date or period, and at least one organisation unit must be defined. | 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" ] } | Parameter | | lastUpdatedDate | 请求查询参数 { #request-query-parameters } | 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" ] } | Parameter | | Filter on whether the current user can manage the returned users through the managed user group relationships. | 强制的 | 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 / 36 / outlierDetection?ds = BfMAe6Itzgt&ds = QX4ZTUbOt3a &ou = O6uvpzGd5pu&ou = fdc6uOvgoji&startDate = 2020-01-01&endDate = 2020-12-31 &algorithm = MIN_MAX | | Date used as basis for relative periods. | 不 [] | Program notification template | z_score、min_max、mod_z_score、invalid_numeric`。 | | Organisation unit, organisation unit level or groups (can be combined) | 不 [] | Program notification template | 开始日期 | | 间隔的开始日期,以检查异常值。 | 是的 | Program notification template | Parameter | | 检查异常值的时间间隔的结束日期。 | 是的 | Program notification template | Parameter | | End date for interval to check for outliers | 是的| Program notification template | 算法 | | Sort the records on the value column | 不 [] | Program notification template | 临界点 |
Threshold for outlier values. Z_SCORE and MOD_Z_SCORE algorithm only.
不
数值,大于零。默认值:3.0。
Start date for interval for mean and std dev calculation. Z_SCORE and MOD_Z_SCORE algorithm only.
不
日期(yyyy-MM-dd)。
dataEndDate
End date for interval for mean and std dev calculation. Z_SCORE and MOD_Z_SCORE algorithm only.
不
日期(yyyy-MM-dd)。
订购
Field to order by. Z_SCORE and MOD_Z_SCOREalgorithm only.
不
MEAN_ABS_DEV,Z_SCORE
maxResults
不
Integer, greater than zero and less than system setting keyDataQualityMaxLimit Default: 500. | [*] You must specify either data sets with the ds parameter, which will include all data elements in the data sets, or specify data elements with the de parameter. |
|---|---|
| 数据存储 { #data-store } | The startDate and endDate parameters are mandatory and refer to the time interval for which you want to detect outliers. The dataStartDate and dataEndDate parameters are optional and refer to the time interval for the data to use when calculating the mean and std dev, which are used to eventually calculate the z-score. |
| 使用特定项目和组织单位查询所有事件: | 使用默认的z分数算法获取异常值: |
GET / api / 36 / outlierDetection?ds = BfMAe6Itzgt&ds = QX4ZTUbOt3a
&ou = O6uvpzGd5pu&ou = fdc6uOvgoji&startDate = 2020-01-01&endDate = 2020-12-31
| 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: | Parameter name | | ---------- | ------------------------------------------------------------ | | Any delete operation will require the authority Perform maintenance tasks. | 组合维度。相反,响应将包含项目 | | 获取前10个离群值: | GET / api / 36 / outlierDetection?ds = BfMAe6Itzgt &ou = O6uvpzGd5pu&startDate = 2020-01-01&endDate = 2020-12-31 &maxResults = 10 | | E7228 | GET / api / 36 / outlierDetection?ds = BfMAe6Itzgt &ou = O6uvpzGd5pu&startDate = 2020-01-01&endDate = 2020-12-31 &dataStartDate = 2018-01-01&dataEndDate = 2020-12-31 | | Filter on whether the current user can manage the returned users through the managed user group relationships. | GET / api / 36 / outlierDetection?ds = BfMAe6Itzgt&ds = QX4ZTUbOt3a &ou = O6uvpzGd5pu&ou = fdc6uOvgoji&startDate = 2020-01-01&endDate = 2020-12-31 &algorithm = MIN_MAX | | 回应格式 { #response-format } | 支持以下响应格式。 | | 数据元素,可以多次指定。 | API格式 | | JSON格式 | / api / 36 / outlierDetection.json或Accept:application / json(默认格式) | | 可选类别组合 | / api / 36 / outlierDetection.csv或接受:application / csv | | 响应包含以下字段: | 领域 | | 日期时间 | 德 | | Response { #webapi_analytics_outlier_detection_response } | 取消命名 | | 数据元素名称。 | 聚乙烯 | | 期间ISO标识符。 | 欧 | | 组织单位标识符。 | ouName | | 组织单位名称。 | 可可 | | 类别选项组合标识符。 | cocName | | Table: Program Stage Query Criteria | 冠捷 |
属性选项组合标识符。
aocName
属性选项组合名称。
数据值。
| json(应用项目/ json) | Validation report |
|---|---|
| https://www.statisticshowto.com/probability-and-statistics/z-score/ | 标准偏差。 |
| modifiedzscore | 对于z得分,与均值的绝对偏差。对于最小-最大,与最小或最大边界的绝对偏差。 |
| https://www.statisticshowto.com/modified-z-scores/ | Z分数。仅Z分数算法。 |
| medianabsdeviation | 默认响应使用单个 count 列进行标准化。通过使用 columns 查询参数指定至少一个组织单位组集,可以在表格布局中呈现响应。 |
| https://math.stackexchange.com/questions/2232309/median-absolute-deviation-mad-formula | 上限。 |
| lowerbound | 数据值是否标记为后续。 |
| Maximum | 响应将与此类似。 元数据部分包含请求和响应的元数据。 outlierValues 部分包含异常值。 |
| The maximum is the largest value in a dataset. It represents the highest observed value among all the data values. | 约束与验证 { #constraints-and-validation } |
| All error messages are delivered with http status code 409. | 错误代码 |
E2200
必须至少指定一个数据元素
必须指定开始日期和结束日期
E2202
persist
E2203
| eventCreatedPeriod | Parameter name | Validation rule | 检索和删除项目通知模板 | 仪表板资源将提供仪表板列表。请记住 仪表板对象是共享的,因此列表将受 当前已验证的用户。您可以检索有关一个的更多信息 特定的仪表板,请点击其链接,类似于: | |---|---|---|---| | E2206 | Indicator type | Response format | subjectTemplate | E2208 | | Filter on whether the current user can manage the returned users through the managed user group relationships. | 类别 | Response format |Tracked Entity UIDS | | | dueDate | 要运行验证规则并检索违规: | ds | subjectTemplate | 昨天 | | lastUpdatedDate | 描述 | ds | subjectTemplate | 昨天 | | vrg | Validation rule group | 假 | subjectTemplate | subjectTemplate | | 欧 | 组织单位 | 假 | subjectTemplate | subjectTemplate | | Sort the records on the value column | Date (yyyy-MM-dd) | 假| subjectTemplate | 500 |
结束日期
End date for the time span
假
Today
persist
Whether to persist violations in the system
| eventCreatedPeriod | Parameter name | Validation rule |
|---|---|---|
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 类别 | Response format |
| dueDate | 假 | query |
| lastUpdatedDate | Integer, greater than zero. Maximum as specified by system setting keyDataQualityMaxLimit | query |
| Table: Query parameters | ```json | |
| { | ||
| "startDate":"2024-01-01", | ||
| "endDate":"2025-04-10", | ||
| "ou":"ImspTQPwCqd", | ||
| "notification":false, | ||
| "persist":false, | ||
| "vrg":"UP1lctvalPn", | ||
| "maxResults": 500 | ||
| } |
Sample output:
[{
"validationRuleId": "kgh54Xb9LSE",
"validationRuleDescription": "Malaria outbreak",
"organisationUnitId": "DiszpKrYNg8",
"organisationUnitDisplayName": "Ngelehun CHC",
"organisationUnitPath": "/ImspTQPwCqd/O6uvpzGd5pu/YuQRtpLP10I/DiszpKrYNg8",
"organisationUnitAncestorNames": "Sierra Leone / Bo / Badjia / ",
"periodId": "201901",
"periodDisplayName": "January 2019",
"attributeOptionComboId": "HllvX50cXC0",
"attributeOptionComboDisplayName": "default",
"importance": "MEDIUM",
"leftSideValue": 10.0,
"operator": ">",
"rightSideValue": 14.0
}, {
"validationRuleId": "ZoG4yXZi3c3",
"validationRuleDescription": "ANC 2 cannot be higher than ANC 1",
"organisationUnitId": "DiszpKrYNg8",
"organisationUnitDisplayName": "Ngelehun CHC",
"organisationUnitPath": "/ImspTQPwCqd/O6uvpzGd5pu/YuQRtpLP10I/DiszpKrYNg8",
"organisationUnitAncestorNames": "Sierra Leone / Bo / Badjia / ",
"periodId": "201901",
"periodDisplayName": "January 2019",
"attributeOptionComboId": "HllvX50cXC0",
"attributeOptionComboDisplayName": "default",
"importance": "MEDIUM",
"leftSideValue": 22.0,
"operator": "<=",
"rightSideValue": 19.0
}]
``` | Response format |
| 根据平均值的标准偏差识别数据异常值
价值: | GET /api/dataAnalysis/stdDevOutlier | 支持以下查询参数: |
### Table: Standard deviation outlier analysis query parameters
查询参数
描述
选项
### 欧
组织单位
ID
开始日期
Start date for the timespan
| 默认值 | Parameter name | ```
Accept: application/json
``` | Attribute identifiers |
| ---------- | ------------------------------------------------------------ | --------- | ----------------------------------------- |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 强制的 | ```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 / 36 / outlierDetection?ds = BfMAe6Itzgt&ds = QX4ZTUbOt3a
&ou = O6uvpzGd5pu&ou = fdc6uOvgoji&startDate = 2020-01-01&endDate = 2020-12-31
&algorithm = MIN_MAX
``` |
| Table: Query parameters | ```
DELETE /api/36/validationResults?ou=NqwvaQC1ni4&pe=2020Q1
``` | Follow-up data analysis | 要基于最小/最大值来识别数据离群值: |
| Any delete operation will require the authority _Perform maintenance tasks_. | 支持的查询参数等于基于 *std dev 的异常值
上面描述的分析*资源。 | Follow-up data analysis | 组合维度。相反,响应将包含项目 |
| dueDate | At least one data set or data element, start date and end date or period, and at least one organisation unit must be defined. | Follow-up data analysis | Parameter |
| lastUpdatedDate | 请求查询参数 { #request-query-parameters } | Follow-up data analysis | Parameter |
| E7228 | 是的 | Follow-up data analysis | ds |
| 数据集,可以多次指定。 | 不 [*] | Follow-up data analysis | 德 |
| 数据元素,可以多次指定。 | 不 [*] | Program notification template | 开始日期 |
| Sort the records on the value column | 不 [*] | Program notification template | 结束日期 |
检查异常值的时间间隔的结束日期。
不 [*]
日期(yyyy-MM-dd)。
## 聚乙烯
ISO period ID.
### 不 [*]
Period ISO ID.
peType
ISO period.
不 [*]
Period ISO string.
可可
| Category option combos, can be specified multiple times. | Parameter name |
| -------- |-------------------------------------------------------------------------------------------------------------------------------|
| Category option combo identifier. | maxResults |
| 输出的最大限制。 | 不 |
| Integer, greater than zero. Default: 50. | [*] You must specify either data sets with the `ds` parameter, which will include all data elements in the data sets, _or_ specify data elements with the `de` parameter.
Equally, either `startDate` and `endDate` _or_ `period` must be specified. |
| The `startDate` and `endDate` parameters refer to the time interval for which you want to detect outliers.
If a period `pe` is provided instead the interval start and end is that of the period. | 如果未提供选项组合`coc`,则考虑所有数值类型的数据元素。 |
数据的完整性 { #webapi_data_integrity }
数据管理模块的数据完整性功能通过网络应用项目接口提供。
可通过网络 API 使用。本节介绍如何运行
数据完整性流程和检索结果。具体
详细信息请参阅用户手册。
Listing the available data integrity checks { #webapi_data_integrity_list }
A description of the available checks is returned by a request to:
GET /api/dataIntegrity
The `name` member of the returned check elements is the identifier used for the
`checks` parameter to declare the set of checks to run.
> **Note**
>
> Each check will indicate whether it may require significant time and resources to complete with the `isSlow` field.
> Users should be cautious about running these
> checks on production systems as they could lead to decreased performance.
> These checks can be run individually, but will
> not be run unless specifically requested.
Checks are grouped semantically by the `section` member and categorised in
one of four `severity` levels:
Severity
描述
### INFO
Indicates that this is for information only.
- WARNING
- A warning indicates that this may be a problem, but not necessarily an error. It is however recommended to triage these issues.
SEVERE
An error that should be fixed but which may not necessarily lead to the system not functioning.
CRITICAL
An error that must be fixed and which may lead to end-user error or system crashes.
The available checks can be filtered using the `checks` parameter.
GET /api/dataIntegrity?checks=<pattern1>,<pattern2>
One or more exact names or patterns using `*` as a wildcard can be provided.
Additional results can be filtered using a `section` parameter.
GET /api/dataIntegrity?section=Categories
The `section` filter will return all exact matches which have the specified section.
Furthermore, to filter (select) only checks marked as `isSlow` use `slow=true`,
GET /api/dataIntegrity?slow=true
或仅过滤(选择)不通过数据库查询执行的检查
(项目化检查)使用 `programmatic=true`:
GET /api/dataIntegrity?programmatic=true
The `slow`, `programmatic` and `section` filters can be combined in which case
all conditions must be met.
Running data integrity summaries { #webapi_data_integrity_run_summary }
Since version 2.38, data integrity checks have two levels of specificity:
a `summary` level that provides an overview of the number of issues
a `details` level that provides a list of issues pointing to individual data integrity violations.
To trigger a summary analysis for a set of checks run:
### POST /api/dataIntegrity/summary?checks=<name1>,<name2>
这将触发一个异步运行检查的作业。单个检查结果
将在检查完成后立即返回应用项目缓存。
Alternatively the list of checks can also be given as BODY of the POST request.
This can be useful if the list becomes to long to be used in the URL.
- To fetch the data integrity summary of the triggered check(s) use:
- GET /api/dataIntegrity/summary?checks=<name1>,<name2>
- When the `checks` parameter is omitted, all checks are fetched from the server cache.
The response is a "map" of check results, one for each check that has completed already.
This information is cached for one hour or until the check is rerun.
To wait for the summary to be available in the cache a `timeout` in milliseconds can be added:
GET /api/dataIntegrity/summary?checks=<name1>,<name2>&timeout=500
### An example of a summary response could look like:
```json
{
"<name1>": {
"name": "<name1>",
"displayName": "<displayName1>",
"startTime": "2023-01-11T06:12:56.436",
"finishedTime": "2023-01-11T06:12:57.021",
"section": "...",
"severity": "WARNING",
"description": "...",
"count": 12,
"percentage": 2.3
},
"<name2>": {
"name": "<name2>",
"displayName": "<displayName2>",
"startTime": "2023-01-11T06:12:57.345",
"finishedTime": "2023-01-11T06:12:58.007",
"section": "...",
"severity": "WARNING",
"description": "...",
"count": 4,
"percentage": 5.1
}
}
Each summary response will contain the name, section, severity, description and optionally an introduction and recommendation.
Each summary contains the number of issues found in the count field. When possible, an optional percentage field will provide the percentage of objects with data integrity issues when compared to all objects of the same type. The startTime field indicates when the check was initiated. Using the finishedTime the duration which was required to execute the check can be calculated.
Should a check analysis fail due to programming error or unforeseen data inconsistencies both the summary and the details will have an error field describing the error that occurred. The count of any checks which failed will be set to -1. No percentage will be returned in such cases.
{
"<name1>": {
"name": "<name1>",
"displayName": "<displayName1>",
"finishedTime": "2022-02-15 14:55",
"section": "...",
"severity": "WARNING",
"description": "...",
"error": "what has happened",
"issues": []
}
}
Note
Each metadata check is run asynchronously on the server. Results will be returned as soon as each check completes. The safest way to ensure that you have retrieved the latest set of results which has been requested is to compare the timestamp of when the request was made with the
finishedTimein the response.
To get a list of the names of checks that are currently being performed by the server use:
GET /api/dataIntegrity/summary/running
To get a list of the names of checks for which results are available already use:
GET /api/dataIntegrity/summary/completed
Retrieving completed checks as Prometheus metrics {#webapi_data_integrity_metrics}
Metadata integrity checks which are present in the cache, can be retrieved in the Prometheus metrics format by making a request to : GET /api/dataIntegrity/metrics
The response should return a plain text format in the Prometheus plain text exposition format. Several metrics are available for each data integrity check.
Count: A count of the number of issues identified by the metadata check.
Percentage: When available, provides a percentage of the objects which have been identified by the check relative to a baseline. For instance, if check "Organisation units with trailing spaces" has a percent of 2.13, the percentage is calculated by dividing the number of organisation units with trailing spaces by the total number of organisation units. Note that this percentage may not be available for all metadata integrity checks.
An example of the output of this endpoint is provided below:
# HELP dhis_data_integrity_check_count Data integrity check counts { #help-dhis_data_integrity_check_count-data-integrity-check-counts }
# TYPE dhis_data_integrity_check_count gauge { #type-dhis_data_integrity_check_count-gauge }
dhis_data_integrity_check_count{check="orgunits_invalid_geometry"} 1
dhis_data_integrity_check_count{check="user_groups_scarce"} 0
dhis_data_integrity_check_count{check="indicator_no_analysis"} 13
# HELP dhis_data_integrity_check_percentage Data integrity check percentages { #help-dhis_data_integrity_check_percentage-data-integrity-check-percentages }
# TYPE dhis_data_integrity_check_percentage gauge { #type-dhis_data_integrity_check_percentage-gauge }
dhis_data_integrity_check_percentage{check="orgunits_invalid_geometry"} 0.13054830287206268
dhis_data_integrity_check_percentage{check="user_groups_scarce"} 0.0
dhis_data_integrity_check_percentage{check="indicator_no_analysis"} 16.0
# HELP dhis_data_integrity_check_duration Data integrity check durations { #help-dhis_data_integrity_check_duration-data-integrity-check-durations }
# TYPE dhis_data_integrity_check_duration gauge { #type-dhis_data_integrity_check_duration-gauge }
dhis_data_integrity_check_duration{check="orgunits_invalid_geometry"} 11
dhis_data_integrity_check_duration{check="user_groups_scarce"} 1
dhis_data_integrity_check_duration{check="indicator_no_analysis"} 0
Data integrity checks which are not currently in the cache will not be returned by this endpoint. A request would need to be made to the /summary endpoint to trigger the checks to be run or alternatively through a scheduled job.
Running data integrity details { #webapi_data_integrity_run_details } - To run a selection of details checks first trigger them using a POST request: POST /api/dataIntegrity/details?checks=
When the checks parameter is not provided, all checks which have not been marked as isSlow will be scheduled to be run on the server.
peType
The /details response returns a map similar to the summary, but does not contain a count or percentage. Instead, a list of issues is returned.
{
"<name1>": {
"name": "<name1>",
"displayName": "<displayName1>",
"startTime": "2023-01-11T06:12:56.436",
"finishedTime": "2023-01-11T06:12:57.021",
"section": "...",
"severity": "WARNING",
"description": "...",
"issuesIdType": "<object-type-plural>",
"isSlow": false,
"issues": [{
"id": "<id-or-other-identifier>",
"name": "<name-of-the-id-obj>",
"comment": "optional plain text description or hint of the issue",
"refs": ["<id1>", "<id2>"]
}]
},
"<name2>": {
"name": "<name2>",
"displayName": "<displayName2>",
"startTime": "2023-01-11T06:12:57.345",
"finishedTime": "2023-01-11T06:12:58.007",
"section": "...",
"severity": "WARNING",
"description": "...",
"issuesIdType": "<object-type-plural>",
"isSlow": false,
"issues": []
}
}
Each issue will always have id and name members. Often the issuesIdType is available to indicate the type of objects the id refers to. If the issuesIdType is not available, the id often is not available either and the name is used for an aggregate key of an issue that has no object equivalent.
The comment and refs fields are optional for each issue. A comment may provide more context or insight into why this particular issue is regarded to be a data integrity problem. The refs list may also give the identifiers of other objects that contributed to the violation. The finishedTime field shows when the particular check finished processing on the server. The cache will store the result of each completed check for one hour.
Tip
A set of checks can also be specified using wild-cards. To include all checks with element in the name use
checks=*element*. Like full names such patterns can be used in a comma-separated list and be mixed with full names as well. Duplicates will be eliminated. Also a check can be given by its code. A code consists of the first letters of each word in the name as upper case letter. For example,orgunits_invalid_geometryhas the codeOIG.
Similar to the summary a set of names of the currently performed and the already completed details checks can be obtained using:
GET /api/dataIntegrity/details/running
GET /api/dataIntegrity/details/completed
Users of DHIS2 can now create and supply their own Data Integrity Checks. This can be useful if users want to avail of this functionality and extend upon the supplied set of core data integrity checks.
Tip
Users are also encouraged to share their custom checks with others by opening a pull request in the dhis2-core repository containing their
.yamlfile(s). Please selectplatform-backendas reviewer to put the PR on our radar early on. The team will take care of checking and linking the check correctly, so it becomes part of the provided suite of checks with the next release.
An example of a custom check could be for determining if certain users are members of specific user groups. This type of check would be very specific to an implementation, and not generally applicable across all installs. These types of metadata checks can be used to extend the default checks which are included with DHIS2.
Custom checks can be implemented by satisfying the following requirements, each of which we will go into detail:
| 类型 | zscore |
|---|---|
Having a directory named custom-data-integrity-checks in your DHIS2_HOME directory | Supplying your valid custom data integrity check yaml files |
| Custom Data Integrity Check List File | DHIS2 will only try to load data integrity files when they are needed. e.g. when making a call to view all |
| data integrity checks: | |
| GET /api/dataIntegrity | DHIS2 will look for a file named custom-data-integrity-checks.yaml in your DHIS2_HOME directory when loading |
| data integrity files. If you are not using custom checks and the file is not present, a warning log like this will | |
| be present: |
08:29:57.729 WARN o.h.d.d.DataIntegrityYamlReader: Failed to load data integrity check from YAML. Error message `{DHIS2_HOME}/custom-data-integrity-checks.yaml (No such file or directory)
The custom-data-integrity-checks.yaml file should list all of your custom data integrity checks. As an example, it could look something like this:
checks:
- categories/my_custom_check.yaml
- users/my_user_group_check.yaml
- base_check.yaml
above, the directory structure should look like this:
├── DHIS2_HOME
│ ├── dhis.conf
│ ├── custom-data-integrity-checks.yaml
│ ├── custom-data-integrity-checks
│ │ ├── categories
│ │ │ ├── my_custom_check.yaml
│ │ ├── users
│ │ │ ├── my_user_group_check.yaml
│ │ ├── base_check.yaml
Each data integrity check name and code must be unique. If there are any clashes then the violating custom check will not be loaded.
Note
System data integrity checks are always loaded first. Any name or code clashes resulting from custom checks will not affect these core system checks. An example data integrity check yaml file is located here for reference. Note the
nameproperty.
The data integrity code is calculated dynamically by using the first letter of each word in the name. Some examples:
名称
my_custom_check
| MCC | Skip headers in the response. | MSCC |
|---|---|---|
| displayColumnOrder | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | If there is a name clash, a warning log like this will be present: | |
| dataFilters | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | dataFilters | |
| Data Integrity Check Schema | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | ```text | |
09:48:43.136 WARN o.h.d.d.DataIntegrityYamlReader: JsonSchema validation errors found for Data Integrity Check categories/my_custom_check.yaml. Errors: [$.name: is missing but it is required] | ||
| ``` | ||
| Any schema violations must be fixed before that check can be loaded and used. | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | ```text | |
10:30:37.858 WARN o.h.d.d.DataIntegrityYamlReader: JsonSchema validation errors found for Data Integrity Check my_custom_check.yaml. Errors: [$: string found, object expected] | ||
| ``` | ||
| To view and use the custom checks please refer to the main Data Integrity section | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | Data Integrity File | |
| Details of the data integrity check yaml file, taken from the JSON schema file | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | required | |
| info | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | yes | |
| unique name of the check | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | yes | |
| 描述 | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | yes | |
| used for logical grouping of checks e.g. categories, users | A data integrity check file must comply with this JSON schema. | |
| If a check does not comply with the schema then a warning like this will be present: | yes |
summary_sql
yes
an SQL query which should return a single result which represents the total count of issues
yes
details_id_type
yes
a short string which identifies the section of the details SQL
severity
yes
level of severity of the issue. One of [INFO, WARNING, SEVERE, CRITICAL]
introduction
yes
| 默认值 | 译 | Parameter name |
|---|---|---|
| outlining how to resolve identified issues | 端点支持*POST*方法注册数据集 | |
| 完成。端点在功能上非常类似于 | ||
| dataValueSets 端点,支持批量导入完整 | ||
| 注册。 | An example of a custom check could be for determining if users have an email. Emails are useful to be | |
| able to communicate with users and sent them notifications, as well as password recovery. So, in some | ||
| instllations of DHIS2, it could be a policy that all users should have emails. An example of this type | ||
| of custom check is shown below. | ||
| programStageIdScheme | 端点支持*POST*方法注册数据集 | |
| 完成。端点在功能上非常类似于 | ||
| dataValueSets 端点,支持批量导入完整 | ||
| 注册。 | 完整的数据集注册 { #webapi_complete_data_set_registrations } | |
| End date for the time span of the values to export | 端点支持*POST*方法注册数据集 | |
| 完成。端点在功能上非常类似于 | ||
| dataValueSets 端点,支持批量导入完整 | ||
| 注册。 | 本节说明如何将数据集注册为完整。这是 | |
| 通过与 completeDataSetRegistrations 交互实现 | ||
| 资源: | ||
| 描述 | 端点支持*POST*方法注册数据集 | |
| 完成。端点在功能上非常类似于 | ||
| dataValueSets 端点,支持批量导入完整 | ||
| 注册。 | 支持导入 XML 和 JSON 格式的有效负载。这 | |
| 这个有效负载的基本格式,在这个例子中以 XML 给出,就像 | ||
| 所以: | ||
| 假 | 假 | source.target.request.categoryOptionComboIdScheme |
| 总览 | 假 | Values |
Sets import strategy, CREATE_AND_UPDATE will try and match on identifier, if it doesn't exist, it will create the object. | dataSetIdScheme | id | name | code | attribute:ID |
| Property of the data set to use to map the complete registrations. | 假 | id | name | code | attribute:ID |
| 异步导入时,会立即返回一个 Location 标头,指向 importReport 的位置。有效载荷还包含一个已创建任务的 json 对象。 | 假 | id | name | code | attribute:ID |
Property of the attribute option combos to use to map the complete registrations.
方案 id | name | code | attribute:ID
Property of all objects including data sets, org units and attribute option combos, to use to map the complete registrations.
false | true
Whether to save changes on the server or just return the import summary.
| 默认值 | Parameter name |
|---|---|
| 描述 | importStrategy |
| eventDate | Save objects of all, new or update import status on the server. |
| dueDate | false | true |
| lastUpdatedDate | async |
| GET /api/metadata/proposals?filter=status:eq:ACCEPTED | Indicates whether the import should be done asynchronous or synchronous. The former is suitable for very large imports as it ensures that the request does not time out, although it has a significant performance overhead. The latter is faster but requires the connection to persist until the process is finished. |
The idScheme, dataSetIdScheme, orgUnitIdScheme, attributeOptionComboIdScheme, | |
dryRun and strategy (note the dissimilar naming to parameter importStrategy) | |
| can also be set as part of the payload. | |
| In case of XML these are attributes, in case of JSON these are members in the | |
completeDataSetRegistrations node. | 例如: |
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} | Should both URL parameter and payload set a scheme the payload takes precedence. |
| 读取完整的数据集注册 { #webapi_reading_complete_data_sets } | 本节说明如何检索数据集完整性 |
| 注册。我们将使用 completeDataSetRegistrations | |
| 资源。要使用的查询参数如下: | |
| Table: Data value set query parameters | Parameter |
| 不 | dataSet |
| 描述 | period |
| outlining how to resolve identified issues | 开始日期 |
| programStageIdScheme | 结束日期 |
| End date for the time span of the values to export | created |
| Include only registrations which were created since the given timestamp |
createdDuration
JSON 格式的有效载荷如下所示,其中attributes指元数据属性,groupSets指组织单位组集,dataItems指数据元素、指标、数据集和计划指标:
orgUnit
Organisation unit identifier, can be specified multiple times. Not applicable if orgUnitGroup is given.
Organisation unit group identifier, can be specified multiple times. Not applicable if orgUnit is given.
yes
Whether to include the children in the hierarchy of the organisation units
yes
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| Table: Query parameters | ```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 | ```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. | ```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" | ||
| ] | ||
| } | ||
| ``` | / api / 33 / system / taskSummaries / {task-category-id} | |
| ```bash | ||
| GET /api/33/completeDataSetRegistrations?dataSet=pBOMPrpg1QX | ||
| &startDate=2014-01-01&endDate=2014-01-31&orgUnit=YuQRtpLP10I | ||
| &orgUnit=vWbkYPRmKyS&children=true | ||
| ``` | 您可以获得 xml 和 json 格式的响应。你可以指出 | |
| 通过 Accept HTTP 标头,您更喜欢哪种响应格式 | ||
| 在上面的例子中。对于 xml,您使用 application/xml;对于 json 你 | ||
| 使用*应用项目/json*。 | 未完成的数据集 { #webapi_uncompleting_data_sets } | |
| 本节说明如何取消注册数据的完整性 | ||
| 放。要取消完成数据集,您将与 | ||
| completeDataSetRegistrations 资源: | 您可以获得 xml 和 json 格式的响应。你可以指出 | |
| 通过 Accept HTTP 标头,您更喜欢哪种响应格式 | ||
| 在上面的例子中。对于 xml,您使用 application/xml;对于 json 你 | ||
| 使用*应用项目/json*。 | 此资源支持*DELETE* 取消注册。以下查询 | |
| 支持参数: | ||
| Table: Complete data set registrations query parameters | 查询参数 | Values |
是的
Data set identifier
聚乙烯
cc
No (must combine with cp)
false | true
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| 数 | ```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" | ||
| ] | ||
| } | ||
| ``` | Whether registration applies to sub units | |
| E7228 | ```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. | ```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" | ||
| ] | ||
| } | ||
| ``` | / api / 33 / system / taskSummaries / {task-category-id} | |
| 可选类别组合 | Program notification template | 状态取决于数据是否被批准用于属性 |
获取批准状态 { #webapi_data_approval_get_status }
要获取数据集的批准信息,您可以发出GET请求:
/ api / dataApprovals?wf = rIUL3hYOjJc&pe = 201801&ou = YuQRtpLP10I
Table: Data approval query parameters
查询参数
| 需要 | Parameter name |
|---|---|
| wf | 是的 |
| 数据批准工作流标识符 | 聚乙烯 |
| 是的 | 期间标识符 |
| 欧 | 是的 |
| 对于与您可能需要的类别组合关联的数据集 | |
| 获取单个属性选项组合的数据批准记录 | |
| 从具有 GET 请求的以下资源: | 冠捷 |
| 不 | 属性选项组合标识符 |
| > 注意 | |
| > | |
> 为了向后兼容,在此和其他数据批准请求中,可能会为数据集提供参数ds而不是wf,如下所述。如果给出了数据集,则将使用与该数据集关联的工作流。 | 这将产生类似于以下的响应: |
| ```json | |
| { | |
| "mayApprove": false, | |
| "mayUnapprove": false, | |
| "mayAccept": false, | |
| "mayUnaccept": false, | |
| "state": "APPROVED_HERE", | |
| "approvedBy": "User A", | |
| "approvedAt": "2022-01-13T12:56:07.005", | |
| "acceptedBy": "User A", | |
| "acceptedAt": "2022-01-13T12:56:07.005" | |
| } | |
| ``` | 返回的参数是: |
| Table: Data approval returned parameters | 返回参数 |
描述
| mayApprove | Parameter name |
|---|---|
| mayUnapprove | Whether the current user may unapprove this data selection. |
| mayAccept | Whether the current user may accept this data selection. |
| mayUnaccept | Whether the current user may unaccept this data selection. |
| 州 | One of the data approval states from the table below. |
| approvedBy | If the selection is approved, and if present (not always needed), the user's name who made this approval. |
| approvedAt | If the selection is approved, and if present (not always needed), the date and time at which the highest level of approval was created. |
| acceptedBy | If the selection is approved, and if present (not always needed), the user's name who made the last update. |
| acceptedAt | If the selection is approved, and if present (not always needed), the date and time at which the highest level of approval was last updated. |
Table: Data approval states
State 描述 UNAPPROVABLE
Data approval does not apply to this selection. (Data is neither approved nor unapproved.) UNAPPROVED_WAITING Data could be approved for this selection, but is waiting for some lower-level approval before it is ready to be approved. 未经批准_其他地方
Data is unapproved, and is waiting for approval somewhere else (not approvable here.) UNAPPROVED_READY Data is unapproved, and is ready to be approved for this selection. APPROVED_HERE
Data is approved, and was approved here (so could be unapproved here.)
APPROVED_ELSEWHERE
ACCEPTED_HERE
Data is approved and accepted here (so could be unapproved here.)
ACCEPTED_ELSEWHERE
Data is approved and accepted, but elsewhere.
注意查询数据审批状态时,可以指定 查询参数的任意组合。您指定的组合 不需要描述数据被批准的地方 审批级别。例如:
组织单位可能不在审批级别。这
| 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: | Parameter name | | ----------- | ----------- | | 可选类别组合 | 状态取决于数据是否被批准用于属性 | | E7228 | 必须是至少一个期间或开始日期和结束日期 | | Filter on whether the current user can manage the returned users through the managed user group relationships. | 数据输入和批准的数据集。批准 | | 状态取决于数据是否被批准用于所有 | 指定期间内的数据集期间。 | | 对于与您可能需要的类别组合关联的数据集 获取单个属性选项组合的数据批准记录 从具有 GET 请求的以下资源: | /api/dataApprovals/categoryOptionCombos?wf=rIUL3hYOjJc&pe=201801&ou=YuQRtpLP10I | | 数 | Whether registration applies to sub units |
参数 wf、pe、ou 和 aoc 与获取单个批准状态的参数相同,但您可以为每个参数提供一个以逗号分隔的一个或多个值的列表。
这将为您提供一个包含批准参数和状态列表的响应,如下所示:
[
{
"aoc": "HllvX50cXC0",
"pe": "201801",
"level": "KaTJLhGmU95",
"ou": "YuQRtpLP10I",
"permissions": {
"mayApprove": false,
"mayUnapprove": true,
"mayAccept": true,
"mayUnaccept": false,
"mayReadData": true,
"approvedBy": "User A",
"approvedAt": "2022-01-13T12:56:07.005",
"acceptedBy": "User A",
"acceptedAt": "2022-01-13T12:56:07.005"
},
"state": "APPROVED_HERE",
"wf": "rIUL3hYOjJc"
},
{
"aoc": "HllvX50cXC0",
"pe": "201802",
"ou": "YuQRtpLP10I",
"permissions": {
"mayApprove": true,
"mayUnapprove": false,
"mayAccept": false,
"mayUnaccept": false,
"mayReadData": true
},
"state": "UNAPPROVED_READY",
"wf": "rIUL3hYOjJc"
}
]
下表描述了返回的字段。
领域
描述
| 冠捷 | 检索和删除项目通知模板 | Parameter name |
|---|---|---|
| 数 | ```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" | ||
| ] | ||
| } | ||
| ``` | Whether registration applies to sub units | |
| E7228 | ```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. | ```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" | ||
| ] | ||
| } | ||
| ``` | / api / 33 / system / taskSummaries / {task-category-id} | |
| 可选类别组合 | Program notification template | 状态取决于数据是否被批准用于属性 |
要接受已经批准的数据,您可以发出 POST 请求 到 dataAcceptances 资源。要取消接受数据,您可以发出 DELETE 对 dataAcceptances 资源的请求。
POST DELETE /api/33/dataAcceptances 这些请求包含以下参数:
Table: Data approval action parameters Action parameter
描述
wf
是的
数据批准工作流标识符
聚乙烯
是的
期间标识符
欧
是的
Organisation unit identifier
不
属性选项组合标识符
对应于可以选择的数据的参数 得到正式认可的。特别是,以下两项都必须为真:
批量批准数据 { #webapi_data_approval_bulk_approve_data }
您可以通过发布到批准大量数据记录 /api/dataApprovals/approvals 资源。
您可以通过发布到 /api/dataApprovals/unapprovals 资源。
POST /api/33/dataApprovals/unapprovals
您可以通过发布到 /api/dataAcceptances/acceptances 资源。
POST /api/33/dataAcceptances/acceptances
/api/dataAcceptances/unacceptances 资源。
POST /api/33/dataAcceptances/unacceptances
批准有效负载受JSON支持,如下所示:
{
"wf": [
"pBOMPrpg1QX", "lyLU2wR22tC"
],
"pe": [
"201601", "201602"
],
"approvals": [
{
"ou": "cDw53Ej8rju",
"aoc": "ranftQIH5M9"
},
{
"ou": "cDw53Ej8rju",
"aoc": "fC3z1lcAW5x"
}
]
}
Get data approval levels 要检索数据审批工作流及其数据审批级别,您 可以发出类似这样的 GET 请求: /api/dataApprovalWorkflows? fields=id,name,periodType,dataApprovalLevels[id,name,level,orgUnitLevel]
F_DATA_APPROVAL_WORKFLOW : allow user to Add/Update Data Approval Workflow
F_DATA_APPROVAL_LEVEL : allow user to Add/Update Data Approval Level 分享中
共享解决方案允许您共享系统中的大多数对象 特定的用户组并定义对象是否应该公开 可访问或私有。要获取和设置对象的共享状态,您可以 与*共享*资源互动。 /api/33/sharing 获取共享状态 { #webapi_get_sharing_status } 要请求对象的共享状态,请使用GET请求执行以下操作: / api / 33 / sharing?type = dataElement&id = fbfJHSPpUQD 响应如下所示。
{
"meta": {
"allowPublicAccess": true,
"allowExternalAccess": false
},
"object": {
"id": "fbfJHSPpUQD",
"name": "ANC 1st visit",
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
{
"object": {
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
公共访问,无外部访问(无需登录),读写访问 一个用户组和另一个用户组的只读访问权限。你可以 使用 curl 将其提交到共享资源:
It is possible to create surprising sharing combinations. For instance, if
externalAccessis set totruebutpublicAccessis set to--------, then users will have access to the object only when they are logged out.
sharing property has been introduced in order to replace the old sharing properties userAccesses, userGroupAccesses, publicAccess, externalAccess in all metadata classes that have sharing enabled. This Sharing object is saved as a JSONB column in database. However, in order make it backward compatible the old sharing objects still work normally as before, for both import and export. In backend sharing data will be saved to new JSONb sharing column instead of the old *accesses tables.### 使用新的 JSON 补丁应用项目设置共享状态{ #webapi_set_sharing_status_using_json_patch_api }
- You can use [JSON Patch API](developer-manual.md#webapi_partial_updates) to update sharing for an object by sending a `PATCH` request to this endpoint with header `Content-Type: application/json-patch+json`
- ```
api/dataElements/fbfJHSPpUQD
sharing format. The payload in JSON format looks like this:``json [ { "op": "replace", "path": "/sharing/users", "value": { "NOOF56dveaZ": { "access": "rw------", "id": "NOOF56dveaZ" }, "Kh68cDMwZsg": { "access": "rw------", "id": "Kh68cDMwZsg" } } } ] ### You can add users to `sharing` property of an object like this
- ```json
[
{
"op": "add",
"path": "/sharing/users",
"value": {
"NOOF56dveaZ": {
"access": "rw------",
"id": "NOOF56dveaZ"
},
"Kh68cDMwZsg": {
"access": "rw------",
"id": "Kh68cDMwZsg"
}
}
}
]
You can add one user tosharing` like this[ { "op": "add", "path": "/sharing/users/NOOF56dveaZ", "value": { "access": "rw------", "id": "NOOF56dveaZ" } } ]
| 类型 | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
| --- | --- | -- |
| 总览 | subjectTemplate | This function will not copy `METADATA_WRITE` access. The copied `UserAccess` and `UserGroupAccess` will **only** receive the `METADATA_READ` permission.
| The bulk sharing API allow you to apply sharing settings to multiple metadata objects. This means the ability to add or remove many users and user groups to many objects in one API operation. | subjectTemplate | The current user must have `METADATA_READ` sharing permission to all target objects. If the user does not, error `E5001` is thrown.
The current user must have `METADATA_WRITE` sharing permission to update any target objects. If a target object should be updated and the user does not have this permission, error `E3001` is thrown.
Sample use case
### DashboardA is shared to userA with `METADATA_READ_WRITE` permission.
- DashboardA has VisualizationA which has DataElementA.
- VisualizationA, DataElementA have `publicAccess` *disabled* and are *not shared* to userA.
- After executing cascade sharing for DashboardA, userA will have `METADATA_READ` access to VisualizationA and DataElementA.
## 应用项目接口端点
- Send `POST` request to endpoint
- ```
api/dashboards/cascadeSharing/{dashboardUID}
If this is set to true, then cascade sharing function will proceed without updating any objects. The response will includes errors if any and all objects which will be updated. This helps user to know the result before actually executing the cascade sharing function. atomic
true, then the cascade sharing function will stop and not updating any objects if there is an error. Otherwise, if this is false then the function will try to proceed with best effort mode.<attribute id>
{
"errorReports": [
{
"message": "No matching object for reference. Identifier was s46m5MS0hxu, and object was DataElement.",
"mainKlass": "org.hisp.dhis.dataelement.DataElement",
"errorCode": "E5001",
"errorProperties": [
"s46m5MS0hxu",
"DataElement"
]
}
],
"countUpdatedDashBoardItems": 1,
"updateObjects": {
"dataElements": [
{
"id": "YtbsuPPo010",
"name": "Measles doses given"
},
{
"id": "l6byfWFUGaP",
"name": "Yellow Fever doses given"
}
]
}
}
errorReports: includes all errors during cascade sharing process.| 类型 | 仪表板资源将提供仪表板列表。请记住 仪表板对象是共享的,因此列表将受 当前已验证的用户。您可以检索有关一个的更多信息 特定的仪表板,请点击其链接,类似于: | Parameter name | | ---- | ---- | -------------------- | | The bulk sharing API allow you to apply sharing settings to multiple metadata objects. This means the ability to add or remove many users and user groups to many objects in one API operation. | subjectTemplate | 应用项目接口需要尊重共享访问控制,即当前用户必须有权限编辑正在更新的对象的共享。 |
PATCH request must use header Content-type:application/json-patch+json/api/{object-type}/sharing with PATCH requestcurl -X PATCH -d @payload.json -H "Content-Type: application/json-patch+json" "https://play.dhis2.org/dev/api/dataElements/sharing"
- Using `/api/metadata/sharing` with `PATCH` request
```json
{
"dataSets":[
"cYeuwXTCPkU",
"aYeuwXTCPkU"
],
"patch":[
{
"op":"add",
"path":"/sharing/users/DXyJmlo9rge",
"value":{
"access":"rw------",
"id":"DXyJmlo9rge"
}
},
{
"op":"remove",
"path":"/sharing/users/N3PZBUlN8vq"
}
]
}
{
"dataElements": {
"fbfJHSPpUQD": [
{
"op": "replace",
"path": "/sharing/users",
"value": {
"NOOF56dveaZ": {
"access": "rw------",
"id": "CotVI2NX0rI"
},
"Kh68cDMwZsg": {
"access": "rw------",
"id": "DLjZWMsVsq2"
}
}
}
]
},
"dataSets": {
"cYeuwXTCPkA": [
{
"op": "remove",
"path": "/sharing/users/N3PZBUlN8vq"
}
],
"cYeuwXTCPkU": [
{
"op": "add",
"path": "/sharing/users/DXyJmlo9rge",
"value": {
"access": "rw------",
"id": "DXyJmlo9rge"
}
}
]
},
"programs": {
"GOLswS44mh8": [
{
"op": "add",
"path": "/sharing/userGroups",
"value": {
"NOOF56dveaZ": {
"access": "rw------",
"id": "NOOF56dveaZ"
},
"Kh68cDMwZsg": {
"access": "rw------",
"id": "Kh68cDMwZsg"
}
}
}
]
}
}
curl -X PATCH -d @payload.json -H "Content-Type: application/json-patch+json" "https://play.dhis2.org/dev/api/metadata/sharing"
Parameters
两个补丁应用项目端点的参数相同:
名称
默认
描述
## atomic
假
If this is set to true, then the batch function will stop and not updating any objects if there is an error <br> Otherwise, if this is false then the function will try to proceed with best effort mode.
| 指标组 | Parameter name | Potential duplicate status |
|---|---|---|
| displayColumnOrder | Response | 具有以下要求: |
| Payload formats | Payload for single object type using `/api/{object-type}/sharing` looks like this | Payload for multiple object types in one payload using `api/metadata/sharing` |
| 排程 { #webapi_scheduling } | Get available job types { #types } | 要获取所有可用作业类型的列表,可以使用以下端点: |
| GET /api/jobConfigurations/jobTypes | 响应包含有关每个作业类型的信息,包括名称、作业类型、键、调度类型和可用参数。调度类型可以是 `CRON`,这意味着可以使用带有 `cronExpression` 字段的 cron 表达式来调度作业,或者是`FIXED_DELAY`,意味着可以使用 `delay` 字段将作业调度为以固定延迟运行.场延迟以秒为单位。 | 响应将类似于以下内容: |
| /api/pushAnalysis/<id>/run | Job Configurations | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 |
### Table: Main properties
Property
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| 串 | A number related to date of execution which resembles the end of the period to monitor | The cron expression which defines the interval for when the job should run. | String (Cron expression) |
| jobType | 创建_并_更新|创建|更新|删除 | String (Enum) | jobParameters |
Job parameters, if applicable for job type.
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| empty | number of tracked entities processed as a unit | false | 类型 |
| 默认 | 描述 | `dataValuesPageSize` | array of string |
| `[]` = all | 项目阶段 | flushMode | Event analytics explain { #webapi_event_analytics_explain } |
| `REPORT` | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | 名称 |
类型
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| empty | number of tracked entities processed as a unit | false | 类型 |
| 默认 | 描述 | `dataValuesPageSize` | array of string |
| `false` | number of tracked entities processed as a unit | 名称 | array of string |
`[]`
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| 默认 | number of tracked entities processed as a unit | `pageSize` | int |
empty
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| Skip generation of tables; Possible values: `DATA_VALUE`, `COMPLETENESS`, `COMPLETENESS_TARGET`, `ORG_UNIT_TARGET`, `EVENT`, `ENROLLMENT`, `VALIDATION_RESULT` | number of tracked entities processed as a unit | int | `0` |
| Hour of day for full update of analytics tables (0-23) | number of tracked entities processed as a unit | 名称 | 类型 |
| 默认 | number of tracked entities processed as a unit | `pageSize` | int |
`10000`
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| Set `true` if job should send notifications based on validation rule groups | number of tracked entities processed as a unit | 名称 | 类型 |
| Set `true` if job should persist validation results | number of tracked entities processed as a unit | 名称 | int |
| `60` | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | int |
| `10000` | 项目阶段 | flushMode | 名称 |
| 类型 | 项目阶段 | flushMode | `relativeStart` |
int
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| `0` | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | array of string |
`[]`
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| Set `true` if job should send notifications based on validation rule groups | number of tracked entities processed as a unit | 名称 | 类型 |
| Set `true` if job should persist validation results | number of tracked entities processed as a unit | 名称 | 类型 |
| 默认 | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | array of string |
| `[]` | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | 名称 |
类型
| 类型 | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住
仪表板对象是共享的,因此列表将受
当前已验证的用户。您可以检索有关一个的更多信息
特定的仪表板,请点击其链接,类似于: | Parameter name |
|---------------|---------------|---------|--------------------------------------------------|
| `0` | A number related to date of execution which resembles the end of the period to monitor | `dataValuesPageSize` | int |
### `0`
A number related to date of execution which resembles the start of the period to monitor
`predictors`
array of string
`[]`
Predictors (UIDs) to include in job
`predictorGroups`
array of string
`[]`
Predictor groups (UIDs) to include in job
Table: `MATERIALIZED_SQL_VIEW_UPDATE` job parameters
### 名称
类型
默认
描述
`sqlViews`
array of string
`[]`
### The UIDs of the SQL views that are updated by the job
Create a Job Configuration
要配置作业,您可以对以下资源发出POST请求:
/api/jobConfigurations
### 不含JSON格式参数的作业如下所示:
```json
{
"name": "",
"jobType": "JOBTYPE",
"cronExpression": "0 * * ? * *",
}
参数为JSON格式的分析表作业的示例:
{
"name": "Analytics tables last two years",
"jobType": "ANALYTICS_TABLE",
"cronExpression": "0 * * ? * *",
"jobParameters": {
"lastYears": "2",
"skipTableTypes": [],
"skipResourceTables": false
}
}
{
"name": "Push anlysis charts",
"jobType": "PUSH_ANALYSIS",
"cronExpression": "0 * * ? * *",
"jobParameters": {
"pushAnalysis": [
"jtcMAKhWwnc"
]
}
}
An example of a job with scheduling type FIXED_DELAY and 120 seconds delay:
{ "name": "Continuous analytics table", "jobType": "CONTINUOUS_ANALYTICS_TABLE", "delay": "120", "jobParameters": { "fullUpdateHourOfDay": 4 } }
Get Job Configurations
列出所有作业配置:
GET /api/jobConfigurations
检索作业:
GET /api/jobConfigurations/{id}
响应有效负载如下所示:
```json
{
"lastUpdated": "2018-02-22T15:15:34.067",
"id": "KBcP6Qw37gT",
"href": "http://localhost:8080/api/jobConfigurations/KBcP6Qw37gT",
"created": "2018-02-22T15:15:34.067",
"name": "analytics last two years",
"jobStatus": "SCHEDULED",
"displayName": "analytics last two years",
"enabled": true,
"externalAccess": false,
"jobType": "ANALYTICS_TABLE",
"nextExecutionTime": "2018-02-26T03:00:00.000",
"cronExpression": "0 0 3 ? * MON",
"jobParameters": {
"lastYears": 2,
"skipTableTypes": [],
"skipResourceTables": false
},
"favorite": false,
"configurable": true,
"access": {
"read": true,
"update": true,
"externalize": true,
"delete": true,
"write": true,
"manage": true
},
"lastUpdatedBy": {
"id": "GOLswS44mh8"
},
"favorites": [],
"translations": [],
"userGroupAccesses": [],
"attributeValues": [],
"userAccesses": []
}
* Delete a Job Configuration
* 使用以下方法删除作业:
DELETE /api/jobConfigurations/{id}
请注意,某些具有自定义配置参数的作业可能不会被添加,如果
未配置所需的系统设置。一个例子是数据
同步,这需要远程服务器配置。
Run Jobs Manually { #execute }
Jobs can be run manually using:
POST /api/jobConfigurations/{id}/execute
Searching for jobs with execution errors
## Since version 2.41 jobs can store errors of the job run to allow inspection
at a later point in time.
> **Note** This feature is only accessible for administrator
> with the `F_JOB_LOG_READ` authority and superusers.
### To view the errors associated with a specific job use:
GET /api/jobConfigurations/{id}/errors
To search for jobs that match user specified search criteria use:
GET /api/jobConfigurations/errors
with one or more of the following search parameters
`user`: include jobs ran by this user
`from`: include jobs that started after this point in time
`to`: include jobs that did not start later than this point in time
`code`: include jobs that have errors with one of the given error codes
`object`: include jobs that have errors linked to one of the given object IDs
`type`: include job with errors of the specified type(s)
When multiple criteria are used all have to be met (AND logic).
If multiple `code`, `object` or `type` parameters are given just one has to match (OR logic).
* For example, to find tracker import errors for the 1. of January 2024 with error code `E1002`
(tracked entity already exists) the following search is made:
* GET /api/jobConfigurations/errors?type=TRACKER_IMPORT_JOB&code=E1002&from=2024-01-01&to=2024-01-02
* The results show the job run error details. By default, the `input` (the payload of the impport)
is excluded from the results. To include it add `includeInput=true`:
* GET /api/jobConfigurations/errors?includeInput=true
### > **Note**
> Not all job types do store their errors. Currently, this feature is mostly
> supported by import jobs.
调度项目接口
而 `/api/jobConfigurations` 则以作业配置对象为中心
API 反映调度项目的状态,而 `/api/scheduler` API 则提供作业进度跟踪信息。
和 `/api/scheduling` API 提供作业进度跟踪信息。
Observe Running Jobs { #running}
The execution steps and state can be observed while the job is running.
A list of all types of jobs that are currently running is provided by:
GET /api/scheduling/running/types
To get an overview of all running jobs by job type use:
### GET /api/scheduling/running
As there only can be one job running for each type at a time the status of a
running job can be viewed in details using:
GET /api/scheduling/running/{type}
For example, to see status of a running `ANALYTICS_TABLE` job use
GET /api/scheduling/running/ANALYTICS_TABLE
A job is a sequence of processes. Each process has a sequence of `stages`.
Within each stage there might be zero, one or many `items`. Items could be
processed strictly sequential or parallel, n items at a time. Often the
number of `totalItems` is known up-front.
In general the stages in a process and the items in a stage are "discovered"
as a "side effect" of processing the data. While most processes have a fixed
sequence of stages some processed might have varying stages depending on the
data processed. Items are usually data dependent. Most jobs just include a
single process.
`code`: include jobs that have errors with one of the given error codes
`RUNNING`: is currently processed (not yet finished)
### `SUCCESS`: when completed successful
`ERROR`: when completed with errors or when an exception has occurred
`CANCELLED`: when cancellation was requested and the item will not complete
See Completed Job Runs { #completed }
## Once a job has completed successful or with a failure as a consequence of an
exception or cancellation the status moves from the set of running states to
the completed job states. This set keeps only the most recent execution
state for each job type. The overview is available at:
GET /api/scheduling/completed
### Details on a particular job type are accordingly provided at:
GET /api/scheduling/completed/{type}
In case of the `ANALYTICS_TABLE` job this would be:
GET /api/scheduling/completed/ANALYTICS_TABLE
Request Cancelling a Running Jobs { #cancel }
### Once a job is started it works through a sequence of steps. Each step might
in turn have collections of items that are processed. While jobs usually
cannot be stopped at any point in time we can request cancellation and the
process gives up cooperatively once it has completed an item or step and
recognises that a cancellation was requested. This means jobs do not stop
immediately and leave at an unknown point right in the middle of some
processing. Instead, they give up when there is an opportunity to skip to
the end. This still means that the overall process is unfinished and is not
rolled back. It might just have done a number of steps and skipped others at
the end.
To cancel a running job use:
POST /api/scheduling/cancel/{type}
For example, to cancel the `ANALYTICS_TABLE` job run:
POST /api/scheduling/cancel/ANALYTICS_TABLE
### Depending on the current step and item performed this can take from
milliseconds to minutes before the cancellation becomes effective.
However, the status of the overall process will be shown as `CANCELLED`
immediately when check using
GET /api/scheduling/running/ANALYTICS_TABLE
Only jobs that have been split into processes, stages and items can be
cancelled effectively. Not all jobs have been split yet. These will run till
completion even if cancellation has been requested.
Reset a Job stuck in RUNNING state
When a server shuts down while a job is in `RUNNING` state the job
needs to be reverted back to its initial state manually.
To revert a job that has `RUNNING` state but is not running use:
POST /api/jobConfigurations/{uid}/revert
### Job Queues { #queues }
Sequences of jobs (configurations) can be created using job queues.
The queue always uses a unique name and a CRON expression trigger.
Once a queue is started it runs all jobs in the queue in the given sequence.
The second in sequence starts when the first is finished and so forth.
List Names of Job Queues { #queues-list }
To list the unique names of existing queues use:
GET /api/scheduler/queues
### The response is a array of the names:
```json
["queue_a", "queue_b"]
Get A Job Queue { #queues-info }
To get all details of a specific queue use:
The details include its name, CRON expression and job sequence:
{
"name": "myQ",
"cronExpression": "0 0 1 ? * *",
"sequence": ["FgAxa6eRSzQ", "BeclVERfWbg" ]
}
Create a new Job Queue { #queues-add }
To create a new queue send a POST request with a payload object having name, CRON expression and the job sequence:
POST /api/scheduler/queues/{name}
To create a queue with name myQ use a POST to /api/scheduler/queues/myQ:
{
"cronExpression": "0 0 1 ? * *",
"sequence": ["FgAxa6eRSzQ", "BeclVERfWbg" ]
}
A name can be present in the payload as well but name specified in the URL path takes precedence.
NOTE
The cron expression of all job configurations but the first in a queue is cleared as they do not have a trigger on their own any longer. It needs to be restored manually once a job is removed from a queue.
To update an existing queue CRON expression or sequence use a PUT request
PUT /api/scheduler/queues/{name}
The payload has to state both new CRON expression and job sequence like in the example above to create a new queue.
To rename a queue the new name can be stated in the payload, while the old name is used in the URL path.
Delete a Job Queue { #queues-delete }
DELETE /api/scheduler/queues/{name}
Deleting a queue does not delete any referenced job configurations. Any job configuration that is removed from a queue either by changing the sequence or deleting the queue is disabled. To use it individually supply a CRON expression and enable the configuration again.
Job Scheduler { #scheduler }
调度项目中的计划是一个基于作业配置和作业队列的列表。 和作业队列的列表。计划表中的条目要么是一个简单的作业配置,要么是一个作业队列、 或作业队列。两者使用相同的条目格式表示。
GET /api/scheduler
A job configuration in this list looks like this:
{
"name": "User account expiry alert",
"type": "ACCOUNT_EXPIRY_ALERT",
"cronExpression": "0 0 2 ? * *",
"nextExecutionTime": "2023-03-15T02:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": false,
"sequence": [
{
"id": "fUWM1At1TUx",
"name": "User account expiry alert",
"type": "ACCOUNT_EXPIRY_ALERT",
"cronExpression": "0 0 2 ? * *",
"nextExecutionTime": "2023-03-15T02:00:00.000",
"status": "SCHEDULED"
}
]
}
Most notably the sequence has only a single item. Information on top level object and the object in the sequence both originate from the job configuration.
{
"name": "myQ",
"type": "Sequence",
"cronExpression": "0 0 1 ? * *",
"nextExecutionTime": "2023-03-15T01:00:00.000",
"status": "SCHEDULED",
"enabled": true,
"configurable": true,
"sequence": [
{
"id": "FgAxa6eRSzQ",
"name": "test Q1",
"type": "ANALYTICS_TABLE",
"cronExpression": "0 0 1 ? * *",
"nextExecutionTime": "2023-03-15T01:00:00.000",
"status": "SCHEDULED"
},
{
"id": "BeclVERfWbg",
"name": "est Q2",
"type": "DATA_INTEGRITY",
"status": "SCHEDULED"
}
]
}
The top level object originates from the queue and aggregate information. The objects within the sequence originate from the job configurations that are part of the sequence.
System jobs and jobs that are already part of a queue cannot be used in another queue. To list job configurations that can be part of any queue use:
GET /api/scheduler/queueable
GET /api/scheduler/queueable?name={queue}
This will also exclude all jobs that are already part the named queue.
同步化 { #webapi_synchronization }
| 默认值 | Validation rule | Parameter name |
|---|---|---|
| Table: Query parameters | 元数据拉取 { #webapi_sync_metadata_pull } | 要从远程 JSON 文档中启动元数据拉取,您可以创建一个 |
| 使用 url 作为请求负载的 POST 请求到以下资源: | ||
| Any delete operation will require the authority Perform maintenance tasks. | > Note | |
| > | ||
> The supplied URL will be checked against the config property metadata.sync.remote_servers_allowed in the dhis.conf file. | ||
| > If the base URL is not one of the configured servers allowed then the operation will not be allowed. See failure example below. | ||
> Some examples where the config set is metadata.sync.remote_servers_allowed=https://server1.org/,https://server2.org/ | ||
> - supply https://server1.org/path/to/resource -> this will be accepted | ||
> - supply https://server2.org/resource/path -> this will be accepted | ||
> - supply https://oldserver.org/resource/path -> this will be rejected | ||
| > | ||
| Sample failure response | ```json | |
| { | ||
| "httpStatus": "Conflict", | ||
| "httpStatusCode": 409, | ||
| "status": "ERROR", | ||
| "message": "Provided URL is not in the remote servers allowed list", | ||
| "errorCode": "E1004" | ||
| } | ||
| ``` | ||
| E7228 | To retrieve information about a form (which corresponds to a data set | |
and its sections) you can interact with the form resource. The form | ||
| response is accessible as XML and JSON and will provide information | ||
| about each section (group) in the form as well as each field in the | ||
| sections, including labels and identifiers. By supplying period and | ||
| organisation unit identifiers the form response will be populated with | ||
| data values. | / api / 33 /同步/可用性 | |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | ```json | |
| ["www.google.com", "www.dhis2.org", "www.who.int"] | ||
| ``` | DHIS2 will audit updates and deletions of aggregate data values, tracked entity data values, tracked entity attribute values and data approval records. This section explains how to retrieve audit records for the mentioned entities. Note that several of the query parameters can be repeated any number of times. | |
| 数 | The endpoint for aggregate data value audits is located at: | ``` |
| /api/audits/dataValue | ||
| ``` | ||
| Table: Aggregate data value query parameters | 假 | 选项 |
| true | ds | Tracked Entity UIDS |
| 定义要返回的页码。 | Parameter | Data approval workflow ID |
| 定义每页返回的元素数量。 | Parameter | Organisation unit ID |
欧
Organisation unit ID
One or more org unit identifiers
auditType
Filter by one or more audit types
skipPaging
false | true
| 默认值 | Validation rule | Parameter name |
|---|---|---|
Absolute end date. Applicable only when type is ABSOLUTE | Enable or disable paging | page |
| > Note | ||
| > | ||
> The repetition attribute (in rows, columns or filters) indicates the events indexes to be retrieved. Taking the example above (in the previous json payload), it can be read as follows: | ||
| > | ||
| 1 = First event | ||
| 2 = Second event | ||
| 3 = Third event | ||
| ... | ||
| -2 = Third latest event | ||
| -1 = Second latest event | ||
| 0 = Latest event (default) | Sharing of data store keys follows the same principle as for other metadata sharing (see | |
| Sharing). | pageSize | |
| 数 | Page size (default 50) | ``` |
| /api/audits/dataValue | ||
| ``` | ||
| dueDate | The endpoint for data approval audits is located at: | /api/33/audits/trackedEntity.json?trackedEntities=wNiQ2coVZ39 |
| lastUpdatedDate | Once auditing is enabled for tracked entities (by setting allowAuditLog of tracked entity types to true), all read and search operations are logged. The endpoint for accessing audit logs is located at: | ``` |
| /api/audits/trackedEntityInstance | ||
| ``` | ||
| Table: Aggregate data value query parameters | 假 | 选项 |
| true | ds | Tracked Entity UIDS |
| 定义要返回的页码。 | Parameter | One or more user identifiers |
| 定义每页返回的元素数量。 | Parameter | Filter by one or more audit types |
开始日期
Start date
Start date for audits in yyyy-mm-dd format
结束日期
End date for audits in yyyy-mm-dd format
skipPaging
false | true
| 默认值 | Validation rule | Parameter name |
|---|---|---|
Absolute end date. Applicable only when type is ABSOLUTE | Enable or disable paging | page |
| > Note | ||
| > | ||
> The repetition attribute (in rows, columns or filters) indicates the events indexes to be retrieved. Taking the example above (in the previous json payload), it can be read as follows: | ||
| > | ||
| 1 = First event | ||
| 2 = Second event | ||
| 3 = Third event | ||
| ... | ||
| -2 = Third latest event | ||
| -1 = Second latest event | ||
| 0 = Latest event (default) | Sharing of data store keys follows the same principle as for other metadata sharing (see | |
| Sharing). | pageSize | |
| 数 | Page size (default 50) | ``` |
| /api/audits/dataValue | ||
| ``` | ||
| dueDate | The endpoint for data approval audits is located at: | /api/33/audits/trackedEntity.json?trackedEntities=wNiQ2coVZ39 |
| lastUpdatedDate | Once auditing is enabled for tracked entities (by setting allowAuditLog of tracked entity types to true), all read and search operations are logged. The endpoint for accessing audit logs is located at: | ``` |
| /api/audits/trackedEntityInstance | ||
| ``` | ||
| Table: Aggregate data value query parameters | 假 | 选项 |
| true | ds | Tracked Entity UIDS |
| 定义要返回的页码。 | Parameter | One or more user identifiers |
| 定义每页返回的元素数量。 | Parameter | Filter by one or more audit types |
开始日期
Start date
Start date for audits in yyyy-mm-dd format
结束日期
End date for audits in yyyy-mm-dd format
skipPaging
false | true
| 默认值 | Validation rule | Parameter name |
|---|---|---|
| 真正 | Whether to enable or disable paging | page |
| 数 | Page number (default 1) | pageSize |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | ```json | |
| ["www.google.com", "www.dhis2.org", "www.who.int"] | ||
| ``` | Example: Get audits of audit type READ with startDate 2018-03-01 and endDate 2018-04-24 with a page size of 5: | |
| 可选类别组合 | Example: Get audits for tracked entity wNiQ2coVZ39: | /api/33/audits/trackedEntityInstance.json?trackedEntities=wNiQ2coVZ39 |
| dueDate | The endpoint for data approval audits is located at: | ``` |
| /api/audits/dataApproval | ||
| ``` | ||
| lastUpdatedDate | Once auditing is enabled for tracked entities (by setting allowAuditLog of tracked entity types to true), all read and search operations are logged. The endpoint for accessing audit logs is located at: | 选项 |
| Table: Aggregate data value query parameters | 假 | 选项 |
| 定义要返回的页码。 | Parameter | Data approval workflow ID |
| 定义每页返回的元素数量。 | Parameter | Organisation unit ID |
One or more organisation unit identifiers
冠捷
Attribute option combo ID
One or more attribute option combination identifiers
Start date for approvals in yyyy-mm-dd format
结束日期
End date
yyyy-mm-dd formatskipPaging
false | true
Turn paging on / off
page
数
Page number (default 1)
pageSize
数
Page size (default 50)
Example: Get audits for data approval workflow i5m0JPw4DQi:
/api/33/audits/dataApproval?wf=i5m0JPw4DQi
Exaple: Get audits between 2021-01-01 and 2022-01-01 for org unit DiszpKrYNg8:
/api/33/audits/dataApproval?ou=DiszpKrYNg8&startDate=2021-01-01&endDate=2022-01-01
讯息传递
讯息对话 { #webapi_message_conversations }
DHIS2 具有发送消息的机制,例如 用户反馈、通知和给用户的一般信息。留言 被分组到对话中。与消息对话交互 您可以向 messageConversations 发送 POST 和 GET 请求 资源。
/ api / 33 / messageConversations
消息会传送到 DHIS2 消息收件箱,但也可以发送 以短信形式发送到用户的电子邮件地址和手机。在这个例子中, 我们将看到如何利用 Web API 来发送、读取和管理 消息。我们将伪装成*DHIS2管理员*用户并发送 给*移动*用户的消息。然后我们会假装是手机 用户并阅读我们的新消息。在此之后,我们将管理管理员 用户收件箱通过标记和删除邮件。
撰写和阅读邮件 { #webapi_writing_messages }
我们在发送和阅读消息时需要交互的资源 是 messageConversations 资源。我们首先访问 Web API 在 http://play.dhis2.org/demo/api 的入口点我们找到并跟随 messageConversations 资源的链接位于 http://play.dhis2.org/demo/api/messageConversations 。说明 告诉我们可以使用 POST 请求来创建新消息 发送给多个用户的以下 XML 格式:
<message xmlns="http://dhis2.org/schema/dxf/2.0">
<subject>This is the subject</subject>
<text>This is the text</text>
<users>
<user id="user1ID" />
<user id="user2ID" />
<user id="user3ID" />
</users>
</message>
为了发送给一个或多个用户组中的所有用户,我们可以 用:
<message xmlns="http://dhis2.org/schema/dxf/2.0">
<subject>This is the subject</subject>
<text>This is the text</text>
<userGroups>
<userGroup id="userGroup1ID" />
<userGroup id="userGroup2ID" />
<userGroup id="userGroup3ID" />
</userGroups>
</message>
为了发送给连接到一个或多个组织单位的所有用户,我们 可以使用:
Since we want to send a message to our friend the mobile user we need to
look up her identifier. We do so by going to the Web API entry point and
follow the link to the *users* resource at `/api/users`. We continue by
following link to the mobile user at `/api/users/PhzytPW3g2J` where we learn
that her identifier is *PhzytPW3g2J*. We are now ready to put our XML
message together to form a message where we want to ask the mobile user
whether she has reported data for January 2014:
```xml
<message xmlns="http://dhis2.org/schema/dxf/2.0">
<subject>Mortality data reporting</subject>
<text>Have you reported data for the Mortality data set for January 2014?</text>
<users>
<user id="PhzytPW3g2J" />
</users>
</message>
为了测试这一点,我们将 XML 内容保存到一个名为 message.xml 的文件中。 我们使用 cURL 将消息发送到 DHIS2 演示实例 指示内容类型是 XML 并以 admin 身份进行身份验证 用户:
curl -d @message.xml "https://play.dhis2.org/demo/api/messageConversations"
-H "Content-Type:application/xml" -u admin:district -X POST
JSON和POST命令中的相应有效负载如下所示:
{
"subject": "Hey",
"text": "How are you?",
"users": [
{
"id": "OYLGMiazHtW"
},
{
"id": "N3PZBUlN8vq"
}
],
"userGroups": [
{
"id": "ZoHNWQajIoe"
}
],
"organisationUnits": [
{
"id": "DiszpKrYNg8"
}
]
}
curl -d @message.json "https://play.dhis2.org/demo/api/33/messageConversations"
-H "Content-Type:application/json" -u admin:district -X POST
如果一切顺利,我们会收到一个 201 Created HTTP 状态代码。另外,请注意 我们收到一个 Location HTTP 标头,该标头的值通知我们 新创建的消息对话资源的 URL - 这可以是 消费者使用它来执行进一步的操作。
我们现在将假装是移动用户并阅读消息 刚刚通过向 messageConversations 发送 GET 请求发送 资源。我们提供一个带有 application/xml 的 Accept 标头作为 表示我们对 XML 资源感兴趣的值 表示,我们以*移动*用户身份进行身份验证:
curl "https://play.dhis2.org/demo/api/33/messageConversations"
-H "Accept:application/xml" -u mobile:district
作为响应,我们得到以下XML:
<messageConversations xmlns="http://dhis2.org/schema/dxf/2.0"
link="https://play.dhis2.org/demo/api/messageConversations">
<messageConversation name="Mortality data reporting" id="ZjHHSjyyeJ2"
link="https://play.dhis2.org/demo/api/messageConversations/ZjHHSjyyeJ2"/>
<messageConversation name="DHIS2 version 2.7 is deployed" id="GDBqVfkmnp2"
link="https://play.dhis2.org/demo/api/messageConversations/GDBqVfkmnp2"/>
</messageConversations>
从响应中,我们能够读取新发送的标识符 消息是 ZjHHSjyyeJ2。注意具体链接 资源已嵌入,可以关注以阅读完整内容 信息。一旦我们知道,我们可以直接回复现有的消息对话 通过包含消息文本作为请求负载来获取 URL。我们 现在可以构造一个 URL 来发送我们的回复:
curl -d "Yes the Mortality data set has been reported"
"https://play.dhis2.org/demo/api/messageConversations/ZjHHSjyyeJ2"
-H "Content-Type:text/plain" -u mobile:district -X POST
如果一切按计划进行,您将收到 200 OK 状态代码。
在2.30中,我们添加了URL搜索参数:
queryString =?&queryOperator =?
过滤器在主题、文本和发件人中搜索消息的匹配项 对话。默认查询运算符是 token,但是其他运算符 可以在查询中定义。
管理讯息 { #webapi_managing_messages }
随着用户接收和发送消息,对话将开始堆积 在他们的收件箱中,最终变得难以跟踪。我们现在将 看看通过删除和标记来管理用户的消息收件箱 通过 Web-API 进行对话。我们将通过执行一些 在“DHIS 管理员”用户的收件箱中维护。
首先,让我们看看从收件箱中删除一些邮件。是 一定要注意这里描述的所有删除操作只删除 用户和消息对话之间的关系。实际上 这意味着我们不会删除消息本身(或任何 内容),但只是从 用户使其不再列在 /api/messageConversations 资源。
To remove a message conversation from a users inbox we need to issue a DELETE request to the resource identified by the id of the message conversation and the participating user. For example, to remove the user with id xE7jOejl9FI from the conversation with id jMe43trzrdi:
curl "https://play.dhis2.org/demo/api/33/messageConversations/jMe43trzrdi
响应正文包含一个 XML 或 JSON 对象(根据接受 请求的标头)包含已删除用户的 ID。
{
"removed" : ["xE7jOejl9FI"]
}
失败时,返回的对象将包含一个消息有效负载 描述错误。
{
"message" : "No user with uid: dMV6G0tPAEa"
}
细心的读者已经注意到对象返回了 在我们的例子中,成功实际上是一个 id 列表(包含一个 入口)。这是因为端点也支持批量删除。这 对相同的 messageConversations 资源发出请求,但遵循 语义略有不同。对于批处理操作,会话 ID 作为查询字符串参数给出。以下示例删除了两个 当前用户的单独消息对话:
curl "https://play.dhis2.org/demo/api/messageConversations?mc=WzMRrCosqc0&mc=lxCjiigqrJm"
-X DELETE -u admin:district
如果您有足够的权限,可以删除对话 通过提供可选的用户 ID 参数代表另一个用户。
curl "https://play.dhis2.org/demo/api/messageConversations?mc=WzMRrCosqc0&mc=lxCjiigqrJm&user=PhzytPW3g2J"
-X DELETE -u admin:district
如上所述,批量删除将返回与 单一操作。删除的对象列表将反映成功 执行的移除。部分错误的请求(即不存在的 ID) 因此不会取消整个批处理操作。
消息带有布尔 read 属性。这允许跟踪是否 用户是否看到(打开)了一条消息。在典型应用中 场景(例如 DHIS2 网络门户),消息将被标记为已读 用户第一次打开它。然而,用户可能想要 管理他们的消息的已读或未读状态,以保持 跟踪某些对话。
标记消息已读或未读遵循与批处理类似的语义 移除,并且还支持批量操作。将消息标记为已读 我们向 messageConversations/read 资源发出一个 POST 包含一个或多个消息 ID 的请求正文。将消息标记为 未读我们向 messageConversations/unread 发出相同的请求 资源。与删除的情况一样,可选的 user 请求参数 可以给。
让我们将几条消息标记为当前用户已读:
curl "https://play.dhis2.org/dev/api/messageConversations/read"
-d '["ZrKML5WiyFm","Gc03smoTm6q"]' -X POST
-H "Content-Type: application/json" -u admin:district
{
"markedRead": ["ZrKML5WiyFm", "Gc03smoTm6q"]
}
您可以将收件人添加到现有的消息对话中。该资源位于:
/ api / 33 / messageConversations / id /收件人
此资源的选项是用户、用户组和 组织单位。请求应如下所示:
{
"users": [
{
"id": "OYLGMiazHtW"
},
{
"id": "N3PZBUlN8vq"
}
],
"userGroups": [
{
"id": "DiszpKrYNg8"
}
],
"organisationUnits": [
{
"id": "DiszpKrYNg8"
}
]
}
邮件附件 { #webapi_message_attachments }
创建带附件的消息分两步完成:上传 文件添加到 attachments 资源,然后包括一个或几个 创建新邮件时的附件 ID。
| Additionally, the following endpoint will return the import summary of the import job. This import summary will only be available after the import has completed: | curl -F file=@attachment.png“ https://play.dhis2.org/demo/api/messageConversations/attachments” -u管理员:区 | |---|---| | 该请求返回一个表示附件的对象。的标识 创建消息时必须使用此对象以链接 邮件附件。 | json { "created": "2018-07-20T16:54:18.210", "lastUpdated": "2018-07-20T16:54:18.212", "externalAccess": false, "publicAccess": "--------", "user": { "name": "John Traore", "created": "2013-04-18T17:15:08.407", "lastUpdated": "2018-03-09T23:06:54.512", "externalAccess": false, "displayName": "John Traore", "favorite": false, "id": "xE7jOejl9FI" }, "lastUpdatedBy": { "id": "xE7jOejl9FI", "name": "John Traore" }, "favorite": false, "id": "fTpI4GOmujz" } | | 创建新消息时,可以在请求正文中传递 id 将上传的文件链接到正在创建的消息。 | json { "subject": "Hey", "text": "How are you?", "users": [ { "id": "OYLGMiazHtW" }, { "id": "N3PZBUlN8vq" } ], "userGroups": [ { "id": "ZoHNWQajIoe" } ], "organisationUnits": [ { "id": "DiszpKrYNg8" } ], "attachments": [ "fTpI4GOmujz", "h2ZsOxMFMfq" ] } | | 回复消息时,可以将 id 作为请求传递 范围。 | bash curl -d "Yes the Mortality data set has been reported" "https://play.dhis2.org/demo/api/33/messageConversations/ZjHHSjyyeJ2?attachments=fTpI4GOmujz,h2ZsOxMFMfq" -H "Content-Type:text/plain" -u mobile:district -X POST | | 创建带有附件的邮件后,附加文件 可以通过对以下 URL 的 GET 请求访问: ||
/ api / messageConversations / <mcv-id> / <msg-id> / attachments / <attachment-id>
其中
一张票和一条消息的唯一区别是你可以给 票证的状态和优先级。设置状态:
POST / api / messageConversations / <uid> / status
设置优先级:
在 2.29 中,验证分析生成的消息现在也用于 状态和优先级属性。默认情况下,消息由 验证分析将继承验证规则的优先级 问题,或者如果消息包含多个最重要的 规则。
在 2.30 中,可以将验证规则分配给任何用户,同时工单 仍然需要分配给系统反馈接收者中的一个用户 团体。
Table: A list of valid status and priority values
状态
Priority
OPEN
LOW
PENDING
INVALID
HIGH
SOLVED
也可以给工单添加内部消息,只能看到 拥有“管理票证”权限的用户。创建一个内部 回复,包括“内部”参数,并将其设置为
curl -d "This is an internal message"
"https://play.dhis2.org/demo/api/33/messageConversations/ZjHHSjyyeJ2?internal=true"
-H "Content-Type:text/plain" -u admin:district -X POST
仪表板旨在为您提供多个分析的概览 地图、图表、数据透视表和报告等项目,它们一起可以 提供您数据的全面概览。仪表板可用 通过 dashboards 资源在 Web API 中。仪表板包含一个 仪表板*项目*列表。一个项目可以代表一个单一的资源,比如 图表、地图或报告表,或表示指向分析的链接列表 资源,如报告、资源、表格报告和用户。一种 仪表板项目最多可以包含八个链接。通常,仪表板 客户可以选择直接在一个 用户界面,同时将多对象项目渲染为可点击 链接。
/ api /仪表板
| eventCreatedPeriod | Parameter name | Potential duplicate status | 仪表板资源将提供仪表板列表。请记住 仪表板对象是共享的,因此列表将受 当前已验证的用户。您可以检索有关一个的更多信息 特定的仪表板,请点击其链接,类似于: | |---|---|---|---| | /api/dashboards/vQFhmLJU5sK.json | 仪表板包含名称和创建日期等信息以及 仪表板项目数组。 JSON 格式的响应看起来类似 对此回复(某些信息已被删除,以便 简洁)。 | 搜索仪表板 { #webapi_searching_dasboards } | 6 | | 通过指定特定字段可以获得更定制的响应 在请求中。下面提供了一个示例,它将返回更多 有关用户仪表板上每个对象的详细信息。 | / api / dashboards / vQFhmLJU5sK /?fields =:all,dashboardItems [:all] | 搜索仪表板 { #webapi_searching_dasboards } | 25 | | 最小-最大数据元素 { #webapi_min_max_data_elements } | /api/dashboards/q/my-query.json /api/dashboards/search?q=my-query | 例如,此查询: | Relationship Type {0} constraint requires a {1} but a {2} was found. |
将搜索以下内容:
分析对象名称包含字符串“ ma”
For REPORT and MAP types, return up to 20 items
Table: dashboards/q and dashboards/search query parameters
查询参数
描述
类型
计数
Positive integer
String [MAP|USER|REPORT|RESOURCE|VISUALIZATION#124;EVENT_VISUALIZATION,EVENT_CHART,EVENT_REPORT]
The number of items of max types to return
Positive integer
The type to return the maxCount for
String [MAP|USER|REPORT|RESOURCE|VISUALIZATION#124;EVENT_VISUALIZATION,EVENT_CHART,EVENT_REPORT]
不适用
将包含对匹配资源的引用和数量 总共找到匹配项,并为每种类型的资源找到匹配项。它会看起来 类似于:
{
"visualizations": [{
"name": "ANC: ANC 3 Visits Cumulative Numbers",
"id": "arf9OiyV7df",
"type": "LINE"
}, {
"name": "ANC: 1st and 2rd trends Monthly",
"id": "jkf6OiyV7el",
"type": "PIVOT_TABLE"
}],
"eventVisualizations": [{
"name": "Inpatient: Cases 5 to 15 years this year (case)",
"id": "TIuOzZ0ID0V",
"type": "LINE_LIST"
}, {
"name": "Inpatient: Cases last quarter (case)",
"id": "R4wAb2yMLik",
"type": "LINE_LIST"
}],
"maps": [{
"name": "ANC: 1st visit at facility (fixed) 2013",
"id": "YOEGBvxjAY0"
}, {
"name": "ANC: 3rd visit coverage 2014 by district",
"id": "ytkZY3ChM6J"
}],
"reports": [{
"name": "ANC: 1st Visit Cumulative Chart",
"id": "Kvg1AhYHM8Q"
}, {
"name": "ANC: Coverages This Year",
"id": "qYVNH1wkZR0"
}],
"searchCount": 8,
"visualizationCount": 2,
"eventVisualizationCount": 2,
"mapCount": 2,
"reportCount": 2,
"userCount": 0,
"eventReports": 0,
"eventCharts" :0,
"resourceCount": 0
}
String [MAP|USER|REPORT|RESOURCE|VISUALIZATION#124;EVENT_VISUALIZATION,EVENT_CHART,EVENT_REPORT]
语义。为了创建一个新的仪表板,您可以创建一个 POST 请求/api/dashboards 资源。从消费者的角度 首先创建仪表板然后添加项目可能会很方便 到它。请求有效负载支持 JSON 和 XML 格式。至 创建一个名为“我的仪表板”的仪表板,您可以在其中使用有效负载 像这样的 JSON:
{
“名称”:“我的仪表板”
}
更新,例如重命名,仪表板,您可以使用 PUT 请求 类似的请求负载相同的 api/dashboards 资源。
要删除仪表板,您可以向特定的人发出 DELETE 请求 与此类似的仪表板资源:
/ api /仪表板/ vQFhmLJU5sK
| ValidationRuleGroup | Parameter name | Potential duplicate status |
|---|---|---|
| To add a visualization to a specific dashboard, send a PUT request to: | ``` | |
| /api/dashboards/ChZ236jPgXs | ||
| ``` | UID \ | |
| ```json | ||
| { | ||
| "name": "test", | ||
| "layout": { | ||
| "columns": [] | ||
| }, | ||
| "itemConfig": { | ||
| "insertPosition": "END" | ||
| }, | ||
| "restrictFilters": false, | ||
| "allowedFilters": [], | ||
| "favorites": [], | ||
| "displayName": "test", | ||
| "user": { | ||
| "id": "xE7jOejl9FI", | ||
| "code": null, | ||
| "name": "John Traore", | ||
| "username": "admin" | ||
| }, | ||
| "id": "ChZ236jPgXs", | ||
| "dashboardItems": [ | ||
| { | ||
| "x": 0, | ||
| "y": 0, | ||
| "w": 20, | ||
| "h": 29, | ||
| "id": "cKd9PKBuHv6", | ||
| "type": "VISUALIZATION", | ||
| "position": null, | ||
| "visualization": { | ||
| "id": "LW0O27b7TdD", | ||
| "name": "ANC: 1-3 dropout rate Yearly" | ||
| }, | ||
| "i": "cKd9PKBuHv6", | ||
| "minH": 4, | ||
| "firstOfType": true, | ||
| "width": 20, | ||
| "height": 29 | ||
| } | ||
| ], | ||
| "starred": false | ||
| } | ||
| ``` | Update an Item | UID \ |
| 不 | The payload must be the latest Dashboard object, including all its items with the updated property value. | Remove an Item |
/api/dashboards/ChZ236jPgXs
Defining a dashboard layout { #webapi_dasboard_layout }
You can define and save a layout for each dashboard. The following object is responsible to hold this setting.
{
"layout": {
"spacing": {
"column": 5,
"row": 5
},
"columns": [{
"index": 0,
"span": 2
}, {
"index": 1,
"span": 1
}]
}
}
The layout definition will be applied for all dashboard items related to the given dashboard, respecting layout attributes like spacing, columns, span and so on. See, below, a brief description of each attribute.
| 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: | Parameter name | |---|---| | Two mappings for the Referrals Age category. A program indicator can choose which mapping | Endpoint responses { #webapi_data_items_possible_responses } | | 是的 | This is the root object | | displayColumnOrder | spacing | | 枚举(参见元数据和渲染类型表中的列表) | 目的 | | 列 | Stores specific parameters related to columns (at the moment, index and span) | | Array of objects | 可视化 { #webapi_visualization } | | dataFilters | This API was introduced to unify both charts and reportTables APIs and entirely replace them by the visualizations API. | | GET /api/metadata/proposals?filter=status:eq:ACCEPTED | API的根端点是/ api / visualizations,下表中描述了当前属性和元素的列表。 | | dueDate | 领域 | | lastUpdatedDate | id | | 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。 只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户 用户可以通过 打破玻璃 获得临时所有权。 玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。 他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。 访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时 时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。 获得临时访问权。 | 码 | | > Note
The
repetitionattribute (inrows,columnsorfilters) indicates the events indexes to be retrieved. Taking the example above (in the previousjsonpayload), it can be read as follows:1 = First event 2 = Second event 3 = Third event ... -2 = Third latest event -1 = Second latest event 0 = Latest event (default) | 名称 || The name of the EventVisualiation | type | | The type of the Visualization. The valid types are: COLUMN, STACKED_COLUMN, BAR, STACKED_BAR, LINE, AREA, PIE, RADAR, GAUGE, YEAR_OVER_YEAR_LINE YEAR_OVER_YEAR_COLUMN, SINGLE_VALUE, PIVOT_TABLE. | title | | A custom title. | subtitle | | A custom subtitle. | 描述 | | Defines a custom description for the Visualization. | created | | The date/time of the Visualization creation. | 开始日期 | | The beginning date used during the filtering. | 结束日期 | | The ending date used during the filtering. | sortOrder | | Events resource only. Custom period on
scheduledDate. See "custom date periods" section. | user | | An object representing the creator of the Visualization. | 结束日期 | | The ending date used during the filtering. | sortOrder | | The sorting order of this EventVisualiation. Integer value. | user | | An object representing the creator of the Visualization. | publicAccess | | Sets the permissions for public access. | displayDensity | | The display density of the text. | fontSize | | The font size of the text. | relativePeriods | | An object representing the relative periods used in the analytics query. | 传说 | | An object representing the definitions for the legend and legend set, display style (FILL or TEXT) and display strategy (FIXED or BY_DATA_ITEM). | aggregationType | | Determines how the values are aggregated (if applicable). Valid options: SUM, AVERAGE, AVERAGE_SUM_ORG_UNIT, LAST, LAST_AVERAGE_ORG_UNIT, FIRST, FIRST_AVERAGE_ORG_UNIT, COUNT, STDDEV, VARIANCE, MIN, MAX, NONE, CUSTOM or DEFAULT. | regressionType | | A valid regression type: NONE, LINEAR, POLYNOMIAL or LOESS. | targetLineValue | | The chart target line. Accepts a Double type. | targetLineLabel | | The chart target line label. | rangeAxisLabel | | 请求查询参数 { #webapi_analytics_query_parameters } | domainAxisLabel | | The chart horizontal axis (x) label/title. | rangeAxisMaxValue | | The chart axis maximum value. Values outside of the range will not be displayed. | rangeAxisMinValue | | The chart axis minimum value. Values outside of the range will not be displayed. | rangeAxisSteps | | The chart axis minimum value. Values outside of the range will not be displayed. | rangeAxisDecimals | | The number of axis steps between the minimum and maximum values. | rangeAxisDecimals | | The number of decimals for the axes values. | baseLineValue | | A chart baseline value. | digitGroupSeparator | | The digit group separator. Valid values: COMMA, SPACE or NONE. | topLimit | | A chart baseline label. | digitGroupSeparator | | The digit group separator. Valid values: COMMA, SPACE or NONE. | topLimit | | The top limit set for the Pivot table. | measureCriteria | | Describes the criteria applied to this measure. | percentStackedValues | | Uses stacked values or not. More likely to be applied for graphics/charts. Boolean value. | externalAccess | | The program stage associated. | 项目状态 | | 不 | externalAccess | | 项目状态。可以是 "激活"、"已完成 "或 "已取消"。 | userOrganisationUnitGrandChildren | | The event status. It can be ACTIVE, COMPLETED, VISITED, SCHEDULE, OVERDUE, SKIPPED. | reportingParams | | Indicates whether the EventVisualization is available as external read-only. Boolean value. | userOrganisationUnit | | sortOrder | colTotals | | Indicates if the user has an organisation unit. Boolean value. | userOrganisationUnitChildren | | Indicates if the user has a children organisation unit. Boolean value. | userOrganisationUnitGrandChildren | | Indicates if the user has a grand children organisation unit. Boolean value. | rowTotals | | Indicates whether the visualization is using cumulative values. Boolean value. | hideEmptyColumns | | Custom period onincidentDate. See "custom date periods" section. | colTotals | | Displays (or not) the columns totals. Boolean value. | rowSubTotals | | Displays (or not) the row sub-totals. Boolean value. | fixRowHeaders | | 不 | completedOnly | | Indicates whether the EventVisualization is using cumulative values. Boolean value. | hideEmptyRows | | Indicates whether to hide rows with no data values. Boolean value. | showDimensionLabels | | Flag used in analytics requests. If true, only completed events/enrollments will be taken into consideration. Boolean value. | showDimensionLabels | | Hides the title or not. Boolean value. | hideSubtitle | | Hides the subtitle or not. Boolean value. | hideLegend | | Defines a custom description for the EventVisualiation. | showHierarchy |
showData
Used by charts to hide or not data/values within the rendered model. Boolean value.
lastUpdatedBy
Object that represents the user that applied the last changes to the Visualization.
lastUpdated
The date/time of the last time the Visualization was changed. favorites
List of user ids who have marked this object as a favorite.
subscribers
The dimensions defined for the rows.
filterDimensions
outlierAnalysis
Object responsible to keep settings related to outlier analysis. The internal attribute 'outlierMethod' supports: IQR, STANDARD_Z_SCORE, MODIFIED_Z_SCORE. The 'normalizationMethod' accepts only Y_RESIDUALS_LINEAR for now.
seriesKey
Styling options for and whether or not to display the series key.
传说
Options for and whether or not to apply legend colors to the chart series.
To retrieve a list of all existing visualizations, in JSON format, with some basic information (including identifier, name and pagination) you can make a GET request to the URL below. You should see a list of all public/shared visualizations plus your private ones.
GET /api/visualizations.json
如果要检索特定可视化的JSON定义,可以将其各自的标识符添加到URL:
GET /api/visualizations/hQxZGXqnLS9.json
| 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: | Parameter name | |---|---| | Two mappings for the Referrals Age category. A program indicator can choose which mapping | Endpoint responses { #webapi_data_items_possible_responses } | | 是的 | json { "interpretations": [ { "id": "Lfr8I2RPU0C" }, { "id": "JuwgdJlJPGb" }, { "id": "WAoU2rSpyZp" } ] } | | displayColumnOrder | 创建,更新和删除可视化 { #webapi_visualization_add_update_remove_visualizations } | | 枚举(参见元数据和渲染类型表中的列表) | json { "columns": [ { "dimension": "J5jldMd8OHv", "items": [ { "name": "CHP", "id": "uYxK4wmcPqA", "displayName": "CHP", "displayShortName": "CHP", "dimensionItemType": "ORGANISATION_UNIT_GROUP" }, { "name": "Hospital", "id": "tDZVQ1WtwpA", "displayName": "Hospital", "displayShortName": "Hospital", "dimensionItemType": "ORGANISATION_UNIT_GROUP" } ] } ], "rows": [ { "dimension": "SooXFOUnciJ", "items": [ { "name": "DOD", "id": "B0bjKC0szQX", "displayName": "DOD", "displayShortName": "DOD", "dimensionItemType": "CATEGORY_OPTION_GROUP" }, { "name": "CDC", "id": "OK2Nr4wdfrZ", "displayName": "CDC", "displayShortName": "CDC", "dimensionItemType": "CATEGORY_OPTION_GROUP" } ] } ], "filters": [ { "dimension": "ou", "items": [ { "name": "Sierra Leone", "id": "ImspTQPwCqd", "displayName": "Sierra Leone", "displayShortName": "Sierra Leone", "dimensionItemType": "ORGANISATION_UNIT" }, { "name": "LEVEL-1", "id": "LEVEL-H1KlN4QIauv", "displayName": "LEVEL-1" } ] } ], "name": "HIV Cases Monthly", "description": "Cases of HIV across the months", "category": "XY1vwCQskjX", "showDimensionLabels": true, "hideEmptyRows": true, "hideEmptyColumns": true, "skipRounding": true, "aggregationType": "SUM", "regressionType": "LINEAR", "type": "PIVOT_TABLE", "numberType": "VALUE", "measureCriteria": "Some criteria", "showHierarchy": true, "completedOnly": true, "displayDensity": "NORMAL", "fontSize": "NORMAL", "digitGroupSeparator": "SPACE", "legendDisplayStyle": "FILL", "legendDisplayStrategy": "FIXED", "hideEmptyRowItems": "BEFORE_FIRST_AFTER_LAST", "fixColumnHeaders": true, "fixRowHeaders": false, "regression": false, "cumulative": true, "sortOrder": 1, "topLimit": 2, "rowTotals": true, "colTotals": true, "hideTitle": true, "hideSubtitle": true, "hideLegend": true, "showData": true, "percentStackedValues": true, "noSpaceBetweenColumns": true, "rowSubTotals": true, "colSubTotals": true, "userOrgUnitType": "TEI_SEARCH", "externalAccess": false, "publicAccess": "--------", "reportingParams": { "reportingPeriod": true, "organisationUnit": true, "parentOrganisationUnit": true, "grandParentOrganisationUnit": true }, "parentGraphMap": { "ImspTQPwCqd": "" }, "access": { "read": true, "update": true, "externalize": true, "delete": false, "write": true, "manage": false }, "optionalAxes": [ { "dimensionalItem": "fbfJHSPpUQD", "axis": 1 }, { "dimensionalItem": "cYeuwXTCPkU", "axis": 2 } ], "relativePeriods": { "thisYear": false, "quartersLastYear": true, "last52Weeks": false, "thisWeek": false, "lastMonth": false, "last14Days": false, "biMonthsThisYear": false, "monthsThisYear": false, "last2SixMonths": false, "yesterday": false, "thisQuarter": false, "last12Months": false, "last5FinancialYears": false, "thisSixMonth": false, "lastQuarter": false, "thisFinancialYear": false, "last4Weeks": false, "last3Months": false, "thisDay": false, "thisMonth": false, "last5Years": false, "last6BiMonths": false, "last4BiWeeks": false, "lastFinancialYear": false, "lastBiWeek": false, "weeksThisYear": false, "last6Months": false, "last3Days": false, "quartersThisYear": false, "monthsLastYear": false, "lastWeek": false, "last7Days": false, "thisBimonth": false, "lastBimonth": false, "lastSixMonth": false, "thisBiWeek": false, "lastYear": false, "last12Weeks": false, "last4Quarters": false }, "user": {}, "yearlySeries": [ "THIS_YEAR" ], "userGroupAccesses": [ { "access": "rwx-----", "userGroupUid": "ZoHNWQajIoe", "displayName": "Bo District M&E officers", "id": "ZoHNWQajIoe" } ], "userAccesses": [ { "access": "--------", "displayName": "John Barnes", "id": "DXyJmlo9rge", "userUid": "DXyJmlo9rge" } ], "legendSet": { "name": "Death rate up", "id": "ham2eIDJ9k6", "legends": [ { "startValue": 1, "endValue": 2, "color": "red", "image": "some-image" }, { "startValue": 2, "endValue": 3, "color": "blue", "image": "other-image" } ] }, "outlierAnalysis": { "enabled": true, "outlierMethod": "IQR", "thresholdFactor": 1.5, "normalizationMethod": "Y_RESIDUALS_LINEAR", "extremeLines": { "enabled": true, "value": 3.5 } }, "legend": { "strategy": "FIXED", "style": "FILL", "set": { "id": "fqs276KXCXi", "displayName": "ANC Coverage" }, "showKey": false }, "seriesKey": { "hidden": true, "label": { "fontStyle": { "textColor": "#cccddd" } } }, "axes": [ { "index": 0, "type": "RANGE", "label": { "fontStyle": { "textColor": "#cccddd" } }, "title": { "text": "Range axis title", "textMode": "CUSTOM", "fontStyle": { "textColor": "#000000" } }, "decimals": 1, "maxValue": 100, "minValue": 20, "steps": 5, "baseLine": { "value": 50, "title": { "text": "My baseline", "fontStyle": { "textColor": "#000000" } } }, "targetLine": { "value": 80, "title": { "text": "My targetline", "fontStyle": { "textColor": "#cccddd" } } } }, { "index": 1, "type": "DOMAIN", "label": { "fontStyle": { "textColor": "#000000" } }, "title": { "text": "Domain axis title", "textMode": "CUSTOM", "fontStyle": { "textColor": "#cccddd" } } } ], "axes": [ { "index": 0, "type": "RANGE", "label": { "fontStyle": { "textColor": "#cccddd" } }, "title": { "text": "Range axis title", "fontStyle": { "textColor": "#000000" } }, "decimals": 1, "maxValue": 100, "minValue": 20, "steps": 5, "baseLine": { "value": 50, "title": { "text": "My baseline", "fontStyle": { "textColor": "#000000" } } }, "targetLine": { "value": 80, "title": { "text": "My targetline", "fontStyle": { "textColor": "#cccddd" } } } }, { "index": 1, "type": "DOMAIN", "label": { "fontStyle": { "textColor": "#000000" } }, "title": { "text": "Domain axis title", "fontStyle": { "textColor": "#cccddd" } } } ] } | | 列 | Stores specific parameters related to columns (at the moment, index and span) | | Array of objects | 可视化 { #webapi_visualization } | | dataFilters | The EventVisualization API is designed to help clients to interact with event charts and reports. The endpoints of this API are used by the Event Visualization application which allows the creation, configuration and management of charts and reports based on the client's definitions. The main idea is to enable clients and users to have a unique and centralized API providing all types of event charts and reports as well as specific parameters and configuration for each type of event visualization. This API was introduced with the expectation to unify both eventCharts and eventReports APIs and entirely replace them in favour of the eventVisualizations API (which means that the usage of eventCharts and eventReports APIs should be avoided). In summary, the following resources/APIs: /api/eventCharts, /api/eventReports are being replaced by /api/eventVisualizations | | GET /api/metadata/proposals?filter=status:eq:ACCEPTED | An EventVisualization object is composed of many attributes (some of them related to charting and others related to reporting), but the most important ones responsible to reflect the core information of the object are: "id", "name", "type", "dataDimensionItems", "columns", "rows" and "filters". The root endpoint of the API is /api/eventVisualizations, and the list of current attributes and elements are described in the table below. | | dueDate | 领域 | | lastUpdatedDate | id | | 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。 只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户 用户可以通过 打破玻璃 获得临时所有权。 玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。 他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。 访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时 时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。 获得临时访问权。 | 码 | | > Note
The
repetitionattribute (inrows,columnsorfilters) indicates the events indexes to be retrieved. Taking the example above (in the previousjsonpayload), it can be read as follows:1 = First event 2 = Second event 3 = Third event ... -2 = Third latest event -1 = Second latest event 0 = Latest event (default) | 名称 || The name of the EventVisualiation | type | | The type of the Visualization. The valid types are: COLUMN, STACKED_COLUMN, BAR, STACKED_BAR, LINE, AREA, PIE, RADAR, GAUGE, YEAR_OVER_YEAR_LINE YEAR_OVER_YEAR_COLUMN, SINGLE_VALUE, PIVOT_TABLE. | title | | A custom title. | subtitle | | Defines a custom description for the Visualization. | created | | Defines a custom description for the EventVisualiation. | created | | Events resource only. Custom period on
scheduledDate. See "custom date periods" section. | 开始日期 | | An object representing the creator of the Visualization. | 结束日期 | | The ending date used during the filtering. | sortOrder | | The sorting order of this EventVisualiation. Integer value. | user | | An object representing the creator of the Visualization. | publicAccess | | Sets the permissions for public access. | displayDensity | | The display density of the text. | fontSize | | The font size of the text. | relativePeriods | | An object representing the relative periods used in the analytics query. | 传说 | | An object representing the definitions for the legend and legend set, display style (FILL or TEXT) and display strategy (FIXED or BY_DATA_ITEM). | aggregationType | | Determines how the values are aggregated (if applicable). Valid options: SUM, AVERAGE, AVERAGE_SUM_ORG_UNIT, LAST, LAST_AVERAGE_ORG_UNIT, FIRST, FIRST_AVERAGE_ORG_UNIT, COUNT, STDDEV, VARIANCE, MIN, MAX, NONE, CUSTOM or DEFAULT. | regressionType | | A valid regression type: NONE, LINEAR, POLYNOMIAL or LOESS. | targetLineValue | | The chart target line. Accepts a Double type. | targetLineLabel | | The chart target line label. | rangeAxisLabel | | 请求查询参数 { #webapi_analytics_query_parameters } | domainAxisLabel | | The chart horizontal axis (x) label/title. | rangeAxisMaxValue | | The chart axis maximum value. Values outside of the range will not be displayed. | rangeAxisMinValue | | The chart axis minimum value. Values outside of the range will not be displayed. | rangeAxisSteps | | The number of axis steps between the minimum and maximum values. | rangeAxisDecimals | | The number of decimals for the axes values. | baseLineValue | | A chart baseline value. | baseLineLabel | | A chart baseline label. | digitGroupSeparator | | The digit group separator. Valid values: COMMA, SPACE or NONE. | topLimit | | The top limit set for the Pivot table. | measureCriteria | | Describes the criteria applied to this measure. | percentStackedValues | | Uses stacked values or not. More likely to be applied for graphics/charts. Boolean value. | noSpaceBetweenColumns | | 不 | externalAccess | | Indicates whether the EventVisualization is available as external read-only. Boolean value. | userOrganisationUnit | | Indicates if the user has an organisation unit. Boolean value. | userOrganisationUnitChildren | | Indicates if the user has a children organisation unit. Boolean value. | userOrganisationUnitGrandChildren | | Indicates if the user has a grand children organisation unit. Boolean value. | rowTotals | | Custom period onincidentDate. See "custom date periods" section. | colTotals | | Displays (or not) the columns totals. Boolean value. | rowSubTotals | | Displays (or not) the row sub-totals. Boolean value. | colSubTotals | | 不 | cumulativeValues | | Indicates whether the EventVisualization is using cumulative values. Boolean value. | hideEmptyRows | | Indicates whether to hide rows with no data values. Boolean value. | completedOnly | | Flag used in analytics requests. If true, only completed events/enrollments will be taken into consideration. Boolean value. | showDimensionLabels | |{ "periodFrom": -15, "periodTo": 15}| hideTitle | | See an example payload below. | hideSubtitle | | 结束日期 | showHierarchy | |"displayOrderColumns": ["enrollmentDate", "program"]| showData | | Used by charts to hide or not data/values within the rendered model. Boolean value. | lastUpdatedBy | | Object that represents the user that applied the last changes to the EventVisualization. | lastUpdated | | The date/time of the last time the EventVisualization was changed. | favorites | | List of user ids who have marked this object as a favorite. | subscribers | | 不 | translations | | 不 | 项目 | | The program associated. | 项目阶段 | | The program stage associated. | 项目状态 | | 项目状态。可以是 "激活"、"已完成 "或 "已取消"。 | eventStatus | | The event status. It can be ACTIVE, COMPLETED, VISITED, SCHEDULE, OVERDUE, SKIPPED. | dataType |
columnDimensions
The dimensions defined for the columns.
rowDimensions
The dimensions defined for the rows.
filterDimensions
outputType
Indicates output type of the EventVisualization. It can be EVENT, ENROLLMENT or TRACKED_ENTITY_INSTANCE.
collapseDataDimensions
<attribute id>
hideNaData
Indicates whether to hide N/A data. Boolean value.
hideEmptyColumns
fixColumnHeaders
Fixes (or not) the pivot table column headers. Boolean value.
Fixes (or not) the pivot table row headers. Boolean value.
Retrieving event visualizations { #webapi_event_visualization_retrieving_event_visualizations }
To retrieve a list of all existing event visualizations, in JSON format, with some basic information (including identifier, name and pagination) you can make a GET request to the URL below. You should see a list of all public/shared event visualizations plus your private ones. GET /api/eventVisualizations.json If you want to retrieve the JSON definition of a specific EventVisualization you can add its respective identifier to the URL: GET /api/eventVisualizations/hQxZGXqnLS9.json The following representation is an example of a response in JSON format (for brevity, certain information has been removed). For the complete schema, please use GET /api/schemas/eventVisualization.
{
"lastUpdated": "2021-11-25T17:18:03.834",
"href": "http://localhost:8080/dhis/api/eventVisualizations/EZ5jbRTxRGh",
"id": "EZ5jbRTxRGh",
"created": "2021-11-25T17:18:03.834",
"name": "Inpatient: Mode of discharge by facility type this year",
"publicAccess": "rw------",
"userOrganisationUnitChildren": false,
"type": "STACKED_COLUMN",
"subscribed": false,
"userOrganisationUnit": false,
"rowSubTotals": false,
"cumulativeValues": false,
"showDimensionLabels": false,
"sortOrder": 0,
"favorite": false,
"topLimit": 0,
"collapseDataDimensions": false,
"userOrganisationUnitGrandChildren": false,
"displayName": "Inpatient: Mode of discharge by facility type this year",
"percentStackedValues": false,
"noSpaceBetweenColumns": false,
"showHierarchy": false,
"hideTitle": false,
"showData": true,
"hideEmptyRows": false,
"hideNaData": false,
"regressionType": "NONE",
"completedOnly": false,
"colTotals": false,
"sharing": {
"owner": "GOLswS44mh8",
"external": false,
"users": {},
"userGroups": {},
"public": "rw------"
},
"programStatus": "CANCELLED",
"hideEmptyRowItems": "NONE",
"hideSubtitle": false,
"outputType": "EVENT",
"hideLegend": false,
"externalAccess": false,
"colSubTotals": false,
"rowTotals": false,
"digitGroupSeparator": "SPACE",
"program": {
"id": "IpHINAT79UW"
},
"access": {
"read": true,
"update": true,
"externalize": true,
"delete": true,
"write": true,
"manage": true
},
"lastUpdatedBy": {
"displayName": "John Traore",
"name": "John Traore",
"id": "xE7jOejl9FI",
"username": "admin"
},
"relativePeriods": {
"thisYear": false,
...
},
"programStage": {
"id": "A03MvHHogjR"
},
"createdBy": {
"displayName": "Tom Wakiki",
"name": "Tom Wakiki",
"id": "GOLswS44mh8",
"username": "system"
},
"user": {
"displayName": "Tom Wakiki",
"name": "Tom Wakiki",
"id": "GOLswS44mh8",
"username": "system"
},
"attributeDimensions": [],
"translations": [],
"legend": {
"set": {
"id": "gFJUXah1uRH"
},
"showKey": false,
"style": "FILL",
"strategy": "FIXED"
},
"filterDimensions": [
"ou",
"H6uSAMO5WLD"
],
"interpretations": [],
"userGroupAccesses": [],
"subscribers": [],
"columns": [
{
"id": "X8zyunlgUfM"
}
]
"periods": [],
"categoryDimensions": [],
"rowDimensions": [
"pe"
],
"itemOrganisationUnitGroups": [],
"programIndicatorDimensions": [],
"attributeValues": [],
"columnDimensions": [
"X8zyunlgUfM"
],
"userAccesses": [],
"favorites": [],
"dataDimensionItems": [],
"categoryOptionGroupSetDimensions": [],
"organisationUnitGroupSetDimensions": [],
"organisationUnitLevels": [],
"organisationUnits": [
{
"id": "ImspTQPwCqd"
}
],
"filters": [
{
"id": "ou"
},
{
"id": "H6uSAMO5WLD"
}
],
"rows": [
{
"id": "pe"
}
]
}
A more tailored response can be obtained by specifying, in the URL, the fields you want to extract. Ie.: GET /api/eventVisualizations/hQxZGXqnLS9.json?fields=interpretations will return
| 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: | Parameter name | |---|---| | Two mappings for the Referrals Age category. A program indicator can choose which mapping | These operations follow the standard REST semantics. A new EventVisualization can be created through a POST request to the /api/eventVisualizations resource with a valid JSON payload. An example of payload could be: | | GET /api/metadata/proposals?filter=status:eq:ACCEPTED | For multi-program support, the root program should not be specified. This will turn the eventVisualization into a multi-program. Consequently, we have to specify the program and programStage (when applicable) for each dimension in rows, columns, and filters. | | 枚举(参见元数据和渲染类型表中的列表) | json "program": null, "columns": [ { "dimension": "ou", "items": [ { "id": "O6uvpzGd5pu" } ], "program": { "id": "IpHINAT79UW" } }, { "dimensionType": "CATEGORY_OPTION_GROUP_SET", "items": [ { "id": "JLGV7lRQRAg" }, { "id": "p916ZCVGNyq" } ], "dimension": "C31vHZqu0qU", "program": { "id": "kla3mAPgvCH" }, "programStage": { "id": "aNLq9ZYoy9W" } } ] | | > Note
The
repetitionattribute (inrows,columnsorfilters) indicates the events indexes to be retrieved. Taking the example above (in the previousjsonpayload), it can be read as follows:1 = First event 2 = Second event 3 = Third event ... -2 = Third latest event -1 = Second latest event 0 = Latest event (default) | To update a specific EventVisualization, you can send a `PUT` request to the same `/api/eventVisualizations` resource with a similar payload `PLUS` the respective EventVisualization's identifier, ie.: PUT /api/eventVisualizations/hQxZGXqnLS9Finally, to delete an existing EventVisualization, you can make a
DELETErequest specifying the identifier of the EventVisualization to be removed, as shown: DELETE /api/eventVisualizations/hQxZGXqnLS9 | | 释义 { #webapi_interpretations } | For resources related to data analysis in DHIS2, such as visualizations, maps, event reports, event charts and even visualizations you can write and share data interpretations. An interpretation can be a comment, question, observation or interpretation about a data report or visualization. | | / api /解释 | 阅读口译 { #webapi_reading_interpretations } | | 为了阅读解释,我们将与/api/interpretations资源。使用字段的典型 GET 请求 过滤可以是这样的: | GET /api/interpretations?fields=*,comments[id,text,user,mentions] | | JSON 响应格式的输出可能如下所示(附加 为简洁起见省略了字段): |json { "interpretations": [ { "id": "XSHiFlHAhhh", "created": "2013-05-30T10:24:06.181+0000", "text": "Data looks suspicious, could be a data entry mistake.", "type": "MAP", "likes": 2, "user": { "id": "uk7diLujYif" }, "reportTable": { "id": "LcSxnfeBxyi" }, "visualization": { "id": "LcSxnfeBxyi" } }, { "id": "kr4AnZmYL43", "created": "2013-05-29T14:47:13.081+0000", "text": "Delivery rates in Bo looks high.", "type": "VISUALIZATION", "likes": 3, "user": { "id": "uk7diLujYif" }, "visualization": { "id": "HDEDqV3yv3H" }, "mentions": [ { "created": "2018-06-25T10:25:54.498", "username": "boateng" } ], "comments": [ { "id": "iB4Etq8yTE6", "text": "This report indicates a surge.", "user": { "id": "B4XIfwOcGyI" } }, { "id": "iB4Etq8yTE6", "text": "Likely caused by heavy rainfall.", "user": { "id": "B4XIfwOcGyI" } }, { "id": "SIjkdENan8p", "text": "Have a look at this @boateng.", "user": { "id": "xE7jOejl9FI" }, "mentions": [ { "created": "2018-06-25T10:03:52.316", "username": "boateng" } ] } ] } ] }| | Table: Interpretation fields | 领域 | | 描述 | id | | The interpretation identifier. | created | | The time of when the interpretation was created. | type |
The type of analytical object being interpreted. Valid options: VISUALIZATION, MAP, EVENT_REPORT, EVENT_CHART, EVENT_VISUALIZATION, DATASET_REPORT.
user
Association to the user who created the interpretation.
visualization
Association to the visualization if type is VISUALIZATION
eventVisualization
Association to the event visualization if type is EVENT_VISUALIZATION
map
eventReport
Association to the event report is type is EVENT_REPORT.
eventChart
Association to the event chart if type is EVENT_CHART.
dataSet
Association to the data set if type is DATASET_REPORT.
comments
Array of comments for the interpretation. The text field holds the actual comment.
mentions
对于所有分析对象,您可以将 /data 附加到 URL 以检索 与资源关联的数据(相对于元数据)。作为 一个例子,通过跟随地图链接并附加 /data 可以 通过检索主题地图的 PNG(图像)表示 以下网址:
https://play.dhis2.org/demo/api/maps/bhmHJ4ZCdCd/data
对于所有分析对象,您可以通过*提及*进行过滤。检索所有 您提到的用户的解释/评论 三个选项。您可以通过解释提及(提及 在解释中 描述):
GET /api/interpretations?fields=*,comments[*]&filter=mentions.username:in:[boateng]
您可以通过解释评论提及(在任何 评论):
&filter = comments.mentions.username:in:[boateng]
您可以按包含提及的解释进行过滤 在解释或任何评论中(或结点):
GET /api/interpretations?fields=*,comments[*]&filter=mentions:in:[boateng]
写作解释 { #webapi_writing_interpretations }
在编写解释时,您将提供解释文本作为 使用内容类型为“text/plain”的 POST 请求的请求正文。 URL 模式如下所示,其中 {object-type} 指的是 被解释的对象的类型,{object-id} 指的是 被解释对象的标识符。
Valid options for object type are visualization, map, eventReport, eventChart, eventVisualization and dataSetReport.
下面列出了一些有效的解释示例。
Note
The
eventChartsandeventReportsAPIs are deprecated. We recommend using theeventVisualizationsAPI instead.
/api/interpretations/visualization/hQxZGXqnLS9
/api/interpretations/map/FwLHSMCejFu
/api/interpretations/eventReport/xJmPLGP3Cde
/api/interpretations/eventChart/nEzXB2M9YBz
/api/interpretations/eventVisualization/nEzXB2M9YBz
/api/interpretations/dataSetReport/tL7eCjmDIgM
As an example, we will start by writing an interpretation for the visualization with identifier EbRN2VIbPdV. To write visualization interpretations we will interact with the /api/interpretations/visualization/{visualizationId} resource. The interpretation will be the request body. Based on this we can put together the following request using cURL:
curl -d "This visualization shows a significant ANC 1-3 dropout" -X POST "https://play.dhis2.org/demo/api/interpretations/visualization/EbRN2VIbPdV" -H "Content-Type:text/plain" -u admin:district
请注意,响应提供了一个带有值的 Location 标头
指示创建的解释的位置。这很有用
从客户的角度来看,当您想向
解释。
更新和删除解释 { #webapi_updating_removing_interpretations }
要更新现有解释,您可以使用 PUT 请求,其中
解释文本是使用以下 URL 模式的请求正文,
其中 {id} 指的是解释标识符:
/ api / interpretations / {id}
基于此,我们可以使用curl来更新解释:
```bash
curl -d "This visualization shows a high dropout" -X PUT
"https://play.dhis2.org/demo/api/interpretations/visualization/EV08iI1cJRA" -H "Content-Type:text/plain" -u admin:district
您可以使用与上面相同的 URL 模式使用 DELETE 请求来 删除解释。
创建解释注释 { #webapi_creating_interpretation_comments }
text 作为使用内容类型的 POST 请求的请求正文 “文本/纯文本”。 URL 模式如下所示,其中 {interpretation-id} 指的是解释标识符。
/ api / interpretations / {interpretation-id} /评论
其次,我们将对我们在 上面的例子。通过查看解释响应,您将看到 返回一个 Location 标头。这个标题告诉我们的 URL 新创建的解释,从中我们可以阅读它的 标识符。此标识符是随机生成的,因此您必须 用您自己的命令替换下面命令中的那个。写评论 我们可以与/api/interpretations/{id}/comments进行交互 像这样的资源:
curl -d "An intervention is needed" -X POST
"https://play.dhis2.org/demo/api/interpretations/j8sjHLkK8uY/comments"
-H "Content-Type:text/plain" -u admin:district
更新和删除解释注释 { #webapi_updating_removing_interpretation_comments }
要更新解释注释,您可以使用 PUT 请求,其中 评论文本是使用以下 URL 模式的请求正文:
/ api / interpretations / {interpretation-id} / comments / {comment-id}
基于此,我们可以使用curl来更新注释:
curl "https://play.dhis2.org/demo/api/interpretations/j8sjHLkK8uY/comments/idAzzhVWvh2"
-d "I agree with that." -X PUT -H "Content-Type:text/plain" -u admin:district
您可以使用与上面相同的 URL 模式,使用 DELETE 请求到 删除解释注释。
喜欢的解释 { #webapi_liking_interpretations }
要喜欢一个解释,你可以使用一个空的 POST 请求到 *喜欢*资源:
POST / api / interpretations / {id} / like
将为当前经过身份验证的用户添加一个赞。一个用户可以 只喜欢解释一次。
要删除解释的赞,您可以使用 DELETE 请求 与类似操作相同的资源。 可以通过查看解释的类似状态来查看 常规 Web API 表示: GET /api/interpretations/{id}
在 likes 字段中可以找到喜欢的信息,它代表 喜欢的数量,以及 likedBy 数组,它枚举了喜欢的用户 喜欢这个解释。 ```json { "id": "XSHiFlHAhhh", "text": "Data looks suspicious, could be a data entry mistake.", "type": "VISUALIZATION", "likes": 2, "likedBy": [ { "id": "k7Hg12fJ2f1" }, { "id": "gYhf26fFkjFS" } ] }
### SQL视图 { #webapi_sql_views }
SQL 视图资源允许您创建和检索结果集
SQL 视图。 SQL 视图可以直接针对
数据库并通过 Web API 资源呈现结果集。
/ api / sqlViews
SQL 视图对于创建可能更容易的数据视图很有用
用SQL构造比较结合Web的多个对象
应用项目接口。举个例子,假设我们被要求提供一个视图
所有组织单位及其名称、父名称、组织单位
级别和名称,以及数据库中列出的坐标。风景
可能看起来像这样:
```sql
select ou.name as orgunit, par.name as parent, ou.coordinates, ous.level, oul.name
from organisationunit ou
inner join _orgunitstructure ous on ou.organisationunitid = ous.organisationunitid
inner join organisationunit par on ou.parentid = par.organisationunitid
inner join orgunitlevel oul on ous.level = oul.level
where ou.coordinates is not null
order by oul.level, par.name, ou.name;
本质上是一个物化过程,并确保我们拥有 检索时可通过 SQL 视图获得的最新数据 从服务器。您可以先从 SQL 视图中查找 api/sqlViews 资源,然后使用以下命令进行 POST:
curl "https://play.dhis2.org/demo/api/sqlViews/dI68mLkP1wN/execute" -X POST -u admin:district
The next step in the process is the retrieval of the data. The endpoint is available at:
/api/sqlViews/{id}/data(.csv)
The id path represents the SQL view identifier. The path extensions refers to the format of the data download. Append either data for JSON data or data.csv for comma separated values. Support response formats are json, xml, csv, xls, html and html+css.
As an example, the following command would retrieve CSV data for the SQL view defined above.
curl "https://play.dhis2.org/demo/api/sqlViews/dI68mLkP1wN/data.csv" -u admin:district
SQL视图有三种类型:
SQL 视图: 标准 SQL 视图。
*物化的SQL视图:*物化的SQL视图,意思是
写入磁盘。需要更新以反映变化
底层表。支持过滤结果集的标准。
| SQL 查询: 普通 SQL 查询。支持内联变量 | 自定义查询。 |
|---|---|
| 标准 { #webapi_sql_view_criteria } | 您可以通过以下方式对结果集中的列进行简单过滤 |
| 使用列名将 criteria 查询参数附加到 URL | |
| 并过滤由列分隔的值作为参数值,在 | |
| 以下格式: | |
| / api / sqlViews / {id} / data?criteria = col1:value1&criteria = col2:value2 | As an example, to filter the SQL view result set above to only return |
| organisation units at level 4 you can use the following URL: |
https://play.dhis2.org/demo/api/sqlViews/dI68mLkP1wN/data.csv?criteria=level:4
变数 { #webapi_sql_view_variables }
SQL 视图支持变量替换。变量替换只是 可用于 query 类型的 SQL 视图,这意味着 SQL 视图不是 在数据库中创建,但只是作为常规 SQL 查询执行。 变量可以直接插入到 SQL 查询中,并且必须在 这种格式:
例如,检索给定的所有数据元素的 SQL 查询 通过变量定义值类型的值类型可以看 像这样:
从dataelement中选择*,其中valuetype ='$ {valueType}';
然后可以在请求时将这些变量作为 URL 的一部分提供 通过 sqlViews Web API 资源。可以提供变量 以下格式:
/ api / sqlViews / {id} / data?var = key1:value1&var = key2:value2
与上面的示例相对应的示例查询如下所示:
/api/sqlViews/dI68mLkP1wN/data.json?var=valueType:int
valueType 变量将替换为 int 值,并且 查询将返回具有 int 值类型的数据元素。
变量必须包含字母数字、破折号、下划线和空格 仅字符。
query 类型的 SQL 视图还支持两个系统定义的变量,这些变量允许查询访问有关执行视图的用户的信息:
变量
手段
${_current_user_id}
用户的数据库ID
${_current_username}
用户的用户名
这些变量的值不能作为URL的一部分提供。它们始终充满有关用户的信息。
select ou.path, ou.name
from organisationunit ou_user
join organisationunit ou on ou.path like ou_user.path || '%'
join usermembership um on um.organisationunitid = ou_user.organisationunitid
where um.userinfoid = ${_current_user_id}
order by ou.path;
The SQL view API supports data filtering, equal to the metadata object_filter. For a complete list of filter operators you can look at the documentation for metadata object_filter.
/api/sqlViews/w3UxFykyHFy/data.json?filter=orgunit_level:eq:2&filter=orgunit_name:ilike:bo
orgunit_level 2 或4:
/api/sqlViews/w3UxFykyHFy/data.json?filter=orgunit_level:in:[2,4]
/api/sqlViews/w3UxFykyHFy/data.json?filter=orgunit_name:!like:Bo
数据项 { #webapi_data_items }
This endpoint allows the user to query data related to a few different dimensional items. These items are: INDICATOR, DATA_ELEMENT, DATA_SET, PROGRAM_INDICATOR, PROGRAM_DATA_ELEMENT, PROGRAM_ATTRIBUTE, OPTION_SET. The endpoint supports only GET requests and, as other endpoints, can return responses in JSON or XML format.
该URL是/ api / dataItems,并且可以想象,它能够在同一GET请求中通过同一端点检索不同的对象。因此,某些可用的可查询属性将根据要查询的维项目而有所不同。
1)GET /api/dataItems?filter=dimensionItemType:eq:DATA_ELEMENT&filter=valueType:eq:TEXT 在这个例子中,项目类型DATA_ELEMENT 有一个valueType 属性,可以在查询中使用。
2) GET /api/dataItems?pageSize=50&order=displayName:asc&filter=dimensionItemType:eq:PROGRAM_INDICATOR&filter=displayName:ilike:someName&filter=programId:eq:WSGAb5XwJ3Y
| 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: | Parameter name | |---|---| | Two mappings for the Referrals Age category. A program indicator can choose which mapping | Endpoint responses { #webapi_data_items_possible_responses } | | 是的 | Results found (status code 200) | | displayColumnOrder | Results not found (status code 200) | | 属性是描述被跟踪实体的值。属性可以通过 通过被跟踪实体类型或项目关联。这意味着属性既可以是被追踪实体的一部分,也可以是注册的一部分。 跟踪实体和注册的一部分。重要的是,一个属性只能有一个值,即使一个 一个属性只能有一个值,即使一个被跟踪实体有多个注册表来定义该属性。这是因为 实体最终拥有属性值。 | Invalid query (status code 409) | | Get translations | 分页 { #webapi_data_items_pagination } | | This endpoint also supports pagination as a default option. If needed, you can disable pagination by adding paging=false to the GET request, i.e.: /api/dataItems?filter=dimensionItemType:in:[INDICATOR]&paging=false. | 这是启用分页时的有效负载示例。请记住,分页是默认选项,不需要显式设置。 | | json { "pager": { "page": 1, "pageCount": 20, "total": 969, "pageSize": 50 }, "dataItems": [...] } | > Note
For elements where there is an associated Program, the program name should also be returned as part of the element name (as a prefix). The only exception is
Program Indicators. We will not prefix the element name in this case, in order to keep the same behavior as existing endpoints.The /dataItems endpoint will bring only data items that are defined as aggregatable type. The current list of valid aggregatable types is:
TEXT, LONG_TEXT,LETTER,BOOLEAN,TRUE_ONLY,NUMBER,UNIT_INTERVAL,PERCENTAGE,INTEGER,INTEGER_POSITIVE,INTEGER_NEGATIVE,INTEGER_ZERO_OR_POSITIVE,COORDINATE.Even though the response returns several different attributes, the filtering can only be applied to specific ones:
displayName,name,valueType,id,dimensionItemType,programId.The
orderwill be considered invalid if it is set on top ofname(ie.: order=name:asc) and afilteris set todisplayName(ie.: filter=displayName:ilike:aName), and vice-versa. | | 名称 | 现在,我们已经了解了此端点的主要功能和用法,让我们看一下响应中返回的属性列表。 | | Table: Data items attributes | 领域 | | 描述 | id |
码
A custom code to identify the dimensional item.
| 名称 | Parameter name | displayName | The display name defined. |
|---|---|---|---|
| shortName | DHIS2 has several resources for data analysis. These resources include | ||
maps, visualizations, eventVisualizations, reports and documents. By visiting these resources you will retrieve information about the resource. For instance, by navigating to /api/visualizations/R0DVGvXDUNP the response will contain the name, last date of modification and so on for the chart. To retrieve the analytical representation, for instance, a PNG representation of the visualization, you can append /data to all these resources. For instance, by visiting /api/visualizations/R0DVGvXDUNP/data the system will return a PNG image of the visualization. | displayShortName | The display short name defined. | |
| dimensionItemType | The dimension type. Possible types: INDICATOR, DATA_ELEMENT, REPORTING_RATE, PROGRAM_INDICATOR, PROGRAM_DATA_ELEMENT, PROGRAM_ATTRIBUTE. | valueType | The display short name defined. |
| simplifiedValueType | The genereal representation of a value type. Valid values: NUMBER, BOOLEAN, DATE, FILE_RESOURCE, COORDINATE, TEXT | 项目Id | 相关的项目 ID。 |
| 查看分析性资源表示 { #webapi_viewing_analytical_resource_representations } | DHIS2 has several resources for data analysis. These resources include | ||
maps, visualizations, eventVisualizations, reports and documents. By visiting these resources you will retrieve information about the resource. For instance, by navigating to /api/visualizations/R0DVGvXDUNP the response will contain the name, last date of modification and so on for the chart. To retrieve the analytical representation, for instance, a PNG representation of the visualization, you can append /data to all these resources. For instance, by visiting /api/visualizations/R0DVGvXDUNP/data the system will return a PNG image of the visualization. | Table: Analytical resources | Resource | |
| The display short name defined. | |||
| Data URL | Resource representations | eventCharts | 活动图 |
| /api/eventCharts/<identifier>/data | png | maps | 地图 |
/api/maps/<identifier>/data
png
| eventCreatedPeriod | json { "object": { "publicAccess": "rw------", "externalAccess": false, "user": {}, "userAccesses": [], "userGroupAccesses": [ { "id": "hj0nnsVsPLU", "access": "rw------" }, { "id": "qMjBflJMOfB", "access": "r-------" } ] } } | Parameter name | |---|---|---| | json | jsonp | html | xml | pdf | xls | csv | Event chart view | 活动图 |
/api/eventVisualizations/<identifier>/data
| eventCreatedPeriod | Parameter name |
|---|---|
| reports | 标准报告 |
| /api/reports/<identifier>/data | pdf | xls | html |
documents
资源资源
解析表示的数据内容可以通过以下方式修改 提供 date 查询参数。这就要求分析 为期间维度的相对期间设置资源。
Table: Data query parameters
值
选项值
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name | Attribute identifiers |
|---|---|---|---|
| 周期(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" | |||
| ] | |||
| } | |||
| ``` | width | /api/visualizations/R0DVGvXDUNP/data | |
| /api/visualizations/R0DVGvXDUNP/data?date=2013-06-01 |
/api/visualizations/jIISuEWxmoI/data.html
/api/visualizations/jIISuEWxmoI/data.html?date=2013-01-01
/api/visualizations/FPmvWs7bn2P/data.xls
/api/visualizations/FPmvWs7bn2P/data.pdf
/api/eventVisualizations/x5FVFVt5CDI/data
/api/eventVisualizations/x5FVFVt5CDI/data.png
/api/maps/DHE98Gsynpr/data
/api/maps/DHE98Gsynpr/data?date=2013-07-01
/api/reports/OeJsA6K1Otx/data.pdf
/api/reports/OeJsA6K1Otx/data.pdf?date=2014-01-01 |
| 数据值 | Program notification template | 用于检索各种分析的有效 URL 的一些示例 代表如下。 | /api/visualizations/R0DVGvXDUNP/data /api/visualizations/R0DVGvXDUNP/data?date=2013-06-01
/api/visualizations/jIISuEWxmoI/data.html
/api/visualizations/jIISuEWxmoI/data.html?date=2013-01-01
/api/visualizations/FPmvWs7bn2P/data.xls
/api/visualizations/FPmvWs7bn2P/data.pdf
/api/eventVisualizations/x5FVFVt5CDI/data
/api/eventVisualizations/x5FVFVt5CDI/data.png
/api/maps/DHE98Gsynpr/data
/api/maps/DHE98Gsynpr/data?date=2013-07-01
/api/reports/OeJsA6K1Otx/data.pdf
/api/reports/OeJsA6K1Otx/data.pdf?date=2014-01-01 |
| Events resource only. Custom period on scheduledDate. See "custom date periods" section. | Program notification template | 要访问 DHIS2 中的分析汇总数据,您可以使用 *分析*资源。分析资源非常强大,因为它可以让您 查询和检索沿所有可用数据维度聚合的数据。 例如,您可以要求分析资源提供 一组数据元素、时间段和 组织单位。此外,您可以检索聚合数据 基于数据元素的任意数量维度的组合和 组织单位组集。 | no | | 请求查询参数 { #webapi_analytics_query_parameters } | Program notification template | Table: Query parameters | 查询参数 | | 需要 | Program notification template | 选项(默认为默认) | 查询参数 | | dueDate | Program notification template | Any dimension | query | | lastUpdatedDate | Program notification template | Any dimension | query | | 不 | Program notification template | SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | LAST | LAST_AVERAGE_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX | 假 | | 不 | Program notification template | ASC | DESC | 假 | | sortOrder | Program notification template | EQ | GT | GE | LT | LE | 假 | | stage | Program notification template | Program stage identifier. | 假 | | 不 | Program notification template | 日期 | 假 | | 不 | Program notification template | false | true | 假 | | 不 | Program notification template | false | true | 假 | | The program stage associated. | Program notification template | false | true | 假 | | Custom period on incidentDate. See "custom date periods" section. | Program notification template | lastUpdated | 假 | | 不 | Program notification template | false | true | 假 | | 不 | Program notification template | ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier> | 假 | | Custom period on lastUpdated. See "custom date periods" section. | Program notification template | DESCENDANTS, CHILDREN, SELECTED | 查询参数 | | json { "httpStatus": "OK", "httpStatusCode": 200, "status": "OK", "response": { "responseType": "ObjectReport", "uid": "pG4bBTMiCqO", "klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange", "errorReports": [] } } | Program notification template | false | true | page | | Required / Notes | Program notification template | false | true | includeNumDen | | 是的 | Program notification template | false | true | includeNumDen | | The name of the headers to be returned as part of the response. One or more headers name separated by comma | Program notification template | 不 | displayProperty | | 不 | Program notification template | NAME | SHORTNAME | outputIdScheme | | 描述 | Program notification template | 需要 | query | | 不 | Program notification template | UUID | CODE | NAME | ATTRIBUTE:<ID> | outputDataElementIdScheme | | 不 | Program notification template | UUID | CODE | NAME | ATTRIBUTE:<ID> | hierarchyMeta | | 不 | Program notification template | UID | CODE | ATTRIBUTE:<ID> | hierarchyMeta | | iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 | Program notification template | Identifier of approval level | 价值 | | 不 | Program notification template | 日期 | userOrgUnit | | 事件聚合资源不返回事件信息 本身,而不是与请求匹配的事件总数 询问。事件维度包括数据元素、人员属性、人员 标识符、期间和组织单位。聚合事件查询 应该是下面描述的格式。 | Program notification template | false | true | skipMeta | | 不 | Program notification template | Any dimension (must be query dimension) | 假 |
不
Dimensions to use as rows for table layout, separated by semi-colon.
Any dimension (must be query dimension)
order
不
Specify the ordering of rows based on value.
ASC | DESC
timeField
不
The time field to base event aggregation on. Applies to event data items only. Can be a predefined option or the ID of an attribute or data element with a time-based value type.
EVENT_DATE | ENROLLMENT_DATE | INCIDENT_DATE | DUE_DATE | COMPLETED_DATE | CREATED | LAST_UPDATED | <Attribute ID> | <Data element ID>
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.
<Attribute ID> | <Data element ID> | REGISTRATION | ENROLLMENT | OWNER_AT_START | OWNER_AT_END
enhancedConditions
不
false | true
dimension 查询参数定义了哪些维度应该是 包含在分析查询中。可以是任意数量的维度 指定的。每个维度都应该重复维度参数 包含在查询响应中。查询响应可能 包含指定的所有组合的聚合值 维度项。
| /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 | 值不引用数字元素或项目一部分的数据元素或属性 | aggregationType 查询参数允许您定义哪个聚合 运算符应该用于查询。默认情况下,聚合 将使用为查询中包含的数据元素定义的运算符。 如果您的查询不包含任何数据元素但包含数据 元素组,第一个数据元素的聚合运算符 将使用第一组。组和数据元素的顺序是 不明确的。此查询参数允许您覆盖默认值和 指定特定的聚合运算符。例如,您可以设置 使用以下 URL 进行“计数”的聚合运算符: | |---|---|---| | /api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2014Q1&dimension=ou:O6uvpzGd5pu &aggregationType=COUNT | measureCriteria 查询参数可让您过滤掉数据范围 要返回的记录。您可以指示系统仅返回记录 其中聚合数据值等于、大于、大于或 等于、小于或小于或等于某些值。您可以指定任何 以下格式的标准数量,其中 criteria 和 value 应替换为实际值: | /api/analytics?measureCriteria=criteria:value;criteria:value | | 例如,以下查询将仅返回以下记录 数据值大于或等于 6500 且小于 33000: | E7228 | Fallback coordinate field is invalid | | /api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014 &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&preAggregationMeasureCriteria=GE:10;LT:100 | Filter on whether the current user can manage the returned users through the managed user group relationships. | /api/analytics.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU &dimension=ou:ImspTQPwCqd&startDate=2018-01-01&endDate=2018-06-01 | | 为了让分析资源生成形状中的数据 一个现成的表格,你可以提供 tableLayout 参数 true 作为值。而不是生成一个普通的、规范化的数据源, 分析资源现在将生成表格布局中的数据。你 可以将 columns 和 rows 参数与维度标识符一起使用 用分号分隔作为值以指示使用哪些值 表格列和行。列和行维度必须存在 作为查询中的数据维度(不是过滤器)。这样的请求可以看 像这样: | 描述 | order 参数可用于分析资源生成 有序数据。数据将按升序(或降序)排序 值。以降序对值进行排序的示例请求 顺序是: | | /api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:LAST_12_MONTHS &dimension=ou:O6uvpzGd5pu&order=DESC | 尺寸和项目 { #webapi_analytics_dimensions_and_items } | DHIS2 features a multi-dimensional data model with several fixed and dynamic data dimensions. The fixed dimensions are the data element, period (time) and organisation unit dimension. You can dynamically add dimensions through categories, category option group sets, organisation unit group sets, data element group sets and organisation unit group sets. The table below displays the available data dimensions in DHIS2. Each data dimension has a corresponding dimension identifier, and each dimension can have a set of dimension items: | | Table: Dimensions and dimension items | 尺寸 | Dimension id | | Dimension items | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | dx | | /api/analytics/events | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | 聚乙烯 | | ISO periods and relative periods, see "date and period format" | Data elements, indicators, data set reporting rate metrics, data element operands, program indicators, program data elements, program attributes, validation rules | 欧 |
Organisation unit identifiers, and keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>
Category option combinations
co
Category option combo identifiers (omit to get all items)
Attribute option combinations
ao
Category option combo identifiers (omit to get all items)
分类目录
<category id>
Category option identifiers (omit to get all items)
数据元素组集
{
"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"
]
]
}
[
{
"year": 2016,
"week": 5,
"mapViews": 2181,
"chartViews": 2227,
"reportTableViews": 5633,
"eventReportViews": 6757,
"eventChartViews": 9860,
"eventVisualizationViews": 2387,
"dashboardViews": 10082,
"passiveDashboardViews": 0,
"totalViews": 46346,
"averageViews": 468,
"averageMapViews": 22,
"averageChartViews": 22,
"averageReportTableViews": 56,
"averageEventReportViews": 68,
"averageEventChartViews": 99,
"averageEventVisualizationViews": 10,
"averageDashboardViews": 101,
"averagePassiveDashboardViews": 0,
"savedMaps": 1805,
"savedCharts": 2205,
"savedReportTables": 1995,
"savedEventReports": 1679,
"savedEventCharts": 1613,
"savedEventVisualizations": 1231,
"savedDashboards": 0,
"savedIndicators": 1831,
"activeUsers": 99,
"users": 969
},
{
"year": 2016,
"week": 6,
"mapViews": 2018,
"chartViews": 2267,
"reportTableViews": 4714,
"eventReportViews": 6697,
"eventChartViews": 9511,
"dashboardViews": 12181,
"passiveDashboardViews": 0,
"totalViews": 47746,
"averageViews": 497,
"averageMapViews": 21,
"averageChartViews": 23,
"averageReportTableViews": 49,
"averageEventReportViews": 69,
"averageEventChartViews": 99,
"averageDashboardViews": 126,
"averagePassiveDashboardViews": 0,
"savedMaps": 1643,
"savedCharts": 1935,
"savedReportTables": 1867,
"savedEventReports": 1977,
"savedEventCharts": 1714,
"savedDashboards": 0,
"savedIndicators": 1646,
"activeUsers": 96,
"users": 953
}
]
{
"name": "Update 'Currently on treatment' data in analytics table",
"phase": "ANALYTICS_TABLE_POPULATED",
"analyticsTableType": "DATA_VALUE",
"sql": "update analytics_temp set monthly = '200212' where monthly in ('200210', '200211')"
}
SVG转换 { #webapi_svg_conversion }
| eventCreatedPeriod | Parameter name | 检索和删除项目通知模板 | Attribute identifiers |
|--------------------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------|
| Table: Query parameters | <indicator-id\> | ```json
{
"name": "Case notification",
"notificationTrigger": "ENROLLMENT",
"subjectTemplate": "Case notification V{org_unit_name}",
"displaySubjectTemplate": "Case notification V{org_unit_name}",
"notifyUsersInHierarchyOnly": false,
"sendRepeatable": false,
"notificationRecipient": "ORGANISATION_UNIT_CONTACT",
"notifyParentOrganisationUnitOnly": false,
"displayMessageTemplate": "Case notification A{h5FuguPFF2j}",
"messageTemplate": "Case notification A{h5FuguPFF2j}",
"deliveryChannels": [
"EMAIL"
]
}
``` | 描述 |
| dueDate | 是的 | Analytics outlier detection { #webapi_analytics_outlier_detection } | ds |
| lastUpdatedDate | The file name for the returned attachment without file extension | Analytics outlier detection { #webapi_analytics_outlier_detection } | ds |
| E7228 | Request { #webapi_analytics_outlier_detection_request } | **Query parameters** | 查询参数 |
| 描述 | 需要 | Program notification template | ds |
| Filter on whether the current user can manage the returned users through the managed user group relationships. | 是的 | Program notification template | 开始日期 |
| Start date for interval tocheck for outliers | No (relative date period is mandatory in this case) | Program notification template | 结束日期 |
| End date for interval to check for outliers | No (relative date period is mandatory in this case) | Program notification template | 聚乙烯 |
| 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 [打破玻璃](#webaptrl) 获得临时所有权。
玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。
他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。
访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时
时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。
获得临时访问权。 | No (start and end date is mandatory in this case) | Program notification template | relativePeriodDate |
| Date used as basis for relative periods. | 不 | Program notification template | 欧 |
| Organisation unit, organisation unit level or groups (can be combined) | 不 | Program notification template | 标头 |
| The name of the headers to be returned as part of the response. One or more headers name separated by comma | 不 | Program notification template | 订购 |
| Sort the records on the value column | 不 | Program notification template | 500 |
| sortOrder | Sort the records on the value column in ascending or descending order | Program notification template | 跳过验证 |
算法
Algorithm to use for outlier detection
### 不
Z_SCORE, MODIFIED_Z_SCORE
- 临界点
- E7126
- 不
- 组织单位分析资源使您可以指定一系列查询参数:
- One or more headers name separated by comma
- page
不
UID, ID, CODE, NAME
### maxResults
| Maximum rows (responses) | 不 | Parameter name | Skip rounding of data values, i.e. provide fine precision (scale 10). |
|---|---|---|---|
| ```json
{
"object": {
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userAccesses": [],
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
``` | 日期时间 | **Request example** | |
| GET api/analytics/outlierDetection?ds=BfMAe6Itzgt&ou=ImspTQPwCqd&startDate=2022-07-26&endDate=2022-10-26&algorithm=Z_SCORE&maxResults=30&orderBy=value&threshold=3.0&sortOrder=asc&outputIdScheme=code | Response { #webapi_analytics_outlier_detection_response } |Response is delivered in several representation formats. The default format is JSON. The
available formats and content types are:| json(应用项目/ json) |
| xml(应用项目/ xml) | xsl (application/vnd.ms-excel) | csv(应用项目/ csv) | html(text / html) |
| html + css(text / html) | **Response example** | ```json
{
"headers":[
{
"name":"dx",
"column":"Data",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"dxname",
"column":"Data name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"pe",
"column":"Period",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"pename",
"column":"Period name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ou",
"column":"Organisation unit",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ouname",
"column":"Organisation unit name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"ounamehierarchy",
"column":"Organisation unit name hierarchy",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"coc",
"column":"Category option combo",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"cocname",
"column":"Category option combo name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"aoc",
"column":"Attribute option combo",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"aocname",
"column":"Attribute option combo name",
"valueType":"TEXT",
"hidden":false,
"meta":false
},
{
"name":"value",
"column":"Value",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"mean",
"column":"Mean",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"stddev",
"column":"Standard deviation",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"absdev",
"column":"Absolute deviation",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"zscore",
"column":"zScore",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"lowerbound",
"column":"Lower boundary",
"valueType":"NUMBER",
"hidden":false,
"meta":false
},
{
"name":"upperbound",
"column":"Upper boundary",
"valueType":"NUMBER",
"hidden":false,
"meta":false
}
],
"metaData":{
"maxResults":30,
"count":3,
"orderBy":"VALUE",
"threshold":3.0,
"algorithm":"Z_SCORE"
},
"rowContext":{
},
"width":18,
"rows":[
[
"DE_22",
"Q_Early breastfeeding (within 1 hr after delivery) at BCG",
"202209",
"September 2022",
"OU_204860",
"Sandaru CHC",
"/Sierra Leone/Kailahun/Penguia/Sandaru CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"105.0",
"18.3",
"28.7",
"86.7",
"3.0",
"-67.9",
"104.4"
],
[
"DE_359706",
"BCG doses given",
"202208",
"August 2022",
"OU_595",
"Ngalu CHC",
"/Sierra Leone/Bo/Bargbe/Ngalu CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"220.0",
"41.6",
"57.4",
"178.3",
"3.1",
"-130.7",
"213.9"
],
[
"DE_35",
"Yellow Fever doses given",
"202209",
"September 2022",
"OU_1027",
"Yemoh Town CHC",
"/Sierra Leone/Bo/Kakua/Yemoh Town CHC",
"COC_292",
"Fixed, <1y",
"default",
"default",
"466.0",
"48.1",
"114.2",
"417.8",
"3.6",
"-294.6",
"391.0"
]
],
"headerWidth":18,
"height":3
}
``` | Statistics in response { #webapi_analytics_outlier_detection_stats_in_response } |
| Statistical Measure | Header name | 描述 | 链接 |
| 值 | 价值 | The data set/ data element numeric value (Penta1 doses given, Measles doses given, etc.) | Mean |
| 意思是 | The average value of a set of numbers. Calculated by summing all values and dividing by the count. | https://www.khanacademy.org/math/statistics-probability/summarizing-quantitative-data | Standard Deviation |
| stddev | A measure of the amount of variation or dispersion in a set of values. | https://www.statisticshowto.com/probability-and-statistics/standard-deviation/ | |
| Absolute Deviation| absdev | The absolute difference between each data value and the middle value. | |
### https://www.mathsisfun.com/data/mean-absolute-deviation.html
Z Score
| zscore | Validation report |
|---|---|
| https://www.statisticshowto.com/probability-and-statistics/z-score/ | Modified Z Score |
| modifiedzscore | Similar to the Z score but robust to outliers. It uses the median and median absolute deviation. |
| https://www.statisticshowto.com/modified-z-scores/ | Median Absolute Deviation |
| medianabsdeviation | A robust measure of the spread of data values, calculated as the median of the absolute deviations from the median. |
| https://math.stackexchange.com/questions/2232309/median-absolute-deviation-mad-formula | Minimum |
| lowerbound | The minimum is the smallest value in a dataset. It represents the lowest observed value among all the data values. |
| Maximum | upperbound |
| The maximum is the largest value in a dataset. It represents the highest observed value among all the data values. | Error messages { #webapi_analytics_outlier_detection_error_messages } |
| All error messages are delivered with http status code 409. | 码 |
| 信息 | E2200 |
| At least one data element must be specified. | E2201 |
| Start date and end date or relative period must be specified. | E2202 |
| Start date must be before end date. | E2203 |
| 必须至少指定一个组织单位。 | E2204 |
| Threshold must be a positive number. | E2205 |
| Max results must be a positive number. | E2206 |
Max results exceeds the allowed max limit: *500*.
E2207
Data start date must be before data end date.
## E2208
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"
}
{
"contextPath": "http://yourdomain.com",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/29.0.1547.62",
"calendar": "iso8601",
"dateFormat": "yyyy-mm-dd",
"serverDate": "2021-01-05T09:16:03.548",
"serverTimeZoneId": "Etc/UTC",
"serverTimeZoneDisplayName": "Coordinated Universal Time",
"version": "2.13-SNAPSHOT",
"revision": "11852",
"buildTime": "2013-09-01T21:36:21.000+0000",
"serverDate": "2013-09-02T12:35:54.311+0000",
"environmentVariable": "DHIS2_HOME",
"javaVersion": "1.7.0_06",
"javaVendor": "Oracle Corporation",
"javaIoTmpDir": "/tmp",
"javaOpts": "-Xms600m -Xmx1500m -XX:PermSize=400m -XX:MaxPermSize=500m",
"osName": "Linux",
"osArchitecture": "amd64",
"osVersion": "3.2.0-52-generic",
"externalDirectory": "/home/dhis/config/dhis2",
"databaseInfo": {
"type": "PostgreSQL",
"name": "dhis2",
"user": "dhis",
"spatialSupport": false
},
"memoryInfo": "Mem Total in JVM: 848 Free in JVM: 581 Max Limit: 1333",
"cpuCores": 8
}
[{
"uid": "hpiaeMy7wFX",
"level": "INFO",
"category": "DATAVALUE_IMPORT",
"time": "2015-09-02T07:43:14.595+0000",
"message": "Import done",
"completed": true
}]
[{
"EVENT_IMPORT": {},
"DATA_STATISTICS": {},
"RESOURCE_TABLE": {},
"FILE_RESOURCE_CLEANUP": {},
"METADATA_IMPORT": {},
"CREDENTIALS_EXPIRY_ALERT": {},
"SMS_SEND": {},
"MOCK": {},
"ANALYTICSTABLE_UPDATE": {},
"COMPLETE_DATA_SET_REGISTRATION_IMPORT": {},
"DATAVALUE_IMPORT": {},
"DATA_SET_NOTIFICATION": {},
"DATA_INTEGRITY": {
"OB1qGRlCzap": [{
"uid": "LdHQK0PXZyF",
"level": "INFO",
"category": "DATA_INTEGRITY",
"time": "2018-03-26T15:02:32.171",
"message": "Data integrity checks completed in 38.31 seconds.",
"completed": true
}]
},
"PUSH_ANALYSIS": {},
"MONITORING": {},
"VALIDATION_RESULTS_NOTIFICATION": {},
"REMOVE_EXPIRED_RESERVED_VALUES": {},
"DATA_SYNC": {},
"SEND_SCHEDULED_MESSAGE": {},
"DATAVALUE_IMPORT_INTERNAL": {},
"PROGRAM_NOTIFICATIONS": {},
"META_DATA_SYNC": {},
"ANALYTICS_TABLE": {},
"PREDICTOR": {}
}]
[
{
"dataSet": "BfMAe6Itzgt",
"values": [
{
"dataElement": "s46m5MS0hxu",
"orgUnit": "Qc9lf4VM9bD",
"optionCombo": "Prlt0C1RF0s",
"minValue": 27,
"maxValue": 564
},
{
"dataElement": "s46m5MS0hxu",
"orgUnit": "Qc9lf4VM9bD",
"optionCombo": "V6L425pT3A0",
"minValue": 0,
"maxValue": 100
}
]
dataElement,orgUnit,optionCombo,minValue,maxValue,generated
s46m5MS0hxu,Qc9lf4VM9bD,Prlt0C1RF0s,27,564,false
s46m5MS0hxu,Qc9lf4VM9bD,V6L425pT3A0,0,100,true
In addition to object counts, the data summary response also includes various usage statistics related to users and data in the form of histograms.
`activeUsers` represents the number of users who have performed an action which results in a data statistics event (opened a dashboard, viewed a report, etc.) over the past hour (0), today (1), last 2 days (2), last 7 days (7) and last 30 days (30). Note that the "today" value represents the number of unique users who have been active since midnight server time, while the "last 2 days", "last 7 days" and "last 30 days" values represent the number of unique users who have been active in the respective time periods calculated backwards from the current time. `logins` represents the number of successful user logins over the same time periods. `userInvitations` provides the number of user invitations currently in the system, both total and expired. An example of these parts of the response is shown below:
```json
"activeUsers": {
"0": 1,
"1": 1,
"2": 1,
"7": 2,
"30": 2
},
"logins": {
"0": 1,
"1": 1,
"2": 131,
"7": 131,
"30": 131
},
"userInvitations": {
"all": 0,
"expired": 0
}
* Finally, the data summary response includes information about the system itself, such as the version, revision, build time, system ID and current server date. An example of the `system` part of the response is shown below:
* ```json
"system": {
"version": "2.43-SNAPSHOT",
"revision": "db516b5",
"buildTime": "2025-11-18T10:53:50.000",
"systemId": "eed3d451-4ff5-4193-b951-ffcc68954299",
"serverDate": "2025-11-18T10:55:15.048"
}
# HELP data_summary_object_counts Count of metadata objects { #help-data_summary_object_counts-count-of-metadata-objects }
# TYPE data_summary_object_counts gauge { #type-data_summary_object_counts-gauge }
data_summary_object_counts{type="indicator"} 77
data_summary_object_counts{type="trackedEntity"} 73125
data_summary_object_counts{type="visualization"} 292
data_summary_object_counts{type="period"} 384
data_summary_object_counts{type="programStageInstance"} 373597
# HELP data_summary_build_info Build information { #help-data_summary_build_info-build-information }
# TYPE data_summary_build_info gauge { #type-data_summary_build_info-gauge }
data_summary_build_info{version="2.42-SNAPSHOT", commit="932e552"} 1737621197
{
"name": "External data exchange with basic authentication",
"source": {
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "CODE"
}
}
}
201 Created
内部数据交换有效载荷示例,其中事件数据与项目指标一起计算,并保存为综合数据值:
```json
{
"name": "Internal data exchange",
"source": {
"params": {
"periodTypes": [
"MONTHLY",
"QUARTERLY"
]
},
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"filters": [
{
"dimension": "Bpx0589u8y0",
"items": [
"oRVt7g429ZO",
"MAs88nJc9nL"
]
}
],
"inputIdScheme": "UID",
"outputDataElementIdScheme": "UID",
"outputOrgUnitIdScheme": "UID",
"outputIdScheme": "UID"
}
]
},
"target": {
"type": "INTERNAL",
"request": {
"dataElementIdScheme": "UID",
"orgUnitIdScheme": "UID",
"categoryOptionComboIdScheme": "UID",
"idScheme": "UID"
}
}
}
{
"name": "External data exchange with basic authentication",
"source": {
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "CODE"
}
}
}
{
"name": "External data exchange with PAT authentication",
"source": {
"requests": [
{
"name": "ANC",
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"accessToken": "d2pat_XIrqgAGjW935LLPuSP2hXSZwpTxTW2pg3580716988"
},
"request": {
"idScheme": "CODE"
}
}
}
201 Created
Update aggregate data exchange
##### 元数据 CSV 导出{ #webapi_metadata_csv_export }
```json
{
"name": "External data exchange with basic authentication",
"source": {
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "CODE"
}
}
}
200 OK
Get aggregate data exchange
##### 元数据 CSV 导出{ #webapi_metadata_csv_export }
```json
{
"name": "External data exchange with basic authentication",
"source": {
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "CODE"
}
}
}
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name | 用户设置 { #webapi_user_settings } |
| --------------- | -------- | ------------------------------------------------------------ | ----------------------------- |
| ```json
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"response": {
"responseType": "ObjectReport",
"uid": "pG4bBTMiCqO",
"klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange",
"errorReports": []
}
}
``` | Program notification template | An aggregate data exchange can be run directly with a POST request to the following endpoint: | ```
POST /api/aggregateDataExchanges/{id}/exchange
```| UID \| ```
200 OK
``` |
```json
{
"responseType": "ImportSummaries",
"status": "SUCCESS",
"imported": 36,
"updated": 0,
"deleted": 0,
"ignored": 0,
"importSummaries": ["<import summaries here>"]
}
GET /api/aggregateDataExchanges/{id}/sourceData
{
"name": "External data exchange with basic authentication",
"source": {
"requests": [
{
"name": "ANC",
"visualization": null,
"dx": [
"fbfJHSPpUQD",
"cYeuwXTCPkU",
"Jtf34kNZhzP"
],
"pe": [
"LAST_12_MONTHS",
"202201"
],
"ou": [
"ImspTQPwCqd"
],
"inputIdScheme": "UID",
"outputIdScheme": "CODE"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "CODE"
}
}
}
| eventCreatedPeriod | 检索和删除项目通知模板 | Parameter name | 用户设置 { #webapi_user_settings } |
| --------------- | -------- | ------------------------------------------------------------ | ----------------------------- |
| ```json
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"response": {
"responseType": "ObjectReport",
"uid": "pG4bBTMiCqO",
"klass": "org.hisp.dhis.dataexchange.aggregate.AggregateDataExchange",
"errorReports": []
}
}
``` | Program notification template | An aggregate data exchange can be run directly with a POST request to the following endpoint: | ```
POST /api/aggregateDataExchanges/{id}/exchange
```| UID \| ```
200 OK
``` |
ATTRIBUTE:{ID}
### The response payload format is identical with the analytics API endpoint. This endpoint is useful for debugging purposes. Consult the analytics API guide for additional details.
Get source data value sets
| 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: | 您还可以通过发布到
通知资源如下所述。 `F_SEND_EMAIL` 或 `ALL`
权限必须在系统中才能使用这个 api。主题
参数是可选的。 “DHIS 2”字符串将作为默认主题发送
如果 url 中没有提供。应该对 URL 进行编码才能使用它
应用项目接口。 | ```
Accept: application/json
``` | Parameter name |
| ------------------------------------------------- | -------------- | ----------- | ------------------------------------------------------------ |
| displayColumnOrder | 具有以下要求: | ```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"
]
}
``` | 需要 |
| ```json
{
"source": "rspjJHg4WY1",
"targets": [
"HT0w9YLMLyn",
"rEpnzuNpRKM"
],
"primaryTarget": "HT0w9YLMLyn",
"deleteSource": true
}
``` | UID \ | ```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"
]
}
``` | 不 |
| Override the output identifier scheme for the data response. | UID \ | Program notification template | ATTRIBUTE:{ID} |
| The response payload format is identical with the data value sets API endpoint. This endpoint is useful for debugging purposes. Consult the data value sets API guide for additional details. | 不 | Program notification template | 领域 |
| 数据类型 | 强制的 | ```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"
]
}
``` | 名称 |
| 串 | 具有以下要求: | ```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"
]
}
``` | source |
| 目的 | 具有以下要求: | Program notification template | source.params |
| 目的 | 不 | ```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"
]
}
``` | source.params.periodTypes |
| Array/String | 不 | ```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"
]
}
``` | source.requests |
| Array/Object | 不 | ```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"
]
}
``` | source.requests.name |
| 串 | 是的 | Program notification template | source.requests.visualization |
| 串 | 具有以下要求: | Program notification template | source.requests.dx |
| Array/String | 不 | Program notification template | source.requests.pe |
| Array/String | 具有以下要求: | Program notification template | source.requests.ou |
| Array/String | 具有以下要求: | Program notification template | source.requests.filters |
| Array (Object) | 具有以下要求: | Program notification template | source.requests.filters.dimension |
| 串 | 具有以下要求: | Program notification template | source.requests.filters.items |
| Array/String | 具有以下要求: | Program notification template | source.requests.inputIdScheme |
| 串 | UID \ | ```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"
]
}
``` | source.requests.outputDataElementIdScheme |
| 串 | 具有以下要求: | ```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"
]
}
``` | source.requests.outputDataItemIdScheme |
| 串 | UID \ | Type of target, can be `EXTERNAL`, `INTERNAL`. | source.requests.outputOrgUnitIdScheme |
| 串 | 具有以下要求: | Type of target, can be `EXTERNAL`, `INTERNAL`. | source.requests.outputIdScheme |
| 串 | 具有以下要求: | Type of target, can be `EXTERNAL`, `INTERNAL`. | source.target |
| 目的 | 具有以下要求: | Type of target, can be `EXTERNAL`, `INTERNAL`. | source.target.type |
| 串 | 具有以下要求: | Type of target, can be `EXTERNAL`, `INTERNAL`. | source.target.api |
| 目的 | UID \ | Program notification template | source.target.api.url |
| 串 | 具有以下要求: | Program notification template | source.target.api.accessToken |
| 串 | 具有以下要求: | Program notification template | source.target.api.username |
| 串 | 具有以下要求: | Program notification template | source.target.api.password |
| 串 | 具有以下要求: | Program notification template | source.target.request |
| 目的 | 具有以下要求: | Program notification template | source.target.request.dataElementIdScheme |
| 串 | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Program notification template | source.target.request.orgUnitIdScheme |
| 串 | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Program notification template | source.target.request.categoryOptionComboIdScheme |
### 串
不
### 整数
#### source.target.request.idScheme
串
不
* Input general ID scheme, can be `UID`, `CODE`, `ATTRIBUTE:{ID}`.
* source.target.request.importStrategy
* 串
* 不
* Import strategy, can be `CREATE_AND_UPDATE`, `CREATE`, `UPDATE`, `DELETE`.
* source.target.request.skipAudit
* Boolean
* 不
* Skip audit, meaning audit values will not be generated. Improves performance at the cost of ability to audit changes. Requires authority "F_SKIP_DATA_IMPORT_AUDIT".
* source.target.request.dryRun
* Boolean
* 不
```
POST /api/aggregateDataExchanges
```
```
Content-Type: application/json
```
```json
{
"name": "Immunization doses program indicators to data elements",
"source": {
"requests": [
{
"name": "Immunization doses",
"dx": [
"BCG_DOSE",
"MEASLES_DOSE",
"YELLOW_FEVER_DOSE"
],
"pe": [
"202201"
],
"ou": [
"OU_525"
],
"inputIdScheme": "code",
"outputIdScheme": "code"
}
]
},
"target": {
"type": "EXTERNAL",
"api": {
"url": "https://play.dhis2.org/2.38.2.1",
"username": "admin",
"password": "district"
},
"request": {
"idScheme": "code"
}
}
}
```
* Whether to save changes on the server or just return the import summary.
* Error handling
* When running a data exchange by identifier, information about the outcome of the operation will be available in the response payload. The response will contain a list of import summaries, i.e. one import summary per source request. The import summary will indicate any potential conflicts as a result of data retrieval from the source instance and data import in the target instance.
* 例子
```
POST /api/aggregateDataExchanges/{id}/exchange
```
* External data exchange with identifier scheme code
```json
{
"responseType": "ImportSummaries",
"status": "SUCCESS",
"imported": 3,
"updated": 0,
"deleted": 0,
"ignored": 0
}
```
* This example will demonstrate how to exchange data based on program indicators in the source DHIS 2 instance and data elements in the target instance. The `code` identifier scheme, which means the data exchange will use the `code` property on the metadata to reference the data. Using codes is useful when the ID properties don't match across DHIS 2 instances. The example will demonstrate how data can be aggregated in the source instance, including aggregation in time and the unit hierarchy, before being exchanged with the target instance.
The example will exchange data using the DHIS 2 play environment, and refer to the 2.39 version at `https://play.dhis2.org/2.39` as the *source instance*, and the 2.38 version at `https://play.dhis2.org/2.38.2.1` as the *target instance*. Note that the URLs will change over time as new patch versions are released, so make sure to update the target URLs.
# 登录**源**实例,导航到 "维护 "应用项目,观察是否存在三个项目指示器。
## _BCG doses_ with code `BCG_DOSE`
_Measles doses_ with code `MEASLES_DOSE`
### _Yellow fever doses_ with code `YELLOW_FEVER_DOSE`
请注意,根组织单位是`塞拉利昂`,代码为`OU_525`。
登录**目标**实例并导航至*维护*应用项目。创建三个数据元素,其中代码与前面提到的计划指标相匹配:
JSON 格式的响应示例:
``json
[
{
"locale":"ar"、
"languageTag":"ar"、
"name":"العربية"、
"displayName":阿拉伯语", "displayName": "Arabic".
},
{
"locale":"ar_EG"、
"languageTag":"ar-EG"、
"name":"العربية (مصر)"、
"displayName":"阿拉伯语(埃及)"
},
{
"locale":"uz_UZ_Cyrl"、
"languageTag":"uz-Cyrl-UZ"、
"name":"ўзбекча (Кирил, Ўзбекистон)"、
"displayName"(显示名称):乌兹别克语(西里尔字母,乌兹别克斯坦)", "displayName": "乌兹别克语(西里尔字母,乌兹别克斯坦)".
}
]
/ api / 33 / locales / ui
Database content locales
You can retrieve and create locales for the database content with GET and POST requests through the `dbLocales` resource. XML and JSON resource representations are supported. To POST data, there are two required parameters: `country` and `language`.
| /api/locales/dbLocales?country=US&language=en | Parameter name |
|---|---|
| displayColumnOrder | That means you can retrieve and update translations using metadata class resources such as `api/dataElements`, `api/organisationUnits`, `api/dataSets`, etc. |
| Get translations | You can get translations for a metadata object such as DataElement by sending a GET request to `api/dataElements/{dataElementUID}` |
| dataFilters | ```json
{
"id": "fbfJHSPpUQD",
"href": "https://play.dhis2.org/dev/api/29/dataElements/fbfJHSPpUQD",
"created": "2010-02-05T10:58:43.646",
"name": "ANC 1st visit",
"shortName": "ANC 1st visit",
"translations":
[
{
"property": "SHORT_NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
},
{
"property": "NAME",
"locale": "fr",
"value": "Soin prénatal 1"
},
{
"property": "NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
}
]
}
``` |
You can also get only the `translations` property of an object by sending a GET request to
`api/dataElements/{dataElementUID}/translations`
```json
{
"translations":
[
{
"property": "SHORT_NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
},
{
"property": "NAME",
"locale": "fr",
"value": "Soin prénatal 1"
},
{
"property": "NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
}
]
}
请求必须是 *POST* 类型并使用 *application/json* 作为
内容类型。使用 curl 的示例,假设请求数据已保存
作为文件`keys.json`:
```bash
curl -d @keys.json "play.dhis2.org/demo/api/33/i18n" -X POST
-H "Content-Type: application/json" -u admin:district
/api/users?selfRegistered=true
/api/users/{id}
/api/users/OYLGMiazHtW
- updatedAtClient
User lookup by identifier
JSON 格式的有效载荷如下所示,其中`attributes `指元数据属性,`groupSets `指组织单位组集,`dataItems `指数据元素、指标、数据集和计划指标:
用户 `id` 将与以下用户属性匹配
按照指定的顺序:
用户标识
### 用户名
用户名
请求示例如下所示:
该响应将包含有关用户的最少信息。
```json
{
"id": "QqvaU7JjkUV",
"username": "nkono",
"firstName": "Thomas",
"surname": "Nkono",
"displayName": "Thomas Nkono"
}
GET / api / userLookup?query = {string}
/ api / userLookup?query = John
{
"users": [
{
"id": "DXyJmlo9rge",
"username": "jbarnes",
"firstName": "John",
"surname": "Barnes",
"displayName": "John Barnes"
},
{
"id": "N3PZBUlN8vq",
"username": "jkamara",
"firstName": "John",
"surname": "Kamara",
"displayName": "John Kamara"
}
]
}
{
"id": "Mj8balLULKp",
"firstName": "John",
"surname": "Doe",
"email": "johndoe@mail.com",
"userCredentials": {
"id": "lWCkJ4etppc",
"userInfo": {
"id": "Mj8balLULKp"
},
"username": "johndoe123",
"password": "Your-password-123",
"skype": "john.doe",
"telegram": "joh.doe",
"whatsApp": "+1-541-754-3010",
"facebookMessenger": "john.doe",
"avatar": {
"id": "<fileResource id>"
},
"userRoles": [
{
"id": "Ufph3mGRmMo"
}
]
},
"organisationUnits": [
{
"id": "Rp268JB6Ne4"
}
],
"userGroups": [
{
"id": "wl5cDMuUhmF"
}
]
}
- 在用户创建负载中,仅在导入时支持用户组
或一次*发布*一个用户。如果您尝试创建多个
user 在指定用户组时,您将不会收到错误,并且
将创建用户,但不会分配用户组。这是设计使然
并且由于用户和用户之间的多对多关系而受到限制
用户组,其中用户组是关系的所有者。更新
或者创建多个用户和他们的用户组,考虑一个项目来*POST*
一次一个,或 *POST* 所有用户,然后执行另一个操作
在指定新用户的标识符的同时更新他们的用户组。
- When creating a user the payload may also contain user settings.
These are added as `settings` object to the root object.
Each key-value pair becomes a member in the `settings` object, for example:
```json
{
"id": "Mj8balLULKp",
"firstName": "John",
"surname": "Doe",
"settings": {
"keyUiLocale": "de"
},
//...
}
有关可用的全部有效负载的更多信息,请参见`/ api / schemas / user`。
有关上传和检索用户头像的更多信息,请参阅
`/fileResources` 端点。
用户帐户邀请 { #webapi_user_invitations }
The Web API supports inviting people to create user accounts through the
`invite` resource. To create an invitation you should POST a user in XML
or JSON format to the invite resource. A specific username can be forced
by defining the username in the posted entity. By omitting the username,
the person will be able to specify it herself. The system will send out
an invitation through email. This requires that email settings have been
properly configured.
邀请资源可用于安全地
允许人们在其他人不知道密码的情况下创建帐户
或通过以纯文本形式传输密码。用于的有效载荷
邀请与创建用户相同。 JSON 格式的示例负载
看起来像这样:
### ```json
{
"firstName": "John",
"surname": "Doe",
"email": "johndoe@mail.com",
"userCredentials": {
"username": "johndoe",
"userRoles": [{
"id": "Euq3XfEIEbx"
}]
},
"organisationUnits": [ {
"id": "ImspTQPwCqd"
} ],
"userGroups": [ {
"id": "vAvEltyXGbD"
}]
}
curl -d @invite.json "localhost/api/33/users/invite" -u admin:district
-H "Content-Type:application/json"
{
"users": [ {
"firstName": "John",
"surname": "Doe",
"email": "johndoe@mail.com",
"userCredentials": {
"username": "johndoe",
"userRoles": [ {
"id": "Euq3XfEIEbx"
} ]
},
"organisationUnits": [ {
"id": "ImspTQPwCqd"
} ]
}, {
"firstName": "Tom",
"surname": "Johnson",
"email": "tomj@mail.com",
"userCredentials": {
"userRoles": [ {
"id": "Euq3XfEIEbx"
} ]
},
"organisationUnits": [ {
"id": "ImspTQPwCqd"
} ]
}
]
}
curl -d @invites.json "localhost/api/33/users/invites" -u admin:district
-H "Content-Type:application/json"
Successful response looks like:
```json
{
"loginStatus": "SUCCESS",
"redirectUrl": "/dhis-web-dashboard/"
}
{
"username": "TestUser",
"firstName": "Test",
"surname": "User",
"password": "Test123!",
"email": "test@test.com",
"phoneNumber": "123456789",
"g-recaptcha-response": "recaptchaResponse",
"token": "aWRUb2tlbjpJRHJlc3RvcmVUb2tlbg=="
}
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Account updated"
}
{
"username": "testSelfReg",
"firstName": "test",
"surname": "selfReg",
"password": "P@ssword123",
"email": "test@test.com",
"phoneNumber": "12345oooo",
"g-recaptcha-response": "recap response"
}
{
"httpStatus": "Created",
"httpStatusCode": 201,
"status": "OK",
"message": "Account created"
}
{
"emailOrUsername": "testUsername1"
}
A successful response returns an empty `200 OK`. The user should now be able to log in using the new password.
用户复制 { #webapi_user_replication }
要复制用户,您可以使用 *replica* 资源。复制一个
用户在调试或重现报告的问题时很有用
特定用户。您需要提供新的用户名和密码
您稍后将用于验证的复制用户。请注意,您
需要 ALL 权限才能执行此操作。要复制用户,您
可以发布如下所示的 JSON 有效负载:
```json
{
"username": "user_replica",
"password": "SecretPassword"
}
curl -d @replica.json "localhost/api/33/users/N3PZBUlN8vq/replica"
-H "Content-Type:application/json" -u admin:district
GET / api / users / {id} / dataApprovalWorkflows
GET /dhis-web-commons-security/logout.action?current={current_username}&switch={username_to_switch_to}
## 当前用户信息 { #webapi_current_user_information }
为了获取有关当前已验证用户的信息和
它与其他资源的关联,您可以使用 *me* 资源
(您也可以通过其旧名称 *currentUser* 来引用它)。目前
用户相关资源为您提供有用的信息
构建客户端,例如用于数据输入和用户管理。这
下面描述了这些资源及其用途。
提供有关您当前登录的用户的基本信息
in as,包括用户名、用户凭据、分配的组织
单位:
不
提供有关当前未读消息和解释的信息:
/ api / me / dashboard
为了更改密码,此端点可用于验证
新输入的密码。密码验证将基于
系统中配置的 PasswordValidationRules。这个端点支持
POST 和密码字符串应在 POST 正文中发送。
/ api / me / validatePassword
更改密码时,此端点(支持 POST)可用于
验证旧密码。密码字符串应在 POST 正文中发送。
/ api / me / verifyPassword
返回授予当前用户的权限集:
/ api / me / authorization
返回 true 或 false,表示当前用户是否已被
授予给定的`<auth>`授权:
/ api / me / authorization / <auth>
给出与当前用户相关的数据批准级别:
/ api / me / dataApprovalLevels
提供当前用户可以访问的数据批准工作流。
对于每个工作流程,显示用户可能看到的数据批准级别,以及
他们在每个级别上具有什么权限:
/ api / me / dataApprovalWorkflows
Settings and configuration
系统设置 { #webapi_system_settings }
您可以通过与
*系统设置*资源。系统设置是一个简单的键值对,
其中键和值都是纯文本字符串。保存或
更新系统设置,您可以向以下 URL 发出 *POST* 请求:
/ api / 33 / systemSettings / my-key?value = my-val
或者,您可以将设置值作为请求正文提交,
其中内容类型设置为“文本/纯文本”。例如,您可以使用
像这样卷曲:
```bash
curl "play.dhis2.org/demo/api/33/systemSettings/my-key" -d "My long value"
-H "Content-Type: text/plain" -u admin:district
{
"keyApplicationNotification": "Welcome",
"keyApplicationIntro": "DHIS2",
"keyApplicationFooter": "Read more at dhis2.org"
}
curl "localhost/api/33/configuration/feedbackRecipients" -d "wl5cDMuUhmF"
-H "Content-Type:text/plain"-u admin:district
使用相同的密钥上传多个文件将覆盖现有的
文件。这样,检索任何给定键的文件只会返回
最新上传的文件。
- 要检索徽标,您可以*获取*以下内容:
GET /api/33/staticContent/<key>
## Example of requests to retrieve the file stored for `logo_front`:
将“Accept: text/html”添加到 HTTP 标头。*__ 在这种情况下,如果未定义任何内容,端点将返回默认图像。找到自定义或默认图像时将返回图像流。
```bash
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front"
-H "Accept: text/html" -L -u admin:district
curl "https://play.dhis2.org/demo/api/33/staticContent/logo_front"
-H "Accept: application/json" -L -u admin:district
{
"images": {
"png": "http://localhost:8080/dhis/api/staticContent/logo_front"
}
}
{
"httpStatus": "Not Found",
"httpStatusCode": 404,
"status": "ERROR",
"message": "No custom file found."
}
通过此资源插入的 JavaScript 和 CSS 内容将由
DHIS2 网络应用项目。这在某些情况下特别有用:
### Side Effects
登录页面或主页。
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| storeCopy | 要创建自定义模板,建议从现有模板开始(这些模板可在登录应用项目的扩展 dhis-web-login/#download 中下载)。 | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| `{"organisationUnit": "a3kGcGDCuk7"}` | Tracker { #webapi_tracker } | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| 类型 | Property | Program notification template | Program notification template | Immutable | 类型 |
| 身份证 | trackedEntity | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| String:Uid | trackedEntityType | Program notification template | Program notification template | Immutable | 类型 |
| DateTime | createdAt | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| `{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"}` | createdAtClient | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| YYYY-MM-DDThh:mm:ss | updatedAt | Program notification template | ```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"
]
}
``` | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| ID | updatedAtClient | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| 串 | orgUnit | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | String:Uid |
| In the case of CSV, the `fields` request parameter has no effect, and the response will always
contain the following fields: | inactive | Program notification template | ```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"
]
}
``` | 是的 | String:any |
| 日期时间 | deleted | Program notification template | ```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"
]
}
``` | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} | storedBy | Program notification template | ```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"
]
}
``` | 是的 | String:Uid |
| Duration | createdBy | Program notification template | ```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"
]
}
``` | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | Program notification template | ```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"
]
}
``` | 不 | String:Uid |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | 属性 | Program notification template | ```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"
]
}
``` | 是的 | List of TrackedEntityAttributeValue |
See Attribute
### 类型
A list of enrollments owned by the tracked entity.
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| 文本 | 是的 | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| `{ "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"
]
}
``` | Program notification template | 价值 | The value of the tracked entity attribute. |
| storeCopy | Property | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| 用户友好型消息,说明操作是否成功。 | enrollment | Program notification template | Program notification template | DateTime | String:Uid |
| `{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"}` | 项目 | ```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"
]
}
``` | Program notification template | 价值 | The value of the tracked entity attribute. |
| 类型 | trackedEntity | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 身份证 | status | Program notification template | Program notification template | Immutable | 类型 |
| String:Uid | orgUnit | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| DateTime | createdAt | Program notification template | Program notification template | Immutable | 类型 |
| 例 | createdAtClient | ```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"
]
}
``` | ```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"
]
}
``` | Immutable | 类型 |
| To retrieve an event with a specific ID: | updatedAt | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| WKT, can be omitted it in case of a `Point` type and with `latitude` and `longitude` provided | updatedAtClient | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 日期时间 | enrolledAt | Program notification template | Program notification template | 是的 | Boolean |
| Table: Program Stage Query Criteria | occurredAt | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| ID | completedAt | Program notification template | ```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"
]
}
``` | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| In the case of CSV, the `fields` request parameter has no effect, and the response will always
contain the following fields: | completedBy | Program notification template | Program notification template | 是的 | String:any |
| 日期时间 | 跟进 | Program notification template | Program notification template | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} | storedBy | Program notification template | Program notification template | 是的 | String:Uid |
| 用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。 | createdBy | Program notification template | Program notification template | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | Program notification template | Program notification template | 不 | String:Uid |
| ABCDEF12345 | 属性 | Program notification template | ```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"
]
}
``` | 不 | 用户 |
| > **注**
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 报名的属性选项组合。如果没有提供,则使用程序类别组合定义的默认值。 | Program notification template | Program notification template | 价值 | The value of the tracked entity attribute.
See Attribute
### events
A list of events owned by the enrollment.
不
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| The message text. | List of Relationship | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| See an example payload below. | List of Note | ```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"
]
}
``` | Program notification template | 价值 | The value of the tracked entity attribute. |
| 文本 | Property | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| `{ "periodFrom": -15, "periodTo": 15}` | event | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| storeCopy | 项目阶段 | Program notification template | Program notification template | 价值 | The value of the tracked entity attribute. |
| 用户友好型消息,说明操作是否成功。 | enrollment | Program notification template | Program notification template | DateTime | String:Uid |
| `{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"}` | 项目 | ```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"
]
}
``` | Program notification template | 价值 | The value of the tracked entity attribute. |
| 类型 | trackedEntity | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 身份证 | status | Program notification template | Program notification template | Immutable | 类型 |
| String:Uid | orgUnit | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| DateTime | createdAt | Program notification template | Program notification template | Immutable | 类型 |
| If not otherwise specified, JSON is the default response for the `GET` method. The API also
supports CSV export for single and collection endpoints. Furthermore, it supports compressed
JSON and CSV for the collection endpoint. | createdAtClient | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| To retrieve an event with a specific ID: | updatedAt | ```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"
]
}
``` | ```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"
]
}
``` | Immutable | 类型 |
| WKT, can be omitted it in case of a `Point` type and with `latitude` and `longitude` provided | updatedAtClient | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 日期时间 | scheduledAt | Program notification template | Program notification template | 是的 | Boolean |
| Table: Program Stage Query Criteria | occurredAt | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| ID | completedAt | Program notification template | ```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"
]
}
``` | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| In the case of CSV, the `fields` request parameter has no effect, and the response will always
contain the following fields: | completedBy | Program notification template | Program notification template | 是的 | String:any |
| 日期时间 | 跟进 | Program notification template | Program notification template | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| > **注**
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 事件的属性选项组合。如果没有提供,则使用程序类别组合定义的默认值。 | Program notification template | Program notification template | 价值 | The value of the tracked entity attribute.
| boolean | 事件的属性类别选项。如果没有提供,则使用由程序类别组合定义的默认值 | Program notification template | Program notification template | 价值 | The value of the tracked entity attribute.
| 布尔 | updatedBy | Program notification template | Program notification template | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | attributeOptionCombo | Program notification template | Program notification template | 是的 | String:Uid |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | attributeCategoryOptions | Program notification template | Program notification template | 不 | String:Uid |
| ABCDEF12345 | assignedUser | Program notification template | ```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/tracker/events/{uid}/changeLogs`
dataValues
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| A list of relationships connected to the event. | 不 | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| Notes connected to the event. It can only be created. | 不 | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| `Relationships` are objects that link together two other tracker objects. The constraints each side
of the relationship must conform to are based on the `Relationship Type` of the `Relationship`. | Property | Program notification template | Program notification template | 不 | 类型 |
| 类型 | relationship | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| String:Uid | relationshipType | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 身份证 | relationshipName | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| Sibling | createdAt | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| YYYY-MM-DDThh:mm:ss | updatedAt | ```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"
]
}
``` | ```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"
]
}
``` | 是的 | Date:ISO 8601 |
YYYY-MM-DDThh:mm:ss
### createdAtClient
Timestamp when the user created the relationship on the client.
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| 不 | 不 | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| 是的 | 是的 | Program notification template | Program notification template | 不 | 属性 |
| 属性是描述被跟踪实体的值。属性可以通过
通过被跟踪实体类型或项目关联。这意味着属性既可以是被追踪实体的一部分,也可以是注册的一部分。
跟踪实体和注册的一部分。重要的是,一个属性只能有一个值,即使一个
一个属性只能有一个值,即使一个被跟踪实体有多个注册表来定义该属性。这是因为
实体最终拥有属性值。 | Property | Program notification template | Program notification template | 不 | 类型 |
| 类型 | attribute | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| String:Uid | 码 | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 日期时间 | displayName | Program notification template | Program notification template | 不 | Boolean |
| 名称 | createdAt | Program notification template | Program notification template | DateTime | Date:ISO 8601 |
| 日期时间 | updatedAt | Program notification template | Program notification template | 不 | Boolean |
YYYY-MM-DDThh:mm:ss
### storedBy
Client reference for who stored/created the value.
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| 最小最大数据元素 | 不 | ```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"
]
}
``` | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| 日期时间 | 不 | Program notification template | Program notification template | 不 | 123 |
| 日期时间 | While attributes describe a tracked entity, data values describe an event. | Program notification template | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Immutable |
| 类型 | 例 | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| String:Uid | 码 | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 日期时间 | displayName | Program notification template | Program notification template | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
YYYY-MM-DDThh:mm:ss
### storedBy
在需要记录有关具体问题的补充信息或说明的情况下,可以使用注释来记录。
可以使用注释来记录。
不
不
String:Any
John Doe
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| updatedBy | Only for reading data. User that last updated the object. Set on the server. | Program notification template | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| 日期时间 | 笔记 | ```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"
]
}
``` | ```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"
]
}
``` | 不 | Notes do not have a dedicated endpoint; they are exchanged as part of the parent event and/or
enrollment payload. A sample payload is found below. |
| ```json
{
"trackedEntity": "oi3PMIGYJH8",
"enrollments": [
{
"enrollment": "EbRsJr8LSSO",
"notes": [
{
"note": "vxmCvYcPdaW",
"value": "Enrollment note 1"
},
{
"value": "Enrollment note 2."
}
],
"events": [
{
"event": "zfzS9WeO0uM",
"notes": [
{
"note": "MAQFb7fAggS",
"value": "Event Note 1."
},
{
"value": "Event Note 2."
}
]
}
]
}
]
}
``` | Property | Program notification template | ```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"
]
}
``` | Immutable | 类型 |
| 日期时间 | note | Program notification template | Program notification template | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | Program notification template | ```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"
]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](developer-manual.md#webapi_sharing)). | String:Any |
### This is a note
| 指标组 | Parameter name | 检索和删除项目通知模板 | 是的 | Potential duplicate status | 描述 |
|---|---|---|---|---|---|
| storedByDataValue | Client reference for who stored/created the note. | 不 | ```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"
]
}
``` | 价值 | The value of the tracked entity attribute. |
| createdBy | Only for reading data. User that created the object. Set on the server. | 不 | ```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"
]
}
``` | 不 | 123 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | Users | Program notification template | ```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"
]
}
``` | 不 | Immutable |
| 类型 | 例 | Program notification template | ```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"
]
}
``` | 不 | 是的 |
String:Uid
## ABCDEF12345
用户名
Username used by the user.
* Yes*
* 是的
* String:Any
firstName
Only for reading data. First name of the user.
* 不
* 是的
String:Any
导入希望元数据标识符只使用所选的 `idScheme`。同样,元数据
只能使用所选的 `idScheme` 导出。如果元数据缺少所选 `idScheme` 的标识符、
就会收到如下错误。
surname
Only for reading data. Last name of the user.
* 不
* 是的
## String:Any
Doe
> **Note**
>
> Either `uid` or `username` must be provided. If both are provided, only username is
> considered.
* Side Effects
* 类型
* 支持的
* `GET /api/tracker/events/{uid}/changeLogs`
* [tracked entity export](developer-manual.md#webapi_tracker_export_tracked_entities)
### [event export](developer-manual.md#webapi_tracker_export_events)
See each section for request parameters.
| 允许值 | Parameter name | Potential duplicate status | `order` | The import expects metadata identifiers to only use the chosen `idScheme`. Similarly, metadata is
exported only using the chosen `idScheme`. If metadata lacks identifiers for the chosen `idScheme`,
you'll receive an error like the below. |
|---|---|---|---|---|
| 异步导入时,会立即返回一个 *Location* 标头,指向 *importReport* 的位置。有效载荷还包含一个已创建任务的 json 对象。 | To resolve this, either: | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | 跟踪器或事件项目的标识符。该参数为必填参数。 | Tracker import { #webapi_tracker_import } |
| ```
GET /tracker/jobs/{uid}
``` | The endpoint `POST /api/tracker` is also called the tracker importer. This endpoint allows clients
to import i.e. create, update and delete | DateTime | Enrollments | 大事记 |
| 设置整体导入模式,决定是否仅 `VALIDATE` 或也 `COMMIT` 元数据,这与我们旧的 dryRun 标志具有相似的功能。 | Objects embedded in other [tracker objects](developer-manual.md#webapi_tracker_objects) | DateTime | 跟踪器导入项目支持以下参数: | Parameter name |
| 描述 | 类型 | DateTime | Enum | Narrows response to tracked entities matching given filters. More on filters [here](developer-manual.md#tracked_entity_attribute_filtering) |
| DateTime | enrollmentEnrolledBefore | DateTime | Enum | importMode |
| programStageIdScheme | [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) | DateTime | Enum |importMode |
| Can either be `VALIDATE` which will report errors in the payload without making changes to the database or `COMMIT` (default) which will validate the payload and make changes to the database. | 方案 | DateTime | Enum | importMode |
| IdScheme used for all metadata references unless overridden by a metadata specific parameter. Default is `UID`. | `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}` | DateTime | Enum | importMode |
| programIdScheme | `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}` | DateTime | Enum | importMode |
| `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}` | `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}` | DateTime | Enum | importMode |
| Sets import strategy, `CREATE_AND_UPDATE` will try and match on identifier, if it doesn't exist, it will create the object. | Enum | DateTime | `idScheme` parameter | 项目阶段标识方案 |
| 设置原子模式,在旧的导入器中,我们总是进行*best effort*导入,这意味着即使某些引用不存在,我们仍然会导入(即数据元素组导入时缺少数据元素)。新进口商的默认设置是不允许这样做,并且类似地拒绝任何验证错误。设置 `NONE` 模式模拟了旧的行为. | Enum | DateTime | `idScheme` parameter | categoryOptionComboIdScheme |
| 设置刷新模式,控制何时刷新内部缓存。*强烈*建议将其保留为`AUTO`(这是默认设置)。仅将 `OBJECT` 用于调试目的,您会看到休眠异常并想查明堆栈发生的确切位置(休眠只会在刷新时抛出,因此很难知道哪个对象有问题)。 | Enum | DateTime | `idScheme` parameter | categoryOptionIdScheme |
| IdScheme used for category option references. Defaults to the `idScheme` parameter. | Enum | DateTime | `idScheme` parameter | importStrategy |
| Indicates the effect the import should have. Can either be `CREATE`, `UPDATE`, `CREATE_AND_UPDATE` and `DELETE`, which respectively only allows importing new data, importing changes to existing data, importing any new or updates to existing data, and finally deleting data. | Enum | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | 跟踪器或事件项目的标识符。该参数为必填参数。 | flushMode |
| Indicates how the import responds to validation errors. If `ALL`, all data imported must be valid for any data to be committed. For `OBJECT`, only the data committed needs to be valid, while other data can be invalid. | Enum | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | 跟踪器或事件项目的标识符。该参数为必填参数。 | flushMode |
| Indicates the frequency of flushing. This is related to how often data is pushed into the database during the import. Primarily used for debugging reasons, and should not be changed in a production setting | Enum | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | 跟踪器或事件项目的标识符。该参数为必填参数。 | flushMode |
#### Indicates the completeness of the validation step. It can be skipped, set to fail fast (Return on the first error), or full (default), which will return any errors found
对于用户来说,同步导入和异步导入的主要区别在于 API 响应的时间。
API 响应的时间。同步导入会在导入完成后立即提供 [导入摘要](developer-manual.md#webapi_tracker_import_summary)
导入完成后,会立即提供 [导入摘要](#webapi_tracker_import_summary)。相反,异步导入会立即返回导入任务的引用。
的引用。可以使用此 `response.location`来跟踪导入任务的进度。异步导入响应的示例
异步导入响应的示例如下。
`FULL`, `FAIL_FAST`, `SKIP`
`FULL`
### A list of assigned users for events. To be used along with `PROVIDED` assignedUserMode above.
If true, it will skip validating the pattern of generated attributes.
#### Boolean
`true`, `false`
``json
{
"trackedEntities":[
{
"orgUnit":"y77LiPqLMoq"、
"trackedEntity":"Kj6vYde4LHh"、
"trackedEntityType":"nEenWmSyUEp" }.
},
{
"orgUnit":"y77LiPqLMoq"、
"trackedEntity":"Gjaiu3ea38E"、
"trackedEntityType":"nEenWmSyUEp" }
}
],
"注册":[
{
"enrolledAt":"2019-08-19T00:00:00.000",
"注册":"MNWZ6hnuhSw"、
"occurredAt":"2019-08-19T00:00:00.000",
"orgUnit":"y77LiPqLMoq"、
"程序": "IpHINAT79U"IpHINAT79UW"、
"状态":"ACTIVE"、
"trackedEntity":"Kj6vYde4LHh"、
"trackedEntityType":"nEenWmSyUEp"、
"attributeOptionCombo":"HllvX50cXC0"、
}
],
"事件":[
{
"attributeCategoryOptions":"xYerKDKCefk"、
"attributeOptionCombo":"HllvX50cXC0"、
"dataValues":[
{
"dataElement":"bx6fsa0t90x"、
"值":"true
},
{
"dataElement":"UXz7xuGCEhU"、
"值":"5.7"
}
],
"注册":"MNWZ6hnuhSw"、
"enrollmentStatus"(注册状态):"ACTIVE"、
"事件": "ZwwuwNp6gVd":"ZwwuwNp6gVd"、
"occurredAt":"2019-08-01T00:00:00.000",
"orgUnit":"y77LiPqLMoq"、
"程序": "IpHINAT79U"IpHINAT79UW"、
"programStage":"A03MvHHogjR"、
"scheduledAt":"2019-08-19T13:59:13.688",
状态"ACTIVE"、
"trackedEntity":"Kj6vYde4LHh"
},
{
"attributeCategoryOptions":"xYerKDKCefk"、
"attributeOptionCombo":"HllvX50cXC0"、
"注册": "MNWZ6hnn"MNWZ6hnuhSw"、
"enrollmentStatus"(注册状态):"ACTIVE"、
"事件": "XwwuwNp6"XwwuwNp6gVE"、
"occurredAt":"2019-08-01T00:00:00.000",
"orgUnit":"y77LiPqLMoq"、
"程序": "IpHINAT79U"IpHINAT79UW"、
"programStage":"ZzYYXq4fJie"、
"scheduledAt":"2019-08-19T13:59:13.688",
"状态":"ACTIVE"、
"trackedEntity":"Kj6vYde4LHh"
}
],
"关系":[
{
"来自":{
"trackedEntity":{
"trackedEntity":"Kj6vYde4LHh"
}
},
"relationshipType":"dDrh5UyCyvQ"、
"到":{
"trackedEntity":{
"trackedEntity":"Gjaiu3ea38E"
}
}
}
]
}
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Tracker job added",
"response": {
"id": "cHh2OCTJvRw",
"location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
}
}
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Tracker job added",
"response": {
"id": "cHh2OCTJvRw",
"location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
}
}
{
"trackedEntities": [
{
"orgUnit": "y77LiPqLMoq",
"trackedEntity": "Kj6vYde4LHh",
"trackedEntityType": "nEenWmSyUEp"
},
{
"orgUnit": "y77LiPqLMoq",
"trackedEntity": "Gjaiu3ea38E",
"trackedEntityType": "nEenWmSyUEp"
}
],
"enrollments": [
{
"enrolledAt": "2019-08-19T00:00:00.000",
"enrollment": "MNWZ6hnuhSw",
"occurredAt": "2019-08-19T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"status": "ACTIVE",
"trackedEntity": "Kj6vYde4LHh",
"trackedEntityType": "nEenWmSyUEp"
}
],
"events": [
{
"attributeCategoryOptions": "xYerKDKCefk",
"attributeOptionCombo": "HllvX50cXC0",
"dataValues": [
{
"dataElement": "bx6fsa0t90x",
"value": "true"
},
{
"dataElement": "UXz7xuGCEhU",
"value": "5.7"
}
],
"enrollment": "MNWZ6hnuhSw",
"enrollmentStatus": "ACTIVE",
"event": "ZwwuwNp6gVd",
"occurredAt": "2019-08-01T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "A03MvHHogjR",
"scheduledAt": "2019-08-19T13:59:13.688",
"status": "ACTIVE",
"trackedEntity": "Kj6vYde4LHh"
},
{
"attributeCategoryOptions": "xYerKDKCefk",
"attributeOptionCombo": "HllvX50cXC0",
"enrollment": "MNWZ6hnuhSw",
"enrollmentStatus": "ACTIVE",
"event": "XwwuwNp6gVE",
"occurredAt": "2019-08-01T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "ZzYYXq4fJie",
"scheduledAt": "2019-08-19T13:59:13.688",
"status": "ACTIVE",
"trackedEntity": "Kj6vYde4LHh"
}
],
"relationships": [
{
"from": {
"trackedEntity": {
"trackedEntity": "Kj6vYde4LHh"
}
},
"relationshipType": "dDrh5UyCyvQ",
"to": {
"trackedEntity": {
"trackedEntity": "Gjaiu3ea38E"
}
}
}
]
}
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Tracker job added",
"response": {
"id": "cHh2OCTJvRw",
"location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
}
}
{
"trackedEntities": [
{
"enrollments": [
{
"attributes": [
{
"attribute": "zDhUuAYrxNC",
"displayName": "Last name",
"value": "Kelly"
},
{
"attribute": "w75KJ2mc4zz",
"displayName": "First name",
"value": "John"
}
],
"enrolledAt": "2019-08-19T00:00:00.000",
"events": [
{
"attributeCategoryOptions": "xYerKDKCefk",
"attributeOptionCombo": "HllvX50cXC0",
"dataValues": [
{
"dataElement": "bx6fsa0t90x",
"value": "true"
},
{
"dataElement": "UXz7xuGCEhU",
"value": "5.7"
}
],
"enrollmentStatus": "ACTIVE",
"notes": [
{
"value": "need to follow up"
}
],
"occurredAt": "2019-08-01T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "A03MvHHogjR",
"scheduledAt": "2019-08-19T13:59:13.688",
"status": "ACTIVE"
}
],
"occurredAt": "2019-08-19T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"status": "ACTIVE",
"trackedEntityType": "nEenWmSyUEp"
}
],
"orgUnit": "y77LiPqLMoq",
"trackedEntityType": "nEenWmSyUEp"
}
]
}
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Tracker job added",
"response": {
"id": "cHh2OCTJvRw",
"location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
}
}
POST /api/tracker?async=false
{
"trackedEntities": [
{
"trackedEntity": "PQfMcpmXeFE",
"trackedEntityType": "nEenWmSyUEp",
"orgUnit": "DiszpKrYNg8",
"attributes": [
{
"attribute": "w75KJ2mc4zz",
"code": "MMD_PER_NAM",
"displayName": "First name",
"createdAt": "2016-08-03T23:49:43.308",
"updatedAt": "2016-08-03T23:49:43.308",
"valueType": "TEXT",
"value": "Johnny"
}
]
}
]
}
```json
{
"trackedEntities": [
{
"trackedEntity": "PQfMcpmXeFE",
"trackedEntityType": "nEenWmSyUEp",
"orgUnit": "DiszpKrYNg8",
"attributes": [
{
"attribute": "w75KJ2mc4zz",
"value": null
}
]
}
]
}
```json
{
"events": [
{
"event": "ZwwuwNp6gVd",
"dataValues": [
{
"dataElement": "bx6fsa0t90x",
"value": "true"
}
],
"attributeOptionCombo": "HllvX50cXC0",
"attributeCategoryOptions": "xYerKDKCefk",
"enrollment": "MNWZ6hnuhSw",
"enrollmentStatus": "ACTIVE",
"occurredAt": "2019-08-01T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "A03MvHHogjR",
"scheduledAt": "2019-08-19T13:59:13.688",
"status": "ACTIVE",
"trackedEntity": "Kj6vYde4LHh"
}
]
}
```json
{
"events": [
{
"event": "ZwwuwNp6gVd",
"dataValues": [
{
"dataElement": "bx6fsa0t90x",
"value": null
}
],
"attributeOptionCombo": "HllvX50cXC0",
"attributeCategoryOptions": "xYerKDKCefk",
"enrollment": "MNWZ6hnuhSw",
"enrollmentStatus": "ACTIVE",
"occurredAt": "2019-08-01T00:00:00.000",
"orgUnit": "y77LiPqLMoq",
"program": "IpHINAT79UW",
"programStage": "A03MvHHogjR",
"scheduledAt": "2019-08-19T13:59:13.688",
"status": "ACTIVE",
"trackedEntity": "Kj6vYde4LHh"
}
]
}
Response example
```json
[
{
"uid": "PQK63sMwjQp",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:16.370",
"message": "Import complete with status OK, 0 created, 0 updated, 0 deleted, 0 ignored",
"completed": true,
"id": "PQK63sMwjQp"
},
{
"uid": "XIfTJ1UUNcd",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:16.369",
"message": "PostCommit",
"completed": false,
"id": "XIfTJ1UUNcd"
},
{
"uid": "uCG4FNJLLBJ",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:16.364",
"message": "Commit Transaction",
"completed": false,
"id": "uCG4FNJLLBJ"
},
{
"uid": "xfOUv2Lk2MC",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:16.361",
"message": "Running Rule Engine Validation",
"completed": false,
"id": "xfOUv2Lk2MC"
},
{
"uid": "cSPfA776obb",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:16.325",
"message": "Running Rule Engine",
"completed": false,
"id": "cSPfA776obb"
},
{
"uid": "t9gOjotekQt",
"level": "INFO",
"category": "TRACKER_IMPORT_JOB",
"time": "2024-03-19T13:18:15.837",
"message": "Tracker import started",
"completed": false,
"dataType": "PARAMETERS",
"data": {
"userId": "xE7jOejl9FI",
"importMode": "VALIDATE",
"idSchemes": {
"dataElementIdScheme": {
"idScheme": "UID",
"attributeUid": null
},
"orgUnitIdScheme": {
"idScheme": "UID",
"attributeUid": null
},
"programIdScheme": {
"idScheme": "UID",
"attributeUid": null
},
"programStageIdScheme": {
"idScheme": "UID",
"attributeUid": null
},
"idScheme": {
"idScheme": "UID",
"attributeUid": null
},
"categoryOptionComboIdScheme": {
"idScheme": "UID",
"attributeUid": null
},
"categoryOptionIdScheme": {
"idScheme": "UID",
"attributeUid": null
}
},
"importStrategy": "CREATE_AND_UPDATE",
"atomicMode": "ALL",
"flushMode": "AUTO",
"validationMode": "FULL",
"skipPatternValidation": false,
"skipSideEffects": false,
"skipRuleEngine": false,
"filename": null,
"reportMode": "ERRORS"
},
"id": "t9gOjotekQt"
}
]
GET /tracker/jobs/{uid}/report
状态
The property, `status`, of the import summary indicates the overall status of the import. If no
errors or warnings were raised during the import, the `status` is reported as `OK`. The presence of
any error or warnings in the import will result in a status of type `ERROR` or `WARNING`.
`status` is based on the presence of the most significant `validationReport`. `ERROR` has the
highest significance, followed by `WARNING` and finally `OK`. This implies that `ERROR` is reported
as long as a single error was found during the import, regardless of how many warnings occurred.
每种类型的跟踪器对象都将被报告,每种对象都有自己的统计信息和 `objectReports`.这些
对象报告 "将提供有关每个导入对象的详细信息,如其类型、uid 以及任何
错误或警告报告(如适用)。
#### Validation report
The `validationReport` might include `errorReports` and `warningReports` if any errors or warnings
were present during the import. When present, they provide a detailed list of any errors or warnings
encountered.
### For example, a validation error while importing a `TRACKED_ENTITY`:
可在 `GET /tracker/jobs/{uid}/report` 请求中使用特定的 `reportMode` 参数检索导入摘要报告。
请求中使用特定的默认情况下,端点将返回一个 `reportMode``ERROR` 的 `importSummary`。
| ```json
{
"object": {
"publicAccess": "rw------",
"externalAccess": false,
"user": {},
"userAccesses": [],
"userGroupAccesses": [
{
"id": "hj0nnsVsPLU",
"access": "rw------"
},
{
"id": "qMjBflJMOfB",
"access": "r-------"
}
]
}
}
``` | Parameter name |
| --- | --- |
| Statistics | The stats object provides an overview of the import operation. After an import is completed, these will be the
actual counts displaying how many objects were created, updated, deleted and ignored. |
| 响应示例: | ```json
{
"stats": {
"created": 2,
"updated": 2,
"deleted": 1,
"ignored": 5,
"total": 10
}
}
``` |
| The `created` field refers to how many new objects were created. In general, objects without an existing uid
in the payload will be treated as new objects. | The `updated` field refers to the number of objects updated. If an object has a uid set in the payload, it
will be treated as an update as long as that same uid exists in the database. |
The `deleted` field refers to the number of objects deleted during the import. Deletion only happens when the
import is configured to delete data and only then when the objects in the payload have existing uids
set.
### The `ignored` field refers to objects that were not persisted. Objects can be ignored for several reasons, for
example trying to create something that already exists. Ignores should always be safe, so if
something was ignored, it was not necessary, or it was due to the configuration of the import.
不同的错误场景有不同的错误代码。下表列出了
下表列出了 Tracker API 抛出的错误代码、错误信息和一些附加说明。
说明。错误信息中的占位符(`{0}`、`{1}`、`{2}`...)通常是 uids,除非另有说明。
另有说明。
| When the import is completed, the `bundleReport` contains all the [tracker objects](#tracker-objects) imported. | An example for `TRACKED_ENTITY`: | Parameter name |
|:--|:----|:----|
| Each type of tracker object will be reported, and each has its own stats and `objectReports`. These
`objectReports` will provide details about each imported object, like their type, their uid, and any
error or warning reports is applicable. | 信息 | If the import ended abruptly, the `message` would contain further information in relation to what
happened. |
| Import summary report level | A import summary report can be retrieved using a specific `reportMode` parameter in a `GET /tracker/jobs/{uid}/report`
request. By default the endpoint will return an `importSummary` with `reportMode` `ERROR`. | Parameter
| 描述 | FULL | Returns everything from `WARNINGS`, plus `timingsStats` |
| WARNINGS | Returns everything from `ERRORS`, plus `warningReports` in `validationReports` | |
| ERRORS (default) | Returns only `errorReports` in `validationReports` | In addition, all `reportModes` will return `status`, `stats`, `bundleReport` and `message` when
applicable. |
| Error codes { #webapi_tracker_error_codes } | There are various error codes for different error scenarios. The following table has the list of
error codes thrown from the new Tracker API, along with the error messages and some additional
descriptions. The placeholders in the error messages (`{0}`,`{1}`,`{2}`..) are usually uids unless
otherwise specified. | Error Code |
| Error Message | 描述 | E1000 |
| User: `{0}`, has no write access to OrganisationUnit: `{1}`. | This typically means that the OrganisationUnit `{1}` is not in the capture scope of the user `{0}` for the write operation to be authorized. | |
| E1001 | User: `{0}`, has no data write access to TrackedEntityType: `{1}`. | The error occurs when the user is not authorized to create or modify data of the TrackedEntityType `{1}` |
| E1002 | TrackedEntity: `{0}`, already exists. | This error is thrown when trying to create a new TrackedEntity with an already existing uid. Make sure a new uid is used when adding a new TrackedEntity. |
| E1003 | User: `{0}`, has no write access to TrackedEntity: `{1}`. | E1005 |
| Could not find TrackedEntityType: `{0}`. | Error thrown when trying to fetch a non existing TrackedEntityType with uid `{0}` . This might also mean that the user does not have read access to the TrackedEntityType. | E1006 |
| Attribute: `{0}`, does not exist. | Error thrown when the system was not able to find a matching TrackedEntityAttribute with uid `{0}`. This might also mean that the user does not have access to the TrackedEntityAttribute. | E1007 |
| Error validating attribute value type: `{0}`; Error: `{1}`. | Mismatch between value type of a TrackedEntityAttribute and its provided attribute value. The actual validation error will be displayed in `{1}`. | E1008 |
| 项目阶段 `{0}` 没有引用项目。检查项目阶段配置 | E1009 | File resource: `{0}`, has already been assigned to a different object.|
| The File resource uid `{0}` is already assigned to another object in the system. | E1010 | Could not find Program: `{0}`, linked to Event. |
| 系统无法找到在事件有效负载中指定了 uid `{0}` 的项目。这也可能意味着登录用户无法访问特定项目。 | E1011 | Could not find OrganisationUnit: `{0}`, linked to Event. |
| The system was unable to find a OrganisationUnit with uid `{0}` specified inside the Event payload. | E1012 | Geometry does not conform to FeatureType: `{0}`. |
| FeatureType provided is either NONE or an incompatible one for the provided geometry value. | E1013 | Could not find ProgramStage: `{0}`, linked to Event. |
| The system was unable to find a ProgramStage with uid `{0}` specified inside the Event payload. This might also mean that the ProgramStage is not accessible to the logged in user. | E1014 | Provided Program: `{0}`, is a Program without registration. An Enrollment cannot be created into Program without registration. |
| Enrollments can only be created for Programs with registration. | E1015 | TrackedEntity: `{0}`, already has an active Enrollment in Program `{1}`. |
| Cannot enroll into a Program if another active enrollment already exists for the Program. The active enrollment will have to be completed first at least. | E1016 | TrackedEntity: `{0}`, already has an active enrollment in Program: `{1}`, and this program only allows enrolling one time. |
| 根据项目 `{1}` 配置,一个 TrackedEntity 只能注册该项目一次。看起来 TrackedEntity `{0}` 已经在该项目中注册过一次。因此不能再添加另一个注册。 | E1018 | Attribute: `{0}`, is mandatory in program `{1}` but not declared in enrollment `{2}`. |
| 有效负载中缺少被定义为项目强制属性的属性值。确保在有效负载中提供强制属性的属性值。 | E1019 | Only Program attributes is allowed for enrollment; Non valid attribute: `{0}`. |
| 注册有效负载中指定的属性 uid `{0}` 与项目无关。 | E1020 | Enrollment date: `{0}`, cannot be a future date. |
| Cannot enroll into a future date unless the Program allows for it in its configuration. | E1021 | OccurredAt 属性为空或有效负载中的日期格式无效。 |
| 事件发生日期不能是未来日期,除非项目在配置中允许这样做。 | E1022 | |
| TrackedEntity: `{0}`, must have same TrackedEntityType as Program `{1}`. | 项目被配置为接受与注册有效负载中提供的不同的 TrackedEntityType uid。 | |
| E1023 | DisplayIncidentDate is true but property occurredAt is null. | 项目已配置 DisplayIncidentDate,但在有效负载中为空。 |
| E1025 | Property enrolledAt is null. | EnrolledAt Date is mandatory for an Enrollment. Make sure it is not null. |
| E1029 | Event OrganisationUnit: `{0}`, and Program: `{1}`, don't match. | 事件有效载荷使用项目 `{1}`,该项目未配置为可被组织单位 `{0}` 访问。 |
| E1030 | Event: `{0}`, already exists. | This error is thrown when trying to add a new Event with an already existing uid. Make sure a new uid is used when adding a new Event. |
| E1031 | Event occurredAt date is missing. | OccurredAt property is either null or has an invalidate date format in the payload. |
| E1032 | Event: `{0}`, do not exist. | E1033 |
| Event: `{0}`, Enrollment value is NULL. | E1039 | ProgramStage: `{0}`, is not repeatable and an event already exists. |
| 特定注册的 ProgramStage 已存在一个事件。由于项目阶段被配置为不可重复,因此无法为同一项目阶段添加另一个事件。 | E1041 | Enrollment OrganisationUnit: `{0}`, and Program: `{1}`, don't match. |
| 注册有效载荷包含一个项目 `{1}`,该项目未配置为可被组织单位 `{0}` 访问。 | E1043 | Event: `{0}`, completeness date has expired. Not possible to make changes to this event. |
| 没有 "F_EDIT_EXPIRED "权限的用户无法更新已过期的事件,因为该事件已在其项目中配置。 | E1046 |
| Event: `{0}`, needs to have at least one (event or schedule) date. | Either of occurredAt or scheduledAt property should be present in the Event payload. | E1047 |
| Event: `{0}`, date belongs to an expired period. It is not possible to create such event. | Event occurredAt or scheduledAt has a value that is earlier than the PeriodType start date. | E1049 |
| Could not find OrganisationUnit: `{0}`, linked to Tracked Entity. | The system could not find an OrganisationUnit with uid `{0}`. | E1050 |
| Event ScheduledAt date is missing. | ScheduledAt property in the Event payload is either missing or an invalid date format. | E1051 |
| Event: `{0}`, completedAt must be null when status is `{1}`. | Event completedAt can only be passed in the payload if status is COMPLETED | E1052 |
| Enrollment: `{0}`, completedAt must be null when status is `{1}`. | Enrollment completedAt can only be passed in the payload if status is COMPLETED | E1054 |
| AttributeOptionCombo `{0}` 不在事件项目类别组合 `{1}` 中。 | E1055 | 由于项目具有非默认的 CategoryCombo,因此不允许使用默认的 AttributeOptionCombo。 |
| 项目被配置为包含非默认 CategoryCombo,但请求使用了默认 AttributeOptionCombo。 | E1056 | Event date: `{0}`, is before start date: `{1}`, for AttributeOption: `{2}`. |
| The CategoryOption has a start date configured , the Event date in the payload cannot be earlier than this start date. | E1057 | |
| Event date: `{0}`, is after end date: `{1}`, for AttributeOption; `{2}`. | The CategoryOption has an end date configured, the Event date in the payload cannot be later than this end date. | |
| E1063 | TrackedEntity: `{0}`, does not exist. | |
| Error thrown when trying to fetch a non existing TrackedEntity with uid `{0}` . This might also mean that the user does not have read access to the TrackedEntity. | E1064 | |
| Non-unique attribute value `{0}` for attribute `{1}` | The attribute value has to be unique within the defined scope. The error indicates that the attribute value already exists for another TrackedEntity. | |
| E1068 | Could not find TrackedEntity: `{0}`, linked to Enrollment. | 当尝试使用已存在的 uid 创建新注册表时,会出现此错误。请确保在添加新注册表时使用新的 uid。 |
| E1069 | Could not find Program: `{0}`, linked to Enrollment. | 系统无法找到注册有效负载中指定的项目。这也可能意味着用户没有项目的读取权限。 |
| E1070 | Could not find OrganisationUnit: `{0}`, linked to Enrollment. | The system could not find the OrganisationUnit specified in the Enrollment payload. |
| E1074 | FeatureType is missing. | E1075 |
| Attribute: `{0}`, is missing uid. | E1076 | `{0}` `{1}` is mandatory and can't be null |
| E1077 | Attribute: `{0}`, text value exceed the maximum allowed length: `{0}`. | E1079 |
| Event: `{0}`, program: `{1}` is different from program defined in enrollment `{2}`. | E1080 | Enrollment: `{0}`, already exists. |
| This error is thrown when trying to create a new Enrollmentt with an already existing uid. Make sure a new uid is used when adding a new Enrollment. | E1081 | Enrollment: `{0}`, do not exist. |
| Error thrown when trying to fetch a non existing Enrollment with uid `{0}` . This might also mean that the user does not have read access to the Enrollment. | E1082 | Event: `{0}`, is already deleted and can't be modified. |
| If the event is soft deleted, no modifications on it are allowed. | E1083 | User: `{0}`, is not authorized to modify completed events. |
| Only a super user or a user with the authority "F_UNCOMPLETE_EVENT" can modify completed events. Completed Events are those Events with status as COMPLETED. | E1089 | Event: `{0}`, references a Program Stage `{1}` that does not belong to Program `{2}`. |
| The ProgramStage uid and Program uid in the Event payload is incompatible. | E1090 | Attribute: `{0}`, is mandatory in tracked entity type `{1}` but not declared in tracked entity `{2}`. |
| The payload has missing values for mandatory TrackedEntityTypeAttributes. | E1091 | User: `{0}`, has no data write access to Program: `{1}`. |
| 在项目共享配置中,用户没有该项目的写入权限。 | E1095 | User: `{0}`, has no data write access to ProgramStage: `{1}`. |
| 在项目阶段共享配置中,用户没有写入该项目阶段的权限。 | E1096 | User: `{0}`, has no data read access to Program: `{1}`. |
| 在项目共享配置中,用户没有该项目的读取权限。 | E1099 | User: `{0}`, has no write access to CategoryOption: `{1}`. |
| The CategoryOption sharing configuration is such that, the user does not have write access for this CategoryOption | E1100 | User: `{0}`, is lacking 'F_TEI_CASCADE_DELETE' authority to delete TrackedEntity: `{1}`. |
| There exists undeleted Enrollments for this TrackedEntity. If the user does not have 'F_TEI_CASCADE_DELETE' authority, then these Enrollments has to be deleted first explicitly to be able to delete the TrackedEntity. | E1102 | |
| 用户: `{0}`, 没有访问被跟踪实体的权限:`{1}`, 项目:`{2}`, 组合。 | 当用户的组织单位不拥有该特定项目的 TrackedEntity 的所有权时,就会抛出此错误。拥有 TrackedEntity-Program 组合的组织单位应属于用户的捕获范围(有时是搜索范围)。 | E1103|
| User: `{0}`, is lacking 'F_ENROLLMENT_CASCADE_DELETE' authority to delete Enrollment : `{1}`. | There exists undeleted Events for this Enrollment. If the user does not have 'F_ENROLLMENT_CASCADE_DELETE' authority, then these Events has to be deleted first explicitly to be able to delete the Enrollment. | |
| E1104 | User: `{0}`, has no data read access to program: `{1}`, TrackedEntityType: `{2}`. | |
| 与项目相关联的 TrackedEntityType 的共享配置规定,用户没有数据读取权限。 | E1112 | |
| Attribute value: `{0}`, is set to confidential but system is not properly configured to encrypt data. | Either JCE files is missing or the configuration property `encryption.password` might be missing in `dhis.conf`. | E1113 |
| Enrollment: `{0}`, is already deleted and can't be modified. | If the Enrollment is soft deleted, no modifications on it are allowed. | |
| E1114 | TrackedEntity: `{0}`, is already deleted and can't be modified. | |
| If the TrackedEntity is soft deleted, no modifications on it are allowed. | E1115 | |
| Could not find CategoryOptionCombo: `{0}`. | E1116 | |
| Could not find CategoryOption: `{0}`. | This might also mean the CategoryOption is not accessible to the user. | |
| E1117 | CategoryOptionCombo does not exist for given category combo and category options: `{0}`. | |
| E1118 | Assigned user `{0}` is not a valid uid. | |
| E1119 | A Tracker Note with uid `{0}` already exists. | |
| E1120 | 项目阶段 `{0}` 不允许用户赋值 | |
| 事件有效载荷具有 assignedUserId,但项目阶段未配置为允许用户分配。 | E1121 | |
| Missing required tracked entity property: `{0}`. | E1122 | |
| Missing required enrollment property: `{0}`. | E1123 | |
| Missing required event property: `{0}`. | E1124 | |
| Missing required relationship property: `{0}`. | E1125 | |
| Value `{0}` is not a valid option code in option set `{1}` | E1126 | |
| Not allowed to update Tracked Entity property: {0}. | E1127 | |
| Not allowed to update Enrollment property: {0}. | E1128 | |
| Not allowed to update Event property: {0}. | E1300 | |
| 由项目规则生成 (`{0}`) - `{1}` | E1301 | |
| 由项目规则生成 (`{0}`) - 不存在强制性数据元素 `{1}` | E1302 | DataElement `{0}` is not valid: `{1}` |
| E1303 | Mandatory DataElement `{0}` is not present | |
| E1304 | DataElement `{0}` is not a valid data element| |
| E1305 | 数据元素 `{0}` 不是 `{1}` 项目阶段的一部分 | |
| E1306 | 由项目规则 (`{0}`) 生成 - 不存在强制属性 `{1}` | |
| E1307 | 由项目规则生成 (`{0}`) - 无法为数据元素 `{1}` 赋值。提供的值必须为空或与计算值 `{2}` 匹配。 | |
| E1308 | 由项目规则 (`{0}`) 生成 - 数据元素 `{1}` 被事件 `{2}` 替换 | |
| E1309 | 由项目规则 (`{0}`) 生成 - 无法为属性 `{1}` 赋值。提供的值必须为空或与计算值 `{2}` 匹配。 | |
| E1310 | 由项目规则 (`{0}`) 生成 - 属性 `{1}` 被替换为 `{2}` | |
| E1313 | Event {0} of an enrollment does not point to an existing tracked entity. The data in your system might be corrupted | |
| Indicates an anomaly in the existing data whereby enrollments might not reference a tracked entity | E1314 | |
| 由项目规则 (`{0}`) 生成 - 数据元素 `{1}` 是必填项,不能删除。 | E1315 | |
| Status `{0}` does not allow defining data values. Statuses that do allow defining data values are: {1} | E1316 | |
| No event can transition from status `{0}` to status `{1}`. | E1317 | |
| 由项目规则 (`{0}`) 生成 - 属性 `{1}` 是强制性的,不能删除。 | E4000 | |
| Relationship: `{0}` cannot link to itself | E4001 | |
| Relationship Item `{0}` for Relationship `{1}` is invalid: an Item can link only one Tracker entity. | E4006 | Could not find relationship Type: `{0}`. |
| E4010 | Relationship Type `{0}` constraint requires a {1} but a {2} was found. | E4012 |
### Could not find `{0}`: `{1}`, linked to Relationship.
E4014
#### Relationship type `{0}` constraint requires a tracked entity having type `{1}` but `{2}` was found.
E4015
Relationship: `{0}`, already exists.
1. E4016
2. Relationship: `{0}`, do not exist.
3. E4017
Relationship: `{0}`, is already deleted and cannot be modified.
#### E4018
Relationship: `{0}`, linking {1}: `{2}` to {3}: `{4}` already exists.
- E4020
- User: `{0}`, has no write access to relationship: `{1}`.
- E5000
#### "{0}" `{1}` cannot be persisted because "{2}" `{3}` referenced by it cannot be persisted.
导入项目无法持久化跟踪器对象,因为引用无法持久化。
E9999
不适用
Undefined error message.
#### Validation { #webapi_tracker_validation }
使用跟踪器导入项目导入数据时,会执行一系列验证,以确保数据的有效性。
数据的有效性。本节将介绍执行的一些不同类型的验证
以便更好地了解导入验证是否失败。
Required properties
Each of the tracker objects has a few required properties that need to be present when importing
data. For an exhaustive list of required properties, have a look at the [tracker objects
section](developer-manual.md#webapi_tracker_objects).
When validating required properties, we are usually talking about references to other data or
metadata. In these cases, there are three main criteria:
#### The reference is present and not null in the payload.
The reference points to the correct type of data and exists in the database
- The user has access to see the reference
- If the first condition fails, the import will fail with a message about a missing reference.
However, suppose the reference points to something that doesn't exist or which the user cannot
access. In that case, both cases will result in a message about the reference not being found.
- Formats
- Some of the properties of tracker objects require a specific format. When importing data, each of
these properties is validated against the expected format and will return different errors depending
on which property has a wrong format. Some examples of properties that are validated this way:
UIDs (These cover all references to other data or metadata in DHIS2.)
### Dates
Geometry (The coordinates must match the format as specified by its type)
#### User access
All data imported will be validated based on the metadata ([sharing](developer-manual.md#webapi_tracker_metadata_sharing))
and the organisation units ([scopes](developer-manual.md#webapi_tracker_orgunit_scope)) referenced in the
data. You can find more information about sharing and organisation unit scopes in the following
sections.
Sharing is validated at the same time as references are looked up in the database. Metadata outside
of the user access scope will be treated as if it does not exist. The import will validate any metadata
referenced in the data.
Users with the `ALL` authority will ignore the limits of sharing and organisation unit scopes when
they import data. However, they can not import enrollments in organisation units that do not have
access to the enrollment program.
#### Attributes and data values
属性和数据值分别是被跟踪实体和事件的一部分。但是
属性可以通过类型(TrackedEntityType)或项目(Program)链接到被跟踪实体。
项目(Program)。此外,属性也可以是唯一的。
The initial validation done in the import is to make sure the value provided for an attribute or
data element conforms to the type of value expected. For example, suppose you import a value for a
data element with a numeric type. In that case, the value is expected to be numeric. Any errors
related to a mismatch between a type and a value will result in the same error code but with a
specific message related to the type of violation.
The import will validate unique attributes at the time of import. That means as long as the provided
value is unique for the attribute in the whole system, it will pass. However, if the unique value is
found to be used by any other tracked entity other than the one being imported, it will fail.
#### 组态
The last part of validations in the importer are validations based on the user's configuration of
relevant metadata. For more information about each configuration, check out the relevant sections.
Some examples of configurable validations:
Feature type (geometry)
Allow future dates
#### Enroll once
These configurations will further change how validation is performed during import.
Generated tracked entity attributes { #webapi_generate_te_attributes }
| 指标组 | Parameter name |
|---|---|
| A TextPattern may include variables that change based on different factors. Some of these factors are unknown to the server;
thus, the values for these variables must be supplied when generating and reserving values. | This endpoint returns a map of required and optional values that the server will inject into the TextPattern when generating new values.
Required variables must be supplied for generation, whereas optional variables should only be provided if necessary. |
| ```
GET /api/33/trackedEntityAttributes/Gs1ICEQTPlG/requiredValues
``` | ```json
{
"REQUIRED": [
"ORG_UNIT_CODE"
],
"OPTIONAL": [
"RANDOM"
]
}
``` |
| 产生价值终点 { #webapi_generate_values } | 在线网络应用项目和其他客户端可使用该端点生成一个唯一值,以供立即使用。
生成的值在生成时保证是唯一的,并保留 3 天。
如果您的 TextPattern 包含必填值,可以将它们作为参数传递。 |
| 日期时间 | ```
GET /api/33/trackedEntityAttributes/Gs1ICEQTPlG/generate?ORG_UNIT_CODE=OSLO
``` |
| GET /api/metadata/proposals?filter=status:eq:ACCEPTED | 产生并保留价值终点 { #webapi_generate_reserve_values } |
| Offline clients can use this endpoint to reserve a number of unique IDs for later use when
registering new tracked entities. The number of IDs to generate can be specified with the
`numberToReserve` parameter (default is 1). | To override the default expiration time of 60 days, add `?expiration=<number-of-days>` to the request. |
### ```json
[
{
"ownerObject": "TRACKEDENTITYATTRIBUTE",
"ownerUid": "Gs1ICEQTPlG",
"key": "RANDOM(X)-OSL",
"value": "B-OSL",
"created": "2018-03-02T13:22:35.175",
"expiryDate": "2018-05-01T13:22:35.174"
},
{
"ownerObject": "TRACKEDENTITYATTRIBUTE",
"ownerUid": "Gs1ICEQTPlG",
"key": "RANDOM(X)-OSL",
"value": "Q-OSL",
"created": "2018-03-02T13:22:35.175",
"expiryDate": "2018-05-01T13:22:35.174"
},
{
"ownerObject": "TRACKEDENTITYATTRIBUTE",
"ownerUid": "Gs1ICEQTPlG",
"key": "RANDOM(X)-OSL",
"value": "S-OSL",
"created": "2018-03-02T13:22:35.175",
"expiryDate": "2018-05-01T13:22:35.174"
}
]
Two endpoints are dedicated to tracked entities:
- `GET /api/tracker/trackedEntities`
- retrieves tracked entities matching given criteria
- `GET /api/tracker/trackedEntities/{id}`
- retrieves a tracked entity given the provided ID
- If not otherwise specified, JSON is the default response for the `GET` method.
The API also supports CSV export for single and collection endpoints. Furthermore, compressed
CSV types is an option for the collection endpoint.
- CSV
- In the case of CSV, the `fields` request parameter has no effect, and the response will always
contain the following fields:
- trackedEntity (UID)
- trackedEntityType (identifier in requested idScheme)
- createdAt (Datetime)
- createdAtClient (Datetime)
updatedAt (Datetime)
#### updatedAtClient (Datetime)
orgUnit (identifier in requested idScheme)
#### inactive (boolean)
deleted (boolean)
#### potentialDuplicate (boolean)
> **Note**
>
> Be aware that performance is directly related to the amount of data requested. Greater page
> sizes will take more time to return.
You can omit it in case of a `Point` type and with `latitude` and `longitude` provided)
latitude (Latitude of a `Point` type of Geometry)
|允许值|Potential duplicate status|`order`|Parameter name|
|---|---|---|---|
|数据值|具有以下要求:|value (String)|storedBy (String) |
|createdBy (Username of user)|具有以下要求:|See [Tracked Entities](#tracked-entities) and [Attributes](#attributes) for more field descriptions.|GZIP|
|The response is file `trackedEntities.csv.gz` containing the `trackedEntities.csv` file.|具有以下要求:|Narrows response to events matching given filters. A filter is a colon separated property or data element UID with optional operator and value pairs. Example: `filter=fazCI2ygYkq:eq:PASSIVE` with operator starts with `eq` followed by a value. A filter like `filter=fazCI2ygYkq:!null` returns all events where the given data element has a value. Characters such as `:` or `,`, as part of the filter value, need to be escaped by `/`. Likewise, `/` needs to be escaped. Multiple operators for the same data element like `filter=qrur9Dvnyt5:gt:70:lt:80` are allowed. User needs access to the data element to filter on it.|Tracked entity collections|
|`{ "periodFrom": -15, "periodTo": 15}`|具有以下要求:|The endpoint returns a list of tracked entities that match the request parameters.|Request parameter|
|See [Events](developer-manual.md#webapi_tracker_objects_events) and [Data Values](developer-manual.md#webapi_tracker_data_values) for more
field descriptions.|JSON格式|The response is file `events.json.gz` or `events.csv.gzip` containing the `events.json`
or `events.csv` file.|跟进|
|See an example payload below.|具有以下要求:|Narrows response to tracked entities matching given filters. More on filters [here](developer-manual.md#tracked_entity_attribute_filtering)|orgUnits|
|Table: Program Stage Query Criteria|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。|跟踪器或事件项目的标识符。该参数为必填参数。|orgUnitMode|
|串|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`. | 项目|
|DateTime|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`. | programStatus **deprecated for removal in version 43 use `enrollmentStatus`**|
|DateTime|[ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)|Filter for events which occurred up until this date. | 项目阶段|
|DateTime|具有以下要求:|The response is file `events.json.gz` or `events.csv.gzip` containing the `events.json`
or `events.csv` file.|跟进|
|DateTime|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|updatedAfter|
|DateTime|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|updatedBefore|
|DateTime|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|指定项目的注册开始日期|
|Duration|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|指定项目的注册结束日期|
|`{"organisationUnit": "a3kGcGDCuk7"}`|具有以下要求:|The status of the tracked entities enrollment in the given program.|enrollmentEnrolledAfter|
|Absolute end date. Applicable only when `type` is ABSOLUTE|具有以下要求:|Start date and time for enrollment in the given program|enrollmentEnrolledBefore|
|Enum|具有以下要求:|End date and time for enrollment in the given program|enrollmentOccurredAfter|
|Property|具有以下要求:|events|enrollmentOccurredBefore|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|具有以下要求:|描述|trackedEntityType|
|`"displayOrderColumns": ["enrollmentDate", "program"]`|具有以下要求:|Narrows response to tracked entities matching given filters. Example: `filterAttributes=H9IlTX2X6SL:eq:John`. More on filters [here](developer-manual.md#tracked_entity_attribute_filtering)|trackedEntities|
|串|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|assignedUserMode|
|串|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.|assignedUsers|
|串|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。|跟踪器或事件项目的标识符。该参数为必填参数。|order|
|串|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。|跟踪器或事件项目的标识符。该参数为必填参数。| eventStatus |
|描述|DateTime|Enum|eventOccurredAfter|
|programStageIdScheme|DateTime|Enum|[ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)|
DateTime
[ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)
| Only one parameter among `trackedEntity`, `enrollment`, `event` can be passed. | Parameter name |
| --- | --- |
| Boolean | `true`, `false` |
| Indicates whether to include soft-deleted elements | potentialDuplicate |
| Boolean | `true`, `false` |
| Filter the result based on the fact that a tracked entities is a potential duplicate. `true`: returns tracked entities flagged as potential duplicates. `false`: returns tracked entities NOT flagged as potential duplicates. | 方案 |
| In summary, DHIS2 has a fine-grained sharing setting that we can use to implement access control
mechanisms both at the data and metadata level. These sharing settings can be applied directly at
the user level or user group level. How exactly to apply a sharing setting depends on the use-case
at hand. | `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}` |
IdScheme used for all metadata references unless overridden by a metadata specific parameter. Default is `UID`. Note: only metadata in fields `trackedEntity.trackedEntityType`, `orgUnit` and `attributes` is exported in this idScheme. All other fields will always be exported using UIDs.
- orgUnitIdScheme
Enum
- `UID`, `CODE`, `NAME`, `ATTRIBUTE:{uid}`
IdScheme used for organisation unit references. Defaults to the `idScheme` parameter.
- The available assigned user modes are explained in the following table.
- Table: Assigned user modes
- Mode
- 描述
CURRENT
- Includes events assigned to the current logged in user.
##### Filter the result down to a limited set of IDs by using `event=id1,id2`.
Includes events assigned to the user provided in the request.
NONE
Includes unassigned events only.
ANY
Includes all assigned events, regardless of who they are assigned to, as long as they are assigned to someone.
全部
Filter the result down to a limited set of tracked entities with events that are assigned to the given user IDs by using `assignedUser=id1,id2`.This parameter will only be considered if `assignedUserMode` is either `PROVIDED` or `null`. The API will error out, if for example, `assignedUserMode=CURRENT` and `assignedUser=someId`.
查询不区分大小写。以下规则适用于查询
参数。
At least one organisation unit must be specified using the `orgUnit`
parameter (one or many), or `orgUnitMode=ALL` must be specified.
Only one of the `program` and `trackedEntity` parameters can be
指定(零或一)。
If `programStatus` is specified, then `program` must also be specified.
If `enrollmentStatus` is specified, then `program` must also be specified.
| 所需值 | Parameter name |
| --- | --- |
| true | 过滤器项目只能指定一次。 |
| true | 查询与特定组织单位和跟踪项目相关的所有被跟踪实体的方法如下
可以这样查询 |
| true | To query for tracked entities using one attribute with a filter and one attribute without a filter,
with one organisation unit using the descendant organisation unit query mode: |
| true | 为过滤器指定了多个操作数和过滤器的查询
物品: |
| true | A query filter with a value that needs escaping and will be interpreted as `:,/`: |
| true | 要将项目注册日期指定为查询的一部分,请执行以下操作: |
| true | To query on an attribute using multiple values with an *IN* filter and semicolon-separated values: |
| ```
GET /api/tracker/trackedEntities?trackedEntityType=nEenWmSyUEp&orgUnits=DiszpKrYNg8&filter=w75KJ2mc4zz:IN:Scott;Jimmy;Santiago
``` | All of the following operators are supported regardless of the value type. Values are compared using
text comparison unless stated otherwise. Integer and decimal value types are treated as PostgreSQL
integer and numeric data types for the specified operators. |
| Supported binary operators: | Operator |
| 描述 | eq |
| true | ieq |
| true | ge|
| greater than or equal to (uses integer/number semantics for integer/decimal value types) | gt |
| greater than, uses integer/number semantics for integer/decimal value types | le |
| less than or equal to, uses integer/number semantics for integer/decimal value types | lt |
| less than (uses integer/number semantics for integer/decimal value types) | ne |
not equal to (uses integer/number semantics for integer/decimal value types)
neq
not equal to (uses integer/number semantics for integer/decimal value types), use `ne` instead*
nieq
| 所需值 | Parameter name |
| --- | --- |
| false | like |
| false | ilike |
##### like text match, ignoring case (use `like` instead)*
nlike
例如: `filter=H9IlTX2X6SL:sw:A` 运算符以 `sw` 开头,后面跟一个值。
过滤器如 `filter=H9IlTX2X6SL:!null` 会返回给定属性有值的所有条目。
特殊字符(如 `+`)需要按百分比编码,因此应使用 `%2B` 代替 `+`。作为过滤值的一部分,`:` 或 `,` 字符需要用 `/` 转义。同样,`/` 也需要转义。
sw
每个被跟踪实体的属性都可配置为
- 进行搜索所需的最少字符数(0 表示没有最少字符数)。
- ends with
*These operators are currently supported but may be removed in the future. We recommend using the operator mentioned in the description, as it provides the same functionality.
ANY
For instance, `filter=w75KJ2mc4zz:eq:Scott` would return values of the given attribute that match any variation of "Scott" regardless of case, such as SCOTT, scott, Scott...
##### Supported unary operators:
Operator
##### 数据存储 { #data-store }
null
has no value
!null
##### 使用特定项目和组织单位查询所有事件:
Tracked entity attribute filtering { #tracked_entity_attribute_filtering }
Filtering by a tracked entity attribute narrows the response to tracked entities matching given filters. A filter is a colon separated property or attribute UID with optional operator and value pairs.
##### Example: `filter=H9IlTX2X6SL:sw:A` with operator starts with `sw` followed by a value.
A filter like `filter=H9IlTX2X6SL:!null` returns all entries where the given attribute has a value.
- Special characters like `+` need to be percent-encoded, so `%2B` instead of `+`. Characters such as `:` or `,`, as part of the filter value, need to be escaped by `/`. Likewise, `/` needs to be escaped.
Multiple operators for the same attribute like `filter=AuPLng5hLbE:gt:438901703:lt:448901704` are allowed.
Each tracked entity attribute can be configured with:
A minimum number of characters required to perform a search (0 means no minimum)
- Blocked operators. Only `sw`, `ew`, and `like` can be blocked. All other operators cannot be blocked.
The following request:
would fail if the minimum character limit was set to 5 (since "John" has only 4 characters), or if the `EQ` operator was blocked for the specified tracked entity attribute.
Tracked entities response
- The API supports CSV and JSON response for `GET /api/tracker/trackedEntities`.
JSON格式
- Responses can be filtered on desired fields, see [field filter](developer-manual.md#webapi_tracker_field_filter) for more information.
- A JSON response looks like the following:
#### ```json
{
"pager": {
"page": 1,
"pageSize": 1
},
"trackedEntities": [
{
"trackedEntity": "F8yKM85NbxW",
"trackedEntityType": "Zy2SEgA61ys",
"createdAt": "2019-08-21T13:25:38.022",
"createdAtClient": "2019-03-19T01:12:16.624",
"updatedAt": "2019-08-21T13:31:33.410",
"updatedAtClient": "2019-03-19T01:12:16.624",
"orgUnit": "DiszpKrYNg8",
"inactive": false,
"deleted": false,
"potentialDuplicate": false,
"geometry": {
"type": "Point",
"coordinates": [
-11.7896,
8.2593
]
},
"attributes": [
{
"attribute": "B6TnnFMgmCk",
"displayName": "Age (years)",
"createdAt": "2019-08-21T13:25:38.477",
"updatedAt": "2019-08-21T13:25:38.477",
"storedBy": "braimbault",
"valueType": "INTEGER_ZERO_OR_POSITIVE",
"value": "30"
},
{
"attribute": "TfdH5KvFmMy",
"displayName": "First Name",
"createdAt": "2019-08-21T13:25:38.066",
"updatedAt": "2019-08-21T13:25:38.067",
"storedBy": "josemp10",
"valueType": "TEXT",
"value": "Sarah"
},
{
"attribute": "aW66s2QSosT",
"displayName": "Last Name",
"createdAt": "2019-08-21T13:25:38.388",
"updatedAt": "2019-08-21T13:25:38.388",
"storedBy": "karoline",
"valueType": "TEXT",
"value": "Johnson"
}
]
}
]
}
Tracked entities collection limits
| 允许值 | Potential duplicate status | `order` | Parameter name |
| --- | --- | --- | --- |
| storedByDataValue | 具有以下要求: | ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` | matches exceed this limit. No limit applies when searching within the capture scope |
| `{ "periodFrom": -15, "periodTo": 15}` | 具有以下要求: |```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` | For paginated requests with non-zero `KeyTrackedEntityMaxLimit`: |
| 默认过滤器是`id,displayName` | 具有以下要求: | Tracked entities single object endpoint | ```json
{
"pager": {
"page": 1,
"pageSize": 1
},
"events": [
{
"event": "A7rzcnZTe2T",
"status": "ACTIVE",
"program": "eBAyeGv0exc",
"programStage": "Zj7UnCAulEk",
"enrollment": "RiLEKhWHlxZ",
"orgUnit": "DwpbWkiqjMy",
"occurredAt": "2023-02-13T00:00:00.000",
"scheduledAt": "2023-02-13T00:00:00.000",
"followUp": false,
"deleted": false,
"createdAt": "2017-09-08T21:40:22.000",
"createdAtClient": "2016-09-08T21:40:22.000",
"updatedAt": "2017-09-08T21:40:22.000",
"attributeOptionCombo": "HllvX50cXC0",
"attributeCategoryOptions": "xYerKDKCefk",
"geometry": {
"type": "Point",
"coordinates": [-11.468912037323042, 7.515913998868316]
},
"dataValues": [
{
"createdAt": "2016-12-06T18:22:34.438",
"updatedAt": "2016-12-06T18:22:34.438",
"storedBy": "bjorn",
"providedElsewhere": false,
"dataElement": "F3ogKBuviRA",
"value": "[-11.4880220438585,7.50978830548003]"
},
{
"createdAt": "2013-12-30T14:23:57.423",
"updatedAt": "2013-12-30T14:23:57.423",
"storedBy": "lars",
"providedElsewhere": false,
"dataElement": "eMyVanycQSC",
"value": "2018-02-07"
},
{
"createdAt": "2013-12-30T14:23:57.382",
"updatedAt": "2013-12-30T14:23:57.382",
"storedBy": "lars",
"providedElsewhere": false,
"dataElement": "oZg33kd9taw",
"value": "Male"
}
],
"notes": [],
"followup": false
}
]
}
``` |
##### Filter the result down to a limited set of IDs by using `event=id1,id2`.
Request syntax
##### Request parameter
类型
###### 数据存储 { #data-store }
Tracked entity attribute value change logs { #webapi_tracker_attribute_change_logs }
``json
{
"trackedEntity":"PQfMcpmXeFE"、
"trackedEntityType":"nEenWmSyUEp"、
"createdAt":"2014-03-06T05:49:28.256",
"createdAtClient":"2014-03-06T05:49:28.256",
"updatedAt":"2016-08-03T23:49:43.309",
"orgUnit":"DiszpKrYNg8"、
"inactive": false、
"deleted": false、
"potentialDuplicate": false、
"属性": [[
{
"属性": ["w75KJ2mc4zz"、
"代码":"MMD_PER_NAM"、
"displayName"(显示名称):"名字"、
"创建时间":"2016-08-03T23:49:43.308",
"updatedAt":"2016-08-03T23:49:43.308",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"约翰"
},
{
"属性":"zDhUuAYrxNC"、
"显示名":"姓氏"、
"创建时间":"2016-08-03T23:49:43.309",
"updatedAt":"2016-08-03T23:49:43.309",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"凯莉"
}
],
"注册":[
{
"注册":"JMgRZyeLWOo"、
"创建时间":"2017-03-06T05:49:28.340",
"创建于客户端":"2016-03-06T05:49:28.340",
"updatedAt":"2017-03-06T05:49:28.357",
"trackedEntity":"PQfMcpmXeFE"、
"程序": "IpHINAT79U"IpHINAT79UW"、
"状态":"ACTIVE"、
"orgUnit":"DiszpKrYNg8"、
"enrolledAt":"2024-03-06T00:00:00.000",
"occurredAt":"2024-03-04T00:00:00.000",
"attributeOptionCombo":"HllvX50cXC0"、
"followUp": false、
"deleted": false、
"事件": [[
{
"event":"Zq2dg6pTNoj"、
"状态":"ACTIVE"、
"程序":"IpHINAT79UW"、
"程序阶段": "ZzYYXq4fJie"ZzYYXq4fJie"、
"注册": "JMgRZyeLWOO":"JMgRZyeLWOo"、
"跟踪实体": "PQfMcpmX"PQfMcpmXeFE"、
"关系":[],
"scheduledAt":"2023-03-10T00:00:00.000",
"followUp": false、
"deleted": false、
"createdAt":"2017-03-06T05:49:28.353",
"createdAtClient":"2016-03-06T05:49:28.353",
"updatedAt":"2017-03-06T05:49:28.353",
"attributeOptionCombo":"HllvX50cXC0"、
"attributeCategoryOptions":"xYerKDKCefk"、
"dataValues":[],
"备注": [[]
}
],
"关系":[],
"属性":[
{
"属性": ["w75KJ2mc4zz"、
"代码":"MMD_PER_NAM"、
"displayName"(显示名称):"名字"、
"创建时间":"2016-08-03T23:49:43.308",
"updatedAt":"2016-08-03T23:49:43.308",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"约翰"
},
{
"属性":"zDhUuAYrxNC"、
"显示名":"姓氏"、
"创建时间":"2016-08-03T23:49:43.309",
"updatedAt":"2016-08-03T23:49:43.309",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"凯莉"
},
{
"属性":"AuPLng5hLbE"、
"代码":"国家标识符"、
"displayName"(显示名称):"国家标识符"、
"createdAt":"2016-08-03T23:49:43.301",
"updatedAt":"2016-08-03T23:49:43.301",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"245435245"
},
{
"属性":"ruQQnf6rswq"、
"显示名称":"结核病编号"、
"创建时间":"2016-08-03T23:49:43.308",
"updatedAt"(更新时间"2016-08-03T23:49:43.308",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值": "1z 1f2 a84"1Z 1F2 A84 59 4464 173 6"
},
{
"属性":"cejWyOfXge6"、
"显示名称":"性别"、
"创建时间":"2016-08-03T23:49:43.307",
"updatedAt":"2016-08-03T23:49:43.307",
"valueType"(值类型): "TEXT"(文本"TEXT"、
"值":"男性"
},
{
"属性":"VqEFza8wbwA"、
"代码":"mmd_per_adr1"、
"显示名称":"地址"、
"创建时间":"2016-08-03T23:49:43.307",
"updatedAt"(更新时间"2016-08-03T23:49:43.307",
"valueType"(值类型):"TEXT"(文本"TEXT"、
"值":"主要街道 2"
}
],
"备注":[]
}
],
"programOwners":[
{
"orgUnit":"DiszpKrYNg8"、
"trackedEntity":"PQfMcpmXeFE"、
"程序":"ur1Edk5Oe2n"
},
{
"orgUnit":"DiszpKrYNg8"、
"trackedEntity":"PQfMcpmXeFE"、
"程序":"IpHINAT79UW" }
}
]
}
This endpoint retrieves change logs for the attributes of a specific tracked entity. It returns a list of all tracked entity attributes that have changed over time for that entity.
Event data value change logs { #webapi_event_data_value_change_logs }
### 类型
Allowed values
path `/{uid}`
- 串
- Tracked entity `UID`.
- 项目
- `String`
#### 项目 `UID`(可选)。
根据筛选条件返回注册列表。
|允许值|Potential duplicate status|`order`|Parameter name|
|---|---|---|---|
|createdBy (Username of user)|具有以下要求:|See [Tracked Entities](#tracked-entities) and [Attributes](#attributes) for more field descriptions.|```json
{
"pager": {
"page": 1,
"pageSize": 10
},
"changeLogs": [
{
"createdBy": {
"uid": "AIK2aQOJIbj",
"username": "tracker",
"firstName": "Tracker demo",
"surname": "User"
},
"createdAt": "2024-06-20T14:51:16.433",
"type": "UPDATE",
"change": {
"dataValue": {
"dataElement": "bx6fsa0t90x",
"previousValue": "true",
"currentValue": "false"
}
}
},
{
"createdBy": {
"uid": "AIK2aQOJIbj",
"username": "tracker",
"firstName": "Tracker demo",
"surname": "User"
},
"createdAt": "2024-06-20T14:50:32.966",
"type": "CREATE",
"change": {
"dataValue": {
"dataElement": "ebaJjqltK5N",
"currentValue": "0"
}
}
}
]
}
```|
|orgUnitMode(见 [orgUnitModes](developer-manual.md#webapi_tracker_orgunit_scope)|具有以下要求:|Narrows response to events matching given filters. A filter is a colon separated property or data element UID with optional operator and value pairs. Example: `filter=fazCI2ygYkq:eq:PASSIVE` with operator starts with `eq` followed by a value. A filter like `filter=fazCI2ygYkq:!null` returns all events where the given data element has a value. Characters such as `:` or `,`, as part of the filter value, need to be escaped by `/`. Likewise, `/` needs to be escaped. Multiple operators for the same data element like `filter=qrur9Dvnyt5:gt:70:lt:80` are allowed. User needs access to the data element to filter on it.|选择组织单位的模式。默认为 "选择"。|
|`{ "periodFrom": -15, "periodTo": 15}`|具有以下要求:|```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
```|`GET /api/tracker/enrollments/{id}`|
|retrieves an enrollment given the provided ID|具有以下要求:|The response is file `events.json.gz` or `events.csv.gzip` containing the `events.json`
or `events.csv` file.|Request parameter|
|用户友好型消息,说明操作是否成功。|具有以下要求:|The response is file `events.json.gz` or `events.csv.gzip` containing the `events.json`
or `events.csv` file.|Request parameter|
|Table: Program Stage Query Criteria|项目阶段| 跟踪器或事件项目的标识符。该参数为必填参数。 | orgUnitMode` see [orgUnitModes](developer-manual.md#webapi_tracker_orgunit_scope)|
|串|Events CSV|Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`. | 项目|
|DateTime|[ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)| Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.| 项目状态 **已过时,将在第 43 版中移除,使用 `status`** |
|串|Events CSV| Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.| status|
|串|Events CSV| Filter for events which were updated up until this date. Cannot be used together with `updatedWithin`.| 跟进|
|storeCopy|具有以下要求:|```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
```| programStatus **deprecated for removal in version 43 use `enrollmentStatus`**|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|具有以下要求:|描述|updatedWithin|
|Duration|具有以下要求:|Only enrollments updated since given duration|enrolledAfter|
|> **注**
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo|具有以下要求:|```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
```|根据给定的属性选项组合筛选注册信息。只返回匹配的注册信息。|
|串|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。| |IdScheme used for category option references. Defaults to the `idScheme` parameter.|
enrolledBefore
##### Filter the result down to a limited set of IDs by using `event=id1,id2`.
[ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)
Only enrollments older than this date
trackedEntity
串
At least one organisation unit must be specified using the `orgUnit`
Identifier of tracked entity
order
串
Comma-separated list of property name or attribute or UID and sort direction pairs in format `propName:sortDirection`.
Supported fields: `completedAt, createdAt, createdAtClient, enrolledAt, updatedAt, updatedAtClient`.
##### enrollments
串
Comma-separated list of enrollment `UID`s.
#### Filter the result down to a limited set of IDs by using `enrollments=id1,id2`.
includeDeleted
Boolean
##### ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc&order=occurredAt:desc&pageSize=10&page=1
{
"pager": {
"page": 1,
"pageSize": 1
},
"enrollments": [
{
"enrollment": "TRE0GT7eh7Q",
"createdAt": "2019-08-21T13:28:00.056",
"createdAtClient": "2018-11-13T15:06:49.009",
"updatedAt": "2019-08-21T13:29:44.942",
"updatedAtClient": "2019-08-21T13:29:44.942",
"trackedEntity": "s4NfKOuayqG",
"program": "M3xtLkYBlKI",
"status": "COMPLETED",
"orgUnit": "DiszpKrYNg8",
"enrolledAt": "2023-11-13T00:00:00.000",
"occurredAt": "2023-11-13T00:00:00.000",
"followUp": false,
"deleted": false,
"storedBy": "healthworker1",
"notes": []
}
]
}
GET /api/tracker/enrollment/{uid}
GET /api/tracker/events/{id}
GET /api/tracker/events?orgUnit=O6uvpzGd5pu&orgUnitMode=DESCENDANTS
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc
查询某一项目和组织单位中发生日期最新的 10 个事件 - 通过分页和按发生日期降序排序的方法
通过分页和按发生日期降序排序:
##### ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc&order=occurredAt:desc&pageSize=10&page=1
event,status,program,programStage,enrollment,orgUnit,occurredAt,scheduledAt,geometry,latitude,longitude,followUp,deleted,createdAt,createdAtClient,updatedAt,updatedAtClient,completedBy,completedAt,updatedBy,attributeOptionCombo,attributeCategoryOptions,assignedUser,dataElement,value,storedBy,providedElsewhere,storedByDataValue,updatedAtDataValue,createdAtDataValue
A7rzcnZTe2T,ACTIVE,eBAyeGv0exc,Zj7UnCAulEk,RiLEKhWHlxZ,DwpbWkiqjMy,2023-02-12T23:00:00Z,2023-02-12T23:00:00Z,"POINT (-11.468912037323042 7.515913998868316)",7.515913998868316,-11.468912037323042,false,false,2017-09-08T19:40:22Z,,2017-09-08T19:40:22Z,,,,,HllvX50cXC0,xYerKDKCefk,,F3ogKBuviRA,"[-11.4880220438585,7.50978830548003]",admin,false,,2016-12-06T17:22:34.438Z,2016-12-06T17:22:34.438Z
A7rzcnZTe2T,ACTIVE,eBAyeGv0exc,Zj7UnCAulEk,RiLEKhWHlxZ,DwpbWkiqjMy,2023-02-12T23:00:00Z,2023-02-12T23:00:00Z,"POINT (-11.468912037323042 7.515913998868316)",7.515913998868316,-11.468912037323042,false,false,2017-09-08T19:40:22Z,,2017-09-08T19:40:22Z,,,,,HllvX50cXC0,xYerKDKCefk,,eMyVanycQSC,2018-02-07,admin,false,,2013-12-30T13:23:57.423Z,2013-12-30T13:23:57.423Z
A7rzcnZTe2T,ACTIVE,eBAyeGv0exc,Zj7UnCAulEk,RiLEKhWHlxZ,DwpbWkiqjMy,2023-02-12T23:00:00Z,2023-02-12T23:00:00Z,"POINT (-11.468912037323042 7.515913998868316)",7.515913998868316,-11.468912037323042,false,false,2017-09-08T19:40:22Z,,2017-09-08T19:40:22Z,,,,,HllvX50cXC0,xYerKDKCefk,,msodh3rEMJa,2018-02-13,admin,false,,2013-12-30T13:23:57.467Z,2013-12-30T13:23:57.467Z
{
"event": "rgWr86qs0sI",
"status": "ACTIVE",
"program": "kla3mAPgvCH",
"programStage": "aNLq9ZYoy9W",
"enrollment": "Lo3SHzCnMSm",
"orgUnit": "DiszpKrYNg8",
"occurredAt": "2024-10-12T00:00:00.000",
"followUp": false,
"deleted": false,
"createdAt": "2018-10-20T12:09:19.492",
"createdAtClient": "2017-10-20T12:09:19.492",
"updatedAt": "2018-10-20T12:09:19.492",
"attributeOptionCombo": "amw2rQP6r6M",
"attributeCategoryOptions": "RkbOhHwiOgW",
"dataValues": [
{
"createdAt": "2015-10-20T12:09:19.640",
"updatedAt": "2015-10-20T12:09:19.640",
"storedBy": "system",
"providedElsewhere": false,
"dataElement": "HyJL2Lt37jN",
"value": "12"
}
],
"notes": [],
"followup": false
}
/api/tracker/trackedEntities?orgUnit=UID&orgUnitMode=specific_organisation_unit_selection_mode
Tracker Ownership Transfer { #webapi_tracker_ownership_transfer }
It is possible to transfer the ownership of a TrackedEntity-Program from one organisation unit to
another. This will be useful in case of patient referrals or migrations. Only a user who has
Ownership access (or temporary access by breaking the glass) can transfer the ownership. To transfer
ownership of a TrackedEntity-Program to another organisation unit, the following PUT request can be
used:
#### A list of assigned users for events. To be used along with `PROVIDED` assignedUserMode above.
"assignedUsers":["DXyJmlo9rge"]
| 指标组 | Parameter name | 描述 |
| --- | --- | --- |
| displayColumnOrder | periodFrom | |
| dataFilters | Protected | |
| 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 [打破玻璃](#webaptrl) 获得临时所有权。
玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。
他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。
访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时
时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。
获得临时访问权。 | Closed | |
| 这是最受限制的访问级别。在访问级别为
如果所有者组织单位不在用户的捕获范围内,则无法访问 "关闭 "项目下记录的数据。
范围。在这种配置下,也无法打破玻璃或获得临时所有权。
请注意,仍有可能将所有权转移到另一个组织单位。只有
才能将 TrackedEntity-Program 组合的所有权转移给另一个组织单位。
另一个组织单位。如果所有权被转移,所有者组织单位将被更新。
跟踪实体 | Working lists | 工作列表允许用户保存筛选器和排序偏好,从而有效地组织工作流程。
首选项。每种类型的工作列表
实体、注册和事件都有专门的应用项目接口进行管理。 |
| `{ "periodFrom": -15, "periodTo": 15}` | Query request parameters | Tracked entity working lists |
| Create, update and delete tracked entity working lists using | /api/trackedEntityInstanceFilters | Payload |
| Table: Payload | Property | 描述 |
例
| 指标组 | Parameter name | 描述 |
| --- |---|---|
|A description of the working list.|sortOrder|The sort order of the working list.|
|DateTime|Object containing css style.||
|Table: Program Stage Query Criteria|项目||
|是否在 DHIS2 中存储一份项目信息副本。|`{ "id" : "uy2gU8kTjF"}`|entityQueryCriteria|
|`{"type":"RELATIVE","period":"TODAY"}`|See *Entity Query Criteria* definition table below.|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event scheduled date.|
|Enum|`[{"programStage": "eaDH9089uMp", "eventStatus": "OVERDUE", "eventCreatedPeriod": {"periodFrom": -15, "periodTo": 15}}]`|Table: Entity query criteria definition|
|Property|Object containing parameters for querying, sorting and filtering events.|例|
|`"enrolledAt": {"type":"RELATIVE","period":"THIS_MONTH"}`|Property|`"attributeValueFilters"=[{"attribute": "abcAttributeUid","le": "20","ge": "10","lt": "20","gt": "10","in": ["India", "Norway"],"like": "abc","sw": "abc","ew": "abc","dateFilter": {"startDate": "2014-05-01","endDate": "2019-03-20","startBuffer": -5,"endBuffer": 5,"period": "LAST_WEEK","type": "RELATIVE"}}]`|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|The tracked entities enrollment status. Can be none(any enrollmentstatus) or ACTIVE, COMPLETED, CANCELLED|跟进|
|See an example payload below.|organisationUnit|To specify the uid of the organisation unit|
|`{"organisationUnit": "a3kGcGDCuk7"}`|ouMode|To specify the organisation unit selection mode. Options are `SELECTED`, `CHILDREN`, `DESCENDANTS`, `ACCESSIBLE`, `CAPTURE`, `ALL`|
|Absolute end date. Applicable only when `type` is ABSOLUTE|assignedUserMode|To specify the assigned user selection mode for events. Options are CURRENT, PROVIDED, NONE , ANY. See table below to understand what each value indicates. If `PROVIDED` (or null), non-empty assignedUsers in the payload will be considered.|
|"assignedUserMode": "PROVIDED"|assignedUsers|To specify a list of assigned users for events. To be used along with PROVIDED assignedUserMode above.|
|`"assignedUsers": ["a3kGcGDCuk7", "a3kGcGDCuk8"]`|displayColumnOrder|To specify the output ordering of columns|
|`"displayOrderColumns": ["enrollmentDate", "program"]`|例|名称|
|"assignedUsers": ["a3kGcGDCuk7", "a3kGcGDCuk8"]|项目阶段|To specify a programStage uid to filter on. tracked entities will be filtered based on presence of enrollment in the specified program stage.|
|"order"="a3kGcGDCuk6:desc,eventDate:asc"|trackedEntityType|To specify a trackedEntityType filter tracked entities on.|
`{"trackedEntityType"="a3kGcGDCuk6"}`
| 指标组 | Parameter name | 描述 |
|---|---|---|
|See an example payload below.|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on enrollment created date.|`"enrollmentCreatedDate": { "period": "LAST_WEEK", "type": "RELATIVE" }`|
|`"displayOrderColumns": ["enrollmentDate", "program"]`|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on enrollment incident date.|`"enrollmentIncidentDate": { "startDate": "2014-05-01", "endDate": "2019-03-20", "startBuffer": -5, "endBuffer": 5, "period": "LAST_WEEK", "type": "RELATIVE" }`|
|eventStatus|The event status. Options are `ACTIVE`, `COMPLETED`, `VISITED`, `SCHEDULE`, `OVERDUE`, `SKIPPED` and `VISITED`|`"status":"VISITED"`|
|Enum|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on event date.|`"eventDate": {"startBuffer": -5,"endBuffer": 5, "type": "RELATIVE" }`|
|Property|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on last updated date.|例|
Table: Event filters definition
| 指标组 | Parameter name | 描述 |
|---|---|---|
|项目阶段|被跟踪实体需要返回哪个项目阶段的事件。|-15|
|`"eaDH9089uMp"`|eventStatus|15|
#### The events status. Can be none(any event status) or ACTIVE, COMPLETED, SCHEDULE, OVERDUE
`ACTIVE`
| eventCreatedPeriod | Parameter name |
|---|---|
|`{ "periodFrom": -15, "periodTo": 15}`|assignedUserMode|
### To specify the assigned user selection mode for events. Options are `CURRENT` (events assigned to current user), `PROVIDED` (events assigned to users provided in "assignedUsers" list), `NONE` (events assigned to no one) , ANY (events assigned to anyone). If PROVIDED (or null), non-empty assignedUsers in the payload will be considered.
`"assignedUserMode": "PROVIDED"`
assignedUsers
#### A list of assigned users for events. To be used along with `PROVIDED` assignedUserMode above.
"assignedUsers":["DXyJmlo9rge"]
| Table: Period filter definition | Parameter name | 描述 |
| --- | --- | --- |
| displayColumnOrder | periodFrom | |
| dataFilters | Protected | |
| `{ "periodFrom": -15, "periodTo": 15}` | Query request parameters| Table: Tracked entity instance filters query parameters |
| See an example payload below. | 描述 | 项目 |
| 项目标识符。将筛选器限制在给定的项目中。 | /api/trackedEntityInstanceFilters | Create, update and delete program stage working lists using |
| Payload | Parameter name | 描述 |
|---|---|---|
|`"displayOrderColumns": ["enrollmentDate", "program"]`|例|名称|
|Name of the working list. Required.|描述|A description of the working list.|
|项目|eventCreatedAt|`{"id" : "uy2gU8kTjF"}`|
|项目阶段|包含项目阶段 ID 的对象。必须填写。|`{"id" : "uy2gU8kTjF"}`|
|DateTime|An object representing various possible filtering values.|See *Program Stage Query Criteria* definition table below.|
|Table: Program Stage Query Criteria|Criteria values|描述|
|例|eventStatus|The event status. Options are `ACTIVE`, `COMPLETED`, `VISITED`, `SCHEDULE`, `OVERDUE`, `SKIPPED` and `VISITED`|
|`"status":"VISITED"`|eventCreatedAt|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event creation date.|
|`{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"}`|eventOccurredAt|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event occurred date.|
|`{"type":"RELATIVE","period":"TODAY"}`|eventScheduledAt|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event scheduled date.|
|Enum|enrollmentStatus|Any valid EnrollmentStatus. Options are `ACTIVE`, `COMPLETED` and `CANCELLED`.|
|Property|跟进|Indicates whether to filter enrollments marked for follow up or not|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|enrolledAt|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event enrollment date.|
|`"enrolledAt": {"type":"RELATIVE","period":"THIS_MONTH"}`|enrollmentOccurredAt|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object filtering based on the event occurred date.|
|`{"type":"RELATIVE","period":"THIS_MONTH"}`|orgUnit|A valid organisation unit UID|
|A description of the working list.|ouMode|A valid OU selection mode|
`"ouMode": "SELECTED"`
assignedUserMode
### A valid user selection mode for events. Options are `CURRENT`, `PROVIDED`, `NONE`, `ANY` and `ALL`. If `PROVIDED` (or null), non-empty assignedUsers in the payload will be expected.
"assignedUserMode":"PROVIDED"
assignedUsers
#### A list of assigned users for events. To be used along with `PROVIDED` assignedUserMode above.
"assignedUsers":["DXyJmlo9rge"]
| 指标组 | Parameter name | 描述 |
|---|---|---|
|displayColumnOrder|Output ordering of columns|"displayColumnOrder":["w75KJ2mc4zz","zDhUuAYrxNC"]|
|dataFilters|Protected|"dataFilters":[{"dataItem": "GXNUsigphqK","ge": "10","le": "20"}]|
|`{ "periodFrom": -15, "periodTo": 15}`|A list of attribute value filters. This is used to specify filters for attribute values when listing tracked entities|"attributeValueFilters":[{"attribute": "ruQQnf6rswq","eq": "15"}]|
|See an example payload below.|```json
{
"name": "Test WL",
"description": "Test WL definition",
"program": {
"id": "uy2gU8kT1jF"
},
"programStage": {
"id": "oRySG82BKE6"
},
"programStageQueryCriteria": {
"eventStatus": "VISITED",
"eventCreatedAt": {
"type": "ABSOLUTE",
"startDate": "2020-03-01",
"endDate": "2022-12-30"
},
"eventScheduledAt": {
"type": "RELATIVE",
"period": "TODAY"
},
"enrollmentStatus": "COMPLETED",
"followUp": true,
"enrolledAt": {
"type": "RELATIVE",
"period": "THIS_MONTH"
},
"enrollmentOccurredAt": {
"type": "RELATIVE",
"period": "THIS_MONTH"
},
"orgUnit": "Rp268JB6Ne4",
"ouMode": "SELECTED",
"assignedUserMode": "PROVIDED",
"assignedUsers": [
"DXyJmlo9rge"
],
"order": "w75KJ2mc4zz:asc",
"displayColumnOrder": [
"w75KJ2mc4zz",
"zDhUuAYrxNC"
],
"dataFilters": [
{
"dataItem": "GXNUsigphqK",
"ge": "10",
"le": "20"
}
],
"attributeValueFilters": [
{
"attribute": "ruQQnf6rswq",
"eq": "15"
}
]
}
}
```|Event working lists|
|Create, update and delete event working lists using the following endpoint.|```
/api/eventFilters
```|Payload|
Table: Payload
| 指标组 | Parameter name | 描述 |
|---|---|---|
|Table: Program Stage Query Criteria|Name of the working list.|"name":"My working list"|
|是否在 DHIS2 中存储一份项目信息副本。|`{ "id" : "uy2gU8kTjF"}`|"description":"for listing all events assigned to me".|
|`{"type":"RELATIVE","period":"TODAY"}`|项目的 uid。|"项目":"a3kGcGDCuk6"|
|Enum|项目阶段的 uid。|"项目阶段": "a3kGcGDCuk6"|
|Property|Object containing parameters for querying, sorting and filtering events.|"eventQueryCriteria": { "organisationUnit":"a3kGcGDCuk6", "status": "COMPLETED", "createdDate": { "from": "2014-05-01", "to": "2019-03-20" }, "dataElements": ["a3kGcGDCuk6:EQ:1", "a3kGcGDCuk6"], "filters": ["a3kGcGDCuk6:EQ:1"], "programStatus": "ACTIVE", "ouMode": "SELECTED", "assignedUserMode": "PROVIDED", "assignedUsers" : ["a3kGcGDCuk7", "a3kGcGDCuk8"], "followUp": false, "events": ["a3kGcGDCuk7", "a3kGcGDCuk8"], "fields": "eventDate,dueDate", "order": "dueDate:asc,createdDate:desc" }|
|`"enrolledAt": {"type":"RELATIVE","period":"THIS_MONTH"}` |Property|描述|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|跟进|Used to filter events based on enrollment followUp flag. Options are `true`, `false`.|
|`{"type":"RELATIVE","period":"THIS_MONTH"}`|organisationUnit|To specify the uid of the organisation unit|
|用户友好型消息,说明操作是否成功。|ouMode|To specify the OU selection mode. Options are `SELECTED`, `CHILDREN`, `DESCENDANTS`, `ACCESSIBLE`, `CAPTURE`, `ALL`|
|用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。|assignedUserMode|To specify the assigned user selection mode for events. Options are `CURRENT`, `PROVIDED`, `NONE`, `ANY`. See table below to understand what each value indicates. If `PROVIDED` (or null), non-empty assignedUsers in the payload will be considered.|
|"assignedUserMode": `PROVIDED`|assignedUsers|To specify a list of assigned users for events. To be used along with PROVIDED assignedUserMode above.|
|"assignedUsers": ["a3kGcGDCuk7", "a3kGcGDCuk8"]|项目阶段|To specify the output ordering of columns|
|"displayOrderColumns": ["eventDate", "dueDate", "program"]|order|To specify ordering/sorting of fields and its directions in comma separated values. A single item in order is of the form "dataItem:direction".|
|"order"="a3kGcGDCuk6:desc,eventDate:asc"|trackedEntityType|To specify filters to be applied when listing events|
`"ouMode": "SELECTED"`
status
### Any valid EventStatus
"eventStatus": "COMPLETED"
| 指标组 | Parameter name | 描述 |
|---|---|---|
|枚举(参见元数据和渲染类型表中的列表)|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on completed date.|"completedDate": { "startDate": "2014-05-01", "endDate": "2019-03-20", "startBuffer": -5, "endBuffer": 5, "period": "LAST_WEEK", "type": "RELATIVE" }|
|eventDate|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on event date.|"eventDate": { "startBuffer": -5, "endBuffer": 5, "type": "RELATIVE" }|
|dueDate|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on due date.|"dueDate": { "period": "LAST_WEEK", "type": "RELATIVE" }|
|lastUpdatedDate|[DateFilterPeriod](developer-manual.md#webapi_tracker_workinglists_common_objects) object date filtering based on last updated date.|"dueDate": { "period": "LAST_WEEK", "type": "RELATIVE" }|
|See an example payload below.|```json
{
"name": "event working list",
"program": "VBqh0ynB2wv",
"eventQueryCriteria": {
"eventDate": {
"period": "LAST_WEEK",
"type": "RELATIVE"
},
"dataFilters": [
{
"ge": "35",
"le": "70",
"dataItem": "qrur9Dvnyt5"
}
],
"assignedUserMode": "PROVIDED",
"assignedUsers": [
"CotVI2NX0rI",
"xE7jOejl9FI"
],
"status": "ACTIVE",
"order": "occurredAt:desc",
"displayColumnOrder": [
"occurredAt",
"status",
"assignedUser",
"qrur9Dvnyt5",
"oZg33kd9taw"
]
}
}
```|Common objects { #webapi_tracker_workinglists_common_objects }|
|Table: DateFilterPeriod object definition|Property|描述|
## 例
type
Specify whether the date period type is `ABSOLUTE`, `RELATIVE`
`"type" : "RELATIVE"`
潜在重复的响应有效载荷如下所示。
Specify if a relative system defined period is to be used. Applicable only when `type` is RELATIVE. (see [Relative Periods](developer-manual.md#webapi_date_relative_period_values) for supported relative periods)
`"period" : "THIS_WEEK"`
| 允许值 | Parameter name | Potential duplicate status | `order` |
|---|---|---|---|
| Absolute end date. Applicable only when `type` is ABSOLUTE | `"startDate":"2014-05-01"` | startBuffer| Relative custom start date. Applicable only when `type` is RELATIVE |
| 用户友好型消息,说明操作是否成功。 | To inspect individual potential duplicate records, use the following endpoint: | 不区分大小写的字符串结尾匹配 | `"startDate":+10` |
Potential duplicates
Potential duplicates are records identified by the data deduplication feature as possibly being
duplicates. Due to the nature of this feature, the API endpoint has certain restrictions. A
potential duplicate represents a pair of records suspected to be duplicates.
To retrieve a list of potential duplicates, use the following endpoint:
The response payload for a potential duplicate looks like this.s
```json
{
"created": "2024-06-04T10:11:29.110",
"lastUpdated": "2024-06-04T10:11:29.110",
"original": "<UID>",
"duplicate": "<UID>",
"status": "OPEN|INVALID|MERGED",
"id": "<id>"
}
| 400 | Status code
### 描述
Input original or duplicate is null or has invalid uid
User do not have access to read original or duplicate TEs
TE not found
| 允许值 | Parameter name | Potential duplicate status | `order` |
| --- | --- | --- | --- |
| 描述 | 类型 | 不区分大小写的字符串结尾匹配 | status |
Potential duplicate status
#### string
`OPEN`, `INVALID`
* Status code
* 描述
* You can't update a potential duplicate to MERGED as this is possible only by a merging request
You can't update a potential duplicate that is already in a MERGED status
Merging tracked entities
#### Tracked entities can be merged together if they are deemed viable. To initiate a merge, the first
step is to define two tracked entities as a Potential Duplicate. The merge endpoint moves data from
the duplicate tracked entity to the original tracked entity and deletes the remaining data of the
duplicate.
To merge a Potential Duplicate, i.e. the two tracked entities the Potential Duplicate represents,
use the following endpoint:
* ```
POST /api/potentialDuplicates/<id>/merge
To retrieve a specific message.
表格查询程序通知实例 API
| 类型 | Potential duplicate status | 检索和删除项目通知模板 | Parameter name |
|-------------|-------------------|----------|-------------------------------------------------------------------------------------------------------------------------------|
| 计划日期 | 日期"(ISO-8601) | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 返回计划在给定日期发送的通知实例。Example: `scheduledAt=2025-01-01`. |
| `true`|`false` | Field Presets { #field-presets } | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 启用或禁用分页。默认为 `true`。使用 `paging=false` 可返回不带分页的所有匹配实例。 |
| comma separated list of fields or presets to include | 整数 | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 启用分页时返回的页码。 |
| 默认 | 整数 | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 启用分页时每页的条目数。 |
| 事件 | Narrows response to tracked entities matching given filters. More on filters [here](developer-manual.md#tracked_entity_attribute_filtering) | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 该活动附有计划通知实例。 |
| 注册 | Narrows response to tracked entities matching given filters. More on filters [here](developer-manual.md#tracked_entity_attribute_filtering) | [Enrollment Aggregate data dimensions](developer-manual.md#webapi_enrollment_aggregate_analytics_dimension) `/analytics/enrollments/aggregate/dimensions` | 该注册附有计划通知实例。 |
## 性能{ #webapi_tracker_performance }
本节包括一般性能原则,然后是针对特定端点的
跟踪器导出端点的具体指导。进一步的性能优化需要了解真实世界的访问
模式和数据分布。如果你的实施能共享这些信息,将有助于
确定改进的优先次序。
### 进口
#### 通知
通知在导入后以异步方式发送,但会与并发请求争夺
数据库连接、CPU 和内存的并发请求。如果有很多实体和通知模板,这可能会增加延迟。
增加延迟。对于不需要通知的批量导入,请跳过通知:
POST /api/tracker?skipSideEffects=true
#### 计划规则
在导入过程中,规则引擎会同步运行捆绑包中的每个注册和事件、
这会大大增加批量导入的延迟。只有当程序中没有
必须在导入时执行的带有验证或分配的规则时才跳过:
POST /api/tracker?skipRuleEngine=true
### 出口
#### 一般原则
导出端点的响应时间通常由数据库查询的执行时间决定。下面的
下面的建议主要是减少数据库的工作量。
##### 正确的查询
跟踪器数据模型有三个层次:跟踪实体、注册人数和事件。始终在
满足需求的最低级别。使用 `GET /api/tracker/events` 而不是 `GET
/api/tracker/trackedEntities?fields=enrollments[events]`。通过父端点查询会增加
查询复杂性或查询次数。
##### 使用明确的 "字段
默认情况下,所有端点都不包括嵌套集合,如 "注册"、"事件 "和 "关系"。
关系"。每个额外的集合都会增加资源利用率和响应时间。只
请求所需的 "字段",避免使用 "字段=*"。
##### 选择性
查询性能取决于数据库在返回结果前必须处理多少条记录。
需要扫描、排序和重复的记录越少,响应速度就越快。这就是**选择性**:
符合查询条件的记录占总记录数的比例。
选择性有几个来源,但都是复合的:请求参数(如
程序"、"过滤器"、日期范围)、用户范围和 "orgUnitMode"。
###### 过滤器
在排序和分页之前,过滤器会缩小结果集的范围。当有
数据库索引支持时最有效。宽泛的筛选器(例如,"filter=w75KJ2mc4zz:like:J")可能会匹配大部分数据集,但几乎不提供选择性。
数据集,选择性很小。窄筛选器(例如,`filter=w75KJ2mc4zz:eq:Jerald` 或严格的日期范围
严格的日期范围)会大大减少工作集。跟踪实体属性的 `like` 过滤器
可受益于 [trigram 索引](#scheduling_tracker_index_maintenance)。
程序和跟踪实体类型上的 "搜索所需的最少属性数 "设置
在用户捕获范围外进行搜索时,需要最少数量的属性筛选器。
###### IndicatorGroup
指定 `program` 可实现基于所有权的访问控制。如果没有 `program`,系统必须
动态评估被跟踪实体注册的所有程序的访问规则。总是
在查询特定程序数据时包含 `program`。
请注意,即使指定了 "程序",选择性也取决于该程序存在多少数据。
程序的数据量。一个包含了大多数被跟踪实体的程序的选择性不会很高。
##### 组织单位模式{ #webapi_tracker_perf_organisation_unit_mode }
[`orgUnitMode`](developer-manual.md#webapi_tracker_orgunit_scope)和用户的组织单位范围会直接影响
数据库处理的记录数量。性能取决于所包含的组织单位
拥有多少数据。只对单个设备有作用域的用户只能查询一小部分记录;而拥有根级
访问权限的用户可能会扫描整个程序。**选择 "是最有效的**,因为数据库可以
直接查询指定组织单位拥有的记录。
**当儿童不拥有数据时,**`CHILDREN`速度较慢。
(最低级别)。在较高层次(如地区)使用 `CHILDREN`,会返回没有事件的行政组织单位。
单位,迫使数据库扫描程序中的所有事件以确认这一点。
当子机构是实际捕获数据的组织单位时,"CHILDREN "速度很快。
**`ALL`** 不包括地域限制。**ACCESSIBLE`**取决于用户的搜索范围、
对于有广泛访问权限的用户,搜索范围可涵盖程序的大部分数据。结合选择性
过滤器相结合,以保持工作集的可管理性。
##### 订购
order "参数会极大地影响查询性能。顺序字段可分为性能
层:
* **快速(索引)**:数据库按顺序运行索引,并在填满所请求的索引后停止运行。
页。成本随页面大小和偏移量而变化,不随数据集大小而变化。假设查询条件为
允许数据库使用索引,这取决于筛选器和 `orgUnitMode`.
* **慢(无索引)**:数据库必须对所有匹配记录进行扫描和排序,然后才能返回
页。成本主要取决于匹配记录的总数。
* **非常慢(跨资源)**:排序值来自相关资源(例如,排序跟踪的资源
或属性值)。数据库必须为每个
匹配记录,然后再进行排序。
**选择性比顺序字段选择更重要、
即使排序速度慢的字段也能快速排序,因为数据库只对一小部分字段进行排序。请注意
仍会降低排序成本,但不会降低扫描成本。
请参阅下面针对端点的章节,了解哪些订单字段属于哪个层级。
##### 分页
DHIS2 使用[基于偏移量的分页](https://use-the-index-luke.com/no-offset)。页码越高,速度越慢,因为数据库必须计算并丢弃前面的所有行。
行。这是偏移分页法的基本特性,并非 DHIS2 所特有。
建议:
* 保持合理的页面大小(默认值为 50)
* 避免浏览到很高的页码
* 除非必要,否则避免使用 `totalPages=true` ,因为它会运行一个额外的计数查询,必须处理所有页数。
无论页面大小,都能匹配记录
* 避免使用 `paging=false` ,因为它会在单个响应中返回所有匹配记录
配置 [收集限制](#tracked-entities-collection-limits) 以限制结果集大小,保护数据库和服务器资源。
保护数据库和服务器资源。
#### `/api/tracker/trackedEntities`.
##### 过滤器
程序 "或 "trackedEntityType "都是必需的。程序 "更可取,因为它可以实现基于所有权的直接
基于所有权的访问控制。
##### 订购
| 层 | 订单字段 | 费用 |
|------|-------------|------|
| 快速 | 被跟踪实体"、"创建时间 | 与 `page` (偏移量) + `pageSize` 成比例 |
| 慢 | `updatedAt`, `createdAtClient`, `updatedAtClient`, `inactive`. | 与匹配跟踪实体总数的比例 |
| 非常慢 | enrolledAt",跟踪的实体属性 UID | 与匹配跟踪实体总数的比例 + 相关表格中每条记录的查找量 |
enrolledAt "还要求在一个被跟踪实体有多个注册同一计划时进行重复数据删除。
同一计划。配置为 "只注册一次 "的计划可避免重复数据删除成本。
#### `/api/tracker/enrollments`.
##### 订购
| 层 | 订单字段 | 费用 |
|------|-------------|------|
| 慢 | 已注册用户"、"已创建用户"、"已完成用户"、"已更新用户"、"已创建客户"、"已更新客户 | 与对等入学总人数的比例 |
目前,所有注册顺序字段都缺少综合索引。数据库必须对所有
匹配的注册信息,然后再返回所请求的页面。
#### `/api/tracker/events`(跟踪程序)
##### 过滤器
program "是必填项,可与 "programStage "结合使用,将范围缩小到单个阶段。
##### 所有权
每个跟踪器事件查询都必须遍历注册和所有权记录,以执行访问控制。
在一个有成千上万注册用户的程序中,广泛的查询(如不带过滤器的 `orgUnitMode=ALL
不带过滤器)必须先处理所有所有权记录,然后才能开始任何事件级工作。索引
因为所有权检查是在不同的表上进行的。
降低成本的最有效方法是缩小 org 单位范围。一个用户对
单个设施的用户会产生一个小的所有权集,从而使查询的其余部分快速完成,而无需考虑其他参数。
参数。
注册级筛选器("enrollmentStatus"、"followUp"、注册日期范围)不受
索引支持。它们仍然可以减少结果集,但不会减少数据库
扫描。
##### 订购
| 层 | 订单字段 | 费用 |
|------|-------------|------|
| 慢 | 发生时间"、"计划时间"、"创建时间"、"更新时间"、"完成时间"、"客户创建时间"、"客户更新时间"、"注册时间"、数据元素 UID | 与匹配事件总数成比例(加入所有权后) |
| 非常慢 | 跟踪的实体属性 UID | 按匹配事件总数比例 + 按事件跨资源查找 |
所有跟踪器事件顺序字段都缺少程序级的复合索引。数据库必须
必须遍历注册和所有权记录,收集所有匹配事件,对其进行排序,并返回所请求的页
请求的页面。成本与匹配事件总数而非页面大小成正比。
指定 `programStage` 并不能提高排序性能,因为瓶颈是所有权连接,而不是事件级扫描。
所有权连接,而不是事件级扫描。
enrolledAt` 来自注册表,而注册表已经是所有权连接的一部分,因此不需要额外的查找。
不需要额外查找。属性 UID 要求对每个匹配事件的被跟踪实体进行跨资源查找。
实体的跨资源查询。
#### `/api/tracker/events`(事件程序)
活动计划(无注册的计划)没有注册或所有权方面的开销。数据库
直接从事件转到其 org 单元,使这些查询在结构上比跟踪程序查询更快。
程序查询更快。
##### 过滤器
程序 "是强制性的。
##### 组织单位模式
在默认的 "occurredAt "顺序下,数据库会执行排序索引,并按
org 单位过滤每个事件。当匹配事件出现在索引的早期时,这种方法速度很快。对于 `SELECTED`、`DESCENDANTS`、
和 `ACCESSIBLE` 的性能取决于匹配的组织单位事件在排序顺序中的分布情况。
排序顺序。如果匹配事件很少或集中在索引末尾,数据库
必须先扫描许多非匹配事件。在拥有数百万个事件的程序阶段,用户的
org单元只覆盖一小部分的情况下,这可能会导致在扫描索引的大部分内容后才填满单页。
填满一个页面。添加 `occurredAfter` 和/或 `occurredBefore` 可以将扫描限制在一个有边界的窗口内,建议用于大容量扫描。
窗口,建议用于大容量程序阶段。
`ALL` 完全避免了 org 单元过滤,使用默认顺序时速度很快。CHILDREN`速度较慢,原因与
一般原则](#webapi_tracker_perf_organisation_unit_mode) 中所述的相同原因。
如果没有默认的 "occurredAt "顺序,所有模式都需要对所有匹配事件进行扫描和排序。
##### 订购
默认顺序是 `occurredAt desc`。这是事件程序最有效的顺序。
| 层 | 订单字段 | 费用 |
|------|-------------|------|
| 快速(索引) | 发生时间 | 与 `page` (偏移量) + `pageSize` 成比例。当组织单位过滤激活但匹配稀少时会降低--参见上文[组织单位模式](#organisation-unit-mode)。 |
| 慢速(无索引) | 创建于客户"、"更新于客户"、"完成于客户"、"创建于客户"、"更新于客户"。 | 占计划阶段活动总数的比例 |
| 缓慢(JSON 提取) | 数据元素 UID | 需要提取每个匹配事件的 JSON 值并对其进行排序 |
# ```
/ api / userLookup
{
"subject": "Integrity check summary",
"text": "All checks ran successfully"
}
DELETE /api/messages/{uid}
GET /api/programNotificationInstances
Table: Query program notification instance API
| Name | Type | Required | Description |
|-------------|-------------------|----------|-------------------------------------------------------------------------------------------------------------------------------|
| `scheduledAt` | `date` (ISO-8601) | no | Returns notification instances scheduled to be sent on the given date. Example: `scheduledAt=2025-01-01`. |
| `paging` | `boolean` | no | Enables or disables pagination. Default is `true`. Use `paging=false` to return all matching instances without pagination. |
| `page` | `integer` | no | Page number to return when pagination is enabled. |
| `pageSize` | `integer` | no | Number of items per page when pagination is enabled. |
| `event` | `UID` | no | Program notification instances attached to this enrollment. |
| `enrollment` | `UID` | no | Program notification instances attached to this event. |
# Email { #email }
## Email { #webapi_email }
The Web API features a resource for sending emails. For emails to be
sent it is required that the SMTP configuration has been properly set up
and that a system notification email address for the DHIS2 instance has
been defined. You can set SMTP settings from the email settings screen
and system notification email address from the general settings screen
in DHIS2.
/api/33/email
### System notification { #webapi_email_system_notification }
The *notification* resource lets you send system email notifications
with a given subject and text in JSON or XML. The email will be sent to
the notification email address as defined in the DHIS2 general system
settings:
```json
{
"subject": "Integrity check summary",
"text": "All checks ran successfully"
}
Dear user,
We are writing to inform you about scheduled system maintenance. The following table shows the maintenance schedule for the upcoming week:
| Day | Time |
|---|---|
| Monday | 10 PM - 11 PM |
| Wednesday | 10 PM - 11 PM |
We apologize for any inconvenience this may cause. Please plan your work accordingly.
Best regards,
The DHIS2 Team
* 响应示例:
* ```json
[
"key_1",
"key_2"
]
{
"foo":"bar"
}
curl "play.dhis2.org/demo/api/33/dataStore/foo/key_1/metaData" -u admin:district
{
"id": "dsKeyUid001",
"created": "...",
"user": {...},
"namespace": "foo",
"key": "key_1"
}
{
"pager": { ... },
"entries": [...]
}
[...]
[
{"key": "key1", "name": "name1", "description": "description1"},
{"key": "key2", "name": "name2", "description": "description2"}
]
[
{"key": "key1", "name": "name1", "description": "description1"},
{"key": "key2", "name": "name2", "description": "description2"},
{"key": "key3", "name": null, "description": null},
{"key": "key4", "name": null, "description": null}
]
[
{ "key": "key1", "name": "name1", "root": {"child1": 1, "child2": []}},
{ "key": "key2", "name": "name2", "root": {"child1": 2, "child2": []}}
]
[
{ "key": "key1", "root": {"level1": {"level2": {"level3": 42}}}},
{ "key": "key1", "root": {"level1": {"level2": {"level3": 13}}}}
]
* If the full path should be kept while giving an alias to a nested member the
parent path needs to be repeated using dot-syntax to indicate the nesting.
This can also be used to restructure a response in a new different structure
like so:
GET /api/dataStore/<namespace>?fields=root[level1[level2[level3~hoist(my-root.my-prop)]]]
### 过滤条目
```json
[
{ "key": "key1", "my-root": {"my-prop": 42}},
{ "key": "key2", "my-root": {"my-prop": 13}}
]
* Sorting results { #sorting-results }
Results can be sored by a single property using the `order=<path>[:direction]` parameter.
This can be any valid value `<path>` or the entry key (use `_` as path).
| 所需值 | Parameter name |
| -------- | ----------- |
| GET /api/dataStore/<namespace>?fields=name&order=name | To switch to descending order use `:desc`: |
| GET /api/dataStore/<namespace>?fields=name&order=name:desc | Sometimes the property sorted by is numeric so alphanumeric interpretation would be confusing.
In such cases special ordering types `:nasc` and `:ndesc` can be used. |
| In summary, order can be one of the following: | `asc`: alphanumeric ascending order |
| `desc:`: alphanumeric descending order | `nasc`: numeric ascending order |
`ndesc`: numeric descending order
| 所需值 | Parameter name |
| -------- | ----------- |
| To filter entries within the query API context add one or more `filter` parameters
while also using the `fields` parameter. | Each `filter` parameter has the following form: |
| unary operators: `<path>:<operator>` | binary operators: `<path>:<operator>:<value>` |
| set operators: `<path>:<operator>:[<value>,<value>,...]` | Unary operators are: |
| Operator | 描述 |
| `null` | value is JSON `null` |
| `!null` | value is defined but different to JSON `null` |
`empty`
| 所需值 | `!empty` | Parameter name |
| -------- | ---------------- | ----------- |
| Binary operators are: | Operator | 描述 |
| `eq` | value is equal to the given boolean, number or string | `!eq`, `ne`, `neq` |
| value is not equal to the given boolean, number or string | `lt` | value is numerically or alphabetically less than the given number or string |
| `le` | value is numerically or alphabetically less than or equal to the given number or string | `gt` |
| value is numerically or alphabetically greater than the given number or string | `ge` | value is numerically or alphabetically greater than or equal to the given number or string |
| Text pattern matching binary operators are: | Operator | Case Insensitive |
描述
`like`
`ilike`
| 所需值 | Parameter name |
| -------- | ----------- |
| `!ilike` | value does not match the text pattern given |
| `$like` | `$ilike`, `startswith` |
value starts with the text pattern given
* `!$like`
* `!$ilike`, `!startswith`
* value does not start with the text pattern given
* `like$`
`ilike$`, `endswith`
value ends with the text pattern given
`!like$`
`!ilike$`, `!endswith`
value does not end with the text pattern given
For operators that work for multiple JSON node types the semantic is determined from the provided value.
If the value is `true` or `false` the filter matches boolean JSON values.
If the value is a number the filter matches number JSON values.
Otherwise, the value matches string JSON values or mixed types of values.
> **Tip**
>
> To force text comparison for a value that is numeric quote the value in single quotes.
> For example, the value `'13'` is the text 13 while `13` is the number 13.
Set operators are:
Operator
描述
`in`
entry value is textually equal to one of the given values (is in set)
`!in`
entry value is not textually equal to any of the given values (is not in set)
### The `<path>` can be:
`_`: the entry key is
`.`: the entry root value is
`<member>`: the member of the root value is
`<member>.<member>`: the member at the path is (up to 5 levels deep)
Indicates whether the value of the given key should be encrypted
Some example queries are found below.
Name (of root object) is "Luke":
GET /api/dataStore/<namespace>?fields=.&filter=name:eq:Luke
### Age (of root object) is greater than 42 (numeric):
GET /api/dataStore/<namespace>?fields=.&filter=age:gt:42
Root value is a number greater than 42 (numeric matching inferred from the value):
GET /api/dataStore/<namespace>?fields=.&filter=.:gt:42
Enabled (of root object) is true (boolean matching inferred from the value):
Indicates whether the value of the given key should be encrypted
Root object has name containing "Pet" and has an age greater than 20:
### GET /api/dataStore/<namespace>?fields=.&filter=name:like:Pet&filter=age:gt:20
Root object is either flagged as minor or has an age less than 18:
GET /api/dataStore/<namespace>?fields=.&filter=minor:eq:true&filter=age:lt:18&rootJunction=or
创造价值 { #webapi_data_store_create_values }
为命名空间创建新的键和值:
Indicates whether the value of the given key should be encrypted
假设有效的JSON有效负载,创建示例的curl请求:
```bash
curl "https://play.dhis2.org/demo/api/33/dataStore/foo/key_1" -X POST
-H "Content-Type: application/json" -d "{\"foo\":\"bar\"}" -u admin:district
curl "https://play.dhis2.org/demo/api/33/dataStore/foo/key_1" -X PUT -d "[1, 2, 3]"
-H "Content-Type: application/json" -u admin:district
curl "play.dhis2.org/demo/api/33/dataStore/foo/key_1" -X DELETE -u admin:district
{
"httpStatus": "OK",
"httpStatusCode": 200,
"status": "OK",
"message": "Key 'key_1' deleted from namespace 'foo'."
}
curl "play.dhis2.org/demo/api/33/dataStore/foo" -X DELETE -u admin:district
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
curl -H "Content-Type: application/json" -u admin:district "play.dhis2.org/api/33/userDataStore"
[
"foo",
"bar"
]
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
[
"key_1",
"key_2"
]
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
{
"some": "value"
}
curl -X POST -H "Content-Type: application/json" -u admin:district -d "['some value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
{
"httpStatus": "Created",
"httpStatusCode": 201,
"status": "OK",
"message": "Key 'bar' in namespace 'foo' created."
}
curl -X PUT -H "Content-Type: application/json" -u admin:district -d "['new value']"
"play.dhis2.org/api/33/userDataStore/foo/bar"
{
"httpStatus":"Created",
"httpStatusCode":201,
"status":"OK",
"message":"Key 'bar' in namespace 'foo' updated."
}
curl -X DELETE -u admin:district "play.dhis2.org/api/33/userDataStore/foo/bar"
{
"httpStatus":"OK",
"httpStatusCode":200,
"status":"OK",
"message":"Key 'bar' deleted from the namespace 'foo."
}
curl -X DELETE -u admin:district "play.dhis2.org/api/33/userDataStore/foo"
{
"httpStatus":"OK",
"httpStatusCode":200,
"status":"OK",
"message":"All keys from namespace 'foo' deleted."
}
{
"name": "wisker",
"favFood": [
"fish", "rabbit"
]
}
"whiskers"
{
"name": "wisker",
"favFood": [
"carrot",
"rabbit"
]
}
- Now we can use the `roll` request param (with the `path` functionality) to state that we want the rolling functionality for _n_ number of elements.
In this example we state that we want the array to have a rolling value of 3, passing in an extra element in the call.
`PUT` `/api/{store}/pets/whiskers?roll=3&path=favFood` with body `"carrot"` would result in the following state.
- ```json
{
"name": "wisker",
"favFood": [
"fish",
"rabbit",
"carrot"
]
}
{
"name": "wisker",
"favFood": [
"fish", "rabbit"
],
"type": {
"breed": ["shorthair"]
}
}
{
"name": "wisker",
"favFood": [
"fish", "rabbit"
],
"type": {
"breed": ["shorthair, small"]
}
}
POST /api/organisationUnitProfile
{
"attributes": [
"xqWyz9jNCA5",
"n2xYlNbsfko"
],
"groupSets": [
"Bpx0589u8y0",
"J5jldMd8OHv"
],
"dataItems": [
"WUg3MYWQ7pt",
"vg6pdjObxsm",
"DTVRnCGamkV",
"Uvn6LCg7dVU",
"eTDtyyaSA7f"
]
}
GET /api/organisationUnitProfile
GET /api/organisationUnitProfile/{org-unit-id}/data?period={iso-period}
GET /api/organisationUnitProfile/DiszpKrYNg8/data?period=2021
{
"info": {
"id": "DiszpKrYNg8",
"code": "OU_559",
"name": "Ngelehun CHC",
"shortName": "Ngelehun CHC",
"parentName": "Badjia",
"level": 4,
"levelName": "Facility",
"openingDate": "1970-01-01T00:00:00.000",
"longitude": -11.4197,
"latitude": 8.1039
},
"attributes": [
{
"id": "n2xYlNbsfko",
"label": "NGO ID",
"value": "GHE51"
},
{
"id": "xqWyz9jNCA5",
"label": "TZ code",
"value": "NGE54"
}
],
"groupSets": [
{
"id": "Bpx0589u8y0",
"label": "Facility Ownership",
"value": "Public facilities"
},
{
"id": "J5jldMd8OHv",
"label": "Facility Type",
"value": "CHC"
}
],
"dataItems": [
{
"id": "WUg3MYWQ7pt",
"label": "Total Population",
"value": 3503
},
{
"id": "DTVRnCGamkV",
"label": "Total population < 1 year",
"value": 140
},
{
"id": "vg6pdjObxsm",
"label": "Population of women of child bearing age (WRA)",
"value": 716
},
{
"id": "Uvn6LCg7dVU",
"label": "ANC 1 Coverage",
"value": 368.2
},
{
"id": "eTDtyyaSA7f",
"label": "FIC <1y",
"value": 291.4
}
]
}
POST /api/fileResources?domain=ORG_UNIT
PATCH /api/organisationUnits/{id}
{
"image": "{file-resource-id}"
}
PUT /api/organisationUnits/{id}
{
"id": "Rp268JB6Ne4",
"name": "Adonkia CHP",
"image": {
"id": "{file-resource-iid}"
}
}
```json
{
"id": "Rp268JB6Ne4",
"name": "Adonkia CHP",
"image": {
"id": "{file-resource-id}"
}
}
`Content-Type`(内容类型)标头将反映正在检索的文件类型。
应用 { #apps }
### 应用 { #webapi_apps }
`/api/apps` 端点可用于安装、删除和
列出应用项目。应用项目密钥基于应用项目名称,但与所有
删除了非字母数字字符,并用破折号替换了空格。
*My app!* 将返回密钥 *My-app*。
> **注意**
>
> 在 2.28 之前,应用密钥是从 ZIP 的名称派生的
> 存档,不包括文件扩展名。使用旧格式的 URL
> 仍应在 api 中返回正确的应用项目。
### / api / 33 / apps
获取应用 { #webapi_get_apps }
> **注意**
>
> 2.28之前的app属性folderName指的是实际
> 已安装应用项目的路径。能够在云上存储应用项目
> 服务,folderName 的用途已更改,现在将引用应用项目
> 键。
## 您可以通过列出应用项目中的所有应用项目来读取应用项目的密钥
资源并查找 *key* 属性。列出所有已安装的应用项目
JSON:
```bash
curl -u user:pass -H "Accept: application/json" "http://server.com/api/33/apps"
curl -X POST -u user:pass -F file=@app.zip "http://server.com/api/33/apps"
curl -X DELETE -u user:pass "http://server.com/api/33/apps/<app-key>"
curl -X PUT -u user:pass "http://server.com/api/33/apps"