You can use the PainChek API to view and manage PainChek patient records.
Key Patient Fields
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. |
Listing Patients
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:
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:
Updating a Patient
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: