Trying to sync bed info from openmrs to openelis

Hello, Its been few month that I have been working in openmrs and openelis. I am trying to sync bed information from openmrs to openelis but I am stuck. I cannot figure out how to do it. It would be great help if anyone can help me on this.

Thanks.

Currently Bed information doesn’t go to OpenELIS (lab). Only Lab Orders are sent. What is the scenario that needs the bed info in OpenELIS?

Hello @gsluthra, I am trying to display bed number of the patient. I am thinking of creating api in openMRS by passing patientUUID which returns bed info like bed number and calling that API in openELIS. I don’t know whether this is possible.

If you can see some information on Bahmni EMR UI, then there is likely an API for it that is exposed by Bahmni EMR Backend (OpenMRS), since the UI makes REST API calls to show data. Those APIs can be called from POSTMAN or any other User App (like Mobile).

So, in this case, I used the Bahmni Demo, to admit a patient. See screenshot below:

https://demo.mybahmni.org/bahmni/adt/#/patient/0187be95-076a-4613-a257-62b08ba33ad5/visit/965c1672-d3dc-4ba3-88f1-8c6a458e0358/

Then using the Chrome Dev tools, I went to “Network” tab to see all the API calls made by the EMR UI to Bahmni backend. One of the API calls it shows is:

https://demo.mybahmni.org/openmrs/ws/rest/v1/beds?patientUuid=0187be95-076a-4613-a257-62b08ba33ad5&v=full

The response of this API is:

