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