1 Cloud HIMS API Specifications Health Information Unit, Ministry of Health 2 Version History Dates Reasons for Version Author/s Approved by change 26-09-2022 Zero Draft 0.0 Dr M H B Ariyaratne 01-10-2022 Security 0.1 Dr M H B Ariyaratne 06-10-2022 API Endpoints 0.2 Dr M H B Ariyaratne 12-10-2022 Updated API Endpoints 0.3 Dr M H B Ariyaratne 15-10-2022 Client as a Person Resource 0.4 Dr M H B Ariyaratne 17-10-2022 Clients as a bundle 0.5 Dr M H B Ariyaratne 22-10-2022 Introduction 0.6 Dr M H B Ariyaratne 25-10-2022 Testing API 0.7 Dr M H B Ariyaratne 1 3 Table of Contents Contents Version History.......................................................................................................................................................................... 2 Table of Contents ...................................................................................................................................................................... 3 Introduction ................................................................................................................................................................................ 4 Testing the FHIR API ............................................................................................................................................................... 4 Security ......................................................................................................................................................................................... 6 Get Client/Clients ..................................................................................................................................................................... 7 Get Client/Clients by PHN or ID or NIC or Phone number ................................................................................. 7 Example 1: Search By ID .............................................................................................................................................. 7 Example 2: By PHN......................................................................................................................................................... 9 Example 3: By NIC ........................................................................................................................................................10 Example 4: By Phone number..................................................................................................................................12 Get Encounters of a Client ...................................................................................................................................................13 Get Observations made in an Encounter ......................................................................................................................13 Get Clients Empaneled in a Hospital ...............................................................................................................................13 Get Clients Registered in a Clinic......................................................................................................................................13 Get Clients of a Grama Niladhari Area ...........................................................................................................................13 4 2 Introduction This document has been prepared to describe API endpoints, respective requests and responsive parameters to interface cHIMS. The API of Cloud HIMS is based on RESTful framework and FHIR standards. Currently it supports output in JSON, later will support other formats like XML. The base URL production is https://hims.health.gov.lk The base URL for testing is https://dmis.health.gov.lk/chimsdev/ Testing the FHIR API Log to the testing application at http://dmis.health.gov.lk/chimsdev/ There is a limited amount of data in the demo application. The test user may have to add data in the application to do additional testing of the API. Username: fhir Password: fHiRTester734# The testing can be done using the Postman. In the header section, add a key value pair to authenticate the API RESTful requests. KEY: FHIR VALUE: b64a5915-646f-4f7e-be87-9c2faf3f7b27 5 6 Security Currently all API requests need to have a key-value pair in the header as the mode of authentication method. The Key should be “FHIR”. The value should be generated after logging into the web application. Only authorized users can use the web application to generate keys. Every API Key is having an expiry date, after which the API key will not be valid to accommodate API requests. The menu access managing the API Keys is Menu > Settings > Manage API Keys. You can use the manage API Keys page to view the existing keys, remove existing one and to generate new API Keys. 7 Get Client/Clients The URL to get the client by is based on BASE_URL/data/fhir/client The Clients can be retrieved by providing the PHN, ID inside cHIMS, NIC or Phone number. Get Client/Clients by PHN or ID or NIC or Phone number In the simplest case, a search is executed by performing a GET operation in the RESTful framework: GET BASE_URL/data/fhir/client/[search text] You can get a matching single client or multiple clients by providing one parameter. The parameter may be the ID inside cHIMS, PHN, NIC or phone number. First the program will search by ID and if a client is found, it will return the results. If there is not match for ID, then the program will search for PHN. If one (or by accident more) client is found with ah matching PHN, it will return the results. If that does not return a result, it will search for NICs. If there is one or more matches, the results will be returned. If there are no matches for NIC, it will search for the phone number. If there are one or more matches, it will return the results. If there are no matches even at that stage, it will result a BASE_URL/data/fhir/client/[search text] The path parameter {search text} must be provided to get valid output. Only one path parameter is be accepted, providing more than one path parameter will give an error. The API key should be provided as a key value paid as described in the Security Section. Any other query parameter is not supported for this URL. The number of data listed will be limited by the size of the data. Example 1: Search By ID GET https://dmis.health.gov.lk/chimsdev/data/fhir/client/43995951 JSON OUTPUT { "resourceType": "Patient", "id": "43995951", "identifier": [ { 8 "system": "https://nic.gov.lk/", "value": "752584524v" }, { "system": "https://passport.gov.lk/" }, { "system": "https://seniorcitizen.gov.lk/" }, { "system": "https://drivinglicense.gov.lk/" }, { "system": "https://phn.health.gov.lk/", "value": "1067XW4CWK8" } ], "active": true, "name": [ { "text": "M H BUDDHIKA ARIYARATNE" }, { "family": "M H BUDDHIKA ARIYARATNE", "given": [ "M H BUDDHIKA ARIYARATNE" ] } ], "telecom": [ { "system": "phone", "value": "0912241603", "use": "home" }, { "system": "phone", "value": "0715812399", "use": "mobile" }, { "system": "email", "value": "buddhika.ari@gmail.com", "use": "home" } ], "gender": "male", "address": [ { "line": [ 9 "36/A, THALGAHAHENA LANE, GALLE" ] } ] } Example 2: By PHN GET https://dmis.health.gov.lk/chimsdev/data/fhir/client/0712R9TRC40 JSON OUTPUT { "resourceType": "Patient", "id": "43995976", "identifier": [ { "system": "https://nic.gov.lk/" }, { "system": "https://passport.gov.lk/" }, { "system": "https://seniorcitizen.gov.lk/" }, { "system": "https://drivinglicense.gov.lk/" }, { "system": "https://phn.health.gov.lk/", "value": "0712R9TRC40" } ], "active": true, "name": [ { "text": "BINUTHI NILAKNA ARIYARATNE" }, { "family": "BINUTHI NILAKNA ARIYARATNE", "given": [ "BINUTHI NILAKNA ARIYARATNE" 10 ] } ], "telecom": [ { "system": "phone", "value": "0912241603", "use": "home" }, { "system": "phone", "value": "0715812399", "use": "mobile" }, { "system": "email", "value": "nilukagun@gmail.com", "use": "home" } ], "gender": "female", "address": [ { "line": [ "36/A, THALAGAHAHENA LANE, BATAGANWILA, GALLE" ] } ] } Example 3: By NIC GET https://dmis.health.gov.lk/chimsdev/data/fhir/client/758521753v JSON OUTPUT { "resourceType": "Patient", "id": "43996093", "identifier": [ { "system": "https://nic.gov.lk/", "value": "758521753v" }, { "system": "https://passport.gov.lk/" }, 11 { "system": "https://seniorcitizen.gov.lk/" }, { "system": "https://drivinglicense.gov.lk/" }, { "system": "https://phn.health.gov.lk/", "value": "07124K2C2V3" } ], "active": true, "name": [ { "text": "NILUKA GUNASEKARA" }, { "family": "NILUKA GUNASEKARA", "given": [ "NILUKA GUNASEKARA" ] } ], "telecom": [ { "system": "phone", "value": "0912241603", "use": "home" }, { "system": "phone", "value": "0711569020", "use": "mobile" }, { "system": "email", "value": "niluka.gun@gmail.com", "use": "home" } ], "gender": "female", "address": [ { "line": [ "RATHGAMA, GALLE" ] } ] } 12 Example 4: By Phone number GET https://dmis.health.gov.lk/chimsdev/data/fhir/client/0912241603 JSON OUTPUT { "resourceType": "Bundle", "id": "[Client{phn=1067XW4CWK8}, Client{phn=0712R9TRC40}, Client{phn=07124K2C2V3}] ", "type": "searchset", "total": 3, "entry": [ { "fullUrl": "https://dmis.health.gov.lk/chimsdev/data/fhir/client/43995951" }, { "fullUrl": "https://dmis.health.gov.lk/chimsdev/data/fhir/client/43995976" }, { "fullUrl": "https://dmis.health.gov.lk/chimsdev/data/fhir/client/43996093" } ] } 13 Get Encounters of a Client Under Construction Get Observations made in an Encounter Under Construction Get Clients Empaneled in a Hospital Under Construction Get Clients Registered in a Clinic Under Construction Get Clients of a Grama Niladhari Area Under Construction 14