{
   "results":[
      {
         "bedId":3,
         "bedNumber":"304-c",
         "bedType":null,
         "physicalLocation":{
            "uuid":"baf83667-d225-11e4-9c67-080027b662ec",
            "display":"General Ward Room 1",
            "name":"General Ward Room 1",
            "description":"1st Floor of General Ward",
            "address1":null,
            "address2":null,
            "cityVillage":null,
            "stateProvince":null,
            "country":null,
            "postalCode":null,
            "latitude":null,
            "longitude":null,
            "countyDistrict":null,
            "address3":null,
            "address4":null,
            "address5":null,
            "address6":null,
            "tags":[
               {
                  "uuid":"a675e840-d225-11e4-9c67-080027b662ec",
                  "display":"Admission Location",
                  "name":"Admission Location",
                  "description":"General Ward Patients",
                  "retired":false,
                  "links":[
                     {
                        "rel":"self",
                        "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/locationtag/a675e840-d225-11e4-9c67-080027b662ec"
                     },
                     {
                        "rel":"full",
                        "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/locationtag/a675e840-d225-11e4-9c67-080027b662ec?v=full"
                     }
                  ],
                  "resourceVersion":"1.8"
               }
            ],
            "parentLocation":{
               "uuid":"baf7bd38-d225-11e4-9c67-080027b662ec",
               "display":"General Ward",
               "name":"General Ward",
               "description":"General Ward",
               "address1":null,
               "address2":null,
               "cityVillage":null,
               "stateProvince":"Chattisgarh",
               "country":null,
               "postalCode":null,
               "latitude":null,
               "longitude":null,
               "countyDistrict":"Bilaspur",
               "address3":null,
               "address4":null,
               "address5":null,
               "address6":null,
               "tags":[
                  {
                     "uuid":"475d8fa3-5572-11e6-8be9-0800270d80ce",
                     "display":"Visit Location",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/locationtag/475d8fa3-5572-11e6-8be9-0800270d80ce"
                        }
                     ]
                  },
                  {
                     "uuid":"b8bbf83e-645f-451f-8efe-a0db56f09676",
                     "display":"Login Location",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/locationtag/b8bbf83e-645f-451f-8efe-a0db56f09676"
                        }
                     ]
                  },
                  {
                     "uuid":"a675e840-d225-11e4-9c67-080027b662ec",
                     "display":"Admission Location",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/locationtag/a675e840-d225-11e4-9c67-080027b662ec"
                        }
                     ]
                  }
               ],
               "parentLocation":null,
               "childLocations":[
                  {
                     "uuid":"e48fb2b3-d490-11e5-b193-0800270d80ce",
                     "display":"General Ward - Room 2",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/e48fb2b3-d490-11e5-b193-0800270d80ce"
                        }
                     ]
                  },
                  {
                     "uuid":"baf83667-d225-11e4-9c67-080027b662ec",
                     "display":"General Ward Room 1",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/baf83667-d225-11e4-9c67-080027b662ec"
                        }
                     ]
                  }
               ],
               "retired":false,
               "attributes":[
                  {
                     "uuid":"1d3a3de3-9d5a-47c5-80f3-188bf60a241d",
                     "display":"IdentifierSourceName: GAN",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/baf7bd38-d225-11e4-9c67-080027b662ec/attribute/1d3a3de3-9d5a-47c5-80f3-188bf60a241d"
                        }
                     ]
                  }
               ],
               "address7":null,
               "address8":null,
               "address9":null,
               "address10":null,
               "address11":null,
               "address12":null,
               "address13":null,
               "address14":null,
               "address15":null,
               "links":[
                  {
                     "rel":"self",
                     "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/baf7bd38-d225-11e4-9c67-080027b662ec"
                  },
                  {
                     "rel":"full",
                     "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/baf7bd38-d225-11e4-9c67-080027b662ec?v=full"
                  }
               ],
               "resourceVersion":"2.0"
            },
            "childLocations":[
               
            ],
            "retired":false,
            "auditInfo":{
               "creator":{
                  "uuid":"62a3b753-3f10-11e4-adec-0800271c1b75",
                  "display":"admin",
                  "links":[
                     {
                        "rel":"self",
                        "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/user/62a3b753-3f10-11e4-adec-0800271c1b75"
                     }
                  ]
               },
               "dateCreated":"2015-03-24T18:30:22.000+0530",
               "changedBy":null,
               "dateChanged":null
            },
            "attributes":[
               
            ],
            "address7":null,
            "address8":null,
            "address9":null,
            "address10":null,
            "address11":null,
            "address12":null,
            "address13":null,
            "address14":null,
            "address15":null,
            "links":[
               {
                  "rel":"self",
                  "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/location/baf83667-d225-11e4-9c67-080027b662ec"
               }
            ],
            "resourceVersion":"2.0"
         },
         "patients":[
            {
               "uuid":"0187be95-076a-4613-a257-62b08ba33ad5",
               "display":"GAN203014 - Abdulla Kamalan",
               "identifiers":[
                  {
                     "display":"Patient Identifier = GAN203014",
                     "uuid":"dd0d257b-05e9-4283-9134-7e75c80639c4",
                     "identifier":"GAN203014",
                     "identifierType":{
                        "uuid":"81433852-3f10-11e4-adec-0800271c1b75",
                        "display":"Patient Identifier",
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patientidentifiertype/81433852-3f10-11e4-adec-0800271c1b75"
                           }
                        ]
                     },
                     "location":null,
                     "preferred":true,
                     "voided":false,
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patient/0187be95-076a-4613-a257-62b08ba33ad5/identifier/dd0d257b-05e9-4283-9134-7e75c80639c4"
                        },
                        {
                           "rel":"full",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patient/0187be95-076a-4613-a257-62b08ba33ad5/identifier/dd0d257b-05e9-4283-9134-7e75c80639c4?v=full"
                        }
                     ],
                     "resourceVersion":"1.8"
                  },
                  {
                     "display":"National ID = NAT2813",
                     "uuid":"8943d450-3e86-414c-b8fe-662adf354c14",
                     "identifier":"NAT2813",
                     "identifierType":{
                        "uuid":"0d2ac572-8de3-46c8-9976-1f78899c599f",
                        "display":"National ID",
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patientidentifiertype/0d2ac572-8de3-46c8-9976-1f78899c599f"
                           }
                        ]
                     },
                     "location":null,
                     "preferred":false,
                     "voided":false,
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patient/0187be95-076a-4613-a257-62b08ba33ad5/identifier/8943d450-3e86-414c-b8fe-662adf354c14"
                        },
                        {
                           "rel":"full",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patient/0187be95-076a-4613-a257-62b08ba33ad5/identifier/8943d450-3e86-414c-b8fe-662adf354c14?v=full"
                        }
                     ],
                     "resourceVersion":"1.8"
                  }
               ],
               "person":{
                  "uuid":"0187be95-076a-4613-a257-62b08ba33ad5",
                  "display":"Abdulla Kamalan",
                  "gender":"M",
                  "age":40,
                  "birthdate":"1981-10-25T00:00:00.000+0530",
                  "birthdateEstimated":false,
                  "dead":false,
                  "deathDate":null,
                  "causeOfDeath":null,
                  "preferredName":{
                     "display":"Abdulla Kamalan",
                     "uuid":"e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0",
                     "givenName":"Abdulla",
                     "middleName":null,
                     "familyName":"Kamalan",
                     "familyName2":null,
                     "voided":false,
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/name/e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0"
                        },
                        {
                           "rel":"full",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/name/e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0?v=full"
                        }
                     ],
                     "resourceVersion":"1.8"
                  },
                  "preferredAddress":null,
                  "names":[
                     {
                        "display":"Abdulla Kamalan",
                        "uuid":"e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0",
                        "givenName":"Abdulla",
                        "middleName":null,
                        "familyName":"Kamalan",
                        "familyName2":null,
                        "voided":false,
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/name/e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0"
                           },
                           {
                              "rel":"full",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/name/e4dd2762-ea5c-4f82-8dd2-fe7f6b8e6fe0?v=full"
                           }
                        ],
                        "resourceVersion":"1.8"
                     }
                  ],
                  "addresses":[
                     
                  ],
                  "attributes":[
                     {
                        "display":"General",
                        "uuid":"5c855730-4ecf-4e6d-98e1-10bdfdc44182",
                        "value":{
                           "uuid":"c1fc20ab-3f10-11e4-adec-0800271c1b75",
                           "display":"General",
                           "links":[
                              {
                                 "rel":"self",
                                 "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/concept/c1fc20ab-3f10-11e4-adec-0800271c1b75"
                              }
                           ]
                        },
                        "attributeType":{
                           "uuid":"c1f455e7-3f10-11e4-adec-0800271c1b75",
                           "display":"class",
                           "links":[
                              {
                                 "rel":"self",
                                 "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/personattributetype/c1f455e7-3f10-11e4-adec-0800271c1b75"
                              }
                           ]
                        },
                        "voided":false,
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/attribute/5c855730-4ecf-4e6d-98e1-10bdfdc44182"
                           },
                           {
                              "rel":"full",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/attribute/5c855730-4ecf-4e6d-98e1-10bdfdc44182?v=full"
                           }
                        ],
                        "resourceVersion":"1.8"
                     },
                     {
                        "display":"landHolding = 2",
                        "uuid":"6814fe22-92dd-4654-9b74-76705686d0f3",
                        "value":2,
                        "attributeType":{
                           "uuid":"3dfdc176-17fd-42b1-b5be-c7e25b78b602",
                           "display":"landHolding",
                           "links":[
                              {
                                 "rel":"self",
                                 "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/personattributetype/3dfdc176-17fd-42b1-b5be-c7e25b78b602"
                              }
                           ]
                        },
                        "voided":false,
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/attribute/6814fe22-92dd-4654-9b74-76705686d0f3"
                           },
                           {
                              "rel":"full",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5/attribute/6814fe22-92dd-4654-9b74-76705686d0f3?v=full"
                           }
                        ],
                        "resourceVersion":"1.8"
                     }
                  ],
                  "voided":false,
                  "auditInfo":{
                     "creator":{
                        "uuid":"c1c21e11-3f10-11e4-adec-0800271c1b75",
                        "display":"superman",
                        "links":[
                           {
                              "rel":"self",
                              "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/user/c1c21e11-3f10-11e4-adec-0800271c1b75"
                           }
                        ]
                     },
                     "dateCreated":"2021-10-25T11:51:37.000+0530",
                     "changedBy":null,
                     "dateChanged":null
                  },
                  "deathdateEstimated":false,
                  "birthtime":null,
                  "links":[
                     {
                        "rel":"self",
                        "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/person/0187be95-076a-4613-a257-62b08ba33ad5"
                     }
                  ],
                  "resourceVersion":"1.11"
               },
               "voided":false,
               "auditInfo":{
                  "creator":{
                     "uuid":"c1c21e11-3f10-11e4-adec-0800271c1b75",
                     "display":"superman",
                     "links":[
                        {
                           "rel":"self",
                           "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/user/c1c21e11-3f10-11e4-adec-0800271c1b75"
                        }
                     ]
                  },
                  "dateCreated":"2021-10-25T11:51:37.000+0530",
                  "changedBy":null,
                  "dateChanged":null
               },
               "links":[
                  {
                     "rel":"self",
                     "uri":"http://demo.mybahmni.org/openmrs/ws/rest/v1/patient/0187be95-076a-4613-a257-62b08ba33ad5"
                  }
               ],
               "resourceVersion":"1.8"
            }
         ],
         "resourceVersion":"1.8"
      }
   ]
}

