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

跟踪器{ #webapi_tracker }

要自定义 DHIS2 应用项目的 UI,您可以插入自定义 JavaScript 和 CSS 样式通过 files 资源。

```

POST删除后/ api / 33 / files / script POST GET DELETE / api / 33 / files / style

Tracker 由几种不同类型的对象组成,这些对象嵌套在一起以表示数据。
在本节中,我们将展示和描述 Tracker API 中使用的每个对象。

### 跟踪实体{ #tracked-entities } 

`跟踪实体`是跟踪器模型的根对象。

| 财产 | 描述 | 需要 | 不可变的 | 类型 | 例 |
|---|---|---|---|---|---|
| 跟踪实体 | 被跟踪实体的标识符。如果未提供则生成 | 不 | 是的 | String:Uid | ABCDEF12345 |
| trackedEntityType | 跟踪实体的类型。 | 是的 | 是的 | String:Uid | ABCDEF12345 |
| createdAt | 用户创建跟踪实体时的时间戳。在服务器上设置。 | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| createdAtClient | 用户在客户端上创建跟踪实体时的时间戳。 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | 对象或任何注册、事件、属性或[起源关系](#relationship_model)最后一次更新的时间戳。在服务器上设置。 | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAtClient | 对象上次在客户端更新的时间戳。 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| orgUnit | 用户创建跟踪实体的组织部门。 | 是的 | 是的 | String:Uid | ABCDEF12345 |
| inactive | 指示被跟踪实体是否处于非活动状态。 | 不 | 是的 | Boolean | 默认值:false,true |
| deleted | 指示跟踪的实体是否已被删除。只有删除时才能改变。 | 不 | 不 | Boolean | 假,直至删除 |
| 潜在重复 | 表示跟踪的实体是否可能重复。 | 不 | 不 | Boolean | 默认值:false |
| geometry | 被跟踪实体的地理表示。基于 TrackedEntityType 的 "featureType"。 | 不 | 是的 | GeoJson | {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} |
|     GET /api/metadata/proposals/ | createdAt | 不 | 是的 | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](sharing.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | 用户 | {<br>"uid": "ABCDEF12345",<br>"用户名": "用户名",<br>“名字”:“约翰”,<br>“姓氏”:“Doe”<br>} |
| {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} | storedBy | 不 | 是的 | 是的 | String:Uid |
| Duration | createdBy | 不 | 是的 | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | 不 | 是的 | 不 | String:Uid |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | 属性 | 不 | 是的 | 是的 | List of TrackedEntityAttributeValue |

See Attribute

### 注册{ #enrollments } 

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 | String:Uid | ABCDEF12345 |
| 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"
    ]
}
``` | String:Uid | ABCDEF12345 |
| 用户友好型消息,说明操作是否成功。 | 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"
    ]
}
``` | 不 | 价值 | 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 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| String:Uid | orgUnit | 不 | ```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 |
| DateTime | createdAt | 不 | Program notification template | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 例 | 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"
    ]
}
``` | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| To retrieve an event with a specific ID: | updatedAt | Program notification template | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| WKT, can be omitted it in case of a `Point` type and with `latitude` and `longitude` provided | updatedAtClient | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 日期时间 | enrolledAt | 不 | Program notification template | 是的 | Boolean |
| Table: Program Stage Query Criteria | occurredAt | 不 | 不 | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| ID | completedAt | 不 | ```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 | 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 | 是的 | String:any |
|     GET /api/metadata/proposals/ | createdAt | 不 | ```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](sharing.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | 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"
    ]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](sharing.md#webapi_sharing)). | String:Any |
| {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} | storedBy | 不 | Program notification template | 是的 | String:Uid |
| 用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。 | createdBy | 不 | Program notification template | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | 不 | 不 | 不 | String:Uid |
| ABCDEF12345 | 属性 | 不 | ```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 | 注册的属性选项下拉列表。如果未提供,则使用由程序类别下拉列表定义的默认值。 | 不 | 不 | 价值 | 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"
    ]
}
``` | String:Uid | ABCDEF12345 |
| `{ "periodFrom": -15, "periodTo": 15}` | 仅用于读取数据。拥有该事件的注册项目类型。 | 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 |
| storeCopy | 项目阶段 | Program notification template | Program notification template | String:Uid | ABCDEF12345 |
| 用户友好型消息,说明操作是否成功。 | enrollment | 不 | 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"
    ]
}
``` | 不 | 价值 | 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 | 不 | ```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 |
| DateTime | createdAt | 不 | Program notification template | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 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 | 不 | ```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 |
| 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"
    ]
}
``` | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| WKT, can be omitted it in case of a `Point` type and with `latitude` and `longitude` provided | updatedAtClient | Program notification template | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 日期时间 | scheduledAt | Program notification template | Program notification template | 是的 | Boolean |
| Table: Program Stage Query Criteria | occurredAt | 不 | Program notification template | *userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 | Date:ISO 8601 |
| ID | completedAt | 不 | ```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 | 是的 | String:any |
|     GET /api/metadata/proposals/ | createdAt | 不 | ```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](sharing.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | 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"
    ]
}
``` | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](sharing.md#webapi_sharing)). | String:Any |
| > **注**
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | 该事件的属性选项下拉列表。如果未提供,则使用由程序类别下拉列表定义的默认值。 | 不 | Program notification template | 价值 | The value of the tracked entity attribute.
| boolean | 该事件的属性类别选项。如果未提供,则使用程序类别下拉菜单中定义的默认值 | 不 | Program notification template | 价值 | The value of the tracked entity attribute.
| 布尔 | updatedBy | 不 | Program notification template | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](sharing.md#webapi_sharing)). | String:Any |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | attributeOptionCombo | 不 | 不 | 是的 | String:Uid |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | attributeCategoryOptions | 不 | 不 | 不 | String:Uid |
| ABCDEF12345 | assignedUser | 不 | ```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"
    ]
}
``` | 不 | 用户 |

### 人际关系 { #relationships } 

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 | 是的 | 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 | 不 | ```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 | *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"
    ]
}
``` | 是的 | 是的 | Date:ISO 8601 |

YYYY-MM-DDThh:mm:ss

### 属性 { #attributes } 

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 | 码 | 不 | ```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 | 类型 |
| 日期时间 | 用于标识谁存储/创建了该值的客户端引用。在服务器端设置 | 不 | ```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 |
| 名称 | createdAt | 不 | Program notification template | DateTime | Date:ISO 8601 |
| 日期时间 | updatedAt | 不 | 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 | 类型 |
|     GET /api/metadata/proposals/ | createdAt | 不 | ```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](sharing.md#webapi_sharing)). | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | Sharing of data store keys follows the same principle as for other metadata sharing (see
[Sharing](sharing.md#webapi_sharing)). | String:Any |

YYYY-MM-DDThh:mm:ss

### 笔记 { #notes } 

在需要记录有关特定问题的补充信息或备注的情况下,
可通过“备注”功能进行记录。

不

不

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 | 类型 |
|     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](sharing.md#webapi_sharing)). | String:Any |

### 用户数 { #users } 

| 指标组 | 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 | 不 | ```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

## 身份识别方案{ #id-schemes } 

用户名

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](tracker.md#webapi_tracker_export_tracked_entities)

### [event export](tracker.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](tracker.md#webapi_tracker_objects) | DateTime | 跟踪器导入项目支持以下参数: | Parameter name |
| 描述 | 类型 | DateTime | Enum | Narrows response to tracked entities matching given filters. More on filters [here](tracker.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 |

#### 同步与异步{ #sync-and-async } 

对用户而言,同步导入与异步导入的主要区别在于
API 响应的时机。同步导入会在导入完成后立即提供 [导入摘要](tracker.md#webapi_tracker_import_summary)
。 相比之下,异步导入会立即返回一个指向导入任务的
引用。可通过该 `response.location` 跟踪导入任务的进度。下文给出了一个
异步导入响应的示例。

`FULL`, `FAIL_FAST`, `SKIP`

`FULL`

### 有效载荷{ #payload } 

If true, it will skip validating the pattern of generated attributes.

#### 扁平化有效载荷{ #flat-payload } 

`true`, `false`

```json
{
  "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",
      "attributeOptionCombo": "HllvX50cXC0",
    }
  ],
  "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",
      "组织单位": "y77LiPqLMoq",
      "项目": "IpHINAT79UW",
      "项目阶段": "ZzYYXq4fJie",
      "计划时间": "2019-08-19T13:59:13.688",
      "status": "ACTIVE",
      "trackedEntity": "Kj6vYde4LHh"
    }
  ],
  "relationships": [
    {
      "from": {
        "trackedEntity": {
          "trackedEntity": "Kj6vYde4LHh"
        }
      },
      "relationshipType": "dDrh5UyCyvQ",
      "to": {
        "trackedEntity": {
          "trackedEntity": "Gjaiu3ea38E"
        }
      }
    }
  ]
}

嵌套有效载荷{ #nested-payload }

If true, it will skip running any side effects for the import

注意

尽管嵌套式有效载荷可能更便于客户端管理,但在导入前,有效载荷始终会被展平。 对于大规模导入,使用扁平化结构的有效载荷能提供更强的控制力, 并减少导入过程中的开销。但是,您无法在关系中嵌套新的受追踪实体、 注册信息或事件。

true, false

创建{ #create }

skipRuleEngine

更新{ #update }

Boolean

有效载荷必须包含您要更新的对象的所有字段,即使这些字段未被 修改。 唯一的例外是集合。集合中不应更改的项目可以 省略,如 更新属性值更新数据 值 所示。

注意

已删除的跟踪器对象和关系无法进行更新。

更新属性值{ #update-attribute-values }

The main difference for the user between synchronous and asynchronous imports is the timing of the API response. Synchronous imports provide an immediate import summary once the import is finished. In contrast, asynchronous imports return a reference to the import job right away. The progress of the import job can be tracked using this response.location. An example of an asynchronous import response is found below.

{
  "httpStatus": "OK",
  "httpStatusCode": 200,
  "status": "OK",
  "message": "Tracker job added",
  "response": {
    "id": "cHh2OCTJvRw",
    "location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
  }
}

For large imports, opting for asynchronous import can be advantageous, as it prevents long waiting times for a response.

Payload

删除属性值{ #delete-attribute-values }

Flat payload

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

更新数据值{ #update-data-values }

Nested payloads are the most commonly used structure, where tracker objects are embedded within their parent objects, such as an enrollment within a tracked entity. The advantage of this structure is that the client does not need to provide UIDs for these references, as this is handled automatically.

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

删除数据值{ #delete-data-values }

Make a POST request to /api/tracker with the importStrategy set to CREATE or CREATE_AND_UPDATE and a payload as described here.

{
  "httpStatus": "OK",
  "httpStatusCode": 200,
  "status": "OK",
  "message": "Tracker job added",
  "response": {
    "id": "cHh2OCTJvRw",
    "location": "https://play.im.dhis2.org/dev/api/tracker/jobs/cHh2OCTJvRw"
  }
}

Make a POST request to /api/tracker with the importStrategy set to UPDATE or CREATE_AND_UPDATE and a payload as described here.

删除{ #delete }

Note

Deleted tracker objects and rselationships cannot be updated.

Update attribute values

Note that it is not necessary to specify the tracked entity's enrollments. However, you must specify the non-collection fields of the tracked entity, even if you are not changing them.

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

Note that it is not necessary to specify the tracked entity's enrollments. However, you must specify the non-collection fields of the tracked entity, even if you are not changing them.

Delete attribute values

The following deletes one of the attribute values of a tracked entity:

CSV导入{ #csv-import }

{
  "trackedEntities": [
    {
      "trackedEntity": "PQfMcpmXeFE",
      "trackedEntityType": "nEenWmSyUEp",
      "orgUnit": "DiszpKrYNg8",
      "attributes": [
        {
          "attribute": "w75KJ2mc4zz",
          "value": null
        }
      ]
    }
  ]
}

大事记

The following updates one of the data values of an event:

CSV 有效载荷示例{ #csv-payload-example }
{
  "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"
    }
  ]
}
事件,状态,项目,项目阶段,报名情况,组织单位,发生时间,计划时间,几何信息,纬度,经度,后续处理,已删除,创建时间,客户端创建时间,更新时间,客户端更新时间,完成人,完成时间,更新人,属性选项组合,属性类别选项,指派用户,数据元素,值,在其他地方提供,由数据值存储,由数据值更新,由数据值创建
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]",false,,2016-12-06T17:22:34.438Z,2016-12-06T17:22:34.438Z

The following deletes one of the data values of an event:

```

POST /api/tracker?async=false

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

删除

Make a POST to /api/tracker with importStrategy set to DELETE. The payload should include only the UIDs of the trackedEntities, enrollments, events or relationships you wish to delete.

The following deletes the events created with this payload:

允许值 Parameter name 描述
storedByDataValue ```json
{
"trackedEntities": [
{
"trackedEntity": "Kj6vYde4LHh",
},
{
"trackedEntity": "Gjaiu3ea38E",
}
]
}
``` All the children of a tracker object will be deleted if the user making the request has the
authorities F_TEI_CASCADE_DELETE and F_ENROLLMENT_CASCADE_DELETE.
Relationships linked to an entity are always deleted, without the need of any authority.

请求示例{ #request-example }

To import events using CSV make a POST request with CSV body file and the Content-Type set to application/csv or text/csv.

响应示例{ #response-example }

Every row of the CSV payload represents an event and a data value. So, for events with multiple data values, the CSV file will have x rows per event, where x is the number of data values in that event.

CSV payload example

Your CSV file can look like:

允许值 Parameter name 描述
fields >
>
> 这些端点依赖于应用项目内存中存储的信息。这意味着信息
> 在某些情况下,如应用项目重启或大量
> 导入请求。 The value of the tracked entity attribute.
```
GET /tracker/jobs/{uid}
``` Parameter Enrollments

请求示例{ #request-example }

uid

响应示例{ #response-example }

eAjkbUGBcZ5

Request example

导入摘要响应{ #import-summary-response }

Response example

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

状态{ #status }

GET /tracker/jobs/{uid}/report

Parameter

描述

验证报告{ #validation-report }

path /{uid}

ID of an existing tracker import job.

ABCDEF12345

该报告包含一条消息和一个描述实际错误的代码(有关错误的更多信息,请参阅错误代码 部分)。此外,报告还包含 trackerTypeuid,用于描述错误在数据中的具体位置。在此情况下,存在一个 TRACKED_ENTITY,其 uid 为 Kj6vYde4LHh,该实体引用了一个被追踪的实体类型,但该类型 未被找到。

Level of detail for the report.

统计数据{ #statistics }

Request example

Indicates whether the value of the given key should be encrypted

Response example

The response payload is the same as the one returned after a sync import request.

Note

Both endpoints are used primarily for async import; however, GET /tracker/jobs/{uid} would also work for sync requests as it eventually uses the same import process and logging as async requests.

Import summary response

Import summaries have the following overall structure, depending on the requested reportMode:

报告合集{ #bundle-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。这些 objectReports 将提供有关每个导入对象的详细信息,例如其类型、uid,以及 (如有)任何错误或警告报告。

消息{ #message }

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.

导入摘要报告级别{ #import-summary-report-level }

可以通过在 GET /tracker/jobs/{uid}/report 请求中使用特定的 reportMode 参数来获取导入摘要报告。默认情况下,该端点将返回一个 importSummary,其中 reportMode 的值为 ERROR

| 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} 等)通常表示用户 ID(uid),除非 另有说明。

When the import is completed, the bundleReport contains all the 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. 用户:{0} 无权访问组织单元:{1}
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
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. 仅允许使用“Program”属性进行注册;无效属性:{0} 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 属性为 null 或日期格式无效。
事件发生日期不能是未来日期,除非项目在配置中允许这样做。 事件:{0} 不存在。
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.
E1097 用户:{0},对 ProgramStage:{1} 没有数据读取权限。 根据 ProgramStage 的共享配置,用户对此 ProgramStage 没有读取权限。
E1098 用户:{0},无权读取分类选项:{1} 根据 CategoryOption 的共享配置,用户对此 CategoryOption 没有读取权限。
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}.
E1105 用户:{0},无权访问组织单位:{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 的共享配置规定,用户没有数据读取权限。 ID 为 {0} 的笔记已存在。
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 不允许更新“被跟踪实体”属性:{0}
E1118 不允许更新“Enrollment”属性:{0}
E1119 不允许更新事件属性:{0}
E1129 未找到与 CategoryCombo {0} 对应的 CategoryOptionCombo。
E1130 属性选项下拉列表 {0} 不在项目注册类别下拉列表 {1} 中。
E1131 用户:{0} 无权读取 TrackedEntityType:{1} 的数据。
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} 某条注册记录的{0} 事件未引用任何TrackedEntity。您的系统中的数据可能已损坏 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}
E1318 状态 {0} 不适用于单个事件。 事件有效载荷中使用的状态对于单个事件而言无效。
E1320 由程序规则({0})生成——事件({1})已自动安排在 {2}
E1321 由程序规则({0})生成——用户({1})对 ProgramStage {2} 没有写入权限,而该 ProgramStage 中有一个事件是通过 SCHEDULEEVENT 规则操作自动安排的。
E1322 由程序规则({0})生成——程序阶段({1})和注册({2})的事件已存在。
E1323 用户:{0} 无权对任何程序进行写入操作。
E1324 用户 {0} 对所提供的 TrackedEntity:{1} 没有所有者访问权限。
E1325 用户:{0} 无权读取任何程序。
E1307 由项目规则生成 ({0}) - 无法为数据元素 {1} 赋值。提供的值必须为空或与计算值 {2} 匹配。
E1308 关系 {1} 中的关系项 {0} 无效:一个项只能关联一个 Tracker 实体、注册或活动。
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} 关系:{0},不存在。
No event can transition from status {0} to status {1}. E1317
由项目规则 ({0}) 生成 - 属性 {1} 是强制性的,不能删除。 E4000
E4019 用户:{0} 无权读取 RelationshipType:{1} 的数据。
Relationship: {0} cannot link to itself 用户:{0} 无权向关系类型:{1} 写入数据。
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

必需属性{ #required-properties }

E4015

Relationship: {0}, already exists.

  1. E4016
  2. Relationship: {0}, do not exist.
  3. E4017

Relationship: {0}, is already deleted and cannot be modified.

格式:{ #formats }

Relationship: {0}, linking {1}: {2} to {3}: {4} already exists.

  • E4020
  • User: {0}, has no write access to relationship: {1}.
  • E5000

用户访问{ #user-access }

导入项目无法持久化跟踪器对象,因为引用无法持久化。

E9999

不适用

Undefined error message.

属性与数据值{ #attributes-and-data-values }

使用跟踪器导入项目导入数据时,会执行一系列验证,以确保数据的有效性。 数据的有效性。本节将介绍执行的一些不同类型的验证 以便更好地了解导入验证是否失败。

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.

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 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)

必填值:{ #required-values }

All data imported will be validated based on the metadata (sharing) and the organisation units (scopes) 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.

GET /api/trackedEntityAttributes/Gs1ICEQTPlG/requiredValues

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.

GET /api/trackedEntityAttributes/Gs1ICEQTPlG/generate?ORG_UNIT_CODE=OSLO

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)

GET /api/trackedEntityAttributes/Gs1ICEQTPlG/generateAndReserve?numberToReserve=3&ORG_UNIT_CODE=OSLO

Allow future dates

保留值

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.
GET /api/33/trackedEntityAttributes/Gs1ICEQTPlG/generateAndReserve?numberToReserve=3&ORG_UNIT_CODE=OSLO

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

Reserved values

目前无法通过 api 访问保留值,但是,它们
由`generate` 和`generateAndReserve` 端点返回。这
下表解释了保留值对象的属性:

| Table: Reserved values | Property |
| --- | --- |
| 设置必填字段 | |
| 淋浴器 | |
| 日程消息 | |
| 名称 | |
| 始终有效 | DISPLAYKEYVALUEPAIR |
| 显示选项组 | DISPLAYKEYVALUEPAIR |
| 隐藏选项组 | DISPLAYKEYVALUEPAIR |
| The timestamp when the reservation was made | DISPLAYKEYVALUEPAIR |
| The timestamp when the reservation will no longer be reserved | DISPLAYKEYVALUEPAIR |
| Program rules { #webapi_tracker_program_rules }| |
| 隐藏选项 | DISPLAYKEYVALUEPAIR |
| 参见说明 | DISPLAYKEYVALUEPAIR |
| 2.37 中为 ProgramRuleAction 模型添加了一些验证。主要目的是防止用户创建错误的项目规则,以保持数据库的一致性。这些验证取决于项目规则动作类型。每种操作类型都有各自的验证。  | DISPLAYKEYVALUEPAIR |

HIDEFIELD

* HIDESECTION
* ASSIGN

X

* 程序规则操作可能导致两种不同的结果:警告或错误。
* X
    * SHOWERROR
    * X
    * WARNINGONCOMPLETION
    * X
    * ERRORONCOMPLETION
    * X

CREATEEVENT

SETMANDATORYFIELD

### X

SENDMESSAGE

X

SCHEDULEMESSAGE

| X | Property | Parameter name |
|--- | --- | --- |
| 项目规则条件必须为真。 | DISPLAYKEYVALUEPAIR | 项目规则操作可能会导致两种不同的结果:警告或错误。 |
| Errors will make the validation fail, while the warnings will be reported as a message in the import summary. | DISPLAYKEYVALUEPAIR | `SHOWERROR`, `ERRORONCOMPLETION`, and `SETMANDATORYFIELD` actions can generate only errors. |

`ASSIGN` action can generate both Warnings and Errors.

### When the action is assigning a value to an empty attribute/data element, a warning is generated.

When the action is assigning a value to an attribute/data element that already has the same value to be assigned, a warning is generated.

When the action is assigning a value to an attribute/data element that already has a value and the value to be assigned is different, an error is generated unless the `RULE_ENGINE_ASSIGN_OVERWRITE` system setting is true.

此外,项目规则也会产生副作用,如发送和计划信息。更多
有关副作用的更多信息,请参阅下一节。

> **注**
>
> 在导入过程中,可以使用 `skipProgramRules` 参数跳过项目规则。

Side effects { #webapi_tracker_side_effects }

After an import has been completed, specific tasks might be triggered as a result of the import.
These tasks are what we refer to as "Side effects". These tasks perform operations that do not
affect the import itself.

## Side effects are tasks running detached from the import but are always triggered by an import. Since
side effects are detached from the import, they can fail even when the import is successful.
Additionally, side effects are only run when the import is successful, so they cannot fail the other
way around.

The following side effects are currently supported:

- Side Effects
- 支持的
- 类型
- `GET /api/tracker/events/{uid}/changeLogs`

X

### 常见请求参数{ #common-request-parameters } 

ProgramRule Notification

- X
- 项目规则可触发通知。请注意,这些通知是通过 DHIS2 规则引擎生成的项目规则效果的一部分。
- > **Note**
>
> Certain configurations can control the execution of side effects. `skipSideEffects` flag can be set during the import to skip side effects entirely. This parameter can be useful if you import something you don't want to trigger notifications for, as an example.
- Assign user to events { #webapi_tracker_user_event_assignment }

#### 类型

|允许值|Potential duplicate status|`order`|Parameter name|
|---|---|---|---|
|定义要返回的页码。|Enrollments|`paging`|追踪实体|
|定义每页返回的元素数量。|Enrollments|`paging`|`Boolean`|
|Common request parameters|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。|跟踪器或事件项目的标识符。该参数为必填参数。|Events: `GET /api/tracker/events`|
|true|*userDataStore* 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。|跟踪器或事件项目的标识符。该参数为必填参数。|Request parameter|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|具有以下要求:||描述|

page

#### 组织单位选择模式{ #organisation-unit-selection-modes } 

Any positive integer

#### Page number to return. Defaults to 1.

pageSize

##### ```
/api/dataElements.csv?fields=id,displayName,dataElementGroups
Any positive integer Parameter name
totalPages Boolean
true, false Indicates whether to return the total number of elements and pages. Defaults to false as getting the totals is an expensive operation.
paging Boolean
true, false Indicates whether paging should be ignored and all rows should be returned. Defaults to true, meaning that by default all requests are paginated, unless paging=false.
order

Comma-separated list of field and sort direction pairs in format field:sortDirection. Example: createdAt:desc

Entities are ordered by newest (internal ID descending) by default. Note: field is case sensitive. Valid sortDirections are asc and desc, where sortDirection is case insensitive, and sortDirection defaults to asc for fields or UIDs without explicit sortDirection.

Note

Be aware that performance is directly related to the amount of data requested. Greater page sizes will take more time to return.

Organisation unit selection modes

  • The available organisation unit selection modes are SELECTED, CHILDREN, DESCENDANTS, ACCESSIBLE, CAPTURE and ALL. Each mode is explained in detail in this section.
  • Field filter responses { #webapi_tracker_field_filter }
  • All export 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 or patterns. A few possible fields filters are shown below. Refer to Metadata field filter for a more complete guide on how to use fields.
  • 例子

Query parameter example

CSV{ #csv }

  • Returns all fields
  • fields=createdAt,uid
  • Returns fields createdAt and uid
  • fields=enrollments[*,!uid]
  • Returns all fields of enrollments except uid
  • fields=enrollments[uid]
  • Returns enrollments field uid
  • fields=enrollments[uid,enrolledAt]
  • Returns enrollments fields uid and enrolledAt
  • Tracked entities { #webapi_tracker_export_tracked_entities }
  • ``` GET /api/tracker/trackedEntities
        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)
      - createdAt (Datetime)
      - createdAtClient (Datetime)
    
    updatedAt (Datetime)
    
    #### GZIP{ #gzip } 
    
    orgUnit (identifier in requested idScheme)
    
    #### ZIP{ #zip } 
    
    deleted (boolean)
    
    #### 受监控实体集合{ #tracked-entity-collections } 
    
    > **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](tracker.md#tracked-entities) and [Attributes](tracker.md#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](tracker.md#webapi_tracker_objects_events) and [Data Values](tracker.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](tracker.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](tracker.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.
    
    ##### 请求示例{ #example-requests } 
    
    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...
    
    ##### 被追踪实体的响应{ #tracked-entities-response } 
    
    Operator
    
    ##### JSON{ #json } 
    
    null
    
    has no value
    
    !null
    
    ##### CSV{ #csv } 
    
    Tracked entity attribute filtering { #tracked_entity_attribute_filtering }
    
    trackedEntity,trackedEntityType,createdAt,createdAtClient,updatedAt,updatedAtClient,orgUnit,inactive,deleted,potentialDuplicate,geometry,纬度,经度,创建者,更新者,属性创建时间,属性更新时间,属性,显示名称,值,值类型 F8yKM85NbxW,Zy2SEgA61ys,2019-08-21T11:25:38.022Z,2019-03-19T00:12:16.624Z,2019-08-21T11:31:33.410Z,2019-03-19T00:12:16.624Z,DiszpKrYNg8,false,false,false,"POINT (-11.7896 8.2593)",8.2593,-11.7896,,,2019-08-21T11:25:38.477Z,2019-08-21T11:25:38.477Z,B6TnnFMgmCk,"年龄(年)",30,INTEGER_ZERO_OR_POSITIVE F8yKM85NbxW,Zy2SEgA61ys,2019-08-21T11:25:38.022Z,2019-03-19T00:12:16.624Z,2019-08-21T11:31:33.410Z,2019-03-19T00:12:16.624Z,DiszpKrYNg8,false,false,false,"POINT (-11.7896 8.2593)",8.2593,-11.7896,,,2019-08-21T11:25:38.066Z,2019-08-21T11:25:38.067Z,TfdH5KvFmMy,"名字",Sarah,TEXT F8yKM85NbxW,Zy2SEgA61ys,2019-08-21T11:25:38.022Z,2019-03-19T00:12:16.624Z,2019-08-21T11:31:33.410Z,2019-03-19T00:12:16.624Z,DiszpKrYNg8,false,false,false,"POINT (-11.7896 8.2593)",8.2593,-11.7896,,,2019-08-21T11:25:38.388Z,2019-08-21T11:25:38.388Z,aW66s2QSosT,"姓氏",Johnson,TEXT
    ##### 受监控实体的收集限制{ #tracked-entities-collection-limits } 
    
    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:
    
    GET /api/tracker/trackedEntities?program=IpHINAT79UW&orgUnits=DiszpKrYNg8&filter=w75KJ2mc4zz:EQ:John
    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](tracker.md#webapi_tracker_field_filter) for more information.
    
    - A JSON response looks like the following:
    
    #### 受监控实体的单对象端点{ #tracked-entities-single-object-endpoint } 
    
    CSV
    
    A CSV response looks like the following:
    
    ##### 请求语法 { #request-syntax } 
    
    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
        }
      ]
    }
    ``` |
    
    ##### 请求示例{ #example-requests } 
    
    Request syntax
    
    GET /api/tracker/trackedEntities/{uid}?program={programUid}&fields={fields}
    ##### 受追踪实体的响应{ #tracked-entity-response } 
    
    类型
    
    ###### JSON{ #json } 
    
    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,
      "attributes": [
        {
          "attribute": "w75KJ2mc4zz",
          "code": "MMD_PER_NAM",
          "displayName": "名字",
          "createdAt": "2016-08-03T23:49:43.308",
          "updatedAt": "2016-08-03T23:49:43.308",
          "valueType": "TEXT",
          "value": "John"
        },
        {
          "attribute": "zDhUuAYrxNC",
          "displayName": "姓氏",
          "createdAt": "2016-08-03T23:49:43.309",
          "updatedAt": "2016-08-03T23:49:43.309",
          "valueType": "TEXT",
          "value": "Kelly"
        }
      ],
      "enrollments": [
        {
          "enrollment": "JMgRZyeLWOo",
          "createdAt": "2017-03-06T05:49:28.340",
          "createdAtClient": "2016-03-06T05:49:28.340",
          "updatedAt": "2017-03-06T05:49:28.357",
          "trackedEntity": "PQfMcpmXeFE",
          "program": "IpHINAT79UW",
          "status": "ACTIVE",
          "orgUnit": "DiszpKrYNg8",
          "enrolledAt": "2024-03-06T00:00:00.000",
          "occurredAt": "2024-03-04T00:00:00.000",
          "attributeOptionCombo": "HllvX50cXC0",
          "followUp": false,
          "deleted": false,
          "events": [
            {
              "event": "Zq2dg6pTNoj",
              "status": "ACTIVE",
              "program": "IpHINAT79UW",
              "programStage": "ZzYYXq4fJie",
              "enrollment": "JMgRZyeLWOo",
              "trackedEntity": "PQfMcpmXeFE",
              "relationships": [],
              "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": [],
              "notes": []
            }
          ],
          "relationships": [],
          "attributes": [
            {
              "attribute": "w75KJ2mc4zz",
              "code": "MMD_PER_NAM",
              "displayName": "名字",
              "createdAt": "2016-08-03T23:49:43.308",
              "updatedAt": "2016-08-03T23:49:43.308",
              "valueType": "TEXT",
              "value": "John"
            },
            {
              "attribute": "zDhUuAYrxNC",
              "displayName": "姓氏",
              "createdAt": "2016-08-03T23:49:43.309",
              "updatedAt": "2016-08-03T23:49:43.309",
              "valueType": "TEXT",
              "value": "Kelly"
            },
            {
              "attribute": "AuPLng5hLbE",
              "code": "国家识别码",
              "displayName": "国家识别码",
              "createdAt": "2016-08-03T23:49:43.301",
              "updatedAt": "2016-08-03T23:49:43.301",
              "valueType": "TEXT",
              "value": "245435245"
            },
            {
              "attribute": "ruQQnf6rswq",
              "displayName": "TB 编号",
              "createdAt": "2016-08-03T23:49:43.308",
              "updatedAt": "2016-08-03T23:49:43.308",
              "valueType": "TEXT",
              "value": "1Z 1F2 A84 59 4464 173 6"
            },
            {
              "attribute": "cejWyOfXge6",
              "displayName": "性别",
              "createdAt": "2016-08-03T23:49:43.307",
              "updatedAt": "2016-08-03T23:49:43.307",
              "valueType": "TEXT",
              "value": "男性"
            },
            {
              "attribute": "VqEFza8wbwA",
              "code": "MMD_PER_ADR1",
              "displayName": "地址",
              "createdAt": "2016-08-03T23:49:43.307",
              "updatedAt": "2016-08-03T23:49:43.307",
              "valueType": "TEXT",
              "value": "主街 2 号"
            }
          ],
          "notes": []
        }
      ],
      "programOwners": [
        {
          "orgUnit": "DiszpKrYNg8",
          "trackedEntity": "PQfMcpmXeFE",
          "program": "ur1Edk5Oe2n"
        },
        {
          "orgUnit": "DiszpKrYNg8",
          "trackedEntity": "PQfMcpmXeFE",
          "program": "IpHINAT79UW"
        }
      ]
    }
    
CSV{ #csv }

uid

Return the tracked entity with specified uid

项目

允许值 Potential duplicate status order
fields 具有以下要求: Include specified sub-objects in the response
{ "periodFrom": -15, "periodTo": 15} JSON格式 ```
GET /api/tracker/trackedEntities/PQfMcpmXeFE
```
iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 JSON格式 JSON格式
数据值 具有以下要求: CSV
受监控实体的属性值变更日志{ #tracked-entity-attribute-value-change-logs }

Tracked entity attribute value change logs { #webapi_tracker_attribute_change_logs }

{
  "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": {
        "attributeValue": {
          "attribute": "w75KJ2mc4zz",
          "previousValue": "John",
          "currentValue": "Johnny"
        }
      }
    },
    {
      "createdBy": {
        "uid": "AIK2aQOJIbj",
        "username": "tracker",
        "firstName": "Tracker demo",
        "surname": "User"
      },
      "createdAt": "2024-06-20T14:50:32.966",
      "type": "CREATE",
      "change": {
        "attributeValue": {
          "attribute": "w75KJ2mc4zz",
          "currentValue": "John"
        }
      }
    }
  ]
}

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 }

注册{ #enrollments }

Allowed values

path /{uid}

    • Tracked entity UID.
  • 项目
    • String

注册收集端点 GET /api/tracker/enrollments

根据筛选条件返回一个注册记录列表。

允许值 Potential duplicate status order Parameter name
createdBy (Username of user) 具有以下要求: See Tracked Entities and 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 具有以下要求: 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. 选择组织单元的模式。默认值为 SELECTED
{ "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
Events CSV Filter for events which were updated up until this date. Cannot be used together with updatedWithin. 项目
DateTime 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

请求示例{ #example-requests }

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.

输出的最大限制。

{
  "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,
      "notes": []
    }
  ]
}

注册单对象端点{ #enrollments-single-object-endpoint }

includeDeleted

Boolean

请求语法

查询不区分大小写。唯一的要求是必须提供项目参数。

允许值 Potential duplicate status order Parameter name
storedByDataValue 具有以下要求: ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` To constrain the response to enrollments of a specific tracked entity you can include a tracked
entity query parameter:
默认过滤器是id,displayName 具有以下要求: ```
GET /api/tracker/enrollments?orgUnitMode=ACCESSIBLE&trackedEntity=tphfdyIiVL6
|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
}
]
}
```
请求示例{ #example-requests }
{
  "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": []
    }
  ]
}

Enrollments single object endpoint

输出的最大限制。

The purpose of this endpoint is to retrieve an enrollment given its ID.

Request syntax

GET /api/tracker/enrollment/{uid}

Request parameter

类型

GET /api/tracker/events/{id}

除非另有说明,否则 GET 方法的默认响应格式为 JSON。该 API 还 支持对单个和集合端点进行 CSV 导出。此外,它还支持 集合端点的压缩 JSON 和 CSV 格式。

活动 CSV{ #events-csv }

指标组 Potential duplicate status
The message text.
用户友好型消息,说明操作是否成功。 具有以下要求:
{ "periodFrom": -15, "periodTo": 15} Response format
See an example payload below. Response format
文本 Response format
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} Response format
To retrieve an event with a specific ID: Events CSV
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. Events CSV
In the case of CSV, the fields request parameter has no effect, and the response will always
contain the following fields: Property
类型 event
用户标识 status
Table: Program Stage Query Criteria 项目阶段
ID 项目阶段
类型 Events CSV
身份证 Events CSV
String:Uid Events CSV
DateTime Events CSV
日期时间 updatedAtClient
WKT, can be omitted it in case of a Point type and with latitude and longitude provided Events CSV
Latitude of a Point type of Geometry updatedAtClient
>
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo Response format
boolean Response format
布尔 updatedAtClient
最小最大数据元素 Response format
日期时间 具有以下要求:
日期时间 项目阶段
用户名 具有以下要求:
createdAtDataValue Events CSV
用户名 Events CSV

ID

事件 GZIP{ #events-gzip }

响应结果是文件 events.json.gzevents.csv.gz,其中包含 events.jsonevents.csv 文件。

活动 ZIP{ #events-zip }

响应内容为文件 events.json.zipevents.csv.zip,其中包含 events.jsonevents.csv 文件。

事件集合端点 GET /api/tracker/events

ID

允许值 Potential duplicate status order Parameter name
{ "periodFrom": -15, "periodTo": 15} 具有以下要求: storedByDataValue
See an example payload below. 具有以下要求: storedByDataValue 日期时间
See Events and Data Values for more
field descriptions. 具有以下要求: The response is file events.json.gz or events.csv.gzip containing the events.json
or events.csv file. scheduledBefore
数据值 具有以下要求: Returns a list of events based on the provided filters. Request parameter
类型 具有以下要求: 描述 项目
Table: Program Stage Query Criteria 项目阶段 跟踪器或事件项目的标识符。该参数为必填参数。 项目阶段
storeCopy 具有以下要求: storedByDataValue programStatus deprecated for removal in version 43 use enrollmentStatus
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} 具有以下要求: storedByDataValue filter
具有以下要求: 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. filterAttributes
用户友好型消息,说明操作是否成功。 具有以下要求: Narrows response to tracked entities matching given filters. Example: filterAttributes=H9IlTX2X6SL:eq:John. More on filters here 跟进
boolean Events CSV Filter for events which were updated up until this date. Cannot be used together with updatedWithin. trackedEntity
Events CSV Filter for events which were updated up until this date. Cannot be used together with updatedWithin. orgUnit
Events CSV Filter for events which were updated up until this date. Cannot be used together with updatedWithin. orgUnitMode see orgUnitModes
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. occurredAfter
DateTime Events CSV Filter for events which were updated up until this date. Cannot be used together with updatedWithin. occurredBefore
DateTime ISO-8601 Filter for events which occurred up until this date. scheduledAfter
DateTime 具有以下要求: The response is file events.json.gz or events.csv.gzip containing the events.json
or events.csv file. scheduledBefore
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. 在指定项目中完成注册的截止日期
描述 DateTime Enum enrollmentEnrolledAfter
DateTime DateTime Enum enrollmentEnrolledBefore
programStageIdScheme DateTime Enum ISO-8601
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 方案
IdScheme used for all metadata references unless overridden by a metadata specific parameter. Default is UID. DateTime Enum UID, CODE, NAME, ATTRIBUTE:{uid}
programIdScheme DateTime Enum UID, CODE, NAME, ATTRIBUTE:{uid}
UID, CODE, NAME, ATTRIBUTE:{uid} DateTime Enum UID, CODE, NAME, ATTRIBUTE:{uid}
iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 具有以下要求: Enum UID, CODE, NAME, ATTRIBUTE:{uid}
用于项目阶段引用的 IdScheme。默认为 idScheme 参数。 具有以下要求: UID, CODE, NAME, ATTRIBUTE:{uid} categoryOptionComboIdScheme
Enum 具有以下要求: IdScheme used for category option combo references. Defaults to the idScheme parameter.
Enum 具有以下要求: categoryOptionIdScheme
userDataStore 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 IdScheme used for category option references. Defaults to the idScheme parameter.
Enum 具有以下要求: order
Property 具有以下要求: events

注意

如果查询中既不包含 attributeCategoryCombo 也不包含 attributeCategoryOptions, 服务器将返回用户具有读取权限的所有属性选项组合的相关事件。

请求示例{ #example-requests }

attributeCategoryCombo (see note)

Attribute category combo identifier. Must be combined with attributeCategoryOptions.

attributeCategoryOptions (see note)

Comma-separated attribute category option identifiers. Must be combined with attributeCategoryCombo.

includeDeleted

Boolean

When true, soft deleted events will be included in your query result.

assignedUserMode

CURRENT, PROVIDED, NONE, ANY

Assigned user selection mode

assignedUsers

Comma-separated list of user UIDs to filter based on events assigned to the users.

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.

Note

If the query contains neither attributeCategoryOptions nor attributeCategoryOptions, the server returns events for all attribute option combos where the user has read access.

事件响应示例{ #events-response-example }

The query for all events with children of a particular organisation unit:

JSON{ #json }

The query for all events with all descendants of a particular organisation unit, implying all organisation units in the sub-hierarchy:

{
  "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",
          "providedElsewhere": false,
          "dataElement": "F3ogKBuviRA",
          "value": "[-11.4880220438585,7.50978830548003]"
        },
        {
          "createdAt": "2013-12-30T14:23:57.423",
          "updatedAt": "2013-12-30T14:23:57.423",
          "providedElsewhere": false,
          "dataElement": "eMyVanycQSC",
          "value": "2018-02-07"
        },
        {
          "createdAt": "2013-12-30T14:23:57.382",
          "updatedAt": "2013-12-30T14:23:57.382",
          "providedElsewhere": false,
          "dataElement": "oZg33kd9taw",
          "value": "男性"
        }
      ],
      "notes": [],
      "followup": false
    }
  ]
}
CSV{ #csv }
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc
事件,状态,项目,项目阶段,报名情况,组织单位,发生时间,计划时间,几何信息,纬度,经度,后续处理,已删除,创建时间,客户端创建时间,更新时间,客户端更新时间,完成人,完成时间,更新人,属性选项组合,属性类别选项,指派用户,数据元素,值,在其他地方提供,由数据值存储,由数据值更新,由数据值创建
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]",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,"点 (-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,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,"点 (-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,false,,2013-12-30T13:23:57.467Z,2013-12-30T13:23:57.467Z

```

GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc&order=scheduledAt

查询某一项目和组织单位中发生日期最新的 10 个事件 - 通过分页和按发生日期降序排序的方法
通过分页和按发生日期降序排序:

##### 请求语法 { #request-syntax } 

Query for all events with a certain program and organisation unit for a specific tracked entity:

|允许值|Potential duplicate status|`order`|Parameter name|
|---|---|---|---|
|```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
```|JSON格式|```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
```|Events response example|
|The API supports CSV and JSON response for `GET /api/tracker/events`.|JSON格式| The JSON response can look like the following: |```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
    }
  ]
}
```|

##### 请求示例{ #example-requests } 

The CSV response can look like the following:

```csv
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-response-example }

该 API 支持 GET /api/tracker/events/{uid} 的 CSV 和 JSON 响应格式。

JSON{ #json }
{
  "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",
      "providedElsewhere": false,
      "dataElement": "HyJL2Lt37jN",
      "value": "12"
    }
  ],
  "notes": [],
  "followup": false
}
CSV{ #csv }

类型

Allowed values

描述

uid

允许值 Potential duplicate status order
fields 具有以下要求: Any valid field filter (default *,!relationships)
iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 具有以下要求: A query for an Event:
数据值 具有以下要求: 应用项目接口支持对 GET /api/tracker/trackedEntities 的 CSV 和 JSON 响应
事件数据值变更日志响应示例{ #event-data-value-change-logs-response-example }
{
  "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
}

CSV

The response will be the same as the collection endpoint but referring to a single event, although it might have multiple rows for each data element value.

Event data value change logs { #webapi_event_data_value_change_logs }

人际关系

This endpoint retrieves change logs for the data values of a specific event. It returns a list of all event data values and event fields (occurredAt, scheduledAt, and geometry) that have changed over time for the specified event.

Parameter

类型

Allowed values

path /{uid}

请求参数{ #request-parameters }

允许值 Potential duplicate status order Parameter name
storeCopy 具有以下要求: ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` Event data value change logs response example
文本 具有以下要求: ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` More on change log configuration here
The message text. 具有以下要求: ```
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,//
``` The purpose of this endpoint is to retrieve relationships between objects.
默认过滤器是id,displayName 具有以下要求: Request parameters ```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
}
]
}
```
iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 具有以下要求: 描述 trackedEntity
userDataStore 由用户、命名空间、键和关联的
值。用户、命名空间和密钥的组合是唯一的。 跟踪器或事件项目的标识符。该参数为必填参数。 enrollment

uid

Identifier of an enrollment

响应示例{ #example-response }

uid

Identifier of an event

fields

Any valid field filter (default relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]])

关于 Tracker 数据的一个关键点在于必须采取整体性的方法。例如,用户 仅拥有对数据元素的读取权限时,将无法查看该数据元素的值。 用户 需要具备数据读取权限,才能访问该数据元素 所属的父级“项目阶段”和“项目”。这与类别选项组合的处理方式相同。在 Tracker 中,活动和 注册信息都与一个 AttributeOptionCombo 相关联,该组合由多个类别 选项构成。 要读取某个事件或注册记录,用户必须拥有对构成该对象“属性选项组合”的所有“类别选项” 及其对应“类别”的数据读取权限。如果用户 缺少对任何一个必需的“类别选项”或“类别”的访问权限,则无法访问 该事件或注册记录的全部内容。

order

Comma-separated list of property name or attribute or UID and sort direction pairs in format propName:sortDirection.

Supported fields: createdAt, createdAtClient.

includeDeleted

Boolean

true, false

whether to include soft-deleted elements in your query result

The following rules apply to the query parameters.

Only one parameter among trackedEntity, enrollment, event can be passed. Parameter name
Example response ```json
{
"pager": {
"page": 1,
"pageSize": 2
},
"relationships": [
{
"relationship": "oGtgtJpp6fG",
"relationshipType": "Mv8R4MPcNcX",
"from": {
"trackedEntity": {
"trackedEntity": "neR4cmMY22o"
}
},
"to": {
"trackedEntity": {
"trackedEntity": "DsSlC54GNXy"
}
}
},
{
"relationship": "SSfIicJKbh5",
"relationshipType": "Mv8R4MPcNcX",
"from": {
"trackedEntity": {
"trackedEntity": "neR4cmMY22o"
}
},
"to": {
"trackedEntity": {
"trackedEntity": "rEYUGH97Ssd"
}
}
}
]
}
```
Tracker access control { #webapi_tracker_access_control } Tracker has a few different concepts in regards to access control, like sharing, organisation unit
scopes, ownership, and access levels. The following sections provide a short introduction to the
different topics.
Metadata sharing { #webapi_tracker_metadata_sharing } Sharing setting is standard DHIS2 functionality that applies to both Tracker and Aggregate
metadata/data as well as dashboards and visualization items. At the core of sharing is the ability
to define who can see/do what. In general, there are five possible sharing configurations – no
access, metadata read, metadata write, data read, and data write. These access configurations can be
granted at user and/or user group level (for more flexibility). With a focus on Tracker, the
following metadata and their sharing setting is of particular importance: Data Element, Category
Option, Program, Program Stage, Tracked Entity Type, Tracked Entity Attribute as well as Tracker
related Dashboards and Dashboard Items.
Sharing settings are enforced during Tracker data import/export. Data read/write access is needed to
read and write respectively. Similarly, if a user is expected to modify metadata, it is essential to
grant metadata write access. One critical point with Tracker data is the need to have a holistic approach. For example, a user
won’t be able to see the Data Element value by having read access to just the Data Element. The user
needs to have data read to access the parent Program Stage and Program where this Data Element
belongs. It is the same with the category option combination. In Tracker, the Event is related to
AttributeOptionCombo, which is made up of a combination of Category Options. Therefore, for a user
to read data of an Event, he/she needs to have data read access to all Category Options and
corresponding Categories that constitute the AttributeOptionCombo of the Event in question. If a
user lacks access to just one Category Option or Category, then the user has no access to the entire
Event.
在访问注册数据时,必须首先访问被跟踪实体。
首先。通过共享设置项目、跟踪实体类型和跟踪实体属性,可以控制对跟踪实体的访问。
类型和跟踪实体属性的共享设置来控制对跟踪实体的访问。一旦访问了注册,就有可能访问事件
数据,这同样取决于项目阶段和数据元素共享设置。 另一个需要考虑的关键点是如何规划对不同项目阶段的访问。
有时,我们可能需要向特定用户组(实验室技术人员)授予访问特定阶段的权限,如
例如 "实验室结果")的访问权限。在这种情况下,我们可以
为 "实验室结果 "阶段提供数据写入访问权限,可能为一个或多个阶段提供数据读取 访问权限,以防我们希望实验室技术人员读取数据。
如果我们希望实验室技术人员读取其他医疗结果,则可以提供数据写入访问权限;如果我们 认为实验室技术人员没有必要查看数据,则可以不提供访问权限。
如果我们认为实验室技术人员没有必要查看实验室相关数据以外的数据,则不提供访问权限。
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. Organisation unit scopes { #webapi_tracker_orgunit_scope }

Organisation units are one of the most fundamental objects in DHIS2. They define a universe under which a user is allowed to record and/or read data. There are three types of organisation units that can be assigned to a user. These are data capture, data view (not used in tracker), and tracker search. As the name implies, these organisation units define a scope under which a user is allowed to conduct the respective operations. A user can search for data in their search scope and capture scope organisation units.

However, to further fine-tune the scope, DHIS2 Tracker introduces a concept that we call OrganisationUnitSelectionMode. Such a mode is often used at the time exporting tracker objects. For example, given that a user has a particular tracker search scope, does it mean that we have to use this scope every time a user tries to search for a tracker, Enrollment, or Event object? Or is the user interested in limiting the searching just to the selected org unit, or the entire capture org unit scope, and so on.

Users can do the fine-tuning by passing a specific value of orgUnitMode in their API request:

/api/tracker/trackedEntities?orgUnit=UID&orgUnitMode=specific_organisation_unit_selection_mode

Currently, there are six selection modes available: SELECTED, CHILDREN, DESCENDANTS, CAPTURE, ACCESSIBLE, and ALL.

Mode

描述

DHIS2 2.30 版本中引入的“追踪对象所有权”功能,定义了 “被追踪实体”与“项目”组合之间的组织单位关联。在项目背景下,我们将此称为 “被追踪实体”的“所有者”(或“所属”)组织单位。 所有者组织单元 用于决定读取和写入与项目相关的追踪器数据时的访问权限。这 与项目的 访问级别 配置共同决定 与项目相关数据(注册和事件)的访问行为。 如果某个“被追踪实体”与“项目”组合对应的 所有者组织单元 属于用户的组织单元范围(搜索/捕获)内,则用户可以访问该“被追踪实体”的 项目数据。 对于配置了 访问级别为 OPENAUDITED 的项目,其所有者组织单元必须位于用户的搜索 范围内。对于配置了访问级别为 PROTECTEDCLOSED 的项目,所有者 组织单位必须位于用户的捕获范围内,才能访问特定 受追踪实体的相应项目数据。无论项目访问级别如何,要访问 Tracker 对象,所请求的组织单位必须始终位于用户的搜索 范围或捕获范围之内。用户无法请求这两个范围之外的对象,除非其 使用组织单位模式 ALL 且拥有使用该模式的足够权限。

Specified organisation units.

  • CHILDREN Specified organisation unit including immediate children, i.e. organisation units at the immediate level below.
  • DESCENDANTS Specified organisation unit and all organisation units in the sub-hierarchy, i.e. at all organisation unit levels in the sub-hierarchy below the specified organisation units.

CAPTURE

The data capture organisation units associated with the current user and all organisation units in the sub-hierarchy.

ACCESSIBLE

跟踪器会搜索与当前用户相关联的组织单位以及子层次结构中的所有组织单位。这包括用户可见的所有内容,包括搜索范围内的打开和已审核项目,以及用户捕获范围内受保护和已关闭项目中的数据。如果用户缺少搜索组织单元,系统会默认为捕获范围,确保用户始终可以访问至少一个范围。捕获范围是强制性的,是保证用户数据环境的基本要素。

全部

All organisation units in the system. This mode is reserved for authorized users, specifically those with the authority ALL (super users). Users with the authority F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS can also search system-wide but need sharing access to the returned program, program stage, and/or tracked entity type. Non-authorized users are not permitted to search using this scope.

The first three modes, SELECTED, CHILDREN and DESCENDANTS, expect an organisation unit to be

supplied in the request, while the last three, CAPTURE, ACCESSIBLE and ALL do not.

The organisation unit mode will be one of the ones listed above when it is explicitly provided in the API request. Since it is not a mandatory paramter, when not specified, the default value will be SELECTED if an organisation unit is present, and ACCESSIBLE if not.

It makes little sense to pass these modes at the time of tracker import operations. Because when writing tracker data, each of the objects needs to have a specific organisation unit attached to them. The system will then ensure if each of the mentioned organisation units falls under the CAPTURE scope. If not, the system will simply reject the write operation.

请注意,与跟踪器对象相关的组织单位关联有四种类型。A

被跟踪实体有一个组织单位,通常称为注册组织单位。 注册有一个与之相关的组织单位。事件也有一个 关联。跟踪项目组合也有一个所有者组织单元。 组合。

When fetching Tracker objects, depending on the context, the organisation unit scope is applied to one of the above four organisation unit associations.

例如,在没有项目上下文的情况下检索 "跟踪实体 "时,组织单位 范围适用于被跟踪实体的注册组织单位。而当 组织单位范围适用于所有者组织单位。 组织单位范围适用于所有者组织单位。

打开{ #open }

A new concept called Tracker Ownership is introduced from 2.30. This introduces a new organisation unit association for a TrackedEntity - Program combination. We call this the Owner (or Owning) Organisation unit of a TrackedEntity in the context of a Program. The Owner organisation unit is used to decide access privileges when reading and writing tracker data related to a program. This, along with the Program's Access Level configuration, decides the access behavior for Program-related data (Enrollments and Events). A user can access a TrackedEntity's Program data if the corresponding Owner OrganisationUnit for that TrackedEntity-Program combination falls under the user's organisation unit scope (Search/Capture). For Programs that are configured with access level OPEN or AUDITED , the Owner OrganisationUnit has to be in the user's search scope. For Programs that are configured with access level PROTECTED or CLOSED , the Owner OrganisationUnit has to be in the user's capture scope to be able to access the corresponding program data for the specific tracked entity. Irrespective of the program access level, to access Tracker objects, the requested organisation unit must always be within either the user's search scope or capture scope. A user cannot request objects outside these two scopes unless they are using the organisation unit mode ALL and have sufficient privileges to use that mode.

经审计{ #audited }

被跟踪的实体已加入用户可访问数据的至少一个项目,且用户

受保护的{ #protected }

被跟踪的实体没有加入用户有数据访问权的任何项目,但用户有

已关闭{ #closed }

Tracker Ownership Override: Break the Glass { #webapi_tracker_ownership_override }

工作列表{ #working-lists }

This act of temporarily gaining access is termed breaking the glass. Currently, temporary access is granted for 3 hours. DHIS2 audit breaking the glass along with the reason specified by the user. This information is also stored in the database, but only if the tracked entity type is configured to allow auditing, which is disabled by default.

无法临时访问已配置为*CLOSED*访问级别的项目。 项目的临时访问权限。

To break the glass for a TrackedEntity-Program combination, the following POST request can be used:

受监控实体的待办事项列表{ #tracked-entity-working-lists }

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:

有效载荷{ #payload }

"assignedUsers":["DXyJmlo9rge"]

指标组 Parameter name 描述
displayColumnOrder periodFrom
dataFilters Protected
这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。
只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户
用户可以通过 打破玻璃 获得临时所有权。
玻璃](#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 "attributeValueFilters":[{"attribute": "abcAttributeUid","le": "20","ge": "10","lt": "20","gt": "10","in": ["印度", "挪威"],"like": "abc","sw": "abc","ew": "abc","dateFilter": {"startDate": "2014-05-01","endDate": "2019-03-20","startBuffer": -5,"endBuffer": 5,"period": "LAST_WEEK","type": "RELATIVE"}}]
DateTime 被追踪实体的注册状态。可以是“none”(任何注册状态)或 ACTIVECOMPLETEDCANCELLED
Table: Program Stage Query Criteria 项目
是否在 DHIS2 中存储一份项目信息副本。 { "id" : "uy2gU8kTjF"} entityQueryCriteria
{"type":"RELATIVE","period":"TODAY"} See Entity Query Criteria definition table below. DateFilterPeriod object filtering based on the event scheduled date.
Enum 项目阶段的 uid。 "eventDate": {"startBuffer": -5,"endBuffer": 5, "type": "RELATIVE" }
Property DateFilterPeriod object date filtering based on last updated date.
"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 "order":"a3kGcGDCuk6:desc"
See an example payload below. organisationUnit "programStage":"a3kGcGDCuk6"
{"organisationUnit": "a3kGcGDCuk7"} ouMode {"trackedEntityType":"a3kGcGDCuk6"}
Absolute end date. Applicable only when type is ABSOLUTE assignedUserMode "trackedEntities":["a3kGcGDCuk6","b4jGcGDCuk7"]
"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 object date filtering based on enrollment created date. "enrollmentCreatedDate": { "period": "LAST_WEEK", "type": "RELATIVE" }
"displayOrderColumns": ["enrollmentDate", "program"] DateFilterPeriod 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 object date filtering based on event date. "eventDate": {"startBuffer": -5,"endBuffer": 5, "type": "RELATIVE" }
Property DateFilterPeriod object date filtering based on last updated date.
Event filters definition
指标组 Parameter name 描述
项目阶段 被跟踪实体需要返回哪个项目阶段的事件。 -15
"eaDH9089uMp" eventStatus 15

查询请求参数{ #query-request-parameters }

ACTIVE

eventCreatedPeriod Parameter name
{ "periodFrom": -15, "periodTo": 15} assignedUserMode

项目阶段工作清单{ #program-stage-working-lists }

"assignedUserMode": "PROVIDED"

assignedUsers

有效载荷{ #payload }

"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
/api/programStageWorkingLists
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 object filtering based on the event creation date.
{"type":"ABSOLUTE","startDate":"2020-03-01","endDate":"2022-12-30"} eventOccurredAt DateFilterPeriod object filtering based on the event occurred date.
{"type":"RELATIVE","period":"TODAY"} eventScheduledAt DateFilterPeriod 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 object filtering based on the event enrollment date.
"enrolledAt": {"type":"RELATIVE","period":"THIS_MONTH"} enrollmentOccurredAt DateFilterPeriod 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

活动工作列表{ #event-working-lists }

"assignedUserMode":"PROVIDED"

assignedUsers

有效载荷{ #payload }

"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
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 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 object date filtering based on event date. "eventDate": { "startBuffer": -5, "endBuffer": 5, "type": "RELATIVE" }
dueDate DateFilterPeriod object date filtering based on due date. "dueDate": { "period": "LAST_WEEK", "type": "RELATIVE" }
lastUpdatedDate DateFilterPeriod 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 描述

可能的重复问题{ #potential-duplicates }

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 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:

GET /api/potentialDuplicates

The response payload for a potential duplicate looks like this.s

{
  "created": "2024-06-04T10:11:29.110",
  "lastUpdated": "2024-06-04T10:11:29.110",
  "original": "<UID>",
  "duplicate": "<UID>",
  "status": "OPEN|INVALID|MERGED",
  "id": "<id>"
}

| POST /api/potentialDuplicates | Parameter name | --- | --- | | 400 | 描述 | 403 | 类型 | 404 | Allowed values | 409 | trackedEntities

List of tracked entities

List of string (separated by comma)

允许值 Parameter name Potential duplicate status order
用户友好型消息,说明操作是否成功。 To inspect individual potential duplicate records, use the following endpoint: 不区分大小写的字符串结尾匹配 To create a new potential duplicate, use this endpoint:

| POST /api/potentialDuplicates | Parameter name | --- | --- | | 400 | ```json { "original": "", "duplicate": "" }

| 400 | Status code

### 合并受追踪实体{ #merging-tracked-entities } 

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

#### 合并策略 AUTO{ #merge-strategy-auto } 

`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

#### 合并策略 手册{ #merge-strategy-manual } 

To merge a Potential Duplicate, i.e. the two tracked entities the Potential Duplicate represents,
use the following endpoint:

* ```
POST /api/potentialDuplicates/<id>/merge
Parameter name * 描述 类型

Allowed values

mergeStrategy

Strategy to use for merging the potentialDuplicate

string

AUTO(default) or MANUAL

关于合并{ #additional-information-about-merging } 的更多信息

Merge strategy AUTO

The automatic merge evaluates the mergability of the two tracked entities and merges them if they are deemed mergeable. The mergability is based on whether the two tracked entities have any conflicts. Conflicts refer to data that cannot be merged automatically. Examples of possible conflicts include:

项目通知模板{ #program-notification-template }

Both tracked entities are enrolled in the same program.

“程序通知模板”中有几个配置参数,这些参数对于 通知的正常运行至关重要。下表对这些参数进行了说明。

If any conflict is encountered, an error message is returned to the user.

When no conflicts are found, all data in the duplicate that is not already in the original will be moved to the original. This includes attribute values, enrollments (including events), and relationships. After the merge completes, the duplicate is deleted and the Potential Duplicate is marked as MERGED. When requesting an automatic merge, a payload is not required and will be ignored.

表格:程序通知模板有效载荷{ #table-program-notification-template-payload }

| 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 | 译 | | --- | --- | --- | --- | | 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" ] } | When a manual merge is requested without a payload, we are telling the API to merge the two tracked entities without moving any data. In other words, we are just removing the duplicate and marking the potentialDuplicate MERGED. This might be valid in a lot of cases where the tracked entity was just created, but not enrolled for example. | Otherwise, if a manual merge is requested with a payload, the payload refers to what data should be moved from the duplicate to the original. The payload looks like this: | | json { "trackedEntityAttributes": ["B58KFJ45L9D"], "enrollments": ["F61SJ2DhINO"], "relationships": ["ETkkZVSNSVw"] } | 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" ] } | Additional information about merging | Currently it is not possible to merge tracked entities that are enrolled in the same program, due to the added complexity. A workaround is to manually remove the enrollments from one of the tracked entities before starting the merge. | | All merging is based on data already persisted in the database, which means the current merging service is not validating that data again. This means if data was already invalid, it will not be reported during the merge. The only validation done in the service relates to relationships, as mentioned in the previous section. | Program notification template | 项目通知模板允许您创建可根据不同类型事件发送的信息模板。 消息和主题模板会被转换为实际值,并发送到配置的目的地。 每个项目通知模板都会转化为 MessageConversation 对象或 ProgramMessage 对象,具体取决于收件人是外部还是内部。 这些中间对象将只包含翻译后的信息和主题文本。 | 项目通知模板中有几个配置参数对通知的正常运行至关重要。 这些参数的说明如下表所示。下表对这些参数进行了说明。 | | POST /api/programNotificationTemplates | 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" ] } | Values | 名称 | | 是的 | Program notification template | case-notification-alert | notificationTrigger | | 是的 | Program notification template | ENROLLMENT | subjectTemplate |

检索和删除程序通知模板{ #retrieving-and-deleting-program-notification-template }

Case notification V{org_unit_name}

项目信息{ #program-messages }

是的

Message template string

发送项目信息

notificationRecipient

  • 是的
  • Who is going to receive notification. Options are USER_GROUP, ORGANISATION_UNIT_CONTACT, TRACKED_ENTITY_INSTANCE, USERS_AT_ORGANISATION_UNIT, DATA_ELEMENT, PROGRAM_ATTRIBUTE, WEB_HOOK

收件人{ #recipients }

deliveryChannels

  • Which channel should be used for this notification. It can be either SMS, EMAIL, or HTTP
  • SMS
  • sendRepeatable

Whether notification should be sent multiple times

表:程序消息有效载荷{ #table-program-message-payload }

| 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 | 译 | |---|---|---|---| | The program message feature enables you to send messages to tracked entities, contact addresses associated with organisation units, phone numbers, and email addresses. Messages can be sent using the messages resource. | 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 | Recipients | 项目消息可以发送给各种收件人: | | The message text. | Program notification template | List of phone numbers: The system will use the explicitly defined phone numbers. | List of email addresses: The system will use the explicitly defined email addresses. | | 是的 | 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 | Values | enrollment | | 是的 | Program notification template | Can be trackedEntity, organisationUnit, an array of phoneNumbers or an array of emailAddresses. | enrollment | | 不 | 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" ] } | Enrollment ID. | enrollment | | 不 | Program notification template | Event ID. | deliveryChannels |

查询项目信息

Array of delivery channels.

SMS, EMAIL

notificationTemplate

GET /api/messages/scheduled/sent?enrollment={uid}
GET /api/messages/scheduled/sent?event={uid}

notificationTemplate

ProgramNotificationTemplate UID 用于交叉检查哪个项目消息属于哪个通知模板。

Text.

该程序消息 API 支持使用特定的请求参数查询消息。您可以根据 以下列出的参数对消息进行筛选。所有请求均应使用 GET HTTP 动词来检索信息。

默认值 Text.
文本 是的
The message text. Text.
storeCopy
是否在 DHIS2 中存储一份项目信息副本。 false, true
查询项目信息 项目消息 API 支持使用特定请求参数查询消息。

程序通知实例{ #program-notification-instance }

To retrieve a specific message.

GET /api/messages/{uid}
GET /api/programNotificationInstances

表:查询程序通知实例 API

类型 Potential duplicate status 检索和删除项目通知模板 Parameter name
scheduledAt date (ISO-8601) Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 返回计划在指定日期发送的通知实例。示例:scheduledAt=2025-01-01
true|false Field Presets { #field-presets } Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 启用或禁用分页。默认值为 true。使用 paging=false 可返回所有匹配的实例,而不进行分页。
comma separated list of fields or presets to include 整数 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 启用分页时应返回的页码。
默认 整数 Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 启用分页时,每页显示的项目数。
event Narrows response to tracked entities matching given filters. More on filters here Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 与该事件关联的程序通知实例。
注册 Narrows response to tracked entities matching given filters. More on filters here Enrollment Aggregate data dimensions /analytics/enrollments/aggregate/dimensions 与本次注册关联的项目通知实例。

性能{ #webapi_tracker_performance }

本节首先介绍通用性能原则,随后针对 跟踪器导出端点提供具体指导。要进一步优化性能,需要了解实际的访问 模式和数据分布情况。如果您的实现能够提供这些信息,将有助于 确定改进的优先级。

有关相较于先前版本的跟踪器性能改进,请参阅相应的发布 说明,例如 2.43

导入{ #import }

通知{ #notifications }

通知会在导入完成后异步发送,但会与并发请求争夺 数据库连接、CPU 和内存资源。当实体和通知模板数量较多时,这可能会 增加延迟。对于无需通知的批量导入,请跳过通知:

POST /api/tracker?skipSideEffects=true

项目规则{ #program-rules }

规则引擎会在导入过程中对打包文件中的每个注册和事件进行同步运行, 这可能会显著增加批量导入的延迟。仅当项目中不存在 必须在导入时强制执行的验证或分配规则时,才应跳过此步骤:

POST /api/tracker?skipRuleEngine=true

导出{ #export }

一般原则{ #general-principles }

导出端点的响应时间通常主要取决于数据库查询的执行情况。 以下建议侧重于减少数据库需要处理的工作量。

在适当级别进行查询{ #query-at-the-right-level }

跟踪器数据模型包含三个层次:被跟踪实体、注册信息和事件。请始终在 能够满足您需求的最低层次进行查询。 请使用 GET /api/tracker/events 代替 GET /api/tracker/trackedEntities?fields=enrollments[events]。通过父级端点进行查询会增加 查询复杂度或查询次数。

使用显式的 fields

默认情况下,所有端点均不包含嵌套集合,例如 enrollmentseventsrelationships。每个额外的集合都会增加资源占用并延长响应时间。请仅 请求您需要的 fields,并避免使用 fields=*

选择性{ #selectivity }

查询性能取决于数据库在返回结果之前需要处理的记录数量。 需要扫描、排序和去重处理的记录越少,响应速度就越快。这就是所谓的**选择性**: 即符合查询条件的记录占总记录数的比例。

选择性来源于多个方面,这些方面相互叠加:请求参数(例如 programfilter、日期范围)、用户作用域以及 orgUnitMode

筛选器

过滤器会在排序和分页之前缩小结果集范围。当有 数据库索引支持时,其效果最佳。宽泛的过滤条件(例如 filter=w75KJ2mc4zz:like:J)可能会匹配数据集中的 大部分内容,且选择性较低。 窄范围过滤器(例如 filter=w75KJ2mc4zz:eq:Jerald 或 严格的日期范围)可显著缩小工作集。 针对受追踪实体属性的 like 过滤器 可受益于 三元组索引

程序和受监控实体类型上的“搜索所需的最小属性数量”设置 要求在用户捕获范围之外进行搜索时,必须设置最少数量的属性过滤条件。

程序{ #program }

指定 program 可启用基于所有权的访问控制。如果不指定 program,系统必须 动态评估被追踪实体所参与的所有程序中的访问规则。查询特定程序的数据时,请务必 包含 program

请注意,即使指定了 program,选择性仍取决于该 项目所拥有的数据量。一个涵盖了大多数受追踪实体的项目,其选择性不会很高。

组织单位模式{ #webapi_tracker_perf_organisation_unit_mode }

orgUnitMode 以及用户的组织单位范围会直接影响 数据库处理的记录数量。 性能取决于所包含的组织单位 所拥有的数据量。范围限定在单个设施内的用户仅查询一小部分记录;而拥有根级 访问权限的用户则可能扫描整个程序。SELECTED 效率最高,因为数据库可以 直接定位到指定组织单位所拥有的记录。

当子节点不拥有数据时,CHILDREN 的执行速度较慢。 数据通常在机构 (最低层级)处捕获。 如果在更高级别(例如区级)使用 CHILDREN,会返回没有事件的行政组织 单位,这会迫使数据库扫描该计划中的所有事件以确认这一点。 当子节点是实际采集数据的组织单位时,CHILDREN 的执行速度很快。

ALL 没有地理限制。ACCESSIBLE 取决于用户的搜索范围, 对于拥有广泛访问权限的用户,其搜索范围可覆盖该程序的大部分数据。结合使用选择性 过滤器,可确保工作集保持在可管理范围内。

订购{ #ordering }

order 参数会对查询性能产生显著影响。排序字段可分为以下 性能等级:

  • 快速(带索引):数据库按顺序遍历索引,并在填满请求的 页面。成本随页面大小和偏移量而变化,而非随数据集大小而变化。这假设查询条件 允许数据库使用该索引,这取决于过滤条件和 orgUnitMode
  • 慢(无索引):数据库必须先扫描并排序所有匹配的记录,然后才能返回 页面。成本主要取决于匹配记录的总数。
  • 非常慢(跨资源):排序值来自相关资源(例如,对已跟踪的 实体(按 enrolledAt 或某个属性值)。数据库必须为每个 在排序前查找匹配的记录。

选择性比排序字段的选择更为重要。 借助选择性过滤器或缩小用户范围, 即使是较慢的排序字段也能快速处理,因为数据库只需对一小部分数据进行排序。请注意, 即使没有后端索引,过滤器仍能降低排序开销,但无法降低扫描开销。

有关各字段属于哪个层级的具体顺序,请参阅下文针对各端点的具体章节。

分页

DHIS2 采用 基于偏移量的分页。较高的页码处理速度本就较慢,因为数据库必须计算并舍弃所有之前的 行。这是基于偏移量的分页的一种基本特性,并非 DHIS2 所独有。

建议: * 保持页面大小在合理范围内(默认值为 50) * 避免跳转到非常大的页码 * 除非必要,否则请避免使用 totalPages=true,因为它会执行一个额外的计数查询,该查询必须处理所有 匹配记录,无论页面大小如何 * 请避免使用 paging=false,因为它会将所有匹配的记录一次性返回

配置 收集限制,以限制结果集的大小,并 保护数据库和服务器资源。

/api/tracker/trackedEntities

筛选器

programtrackedEntityType 其中之一为必填项。建议使用 program,因为它支持基于 所有权的直接访问控制。

订购{ #ordering }
层级 订单字段 成本
trackedEntitycreatedAt page(偏移量)+ pageSize 成正比
updatedAtcreatedAtClientupdatedAtClientinactive 占已追踪匹配实体总数的百分比
非常慢 enrolledAt,被追踪实体的属性 UID 与已追踪匹配实体的总数成正比 + 在相关表中按记录进行的查询

当被追踪实体在 同一项目中有多项注册记录时,enrolledAt 还需进行去重处理。配置为“仅注册一次”的项目可避免这种去重开销。

/api/tracker/enrollments

订购{ #ordering }
层级 订单字段 成本
enrolledAtcreatedAtcompletedAtupdatedAtcreatedAtClientupdatedAtClient 与总匹配注册人数成正比

目前所有注册订单字段均未设置复合索引。数据库必须先扫描并排序所有 匹配的注册记录,才能返回所请求的页面。

/api/tracker/events(追踪计划){ #apitrackerevents-tracker-programs }

筛选器

program 是必填项,可与 programStage 结合使用,以限定为单个阶段。

所有权{ #ownership }

每个跟踪器事件查询都必须遍历注册和所有权记录,以实施访问控制。 对于拥有数十万条注册记录的程序,广泛查询(例如 orgUnitMode=ALL 且未应用过滤条件)必须先处理所有所有权记录,才能开始任何事件级别的处理。仅在事件表上建立索引 并不能解决问题,因为所有权检查是在另一张表上进行的。

降低成本最有效的方法是限定组织单位的范围。将用户范围限定为 单一设施,可生成较小的所有权集合,从而使查询的其余部分运行迅速,无论其他 参数如何。

注册级别的筛选条件(enrollmentStatusfollowUp、注册日期范围)并未由 索引支持。虽然它们仍能缩小结果集,但并不能减少数据库 扫描的记录数。

订购{ #ordering }
层级 订单字段 成本
occurredAtscheduledAtcreatedAtupdatedAtcompletedAtcreatedAtClientupdatedAtClientenrolledAt、数据元素 UID 占匹配事件总数的百分比(在进行所有权关联后)
非常慢 受追踪实体的属性 UID 与匹配事件总数成正比 + 每次事件的跨资源查询

所有追踪器事件顺序字段在程序层面上均未设置复合索引。数据库必须 遍历注册和所有权记录,收集所有匹配的事件,对其进行排序,并返回 所请求的页面。计算成本与匹配事件的总数成正比,而非页面大小。

指定 programStage 并不会提高排序性能,因为瓶颈在于 所有权连接,而非事件级扫描。

enrolledAt 来自注册表,该表已是所有权连接的一部分,因此 无需额外查询。对于每个匹配的事件,属性 UID 都需要进行跨资源查询,以定位 相应的被追踪实体。

/api/tracker/events(活动计划){ #apitrackerevents-event-programs }

活动项目(无需注册的项目)没有报名或所有权相关的管理开销。数据库 会直接从活动跳转到其所属的组织单元,因此这些查询在结构上比 Tracker 项目查询更快。

筛选器

program 是必填项。

组织单位模式{ #organisation-unit-mode }

在默认的 occurredAt 排序方式下,数据库会遍历已排序的索引,并按 组织单位对每个事件进行过滤。当匹配的事件出现在索引的前部时,此过程速度很快。对于 SELECTEDDESCENDANTSACCESSIBLE,性能取决于匹配的组织单位的事件在 排序顺序中的分布情况。 如果匹配事件很少,或者集中在索引末尾,数据库 必须先扫描大量不匹配的事件。 在包含数百万个事件的程序阶段中,如果用户的 组织单位仅覆盖其中一小部分,这可能会导致在 填满单个页面之前就扫描了索引的大部分内容。添加 occurredAfter 和/或 occurredBefore 可将扫描范围限制在 一个有限的窗口内,建议在数据量大的程序阶段采用此方法。

ALL 完全避免了组织单位过滤,且在默认排序下速度很快。CHILDREN 运行缓慢, 原因与 一般原则 中所述相同。

如果没有默认的 occurredAt 排序规则,所有模式都需要扫描并排序所有匹配的事件。

订购{ #ordering }

默认排序方式为 occurredAt desc。这是事件程序中效率最高的排序方式。

层级 订单字段 成本
快速(带索引) occurredAt page(偏移量)+ pageSize 成正比。当组织单位过滤功能处于激活状态但匹配结果稀疏时,性能会下降——参见上文的 组织单位模式
慢速(无索引) createdAtupdatedAtcompletedAtcreatedAtClientupdatedAtClient 与该节目阶段的总事件数成正比
速度慢(JSON提取) 数据元素的UID 需要对每个匹配的事件提取并排序 JSON 值