You can use the PainChek API to view and manage PainChek patient records.
Field |
Type |
Comment |
---|---|---|
first_name |
Mandatory String |
The patients first name |
last_name |
Mandatory String |
The patients last name |
nickname |
Optional string |
A nickname or the patients preferred name |
gender |
Mandatory string |
"m" (Male), "f" (Female) or "x" (Indeterminate/Intersex/Unspecified) |
birth_date |
Mandatory YYYY-MM-DD |
Patients date of birth |
deleted_reason |
Optional String |
Indicates if the patient has been archived or not. |Note that the name is misleading - it's a reason for archiving the record and nothing to do with deleting the record |
image |
URL |
The URL for the patients' profile image |
training_record |
Mandatory Boolean |
Indicates the record is for training purposes only. Defaults to False if not supplied. |
To list the all Patients in your PainChek instance (in the User Acceptance Environment), you can issue this command:
curl https://ua.ap.painchek.com/api/patients/
Sample return data:
{ "count": 2, "next": null, "previous": null, "results": [{ "uuid": "7f58e25c-ba8a-47d5-b7d6-1377428b14fa", "license": "a89e0cc1-fd90-4721-b09b-7f527f5ff626", "license_name": "A89E0CC1-FD90/ePAT Technologies Ltd/2018-08-25", "first_name": "Enola", "last_name": "Gay", "nickname": "Rose", "gender": "f", "birth_date": "1951-11-14", "death_date": null, "created_at": "2017-09-26T02:16:28.850000Z", "modified_at": "2017-11-13T02:17:35.662737Z", "deleted_at": null, "deleted_reason": null, "update_stamp": 760, "image": "https://ua.ap.painchek.com/media/patients/7f58e25c-ba8a-47d5-b7d6-1377428b14fa.jpg", "external_id": null, "training_record": false }, { "uuid": "9b829fe4-a72a-4323-ae65-5fa4622b6986", "license": "a89e0cc1-fd90-4721-b09b-7f527f5ff626", "license_name": "A89E0CC1-FD90/ePAT Technologies Ltd/2018-08-25", "first_name": "Norma", "last_name": "May", "nickname": "Maisie", "gender": "f", "birth_date": "1940-06-23", "death_date": null, "created_at": "2017-09-26T02:16:28.806000Z", "modified_at": "2017-11-13T02:14:26.372040Z", "deleted_at": null, "deleted_reason": null, "update_stamp": 759, "image": "https://ua.ap.painchek.com/media/patients/9b829fe4-a72a-4323-ae65-5fa4622b6986.jpg", "external_id": null, "training_record": true }] }
To create a patient, issue the following command (which shows the minimum fields that need to be supplied - you can add other fields, such as nickname as required):
curl \ -H "Content-Type: application/json" \ -X POST https://ua.ap.painchek.com/api/patients/ -d @- << EOF { "first_name":"Fred", "last_name":"Smith", "gender":"m", "birth_date": "1940-01-20" } EOF
The return is the full patient record:
{ "uuid": "b416d163-2e6e-4fdb-9a22-c1f0f9ae6b26", "license": "a89e0cc1-fd90-4721-b09b-7f527f5ff626", "license_name": "A89E0CC1-FD90/ePAT Technologies Ltd/2018-08-25", "first_name": "Fred", "last_name": "Smith", "nickname": null, "gender": "m", "birth_date": "1940-01-20", "death_date": null, "created_at": "2017-11-13T07:07:58.267644Z", "modified_at": "2017-11-13T07:07:58.268769Z", "deleted_at": null, "deleted_reason": null, "update_stamp": 767, "image": null, "external_id": null, "training_record": false }
To update a Patient, issue a PATCH to the "api/patients/{patient_uuid}/" endpoint, passing the same JSON details as you would when creating the record using a POST to "api/patients/".
If you are using a PATCH, then you are updating the current details and so only need to provide the fields that require changing (all other fields will remain unchanged).
A successful PATCH will return the full details of the patient (i.e. the same details as you get returned when creating the record using a POST to "api/patients/").
For example, to update the nickname of patient b416d163-2e6e-4fdb-9a22-c1f0f9ae6b26, you can issue:
curl -X PATCH \ -H "Content-Type: application/json" \ https://ua.ap.painchek.com/api/patients/b416d163-2e6e-4fdb-9a22-c1f0f9ae6b26/ -d @- << EOF { "nickname": "Smithy" } EOF
The return is the full patient record:
{ "uuid": "b416d163-2e6e-4fdb-9a22-c1f0f9ae6b26", "license": "a89e0cc1-fd90-4721-b09b-7f527f5ff626", "license_name": "A89E0CC1-FD90/ePAT Technologies Ltd/2018-08-25", "first_name": "Fred", "last_name": "Smith", "nickname": "Smithy", "gender": "m", "birth_date": "1940-01-20", "death_date": null, "created_at": "2017-11-13T07:07:58.267644Z", "modified_at": "2017-11-13T07:07:58.268769Z", "deleted_at": null, "deleted_reason": null, "update_stamp": 767, "image": null, "external_id": null, "training_record": false }