CDT Record
CDT records in Welkin are associated with a Patient. In REST terms, they are a sub-resource to the patient object
Each CDT record has a set of system fields associated with it and a set of custom fields that you will create in the designer.
Formula field type
Type formula is intended for calculating values at the time of receipt of the cdt record. The formula looks like a mathematical expression. See Example 1.
Example 1 of a simple formula
{
"formula": "(2 + 2) * 2"
}
Variables
The formula supports the mechanism of variables. This allows you to reference fields in CDT and substitute values into the formula at runtime. To refer to a field, you should specify the field name and enclose it in double curly brackets. An example of a field reference is {{some-cdt-field}}. See Example 2.
Example
Some cdt contains two integer fields named field-a and field-b. The formula for calculating the sum of these fields values is as follows.
Example 2 of a sum of fields values
{
"formula": "{{field-a}} + {{field-b}}"
}
Functions
The formula supports the mechanism of functions. Functions allow you to perform more complex calculations. to specify a function, you should specify # and then the name of the function and parentheses () to list the passed parameters. An example of a function is #functionName(2, {{variable}})
Example
You want to know how many days have passed since the onset of the illness. A cdt contains a date field named onset-disease. See Example 3.
Get all cdt records
HTTP Request
GET /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}
2. In our example it would be:
GET https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/vitals
Responses
200
OK
401
Unauthorized
403
Forbidden
404
Not Found
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
: fields=name,phone
field1,field2Page number
0Example: 1Page size
20Example: 3key - cdt field name; v1,v3,v4 - values to search
key=v1,v2Date_time in ISO-8601 format
2021-03-25T11:40:02.803ZSort field with sorting order(asc or desc) after coma
time,ascDate_time in ISO-8601 format
Paginated CDT records
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
GET /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"name": "text",
"data": {
"content": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"patientId": "123e4567-e89b-12d3-a456-426614174000",
"cdtId": "123e4567-e89b-12d3-a456-426614174000",
"version": 1,
"cdtName": "text",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
],
"pageable": {
"sort": {
"sorted": true,
"unsorted": true,
"empty": true
},
"pageSize": 1,
"pageNumber": 1,
"offset": 1,
"unpaged": true,
"paged": true
},
"totalElements": 1,
"totalPages": 1,
"last": true,
"first": true,
"number": 1,
"size": 1,
"numberOfElements": 1,
"empty": true,
"sort": {
"sorted": true,
"unsorted": true,
"empty": true
}
}
}Create cdt record
HTTP Request
POST /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}
2. In our example it would be:
POST https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/{cdtName}
Responses
201
Created
401
Unauthorized
403
Forbidden
404
Not Found
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
Field values as defined by the target CDT schema.
Created CDT record
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
POST /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 38
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"patientId": "123e4567-e89b-12d3-a456-426614174000",
"cdtId": "123e4567-e89b-12d3-a456-426614174000",
"version": 1,
"cdtName": "text",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}Update cdt records with bulk. Allowed only for list fields with bulk edit flag
HTTP Request
PATCH /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}
2. In our example it would be:
PATCH https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/vitals
Responses
200
OK
401
Unauthorized
403
Forbidden
404
Not Found
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
Bulk update result (per-row status)
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
PATCH /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 106
{
"rows": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
]
}{
"rows": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"result": {
"status": "OK",
"content": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
}
]
}Get cdt record by identifier (id, external_id, external_guid)
HTTP Request
GET /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtRecordId}
2. In our example it would be:
GET https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/vitals/8c0684ac-217e-45f4-8727-5587220dd512
Responses
200
OK
401
Unauthorized
403
Forbidden
404
Not Found
Examples
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
UUID of the CDT record
field1,field2Identificator type (ID, EID, EGUID), default ID
IDCDT record
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
GET /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtId} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"patientId": "123e4567-e89b-12d3-a456-426614174000",
"cdtId": "123e4567-e89b-12d3-a456-426614174000",
"version": 1,
"cdtName": "text",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}Delete cdt record by id
HTTP Request
DELETE /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtRecordId}
2. In our example it would be:
DELETE https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/vitals/8c0684ac-217e-45f4-8727-5587220dd512
Responses
200
OK
401
Unauthorized
403
Forbidden
404
Not Found
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
UUID of the CDT record
CDT record deleted
No content
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
DELETE /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtId} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Update cdt record by id
HTTP Request
PATCH /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtRecordId}
2. In our example it would be:
PATCH https://api.live.welkincloud.io/gh/sb-demo/patients/d6ea79ce-d3d6-4c2d-a27e-e4d1207f60f1/cdts/vitals/8c0684ac-217e-45f4-8727-5587220dd512
Responses
200
OK
401
Unauthorized
403
Forbidden
404
Not Found
Bearer token obtained from POST /{tenantName}/admin/api_clients/{clientName}. Valid for 60 minutes.
Your organization (tenant) name, e.g. acme-health
acme-healthYour environment name: live, sandbox, or a custom name
liveUUID of the patient record
Machine-readable CDT name defined in Designer (e.g. my_custom_type)
UUID of the CDT record
Partial field values to update.
Updated CDT record
Bad request — the request could not be understood or was missing required parameters.
Unauthorized — the Bearer token is missing, expired, or invalid.
Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin.
Not found — the requested resource does not exist.
Too many requests — rate limit exceeded. Implement exponential backoff.
Internal server error.
PATCH /{tenantName}/{instanceName}/patients/{patientId}/cdts/{cdtName}/{cdtId} HTTP/1.1
Host: api.live.welkincloud.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 38
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"patientId": "123e4567-e89b-12d3-a456-426614174000",
"cdtId": "123e4567-e89b-12d3-a456-426614174000",
"version": 1,
"cdtName": "text",
"jsonBody": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}Last updated
Was this helpful?