用户界面定制¶
要自定义 DHIS2 应用项目的 UI,您可以插入自定义 JavaScript 和 CSS 样式通过 files 资源。
```¶
POST删除后/ api / 33 / files / script POST GET DELETE / api / 33 / files / style
通过此资源插入的 JavaScript 和 CSS 内容将由
DHIS2 网络应用项目。这在某些情况下特别有用:
### 跟踪实体{ #tracked-entities }
`跟踪实体`是跟踪器模型的根对象。
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| storeCopy | 要创建自定义模板,建议从现有模板开始(这些模板可在登录应用项目的扩展 dhis-web-login/#download 中下载)。 | 不 | 是的 | String:Uid | ABCDEF12345 |
| trackedEntityType | Tracker { #webapi_tracker } | 是的 | 是的 | String:Uid | ABCDEF12345 |
| createdAt | Property | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| createdAtClient | trackedEntity | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | trackedEntityType | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAtClient | createdAt | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| orgUnit | createdAtClient | 是的 | 是的 | String:Uid | ABCDEF12345 |
| inactive | updatedAt | 不 | 是的 | Boolean | Date:ISO 8601 |
| deleted | updatedAtClient | 不 | 不 | Boolean | Date:ISO 8601 |
| 串 | orgUnit | 不 | 不 | Boolean | String:Uid |
| geometry | inactive | 不 | 是的 | GeoJson | {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} |
| 日期时间 | deleted | 不 | 是的 | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | 不 | 是的 | 用户 | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | 用户 | String:Any |
| 属性 | storedBy | 不 | 是的 | 是的 | String:Uid |
| Duration | createdBy | 不 | 是的 | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | 不 | 是的 | 不 | String:Uid |
| 项目所有者 | 可通过特定项目访问此被跟踪实体的组织单位列表。请参阅 "项目所有权"。 | 不 | 是的 | 项目所有者列表 | List of TrackedEntityAttributeValue |
See Attribute
### 注册{ #enrollments }
A list of enrollments owned by the tracked entity.
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| 文本 | 是的 | 不 | 是的 | String:Uid | ABCDEF12345 |
| 项目 | 是的 | 是的 | 不 | String:Uid | ABCDEF12345 |
| storeCopy | Property | 是的 | 是的 | String:Uid | ABCDEF12345 |
| 用户友好型消息,说明操作是否成功。 | enrollment | 不 | 不 | DateTime | String:Uid |
| orgUnit | 项目 | 是的 | 不 | String:Uid | ABCDEF12345 |
| createdAt | trackedEntity | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| createdAtClient | status | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | orgUnit | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAtClient | createdAt | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 例 | createdAtClient | 是的 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| To retrieve an event with a specific ID: | updatedAt | 不 | 是的 | 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 | 不 | 不 | 是的 | Boolean |
| 跟进 | occurredAt | 不 | 不 | Boolean | Default: False, True |
| deleted | completedAt | 不 | 是的 | Boolean | Date:ISO 8601 |
| geometry | completedBy | 不 | 不 | GeoJson | {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} |
| 日期时间 | 跟进 | 不 | 不 | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | 不 | 是的 | 用户 | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | 用户 | String:Any |
| 属性 | storedBy | 不 | 不 | 是的 | String:Uid |
| 用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。 | createdBy | 不 | 不 | 是的 | 用户 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | updatedBy | 不 | 不 | 不 | String:Uid |
| ABCDEF12345 | 属性 | 不 | 是的 | 不 | 用户 |
See Attribute
### events
A list of events owned by the enrollment.
在 API 中,最大的区别在于所有事件要么连接到相同的注册("事件程序"),要么连接到不同的注册("跟踪程序")。
事件程序")或不同的程序("跟踪程序")。下表将
指出这两者之间的任何特殊情况。
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| The message text. | List of Relationship | 不 | 是的 | String:Uid | ABCDEF12345 |
| 项目阶段 | List of Note | 是的 | 不 | String:Uid | ABCDEF12345 |
| 文本 | Property | 是的 | 是的 | String:Uid | ABCDEF12345 |
| 项目 | 仅用于读取数据。拥有该事件的注册项目类型。 | 不 | 是的 | String:Uid | ABCDEF12345 |
| storeCopy | 项目阶段 | 不 | 不 | String:Uid | ABCDEF12345 |
| 用户友好型消息,说明操作是否成功。 | 事件的状态。默认为 "ACTIVE"。 | 不 | 不 | DateTime | String:Uid |
| orgUnit | 项目 | 是的 | 不 | String:Uid | ABCDEF12345 |
| createdAt | trackedEntity | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| createdAtClient | status | 不 | 不 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | orgUnit | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAtClient | createdAt | 不 | 不 | 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. | 事件计划发生的时间戳。 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| To retrieve an event with a specific ID: | updatedAt | 是的 | 是的 | 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 |
| 日期时间 | scheduledAt | 不 | 不 | 是的 | Boolean |
| 跟进 | occurredAt | 不 | 不 | Boolean | Date:ISO 8601 |
| deleted | completedAt | 不 | 是的 | Boolean | Date:ISO 8601 |
| geometry | completedBy | 不 | 不 | GeoJson | {<br>"type": "POINT",<br>"coordinates": [123.0, 123.0]<br>} |
| 日期时间 | 跟进 | 不 | 不 | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | 不 | 是的 | 用户 | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | 用户 | String:Any |
| > **注**
>
> 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。
>
> 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo
>
> 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | storedBy | 不 | 不 | String:Uid | ABCDEF12345
| boolean | createdBy | 不 | 不 | String:Uid | ABCDEF12345
| 布尔 | updatedBy | 不 | 不 | 用户 | 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 | 不 | 是的 | 不 | 用户 |
### 人际关系 { #relationships }
dataValues
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| A list of relationships connected to the event. | 不 | 不 | 是的 | String:Uid | ABCDEF12345 |
| Notes connected to the event. It can only be created. | 不 | 是的 | 是的 | String:Uid | ABCDEF12345 |
| `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 | 不 | 不 | 不 | 类型 |
| createdAt | relationship | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | relationshipType | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| createdAtClient | relationshipName | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| Sibling | createdAt | 不 | 不 | Boolean | Date:ISO 8601 |
| YYYY-MM-DDThh:mm:ss | updatedAt | 是的 | 是的 | 是的 | Date:ISO 8601 |
YYYY-MM-DDThh:mm:ss
### 属性 { #attributes }
属性是描述被跟踪实体的值。属性可以通过
通过被跟踪实体类型或项目关联。这意味着属性既可以是被追踪实体的一部分,也可以是注册的一部分。
跟踪实体和注册的一部分。重要的是,一个属性只能有一个值,即使一个
一个属性只能有一个值,即使一个被跟踪实体有多个注册表来定义该属性。这是因为
实体最终拥有属性值。
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| 不 | 不 | 是的 | 是的 | String:Uid | ABCDEF12345 |
| 码 | 是的 | 不 | 不 | 不 | 属性 |
| 属性是描述被跟踪实体的值。属性可以通过
通过被跟踪实体类型或项目关联。这意味着属性既可以是被追踪实体的一部分,也可以是注册的一部分。
跟踪实体和注册的一部分。重要的是,一个属性只能有一个值,即使一个
一个属性只能有一个值,即使一个被跟踪实体有多个注册表来定义该属性。这是因为
实体最终拥有属性值。 | Property | 不 | 不 | 不 | 名称 |
| createdAt | attribute | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | 码 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 日期时间 | displayName | 不 | 不 | 不 | Boolean |
| 名称 | createdAt | 不 | 不 | DateTime | Date:ISO 8601 |
| 价值 | updatedAt | 不 | 不 | 不 | Boolean |
YYYY-MM-DDThh:mm:ss
### storedBy
Client reference for who stored/created the value.
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| 最小最大数据元素 | 不 | 是的 | 是的 | String:Uid | ABCDEF12345 |
| 价值 | 不 | 不 | 不 | 不 | 123 |
| 日期时间 | While attributes describe a tracked entity, data values describe an event. | 不 | 不 | Boolean | Immutable |
| createdAt | 例 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| updatedAt | 码 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 日期时间 | displayName | 不 | 不 | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | 不 | 是的 | 用户 | String:Any |
| Latitude of a `Point` type of Geometry | updatedAt | 不 | 是的 | 用户 | String:Any |
YYYY-MM-DDThh:mm:ss
### 笔记 { #notes }
Client reference for who stored/created the value.
不
不
String:Any
John Doe
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| updatedBy | Only for reading data. User that last updated the object. Set on the server. | 不 | 是的 | String:Uid | ABCDEF12345 |
| 价值 | 笔记 | 是的 | 是的 | 不 | 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 | 不 | 是的 | Date:ISO 8601 | YYYY-MM-DDThh:mm:ss |
| 日期时间 | note | 不 | 不 | 不 | Boolean |
| GET /api/metadata/proposals/ | createdAt | 不 | 是的 | 用户 | String:Any |
### 用户数 { #users }
| 指标组 | 描述 | 需要 | 是的 | 类型 | 例 |
|---|---|---|---|---|---|
| storedByDataValue | Client reference for who stored/created the note. | 不 | 是的 | String:Uid | ABCDEF12345 |
| 用户名 | Only for reading data. User that created the object. Set on the server. | 不 | 是的 | 不 | 123 |
| {<br>"uid": "ABCDEF12345",<br>"username": "username",<br>"firstName": "John",<br>"surname": "Doe"<br>} | Users | 不 | 是的 | 不 | Immutable |
| 类型 | 例 | 不 | 是的 | 不 | 是的 |
String:Uid
## ID 计划{ #id-schemes }
用户名
Username used by the user.
* Yes*
* 是的
* String:Any
firstName
Only for reading data. First name of the user.
* 不
* 是的
String:Any
John
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.
* 追踪实体
* 类型
* 大事记
* 人际关系
* [tracked entity export](tracker.md#webapi_tracker_export_tracked_entities)
### [event export](tracker.md#webapi_tracker_export_events)
跟踪器导入项目支持以下参数:
| existing tracked entity UIDs | 描述 | 类型 | `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: | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | 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](#tracked_entity_attribute_filtering) |
| 数据元素标识方案 | enrollmentEnrolledBefore | DateTime | Enum | importMode |
| programStageIdScheme | [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) | DateTime | Enum |importMode |
| 程序标识方案 | 用于项目引用的 IdScheme。默认为 `idScheme` 参数。 | DateTime | Enum | importMode |
| 程序阶段标识方案 | 用于项目阶段引用的 IdScheme。默认为 `idScheme` 参数。 | 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 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | 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 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | 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 | 如果为 "true",它将跳过运行导入的任何项目规则 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | flushMode |
#### 同步和异步{ #sync-and-async }
Enum
`FULL`, `FAIL_FAST`, `SKIP`
`FULL`
### 有效载荷{ #payload }
导入项目支持 *flat* 和 *nested* 有效载荷。
#### 扁平有效载荷{ #flat-payload }
`true`, `false`
`false`
#### 嵌套有效载荷{ #nested-payload }
If true, it will skip running any side effects for the import
Boolean
`true`, `false`
### 创建{ #create }
skipRuleEngine
### 更新{ #update }
Boolean
`true`, `false`
`false`
#### 更新属性值{ #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](tracker.md#webapi_tracker_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.
```json
{
"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"
}
]
}
Delete data values
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:
| 默认值 | 描述 | 例 |
|---|---|---|
| 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:
| 默认值 | 描述 | 例 |
|---|---|---|
fields | > 注 | |
| > | ||
| > 这些端点依赖于应用项目内存中存储的信息。这意味着信息 | ||
| > 在某些情况下,如应用项目重启或大量 | ||
| > 导入请求。 | ABCDEF12345 | |
| ``` | ||
| 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
reportMode
注
当引用跟踪器对象的
uid时,它们在 有效载荷。例如,被跟踪实体的uid在有效载荷中的名称是 跟踪实体"。注册"、"事件 "和 "关系 "也是如此、 事件和关系。如果有效载荷中没有提供 uid,导入过程将生成新的 uid。这意味着 错误报告可能会引用一个不存在于有效负载中的 uid。
错误代表有效载荷中存在导入项目无法规避的问题。任何错误都会 阻止数据导入。另一方面,警告是指可以安全规避的问题。 但应让用户知道发生了这种情况。警告不会阻止数据 无法导入。
统计{ #statistics }¶
Request example
响应示例:
{
"stats": {
"created": 2,
"updated": 2,
"deleted": 1,
"ignored": 5,
"total": 10
}
}
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.
Note
If the import is performed using the AtomicMode "OBJECT", where the import will import any data without validation errors, the overall status will still be
ERRORif any errors were found.
信息{ #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 }¶
{
"validationReport": {
"errorReports": [
{
"message": "Could not find TrackedEntityType: `Q9GufDoplCL`.",
"errorCode": "E1005",
"trackerType": "TRACKED_ENTITY",
"uid": "Kj6vYde4LHh"
}
],
"warningReports": [
]
}
}
| 默认值 | 描述 |
|---|---|
| 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.
Bundle report
When the import is completed, the bundleReport contains all the tracker objects imported. | An example for TRACKED_ENTITY: | 描述 |
|---|---|---|
| E1000 | 信息 | If the import ended abruptly, the message would contain further information in relation to what |
| happened. | ||
| E1001 | 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 | |
| E1002 | FULL | Returns everything from WARNINGS, plus timingsStats |
| WARNINGS | Returns everything from ERRORS, plus warningReports in validationReports | |
| E1005 | Returns only errorReports in validationReports | In addition, all reportModes will return status, stats, bundleReport and message when |
| applicable. | ||
| E1006 | 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 | |
| E1007 | 描述 | E1000 |
User: {0}, has no write access to OrganisationUnit: {1}. | 项目阶段 {0} 没有引用项目。检查项目阶段配置 | |
| E1009 | 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} |
| E1010 | TrackedEntity: {0}, already exists. | 系统无法找到在事件有效负载中指定了 uid {0} 的项目。这也可能意味着登录用户无法访问特定项目。 |
| E1011 | User: {0}, has no write access to TrackedEntity: {1}. | E1005 |
| E1012 | 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 |
| E1013 | 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 |
| E1014 | Mismatch between value type of a TrackedEntityAttribute and its provided attribute value. The actual validation error will be displayed in {1}. | E1008 |
| E1015 | E1009 | File resource: {0}, has already been assigned to a different object. |
| E1016 | E1010 | 根据项目 {1} 配置,一个 TrackedEntity 只能注册该项目一次。看起来 TrackedEntity {0} 已经在该项目中注册过一次。因此不能再添加另一个注册。 |
| E1018 | E1011 | 有效负载中缺少被定义为项目强制属性的属性值。确保在有效负载中提供强制属性的属性值。 |
| E1019 | E1012 | 注册有效负载中指定的属性 uid {0} 与项目无关。 |
| E1020 | E1013 | Could not find ProgramStage: {0}, linked to Event. |
| E1021 | E1014 | 事件发生日期不能是未来日期,除非项目在配置中允许这样做。 |
| E1022 | E1015 | 项目被配置为接受与注册有效负载中提供的不同的 TrackedEntityType uid。 |
| E1023 | E1016 | 项目已配置 DisplayIncidentDate,但在有效负载中为空。 |
| E1025 | E1018 | Attribute: {0}, is mandatory in program {1} but not declared in enrollment {2}. |
| E1029 | E1019 | 事件有效载荷使用项目 {1},该项目未配置为可被组织单位 {0} 访问。 |
| E1030 | E1020 | Enrollment date: {0}, cannot be a future date. |
| E1031 | E1021 | Incident date: {0}, cannot be a future date. |
| E1032 | E1022 | |
| E1033 | 项目被配置为接受与注册有效负载中提供的不同的 TrackedEntityType uid。 | |
| E1039 | DisplayIncidentDate is true but property occurredAt is null. | 特定注册的 ProgramStage 已存在一个事件。由于项目阶段被配置为不可重复,因此无法为同一项目阶段添加另一个事件。 |
| E1041 | Property enrolledAt is null. | 注册有效载荷包含一个项目 {1},该项目未配置为可被组织单位 {0} 访问。 |
| E1043 | Event OrganisationUnit: {0}, and Program: {1}, don't match. | 没有 "F_EDIT_EXPIRED "权限的用户无法更新已过期的事件,因为该事件已在其项目中配置。 |
| E1046 | 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. |
| E1047 | Event occurredAt date is missing. | OccurredAt property is either null or has an invalidate date format in the payload. |
| E1049 | Event: {0}, do not exist. | E1033 |
| E1050 | 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 "权限的用户无法更新已过期的事件,因为该事件已在其项目中配置。 | AttributeOptionCombo {0} 不在事件项目类别组合 {1} 中。 | |
| E1055 | 由于项目具有非默认的 CategoryCombo,因此不允许使用默认的 AttributeOptionCombo。 | 项目被配置为包含非默认 CategoryCombo,但请求使用了默认 AttributeOptionCombo。 |
| E1056 | Event occurredAt or scheduledAt has a value that is earlier than the PeriodType start date. | E1049 |
| E1057 | The system could not find an OrganisationUnit with uid {0}. | E1050 |
| E1063 | ScheduledAt property in the Event payload is either missing or an invalid date format. | E1051 |
| E1064 | Event completedAt can only be passed in the payload if status is COMPLETED | E1052 |
| E1068 | Enrollment completedAt can only be passed in the payload if status is COMPLETED | E1054 |
| E1069 | E1055 | 系统无法找到注册有效负载中指定的项目。这也可能意味着用户没有项目的读取权限。 |
| E1070 | E1056 | Event date: {0}, is before start date: {1}, for AttributeOption: {2}. |
| E1074 | E1057 | |
| E1075 | The CategoryOption has an end date configured, the Event date in the payload cannot be later than this end date. | |
| E1076 | TrackedEntity: {0}, does not exist. | |
| E1077 | 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. | |
| E1080 | Could not find TrackedEntity: {0}, linked to Enrollment. | The system could not find the TrackedEntity specified in the Enrollment payload. This might also mean that the user does not have read access to the TrackedEntity. |
| E1081 | Could not find Program: {0}, linked to Enrollment. | 系统无法找到注册有效负载中指定的项目。这也可能意味着用户没有项目的读取权限。 |
| E1082 | Could not find OrganisationUnit: {0}, linked to Enrollment. | The system could not find the OrganisationUnit specified in the Enrollment payload. |
| E1083 | FeatureType is missing. | E1075 |
| E1089 | E1076 | {0} {1} is mandatory and can't be null |
| E1090 | Attribute: {0}, text value exceed the maximum allowed length: {0}. | E1079 |
| E1091 | E1080 | 在项目共享配置中,用户没有该项目的写入权限。 |
| E1095 | E1081 | 在项目阶段共享配置中,用户没有写入该项目阶段的权限。 |
| E1096 | E1082 | 在项目共享配置中,用户没有该项目的读取权限。 |
| E1099 | E1083 | User: {0}, is not authorized to modify completed events. |
| E1100 | E1089 | Event: {0}, references a Program Stage {1} that does not belong to Program {2}. |
| E1102 | 用户: {0}, 没有访问被跟踪实体的权限:{1}, 项目:{2}, 组合。 | 当用户的组织单位不拥有该特定项目的 TrackedEntity 的所有权时,就会抛出此错误。拥有 TrackedEntity-Program 组合的组织单位应属于用户的捕获范围(有时是搜索范围)。 |
| E1103 | E1091 | User: {0}, has no data write access to Program: {1}. |
| E1104 | E1095 | 与项目相关联的 TrackedEntityType 的共享配置规定,用户没有数据读取权限。 |
| E1112 | E1096 | User: {0}, has no data read access to Program: {1}. |
| E1113 | E1099 | User: {0}, has no write access to CategoryOption: {1}. |
| E1114 | E1100 | User: {0}, is lacking 'F_TEI_CASCADE_DELETE' authority to delete TrackedEntity: {1}. |
| E1115 | E1102 | |
| E1116 | 当用户的组织单位不拥有该特定项目的 TrackedEntity 的所有权时,就会抛出此错误。拥有 TrackedEntity-Program 组合的组织单位应属于用户的捕获范围(有时是搜索范围)。 | E1103 |
| E1117 | 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. | |
| E1118 | User: {0}, has no data read access to program: {1}, TrackedEntityType: {2}. | |
| E1119 | E1112 | |
| E1120 | 项目阶段 {0} 不允许用户赋值 | 事件有效载荷具有 assignedUserId,但项目阶段未配置为允许用户分配。 |
| E1121 | If the Enrollment is soft deleted, no modifications on it are allowed. | |
| E1122 | TrackedEntity: {0}, is already deleted and can't be modified. | |
| E1123 | E1115 | |
| E1124 | E1116 | |
| E1125 | This might also mean the CategoryOption is not accessible to the user. | |
| E1117 | CategoryOptionCombo does not exist for given category combo and category options: {0}. | |
| E1118 | Assigned user {0} is not a valid uid. | |
| E1119 | A Tracker Note with uid {0} already exists. | |
| E1300 | 由项目规则生成 ({0}) - {1} | |
| 事件有效载荷具有 assignedUserId,但项目阶段未配置为允许用户分配。 | 由项目规则生成 ({0}) - 不存在强制性数据元素 {1} | |
| E1302 | E1122 | |
| E1303 | E1123 | |
| E1304 | E1124 | |
| E1305 | 数据元素 {0} 不是 {1} 项目阶段的一部分 | |
| E1306 | 由项目规则 ({0}) 生成 - 不存在强制属性 {1} | |
| E1307 | 由项目规则生成 ({0}) - 无法为数据元素 {1} 赋值。提供的值必须为空或与计算值 {2} 匹配。 | |
| E1308 | 由项目规则 ({0}) 生成 - 数据元素 {1} 被事件 {2} 替换 | |
| E1309 | 由项目规则 ({0}) 生成 - 无法为属性 {1} 赋值。提供的值必须为空或与计算值 {2} 匹配。 | |
| E1310 | 由项目规则 ({0}) 生成 - 属性 {1} 被替换为 {2} | |
由项目规则生成 ({0}) - 不存在强制性数据元素 {1} | E1302 | DataElement {0} is not valid: {1} |
| E1303 | 由项目规则 ({0}) 生成 - 数据元素 {1} 是必填项,不能删除。 | |
| E1304 | DataElement {0} is not a valid data element | |
| E1305 | 数据元素 {0} 不是 {1} 项目阶段的一部分 | |
| E1306 | 由项目规则 ({0}) 生成 - 属性 {1} 是强制性的,不能删除。 | |
| E4000 | 由项目规则生成 ({0}) - 无法为数据元素 {1} 赋值。提供的值必须为空或与计算值 {2} 匹配。 | |
| E4001 | 由项目规则 ({0}) 生成 - 数据元素 {1} 被事件 {2} 替换 | |
| E4006 | 由项目规则 ({0}) 生成 - 无法为属性 {1} 赋值。提供的值必须为空或与计算值 {2} 匹配。 | |
| E4010 | 由项目规则 ({0}) 生成 - 属性 {1} 被替换为 {2} | |
| E4012 | Event {0} of an enrollment does not point to an existing tracked entity. The data in your system might be corrupted | |
| E4014 | E1314 | |
由项目规则 ({0}) 生成 - 数据元素 {1} 是必填项,不能删除。 | E1315 | |
Status {0} does not allow defining data values. Statuses that do allow defining data values are: {1} | E1316 | |
No event can transition from status {0} to status {1}. | E1317 | |
由项目规则 ({0}) 生成 - 属性 {1} 是强制性的,不能删除。 | E4000 | |
Relationship: {0} cannot link to itself | E4001 | |
Relationship Item {0} for Relationship {1} is invalid: an Item can link only one Tracker entity. | E4006 | 导入项目无法持久化跟踪器对象,因为引用无法持久化。 |
| E9999 | 不适用 | E4012 |
Could not find {0}: {1}, linked to Relationship.¶
使用跟踪器导入项目导入数据时,会执行一系列验证,以确保数据的有效性。 数据的有效性。本节将介绍执行的一些不同类型的验证 以便更好地了解导入验证是否失败。
所需属性{ #required-properties }¶
E4015
Relationship: {0}, already exists.
- E4016
- Relationship:
{0}, do not exist. - 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 }¶
属性和数据值分别是被跟踪实体和事件的一部分。但是 属性可以通过类型(TrackedEntityType)或项目(Program)链接到被跟踪实体。 项目(Program)。此外,属性也可以是唯一的。
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¶
使用自动生成唯一值的跟踪实体属性 应用项目可使用三个端点来生成和保留这些值。
所需数值{ #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.
而组织单位则具有双重目的。它主要确保数据 只有在导入用户捕获范围内的组织单位时,才能导入数据。 范围内的组织单位导入数据。其次,组织单位还用于限制可用的项目。这 也就是说,如果你试图为一个组织单位导入数据,而该组织单位无法访问你要导入的项目,那么导入就会失败。 项目,则导入将无效。
{
"REQUIRED": [
"ORG_UNIT_CODE"
],
"OPTIONAL": [
"RANDOM"
]
}
产生价值终点¶
在线网络应用项目和其他客户端可使用该端点生成一个唯一值,以供立即使用。 生成的值在生成时保证是唯一的,并保留 3 天。 如果您的 TextPattern 包含必填值,可以将它们作为参数传递。
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.
Mandatory attributes and data values are also checked on creation, on update mandatory attributes and data values are not required in the payload. Currently, removing mandatory attributes and data values is never allowed. Some use-cases require values to be sent separately, while others require all values to be sent as one. Programs can be configured to either validate mandatory attributes ON_COMPLETE or ON_UPDATE_AND_INSERT to accommodate these use-cases.
{
"ownerObject": "TRACKEDENTITYATTRIBUTE",
"ownerUid": "Gs1ICEQTPlG",
"key": "RANDOM(X)-OSL",
"value": "C-OSL",
"created": "2018-03-02T12:01:36.680",
"expiryDate": "2018-03-05T12:01:36.678"
}
产生并保留价值终点¶
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)
User-assignable events
[
{
"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"
}
]
保留值¶
目前无法通过 api 访问保留值,但是,它们 由generate 和generateAndReserve 端点返回。这 下表解释了保留值对象的属性:
Generated tracked entity attributes { #webapi_generate_te_attributes }
| 指标组 | 描述 |
|---|---|
| A TextPattern may include variables that change based on different factors. Some of these factors are unknown to the server; | |
| thus, the values for these variables must be supplied when generating and reserving values. | This endpoint returns a map of required and optional values that the server will inject into the TextPattern when generating new values. |
| Required variables must be supplied for generation, whereas optional variables should only be provided if necessary. | |
| ``` | |
| GET /api/33/trackedEntityAttributes/Gs1ICEQTPlG/requiredValues | |
|json | |
| { | |
| "REQUIRED": [ | |
| "ORG_UNIT_CODE" | |
| ], | |
| "OPTIONAL": [ | |
| "RANDOM" | |
| ] | |
| } | |
| ``` | |
| 产生价值终点 { #webapi_generate_values } | 在线网络应用项目和其他客户端可使用该端点生成一个唯一值,以供立即使用。 |
| 生成的值在生成时保证是唯一的,并保留 3 天。 | |
| 如果您的 TextPattern 包含必填值,可以将它们作为参数传递。 | |
| 价值 | ``` |
| GET /api/33/trackedEntityAttributes/Gs1ICEQTPlG/generate?ORG_UNIT_CODE=OSLO | |
| ``` | |
| GET /api/metadata/proposals?filter=status:eq:ACCEPTED | 产生并保留价值终点 { #webapi_generate_reserve_values } |
| Offline clients can use this endpoint to reserve a number of unique IDs for later use when | |
| registering new tracked entities. The number of IDs to generate can be specified with the | |
numberToReserve parameter (default is 1). | To override the default expiration time of 60 days, add ?expiration=<number-of-days> to the request. |
过期的预订每天都会被删除。如果模式发生变化,则值 存储数据时将接受已经保留的数据,即使 它们与新模式不匹配,只要预订没有 已到期。
```json¶
[ { "ownerObject": "TRACKEDENTITYATTRIBUTE", "ownerUid": "Gs1ICEQTPlG", "key": "RANDOM(X)-OSL", "value": "B-OSL", "created": "2018-03-02T13:22:35.175", "expiryDate": "2018-05-01T13:22:35.174" }, { "ownerObject": "TRACKEDENTITYATTRIBUTE", "ownerUid": "Gs1ICEQTPlG", "key": "RANDOM(X)-OSL", "value": "Q-OSL", "created": "2018-03-02T13:22:35.175", "expiryDate": "2018-05-01T13:22:35.174" }, { "ownerObject": "TRACKEDENTITYATTRIBUTE", "ownerUid": "Gs1ICEQTPlG", "key": "RANDOM(X)-OSL", "value": "S-OSL", "created": "2018-03-02T13:22:35.175", "expiryDate": "2018-05-01T13:22:35.174" } ]
用户可以配置 [项目规则](metadata.md#webapi_program_rules),为跟踪器表单添加条件行为。
跟踪器表单添加条件行为。除了在跟踪器应用项目中运行这些规则外,跟踪器导入项目也会
也会运行这些规则中的一部分。由于导入项目也会运行这些规则,因此我们可以确保
多一层验证。
并非所有项目规则操作都受支持,因为它们只适用于前台演示。
受支持的项目规则操作的完整列表如下。
| Table: Reserved values | 支持的 |
| --- | --- |
| 设置必填字段 | |
| 淋浴器 | |
| 日程消息 | |
| 名称 | |
| 始终有效 | 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 |
项目规则在导入项目中的评估方式与在跟踪应用项目中的评估方式相同。
总之,执行项目规则时会考虑以下条件:
* 项目规则必须与导入的数据相关联。例如,项目阶段或数据元素。
* 项目规则条件必须为真。
项目规则的结果取决于这些规则中定义的操作:
* 项目规则操作可能会导致两种不同的结果:警告或错误。
* X
* SHOWERROR
* X
* WARNINGONCOMPLETION
* X
* ERRORONCOMPLETION
* X
此外,项目规则也会产生副作用,如发送和计划信息。更多
有关副作用的更多信息,请参阅下一节。
> **注**
>
> 在导入过程中,可以使用 `skipProgramRules` 参数跳过项目规则。
### X
SENDMESSAGE
X
SCHEDULEMESSAGE
| X | 支持的 | 描述 |
|--- | --- | --- |
| 项目规则条件必须为真。 | DISPLAYKEYVALUEPAIR | 项目规则操作可能会导致两种不同的结果:警告或错误。 |
| Errors will make the validation fail, while the warnings will be reported as a message in the import summary. | DISPLAYKEYVALUEPAIR | 项目规则可触发通知。请注意,这些通知是通过 DHIS2 规则引擎生成的项目规则效果的一部分。 |
`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 }
要使用这一功能,相关项目阶段必须启用用户分配功能,而且为用户提供的 uid
必须是一个有效的现有用户。
## 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:
- 追踪实体
- 大事记
- 类型
- 人际关系
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 }
#### 类型
|允许值|类型|`order`|描述|
|---|---|---|---|
|定义要返回的页码。|整数|`paging`|追踪实体|
|定义每页返回的元素数量。|整数|`paging`|`Boolean`|
|Common request parameters|Boolean|跟踪器或事件项目的标识符。该参数为必填参数。|Events: `GET /api/tracker/events`|
|true|Boolean|跟踪器或事件项目的标识符。该参数为必填参数。|Request parameter|
|iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。|串||描述|
page
#### 组织单位选择模式{ #organisation-unit-selection-modes }
Any positive integer
#### Page number to return. Defaults to 1.
pageSize
##### 例子 { #examples }
| Any positive integer | 描述 |
| --- | --- |
| 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`<br><br>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
- `GET /api/tracker/trackedEntities`
- Field filter responses { #webapi_tracker_field_filter }
- `GET /api/tracker/trackedEntities/{id}`
- 例子
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
GET /api/tracker/trackedEntities - retrieves tracked entities matching given criteria - GET /api/tracker/trackedEntities/{id} - retrieves a tracked entity given the provided ID - If not otherwise specified, JSON is the default response for the GET method. The API also supports CSV export for single and collection endpoints. Furthermore, compressed CSV types is an option for the collection endpoint. - CSV - In the case of CSV, the fields request parameter has no effect, and the response will always contain the following fields: - trackedEntity (UID) - trackedEntityType (identifier in requested idScheme) - createdAt (Datetime) - createdAtClient (Datetime) updatedAt (Datetime)
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)
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| 数据值 | 串 | value (String) | 将响应缩小到符合给定过滤器的跟踪实体。过滤器是以冒号分隔的属性或属性 UID,带有可选的操作符和值对。例如:filter=H9IlTX2X6SL:sw:A,操作符以sw开头,后跟一个值。过滤器如 filter=H9IlTX2X6SL:!null 会返回给定属性有值的所有事件。特殊字符(如 +)需要按百分比编码,因此应使用 %2B 代替 +。作为过滤值一部分的字符 : 或 ,,需要用 / 转义。同样,/ 也需要转义。允许对同一属性使用多个操作符,如 filter=AuPLng5hLbE:gt:438901703:lt:448901704。 |
| createdBy (Username of user) | 串 | See Tracked Entities and 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 |
| 项目 | 串 | 项目 UID | 跟踪项目的 UID ,响应中的被跟踪实体必须加入该项目。 |
| See Events and 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. | 跟进 | ||
| 项目阶段 | 串 | Narrows response to tracked entities matching given filters. More on filters here | 项目阶段 UID ,响应中的被跟踪实体必须有事件。 |
| 跟进 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | orgUnitMode |
| 串 | Events CSV | ISO-8601 | 项目 |
| DateTime | Events CSV | ISO-8601 | programStatus deprecated for removal in version 43 use enrollmentStatus |
| DateTime | ISO-8601 | ISO-8601 | 项目阶段 |
| DateTime | 串 | The response is file events.json.gz or events.csv.gzip containing the events.json | |
or events.csv file. | 跟进 | ||
| DateTime | Events CSV | ISO-8601 | updatedAfter |
| DateTime | Events CSV | ISO-8601 | updatedBefore |
| DateTime | Events CSV | ISO-8601 | 给定项目的开始日期和时间以及发生时间和时间 |
| Duration | Events CSV | ISO-8601 | 给定项目中出现的结束日期和时间 |
| trackedEntityType | 串 | 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 | 指定项目中任何事件的状态 |
| 串 | Events CSV | ISO-8601 | assignedUserMode |
| 串 | Events CSV | ISO-8601 | assignedUsers |
| 串 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | order |
| 串 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | eventStatus |
| 方案 | DateTime | Enum | eventOccurredAfter |
| programStageIdScheme | DateTime | Enum | ISO-8601 |
DateTime
Only one parameter among trackedEntity, enrollment, event can be passed. | 描述 |
|---|---|
| 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. | 方案 |
| 全部 | UID, CODE, NAME, ATTRIBUTE:{uid} |
查询不区分大小写。以下规则适用于查询 参数。
- orgUnitIdScheme Enum
UID,CODE,NAME,ATTRIBUTE:{uid}指定(零或一)。- The available assigned user modes are explained in the following table.
- Table: Assigned user modes
- Mode
-
描述 CURRENT
-
过滤器项目只能指定一次。
请求示例{ #example-requests }¶
查询与特定组织单位和跟踪项目相关的所有被跟踪实体的方法如下 可以这样查询
NONE
Includes unassigned events only.
ANY
为过滤器指定了多个操作数和过滤器的查询 物品:
全部
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.
查询不区分大小写。以下规则适用于查询 参数。
要将程序注册日期指定为查询的一部分,请执行以下操作:
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.
| 所需值 | 描述 |
|---|---|
| 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 | 不等于(对整数/十进制值类型使用整数/数值语义 |
| ``` | |
| GET /api/tracker/trackedEntities?trackedEntityType=nEenWmSyUEp&orgUnits=DiszpKrYNg8&filter=w75KJ2mc4zz:IN:Scott;Jimmy;Santiago | |
| ``` | 不等于(对整数/十进制值类型使用整数/数值语义 |
| Supported binary operators: | 不如 |
| 在 | eq |
| true | ieq |
| true | 类似文本匹配,忽略大小写 |
| greater than, uses integer/number semantics for integer/decimal value types | gt |
| greater than or equal to (uses integer/number semantics for integer/decimal value types) | gt |
| 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 |
匹配是不区分大小写的,例如 eq 和 ieq (i 表示 `不区分大小写')的行为方式相同。
nieq
| 操作符 | 说明 | null | 没有值 | | ! | !null | 有值
被跟踪实体的回复{ #tracked-entities-response }¶
Operator
JSON{ #json }¶
null
has no value
!null
CSV{ #csv }¶
Tracked entity attribute filtering { #tracked_entity_attribute_filtering }
Filtering by a tracked entity attribute narrows the response to tracked entities matching given filters. A filter is a colon separated property or attribute UID with optional operator and value pairs.
跟踪实体收集限制{ #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%2Binstead 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 likefilter=AuPLng5hLbE:gt:438901703:lt:448901704are allowed. Each tracked entity attribute can be configured with:
A minimum number of characters required to perform a search (0 means no minimum) -
在**项目或被跟踪实体类型**中返回的 TE 的最大数量:它限制了在**外部搜索时的结果。 的捕获范围**与指定的项目或跟踪实体类型。如果
would fail if the minimum character limit was set to 5 (since "John" has only 4 characters), or if theGET /api/tracker/trackedEntities?program=IpHINAT79UW&orgUnits=DiszpKrYNg8&filter=w75KJ2mc4zz:EQ:JohnEQoperator was blocked for the specified tracked entity attribute. 该限制可在维护应用项目中进行配置。 -
The API supports CSV and JSON response for
GET /api/tracker/trackedEntities.
JSON格式
-
Responses can be filtered on desired fields, see 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:
请求语法¶
Tracked entities collection limits
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| 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 | ||
| 项目 | 串 | ``` | |
| GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,// | |||
| ``` | 在响应中包含项目属性(仅限用户可访问的属性) | ||
默认过滤器是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 }
uid
CSV{ #csv }¶
uid
Return the tracked entity with specified uid¶
项目
串
| 默认值 | 类型 | order |
|---|---|---|
fields | 串 | Include specified sub-objects in the response |
| 项目 | JSON格式 | 项目 UID(可选)。 |
| iasc 和 idesc 是不区分大小写的排序。如果需要对多个属性进行排序,请使用逗号将它们分开。 | JSON格式 | JSON格式 |
| 数据值 | 串 | CSV |
跟踪实体属性值更改日志{ #tracked-entity-attribute-value-change-logs }¶
Tracked entity attribute value change logs { #webapi_tracker_attribute_change_logs }
GET /api/tracker/trackedEntities/{uid}/changeLogs
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.
更改日志默认已启用,可在 dhis.conf 中配置,详见 [此处](../../sysadmin/reference/logging.md#install_changelog)。
注册{ #enrollments }¶
Allowed values
path /{uid}
GET /api/tracker/enrollments- Tracked entity
UID.
- Tracked entity
GET /api/tracker/enrollments/{id}String
注册信息收集端点 GET /api/tracker/enrollments¶
order
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| orgUnits | JSON格式 | 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 | JSON格式 | 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 |
| 程序 | JSON格式 | ``` | |
| GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,// | |||
| ``` | 登记加入的跟踪项目的标识符。该参数为必填参数。 | ||
programStatus 已过时,将在第 43 版中删除,使用 status | JSON格式 | The response is file events.json.gz or events.csv.gzip containing the events.json | |
or events.csv file. | Request parameter | ||
| 状态 | JSON格式 | The response is file events.json.gz or events.csv.gzip containing the events.json | |
or events.csv file. | Request parameter | ||
| 跟进 | boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | orgUnitMode` see orgUnitModes |
| 更新后 | 日期时间 | ISO-8601 | 项目 |
| 更新范围 | 持续时间 | ISO-8601 | 项目状态 已过时,将在第 43 版中移除,使用 status |
| 注册后 | 日期时间 | ISO-8601 | status |
| 注册前 | 日期时间 | ISO-8601 | 跟进 |
| 跟踪实体类型 | JSON格式 | ``` | |
| GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,// | |||
| ``` | 被跟踪实体类型的标识符 | ||
trackedEntity | JSON格式 | ``` | |
| GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=lxAQ7Zs9VYR&filter=DanTR5x0WDK:EQ:/:/,// | |||
| ``` | programStatus deprecated for removal in version 43 use enrollmentStatus | ||
extent of fields selected by * field selector | JSON格式 | 描述 | updatedWithin |
| 注册 | JSON格式 | Only enrollments updated since given duration | enrolledAfter |
| 包括删除 | Boolean | IdScheme used for category option references. Defaults to the idScheme parameter. |
查询不区分大小写。以下规则适用于查询参数。
- 必须使用
orgUnit参数(一个或多个)指定至少一个组织单位,或指定 orgUnitMode=ALL 。 - 只能指定 program 和 trackedEntity 参数中的一个(0 或 1)。
- 如果指定了 programStatus,则还必须指定 program。
- 如果指定了*enrollmentStatus*,则还必须指定*program*。
- 如果指定了*followUp*,则还必须指定*program*。
- 如果指定了 enrolledAfter 或 enrolledBefore,则还必须指定 program。
请求示例{ #example-requests }¶
查询与特定组织单位关联的所有注册 看起来像这样:
Only enrollments older than this date
trackedEntity
串
要将程序注册日期指定为查询的一部分,请执行以下操作:
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.
回应格式¶
串
Comma-separated list of enrollment UIDs.
注册单一对象端点{ #enrollments-single-object-endpoint }¶
includeDeleted
Boolean
请求语法¶
查询不区分大小写。唯一的要求是必须提供项目参数。
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| 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
类型
Allowed values
描述
活动 CSV{ #events-csv }¶
串
| 指标组 | 类型 |
|---|---|
| The message text. | 用户标识 |
| 用户友好型消息,说明操作是否成功。 | 串 |
| 项目 | Response format |
| 项目阶段 | Response format |
| 文本 | Response format |
| orgUnit | 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 |
| geometry | Property |
| 类型 | event |
| 用户标识 | status |
| 跟进 | 项目阶段 |
| deleted | 项目阶段 |
| createdAt | Events CSV |
| createdAtClient | Events CSV |
| updatedAt | Events CSV |
| updatedAtClient | Events CSV |
| 日期时间 | 用户名 |
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 | 用户名 |
| > 注 | |
| > | |
| > 以下属性可能使用了外部系统的引用,因此被特意排除在合并之外。如果这些字段出现问题,可能需要更新。 | |
| > | |
| > 指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | |
| > | |
| > 项目指标: aggregateExportCategoryOptionCombo & aggregateExportAttributeOptionCombo | Response format |
| boolean | Response format |
| 布尔 | 用户名 |
| 最小最大数据元素 | Response format |
| 价值 | 串 |
| 日期时间 | 用户名 |
| 日期时间 | 项目阶段 |
| 用户名 | 串 |
| DateTime | Events CSV |
| 用户名 | Events CSV |
ID
活动 GZIP{ #events-gzip }¶
身份证
活动 ZIP{ #events-zip }¶
用户名
事件收集端点 GET /api/tracker/events¶
ID
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| 项目 | 串 | storedByDataValue | 跟踪器或事件程序的标识符 |
| 项目阶段 | 串 | 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 |
| 类型 | 串 | 描述 | 将响应缩小到符合给定过滤器的跟踪实体。过滤器是以冒号分隔的属性或属性 UID,带有可选的操作符和值对。例如:filterAttributes=H9IlTX2X6SL:sw:A,操作符以sw开头,后跟一个值。过滤器如 filter=H9IlTX2X6SL:!null 会返回给定属性有值的所有事件。特殊字符(如 +)需要按百分比编码,因此应使用 %2B 代替 +。作为过滤值一部分的字符 : 或 ,,需要用 / 转义。同样,/ 也需要转义。允许对同一属性使用多个操作符,如 filterAttributes=AuPLng5hLbE:gt:438901703:lt:448901704。用户需要访问属性才能对其进行过滤。 |
| 跟进 | 项目阶段 | 跟踪器或事件项目的标识符。该参数为必填参数。 | 项目阶段 |
| storeCopy | 串 | storedByDataValue | programStatus deprecated for removal in version 43 use enrollmentStatus |
| orgUnit | 串 | 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 | ISO-8601 | trackedEntity |
| 串 | Events CSV | ISO-8601 | orgUnit |
| 串 | Events CSV | ISO-8601 | orgUnitMode see orgUnitModes |
| 串 | Events CSV | ISO-8601 | status |
| 串 | Events CSV | ISO-8601 | occurredAfter |
| DateTime | Events CSV | ISO-8601 | occurredBefore |
| DateTime | ISO-8601 | ISO-8601 | Include only items which are updated within the given duration. The format is ISO-8601#Duration |
| DateTime | 串 | The response is file events.json.gz or events.csv.gzip containing the events.json | |
or events.csv file. | scheduledBefore | ||
| DateTime | Events CSV | ISO-8601 | updatedAfter |
| DateTime | Events CSV | ISO-8601 | updatedBefore |
| DateTime | Events CSV | ISO-8601 | 给定项目的开始日期和时间 |
| Duration | Events CSV | ISO-8601 | 给定项目的结束日期和时间 |
| 方案 | DateTime | Enum | enrollmentEnrolledAfter |
| 数据元素标识方案 | DateTime | Enum | enrollmentEnrolledBefore |
| programStageIdScheme | DateTime | Enum | ISO-8601 |
| 程序标识方案 | DateTime | Enum | 用于项目引用的 IdScheme。默认为 idScheme 参数。 |
| 程序阶段标识方案 | DateTime | Enum | 用于项目阶段引用的 IdScheme。默认为 idScheme 参数。 |
| 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 | |
| 串 | Boolean | IdScheme used for category option references. Defaults to the idScheme parameter. | |
| Enum | 串 | order | 串 |
| Property | 串 | events | 串 |
Comma-separated list of event UIDs.
请求示例{ #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
查询某一项目和组织单位中发生日期最新的 10 个事件 - 通过分页和按发生日期降序排序的方法 通过分页和按发生日期降序排序:
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
attributeCategoryOptionsnorattributeCategoryOptions, 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:
GET /api/tracker/events?orgUnit=O6uvpzGd5pu&orgUnitMode=DESCENDANTS
CSV{ #csv }¶
GET /api/tracker/events?orgUnit=DiszpKrYNg8&program=eBAyeGv0exc
Query for all events with a certain program and organisation unit, sorting by scheduled date ascending:
Events single object endpoint GET /api/tracker/events/{uid}¶
查询某一项目和组织单位中发生日期最新的 10 个事件 - 通过分页和按发生日期降序排序的方法 通过分页和按发生日期降序排序:
请求语法¶
GET /api/tracker/events/{uid}?fields={fields}
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| ``` | |||
| 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:
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 }¶
应用项目接口支持对 GET /api/tracker/trackedEntities 的 CSV 和 JSON 响应
JSON{ #json }¶
GET /api/tracker/events/{uid}?fields={fields}
CSV{ #csv }¶
类型
Allowed values¶
描述
uid
| 默认值 | 类型 | 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.
更改日志默认已启用,可在 dhis.conf 中配置,详见 此处。
人际关系¶
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 }¶
| 允许值 | 类型 | order | 描述 |
|---|---|---|---|
| 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 |
| 串 | Boolean | 跟踪器或事件项目的标识符。该参数为必填参数。 | 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]])
Include specified sub-objects in the response
在访问注册数据时,必须首先访问被跟踪实体。 首先。通过共享设置项目、跟踪实体类型和跟踪实体属性,可以控制对跟踪实体的访问。 类型和跟踪实体属性的共享设置来控制对跟踪实体的访问。一旦访问了注册,就有可能访问事件 数据,这同样取决于项目阶段和数据元素共享设置。
另一个需要考虑的关键点是如何规划对不同项目阶段的访问。 有时,我们可能需要向特定用户组(实验室技术人员)授予访问特定阶段的权限,如 例如 "实验室结果")的访问权限。在这种情况下,我们可以 为 "实验室结果 "阶段提供数据写入访问权限,可能为一个或多个阶段提供数据读取 访问权限,以防我们希望实验室技术人员读取数据。 如果我们希望实验室技术人员读取其他医疗结果,则可以提供数据写入访问权限;如果我们 认为实验室技术人员没有必要查看数据,则可以不提供访问权限。 如果我们认为实验室技术人员没有必要查看实验室相关数据以外的数据,则不提供访问权限。
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. | 描述 |
|---|---|
| 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. | |
| 在访问注册数据时,必须首先访问被跟踪实体。 | |
| 首先。通过共享设置项目、跟踪实体类型和跟踪实体属性,可以控制对跟踪实体的访问。 | |
| 类型和跟踪实体属性的共享设置来控制对跟踪实体的访问。一旦访问了注册,就有可能访问事件 | |
| 数据,这同样取决于项目阶段和数据元素共享设置。 | 跟踪器会搜索与当前用户相关联的组织单位以及子层次结构中的所有组织单位。这包括用户可见的所有内容,包括搜索范围内的打开和已审核项目,以及用户捕获范围内受保护和已关闭项目中的数据。如果用户缺少搜索组织单元,系统会默认为捕获范围,确保用户始终可以访问至少一个范围。捕获范围是强制性的,是保证用户数据环境的基本要素。 |
| 全部 | 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:
请注意,与跟踪器对象相关的组织单位关联有四种类型。A 被跟踪实体有一个组织单位,通常称为注册组织单位。 注册有一个与之相关的组织单位。事件也有一个 关联。跟踪项目组合也有一个所有者组织单元。 组合。
Currently, there are six selection modes available: SELECTED, CHILDREN, DESCENDANTS, CAPTURE, ACCESSIBLE, and ALL.
例如,在没有项目上下文的情况下检索 "跟踪实体 "时,组织单位 范围适用于被跟踪实体的注册组织单位。而当 组织单位范围适用于所有者组织单位。 组织单位范围适用于所有者组织单位。
描述¶
SELECTED
请求跟踪实体而不指定项目时,响应将只包括 符合[元数据共享设置](#webapi_tracker_metadata_sharing)和以下标准之一的被跟踪实体 以下标准之一:
- 被跟踪的实体已加入用户可访问数据的至少一个项目,且用户 Specified organisation unit including immediate children, i.e. organisation units at the immediate level below.
- 被跟踪的实体没有加入用户有数据访问权的任何项目,但用户有 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
无法临时访问已配置为*CLOSED*访问级别的项目。 项目的临时访问权限。
全部
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¶
被跟踪实体有一个组织单位,通常称为注册组织单位。 注册有一个与之相关的组织单位。事件也有一个 关联。跟踪项目组合也有一个所有者组织单元。 组合。
跟踪器数据的处理受到额外的保护。除了通过共享设置 元数据和数据保护的标准功能外,Tracker 数据还通过额外的 访问级别保护机制。 目前,可为项目配置四种访问级别 项目:开放、审核、保护和关闭。
只有当用户尝试与计划数据(即 注册和活动数据。项目的不同访问级别配置是项目数据开放(或封闭)的程度。 项目数据的开放(或封闭)程度。需要注意的是,所有其他共享设置仍然有效、 访问级别只是访问控制的附加层。下面简要介绍 项目可配置的四种访问级别。
打开{ #open }¶
在所有访问级别中,该访问级别的限制最少。OPEN 项目中的数据可以 用户可以访问和修改 OPEN 项目中的数据,前提是所有者组织单元属于用户的搜索范围。 用户可以访问和修改 OPEN 项目中的数据。 使用此访问级别,可以访问和修改捕获范围之外的数据,而无需说明理由或承担后果。 无需任何理由或后果。
经审计的{ #audited }¶
被跟踪的实体已加入用户可访问数据的至少一个项目,且用户
受保护的{ #protected }¶
这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。 只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户 用户可以通过 打破玻璃 获得临时所有权。 玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。 他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。 访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时 时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。 获得临时访问权。
关闭{ #closed }¶
这是最受限制的访问级别。在访问级别为 如果所有者组织单位不在用户的捕获范围内,则无法访问 "关闭 "项目下记录的数据。 范围。在这种配置下,也无法打破玻璃或获得临时所有权。 请注意,仍有可能将所有权转移到另一个组织单位。只有 才能将 TrackedEntity-Program 组合的所有权转移给另一个组织单位。 另一个组织单位。如果所有权被转移,所有者组织单位将被更新。 跟踪实体
工作清单{ #working-lists }¶
工作列表允许用户保存筛选器和排序偏好,从而有效地组织工作流程。 首选项。每种类型的工作列表 实体、注册和事件都有专门的应用项目接口进行管理。
无法临时访问已配置为*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"]
| 指标组 | 描述 | 例 |
|---|---|---|
| 名称 | periodFrom | |
| 描述 | Protected | |
| 这种访问级别的限制稍多一些。受保护项目中的数据只有在所有者组织单位属于用户捕获范围的情况下才能被用户访问。 | ||
| 只有当所有者组织单位属于用户的捕获范围时,用户才能访问受保护项目内的数据。但是,如果用户 | ||
| 用户可以通过 打破玻璃 获得临时所有权。 | ||
| 玻璃](#webapi_tracker_ownership_override)获得临时所有权。用户必须说明为什么要访问手头的数据。 | ||
| 他们为什么要访问手头的数据。然后,系统会将理由和访问审核记录在案,并提供 3 个月的临时访问权限。 | ||
| 访问审计日志,并为用户提供 3 小时的临时访问权限。请注意,打破玻璃时 | ||
| 时,所有者组织单位保持不变,只有打碎玻璃的用户才能获得临时访问权。 | ||
| 获得临时访问权。 | Closed | |
| 这是最受限制的访问级别。在访问级别为 | ||
| 如果所有者组织单位不在用户的捕获范围内,则无法访问 "关闭 "项目下记录的数据。 | ||
| 范围。在这种配置下,也无法打破玻璃或获得临时所有权。 | ||
| 请注意,仍有可能将所有权转移到另一个组织单位。只有 | ||
| 才能将 TrackedEntity-Program 组合的所有权转移给另一个组织单位。 | ||
| 另一个组织单位。如果所有权被转移,所有者组织单位将被更新。 | ||
| 跟踪实体 | Working lists | 工作列表允许用户保存筛选器和排序偏好,从而有效地组织工作流程。 |
| 首选项。每种类型的工作列表 | ||
| 实体、注册和事件都有专门的应用项目接口进行管理。 | ||
| 项目 | 包含项目 ID 的对象。必须填写。 | Tracked entity working lists |
| Create, update and delete tracked entity working lists using | /api/trackedEntityInstanceFilters | Payload |
| Table: Payload | Property | 描述 |
例
| 指标组 | 描述 | 例 |
|---|---|---|
| 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 | 被跟踪实体的注册状态。可以是 "无"(任何注册状态)或 "ACTIVE"、"COMPLETED"、"CANCELLED"。 | |
| 跟进 | 项目 | |
| 是否在 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" |
| 项目阶段 | organisationUnit | "programStage": "a3kGcGDCuk6" |
| trackedEntityType | 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"}
| 指标组 | 描述 | 例 |
|---|---|---|
| 项目阶段 | 被跟踪实体需要返回哪个项目阶段的事件。 | "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. | 例 |
| 指标组 | 描述 | 例 |
|---|---|---|
| 项目阶段 | 被跟踪实体需要返回哪个项目阶段的事件。 | -15 |
"eaDH9089uMp" | eventStatus | 15 |
查询请求参数{ #query-request-parameters }¶
ACTIVE
| 查询参数 | 描述 |
|---|---|
| 项目 | 项目标识符。将筛选器限制在给定的项目中。 |
计划阶段工作清单{ #program-stage-working-lists }¶
"assignedUserMode": "PROVIDED"
assignedUsers
有效载荷{ #payload }¶
"assignedUsers":["DXyJmlo9rge"]
| Table: Period filter definition | 描述 | 例 |
|---|---|---|
| 名称 | periodFrom | |
| 描述 | Protected | |
| 项目 | 包含项目 ID 的对象。必须填写。 | Table: Tracked entity instance filters query parameters |
| 项目阶段 | 包含项目阶段 ID 的对象。必须填写。 | 项目 |
| 项目阶段查询标准 | /api/trackedEntityInstanceFilters | Create, update and delete program stage working lists using |
/api/programStageWorkingLists
| Payload | 描述 | 例 |
|---|---|---|
"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. |
| 跟进 | 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. |
| orgUnit | 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"]
| 指标组 | 描述 | 例 |
|---|---|---|
| 名称 | Output ordering of columns | "displayColumnOrder":["w75KJ2mc4zz","zDhUuAYrxNC"] |
| 描述 | Protected | "dataFilters":[{"dataItem": "GXNUsigphqK","ge": "10","le": "20"}] |
| 项目 | 项目的 uid。 | "项目":"a3kGcGDCuk6" |
| 项目阶段 | 项目阶段的 uid。 | "项目阶段": "a3kGcGDCuk6" |
| Create, update and delete event working lists using the following endpoint. | ``` | |
| /api/eventFilters | ||
| ``` | Payload |
| 指标组 | 描述 | 例 |
|---|---|---|
| 跟进 | 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"
| 指标组 | 描述 | 例 |
|---|---|---|
| 枚举(参见元数据和渲染类型表中的列表) | 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" } |
| 开始日期 | DateFilterPeriod object date filtering based on due date. | "dueDate": { "period": "LAST_WEEK", "type": "RELATIVE" } |
| 结束日期 | 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"
period
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"
| existing tracked entity UIDs | 描述 | 类型 | 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 | 描述 | --- | --- | | 400 | 描述 | 403 | 类型 | 404 | Allowed values | 409 | trackedEntities
List of tracked entities
List of string (separated by comma)
| existing tracked entity UIDs | 描述 | 类型 | order |
|---|---|---|---|
| 用户友好型消息,说明操作是否成功。 | To inspect individual potential duplicate records, use the following endpoint: | 不区分大小写的字符串结尾匹配 | To create a new potential duplicate, use this endpoint: |
| POST /api/potentialDuplicates | 描述 | --- | --- | | 400 | ```json { "original": "| 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
| existing tracked entity UIDs | 描述 | 类型 | `order` |
| --- | --- | --- | --- |
| 描述 | 类型 | 不区分大小写的字符串结尾匹配 | status |
Potential duplicate status
#### 合并策略 自动{ #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
#### 合并战略 MANUAL{ #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
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 }¶
项目通知模板允许您创建可根据不同类型事件发送的信息模板。 消息和主题模板会被转换为实际值,并发送到配置的目的地。 每个项目通知模板都会转化为 MessageConversation 对象或 ProgramMessage 对象,具体取决于收件人是外部还是内部。 这些中间对象将只包含翻译后的信息和主题文本。
项目通知模板中有几个配置参数对通知的正常运行至关重要。 这些参数的说明如下表所示。下表对这些参数进行了说明。
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 }¶
| 领域 | 需要 | 描述 | 译 |
|---|---|---|---|
| 名称 | 是的 | 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"] | |||
| } | |||
| ``` | 是的 | 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. | 不 | 项目通知模板允许您创建可根据不同类型事件发送的信息模板。 | |
| 消息和主题模板会被转换为实际值,并发送到配置的目的地。 | |||
| 每个项目通知模板都会转化为 MessageConversation 对象或 ProgramMessage 对象,具体取决于收件人是外部还是内部。 | |||
| 这些中间对象将只包含翻译后的信息和主题文本。 | 项目通知模板中有几个配置参数对通知的正常运行至关重要。 | ||
| 这些参数的说明如下表所示。下表对这些参数进行了说明。 | |||
| ``` | |||
| POST /api/programNotificationTemplates | |||
| ``` | 是的 | 表:项目通知模板有效载荷 | 领域 |
| 需要 | 是的 | Values | 名称 |
| 是的 | 不 | case-notification-alert | notificationTrigger |
| 是的 | 不 | ENROLLMENT | 假 |
不
检索和删除计划通知模板{ #retrieving-and-deleting-program-notification-template }¶
由于项目通知模板是元数据的一种,因此可以像其他元数据一样创建、更新和删除。
项目信息{ #program-messages }¶
是的
Message template string
发送程序信息¶
程序消息可以使用两个传递渠道发送:
- 短信(SMS)
- 电子邮件地址(EMAIL)
收件人{ #recipients }¶
程序消息可以发送给各种收件人:
- 不
- Which channel should be used for this notification. It can be either
SMS,EMAIL, orHTTP SMS- sendRepeatable
不
Whether notification should be sent multiple times
表:程序报文有效载荷{ #table-program-message-payload }¶
| 领域 | 需要 | 描述 | 译 |
|---|---|---|---|
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. | 是的 | 发送项目信息 | 项目消息可以使用两个传递渠道发送: |
| 文本 | 不 | Recipients | 项目消息可以发送给各种收件人: |
| The message text. | 不 | 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. |
| 是的 | 是的 | 表格项目报文有效载荷 | 领域 |
| 需要 | 不 | ProgramNotificationTemplate UID 用于交叉检查哪个项目消息属于哪个通知模板。 | enrollment |
| 是的 | 不 | Can be trackedEntity, organisationUnit, an array of phoneNumbers or an array of emailAddresses. | enrollment |
| 文本 | 是的 | Enrollment ID. | enrollment |
| 不 | 不 | 是否在 DHIS2 中存储一份项目信息副本。 | deliveryChannels |
查询程序信息¶
项目消息 API 支持使用特定请求参数查询消息。
SMS, EMAIL
要获取已发送的跟踪器信息列表,可使用以下端点。必须提供注册或事件 UID。
GET /api/messages/scheduled/sent?enrollment={uid}
GET /api/messages/scheduled/sent?event={uid}
notificationTemplate
不
ProgramNotificationTemplate UID 用于交叉检查哪个项目消息属于哪个通知模板。
Text.
项目消息 API 支持使用特定请求参数查询消息。您可以根据 过滤信息。所有请求都应使用 GET HTTP verb 来检索信息。
表格查询项目信息 API
| 默认值 | 网址 |
|---|---|
| 文本 | 是的 |
| The message text. | Text. |
| storeCopy | 不 |
| 是否在 DHIS2 中存储一份项目信息副本。 | false, true |
| 查询项目信息 | 项目消息 API 支持使用特定请求参数查询消息。 |