The objects within the PainChek API (users, patients, assessments, etc.) have a number of common fields:
Field |
Data Type |
Mandatory |
Example |
Comment |
---|---|---|---|---|
uuid |
UUID |
Yes |
7f58e25c-ba8a-47d5-b7d6-1377428b14fa |
Every record in the PainChek system is identified by a unique UUID. |
created_at |
DateTime |
Yes |
2017-09-26T02:16:28.850000Z |
The Date/Time the record was created (in UTC) |
modified_at |
DateTime |
Yes |
2017-11-13T02:17:35.662737Z |
The Date/Time the record was last updated (in UTC) |
deleted_at |
DateTime |
No |
null |
The Date/Time the record was marked as deleted. Note that records are never actually removed from the PainChek database. Rather, they are logically deleted by populating the deleted_at field. Hence records with the deleted_at field populated (i.e. not null) should be considered deleted and not displayed or used. |
update_stamp |
Integer |
Yes |
760 |
An identifier used to indicate the order in which updates have been performed to records in a table. See the "Data Syncing" page for more details |
external_id |
String |
No |
Patient1 |
Used to store an external identifier (that is an identifier from a third-party system) for a user, patient or site. You can use that field to store an identifier from an external system in PainChek to assist with data synchronisation. |
created_by_id |
UUID |
? |
0a9fcde4-39c1-410e-85bd-d43d6efae577 |
The user that created the record. This is the UUID for a user (see details here) |
modified_by_id |
UUID |
? |
0a9fcde4-39c1-410e-85bd-d43d6efae577 |
The user who last updated the record. This is the UUID for a user (see details here) |
device_id |
UUID |
? |
87EFD095-F650-4011-9546-C9553A2BD3BC |
The device that created the record. This is the UUID for devices (see details here) |
license |
UUID |
? |
a89e0cc1-fd90-4721-b09b-7f527f5ff626 |
The license the record is associated with. This is the UUID for the license and can be considered an informational field. |
license_name |
string |
? |
A89E0CC1-FD90/ePAT Technologies Ltd/2018-08-25 |
The description of the license holder. This is a three-part field consisting of a partial UUID, Name of the License Holder and the expiry date of the license. |
site |
UUID |
? |
c186cf8e-708c-479e-acbd-d534f54b7e89 |
The UUID of the site associated with this record. See Managing Sites for more details. |
site_name |
string |
? |
St George Hospital / Kogarah |
The description of the site. This is a two-part field consisting of the name and the city of the site. |
patient |
UUID |
? |
9b829fe4-a72a-4323-ae65-5fa4622b6986 |
The UUID of the patient associated with this record. See Managing Patients for more details. |
DateTime fields use the ISO 8601 combined date and time representation: <date>T<time>.
<date> is in YYYY-MM-DD format - e.g. "2017-11-24".
<time> is in hh:mm:ss.sss format (although the fraction part is often omitted - i.e. hh:mm:ss is valid) - e.g. "08:00:00" or "08:34:48.374"
The <time> component will also include a time zone designators. This is a postfix to the time in one of the following formats:
-
<time>Z
-
<time>±hh:mm
-
<time>±hh
Z indicates Zulu (UTC) time and is the same as using "+00" or "+00:00". If no time zone designator is applied to a time, UTC is assumed.
See here for more details in the ISO 8601 DateTime format.
{ "count":0, "next":null, "previous":null, "results":[] }
Note
A timezone should always be specified when creating a record. Failing to do that will result in UTC being assumed and this might lead to incorrect data.
For example, if an event occurred at 8:00 am on the 24th November in Brisbane, and no timezone is specified (e.g. 2017-11-24T08:00:00 is used to create the record), that record is created with a timestamp of 8:00 am UTC. When displayed back to a user in the Brisbane Timezone, that will show up as a 6:00 pm timestamp (as Brisbane is +10 ahead of UTC). Such a record should be created using "2017-11-24T08:00:00+10"
List Data
All lists of data - users, patients, assessments, etc - are returned using this JSON structure:
{ "count":0, "next":null, "previous":null, "results":[] }
Where:
Field |
Description |
---|---|
count |
The number of records returned in the "results" array |
next |
The URL for the "next" page of data - null if this is the last page of data - see Pagination for more details. |
previous |
The URL for the "previous" page of data - null if this is the last page of data - see Pagination for more details. |
results |
An array of JSON objects holding the specific data requested |
The above example showed a list with no data. If the list contained 2 records, it would appear as follows:
{ "count": 2, "next": null, "previous": null, "results": [ {"item":"record 1"}, {"item":"record 2"}] }
NB: The content of the results object will vary depending on the type of list being returned.