Encounter/Obs POST with full representation fails with boolean obs value

Hello everyone,

In our project, we need to use openmrs-rest APIs to create encounters and need to get the full representation of the created encounter back. To achieve this we started using encounter endpoint /openmrs/rest/v1/encounter along with query params ?v=full , and it was working fine.

However, we started facing issues with obs with boolean values. If we try sending below JSON

{
    "uuid": "1D3B8CBC-9262-3943-5740-CB76C7A50EFE",
    "patient": {
        "uuid": "12B4D94F-7AA4-404D-981A-08C47ED507A7"
    },
    "encounterDatetime": "2017-07-21T00:00:00",
    "encounterType": {
        "uuid": "ca3aed11-1aa4-42a1-b85c-8332fc8001fc"
    },
    "obs": [
        {
            "concept": "e73cccbf-63a2-4946-a380-ed9f3fe1455f", //( question concept with boolean datatype) 
    		"value": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" //(True concept From CIEL)
        }
    ]
}

To Url

http://localhost:8080/openmrs/ws/rest/v1/encounter?v=full

It fails with an error

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.openmrs.Concept.names, could not initialize proxy - no Session.

However it works if we send the POST request without the ?v=full query-param and then later make a GET with ?v=full. This will lead to two calls and we would like to avoid it.

Any thoughts on what might be going wrong. We tried debugging it but couldn’t get much information. We have not been able to reproduce this in ObsResourceTests as well.

Thanks

CC: @mksd @wyclif @mogoodrich @premnisha @rrameshbtech @vasanth2019

Which versions of the webservices module and openmrs platform are you running?

1 Like

Hello @dkayiwa,

Thanks for the reply. We just figured out that upgrading to the webservices-rest-2.28.0, has fixed this problem. Before this we were running 2.25.0.

Though was going through the commits on webservices-rest and not sure what changes are fixing it. Just wanted to understand what was causing this problem.

Thanks