So, as you can see… it has the bed-number in it for a given patient, which is the same API you are requesting for. It already exists.

WARNING:

  1. Even though the API exists, I think it would not be a good idea to call it from OpenELIS. This is because if the API is called from OpenELIS UI, then the lab user will need to have access to Bahmni EMR/OpenMRS – and logged in, since session information is different between LAB and EMR UI. If this API is called from LAB backend, then LAB backend will need credentials to directly make this call to OpenMRS. Both are brittle, and can causes issues if EMR Is down / not accessible or user doesn’t have access.

  2. Also, architecturally, the design of Bahmni assumes LAB and EMR UI run independently, with data exchange between them over Atom Feed. Not realtime. Whenever they have connectivity to each other, the data is exchanged over the feed. It would be better if Patient Bed Details were sent over Atom feed to Lab for maintaining the same operational requirements.

But if you feel that a bed lookup from Lab will be needed, and direct API call is fine – you can try it. The API already exists. You will need to modify Lab side code to make this call.

I hope this helps. :slight_smile:

Thank you for the help. I’ll try syncing data with atom feed.

Hi @rojanmaharjan , Could you tell me how the orders from openmrs can be sent to openelis, I want to work on both modules separately in different system.I am trying from databases of both but not able to find the common link between opermrs orders table in mrsdb and elis orders table is lisdb

This discussion will be helpful for you @sunny123. Shows how to push data from OpenMRS/Bahmni into SenaiteLIMS/BikaLIMS (via atomfeed/mirth). Introducing Bahmni HL7 LIS Integration - #17 by bgevam

Hi @rojanmaharjan I have gone through the link. But the thing As I am placing the lab test order from bahmni emr but I am not able to get the data from it’s database(openmrs). I have checked all the tables but not able to get the lab test details that I ordered or selected from Panel.