DGHS Project

Looking for help?
< All Topics
Print

MCI Patient Catchment Feed API

Patient Catchment feed (API to get all patients by a given catchment).

Authentication:

The API described below need authentication. The client_id and From are given when registering with the Identity Provider. The signin API of Identity Provider should be used to get the auth token(To be provided in the “X-Auth-Token” header). Refer the Identity Provider page for more information on how to use the Identity Provider APIs. 

Required roles for the client : Mci user and Facility/SHR system adimin .

Description of the API

Request :

GET  https://{mci_service}/api/default/catchments/{catchment}/patients?since=<date value>&last_marker=<last marker value>

Headers :

X-Auth-Token : {auth token returned from Identity Service Provider}
client_id : {client id of requester in Identity Service Provider}
From : {email_id of requester registered in Identity Service Provider}

Points to remember:

  • Both since and last marker values are optional.
  • Since takes a date and gives back all patient creates and updated on or after that date.
    Eg: If we hit the url with https://{mci_service}/catchments/3033/patients?since=2016-12-08 -→ It will give back all patient creates for the catchment on or after 8th December 2016
  • Last marker takes a Unique Event UUID and returns all patient create or update events after the event.
    Eg:  If we hit the url with https://{mci_service}/catchments/3033/patients??last_marker=7945db81-bd30-11e6-b56a-024dbda31eaf  -→ It will give back all patient creates for the catchment  after the event with id 7945db81-bd30-11e6-b56a-024dbda31eaf.
  • By default the maximum number of entries per page in 25 unless the server in configured otherwise.
  • If both since and last marker are provided the server gives preference to last marker.
  • If none of since and last marker is provided then the server gives back all patients creates for the catchment from the begining.

Sample Response:

{
   
  "author": "MCI",
  "title": "Patients",
  "feedUrl": "https://mci-dev.twhosted.com/api/default/catchments/3026/patients?since=2017-03-20T09%3A44%3A28.988%2B05%3A30&last_marker=712ea160-0d22-11e7-bc64-b6daa7dd04a2",
  "prevUrl": null,
  "nextUrl": "https://mci-dev.twhosted.com/api/default/catchments/3026/patients?since=2017-03-21T11%3A55%3A55.935%2B05%3A30&last_marker=a09057a0-0d6d-11e7-b917-024dbda31eaf",
  "entries": [
    {
      "id": "553d01a0-0d6c-11e7-b917-024dbda31eaf",
      "publishedDate": "2017-03-20T18:24:19.578+05:30",
      "title": "Patient in Catchment: 98000103492",
      "link": "https://mci-dev.twhosted.com/api/default/patients/98000103492",
      "eventType": null,
      "categories": [
        "patient"
      ],
      "content": {
        "hid": "98000103492",
        "given_name": "ohel",
        "sur_name": "M",
        "date_of_birth": "1970-11-06T00:00:00.000+05:30",
        "dob_type": "1",
        "gender": "M",
        "present_address": {
          "address_line": "37, Good Street,",
          "division_id": "30",
          "district_id": "26",
          "upazila_id": "18",
          "country_code": "050"
        },
        "confidential": "No",
        "created_by": {
          "facility": null,
          "provider": {
            "id": "113068",
            "name": null
          },
          "admin": null
        },
        "updated_by": {
          "facility": null,
          "provider": {
            "id": "113068",
            "name": null
          },
          "admin": null
        },
        "status": {
          "type": "1"
        },
        "active": true,
        "hid_card_status": "REGISTERED",
        "provider": null,
        "created": "2017-03-20T18:24:19.578+05:30",
        "modified": "2017-03-20T18:24:19.578+05:30"
      }
    },
    {
      "id": "a09057a0-0d6d-11e7-b917-024dbda31eaf",
      "publishedDate": "2017-03-20T18:33:35.450+05:30",
      "title": "Patient in Catchment: 98000106529",
      "link": "https://mci-dev.twhosted.com/api/default/patients/98000106529",
      "eventType": null,
      "categories": [
        "patient"
      ],
      "content": {
        "hid": "98000106529",
        "nid": "1490015062881",
        "given_name": "AHIBEJAABFAGCIIB",
        "sur_name": "REVBIICGAFBAAJEB",
        "date_of_birth": "1980-06-14T16:50:00.000+05:30",
        "dob_type": "1",
        "gender": "M",
        "present_address": {
          "address_line": "6th BEJAABFAGCIIB lane",
          "division_id": "30",
          "district_id": "26",
          "upazila_id": "07",
          "country_code": "050"
        },
        "confidential": "No",
        "created_by": {
          "facility": {
            "id": "10019841",
            "name": null
          },
          "provider": null,
          "admin": null
        },
        "updated_by": {
          "facility": {
            "id": "10019841",
            "name": null
          },
          "provider": null,
          "admin": null
        },
        "status": {
          "type": "1"
        },
        "active": true,
        "hid_card_status": "REGISTERED",
        "provider": null,
        "created": "2017-03-20T18:33:35.450+05:30",
        "modified": "2017-03-20T18:33:35.450+05:30"
      }
    }
  ]
}

Notes

feedUrl: The url that was hit.

Entries: Contain a list of events that are there. Each event inside entries start with an “id” which is the unique uuid for that event,  “eventType” specifies the type of event (created or updated).

nextUrl: give an url which returns the next set of events, The last marker in the nextUrl is the id of the last event on that page.

Table of Contents