Some entities in the PainChek data model allow you to record an "External Id", that an identifier from a third party system.
Currently, this applies to the user, patient and site objects.
You can this field to store an identifier from an external system in PainChek to assist with data synchronisation.
The external ID is treated as a string field by PainChek and we do not validate the format or content (or mandate that you supply an External Id - it is optional).
Ensure that you use a consistent format for your External Ids when using them with PainChek (External id "1" is not the same as External id "001").
External Ids must be unique (for a particular type of object).
You can not assign two patients an External Id of "123", but it is acceptable for a patient and a user to have the same External Id.
The fact that two objects have the same External Id does not mean that they are in any way related to each other - it's just coincidental as far as PainChek is concerned (e.g. if a patient and a user happen to share External ID "123").
Simply include the "external_id" element when POSTing a new entity to PainChek - e.g.: when POSTing a new patient:
{ "first_name":"Fred", "last_name":"Smith-7", "gender":"m", "birth_date": "1940-01-20", "external_id": "123-456" }
You can fetch an object by using the "external_id" object on the GET request - e.g."
curl https://ua.ap.painchek.com/api/patients/?external_id=P123
returns:
{ "count": 1, "next": null, "previous": null, "results": [{ "uuid": "16a8b675-61e2-49a5-b1aa-9a6fef94bfc9", "license": "a89e0cc1-fd90-4721-b09b-7f527f5ff626", "license_name": "A89E0CC1-FD90/PainChek Ltd/2018-08-25", "first_name": "Chuck", "last_name": "Yager", "nickname": "", "gender": "m", "birth_date": "1949-10-05", "death_date": null, "created_at": "2017-09-26T02:16:28.830000Z", "modified_at": "2017-09-26T02:16:28.995000Z", "deleted_at": null, "deleted_reason": "null", "update_stamp": 505, "image": "https://ua.ap.painchek.com/media/patients/16a8b675-61e2-49a5-b1aa-9a6fef94bfc9.jpg", "external_id": "P123" }] }