I am trying to save an obs via REST. The requirement is that it should be able to save the concept of a drug, as well as the formulation(that comes from the drug table). An ideal payload would be as follows:
The concept is uuid for “current arv medication” concept.
The value is concept uuid for “Nevirapine” and
The value drug is drug uuid for “Nevirapine 200mg”.
I haven’t been able to save/retrieve this via rest. Any ideas on how I can achieve this via REST?
I’m not sure that what you are trying to do can be done using a single core REST resource (you could create your own in a module). Do you actually need to create the
obs as well as the drug order?
Perhaps have a look at the obs resource and order resource docs and see if they help you.
Have you not been able to create an
obs via rest at all? Or just the ones involving drugs that are you describing?
Thanks @pascal for the immediate response. I am able to submit obs with simple value and also with value coded. What I am not able to do is view/submit obs with value_drug. I want to be able to do this without using order api i.e. drug order for backward compatibility purpose with existing encounters since I want to be able to edit already saved data, that was saved using either html form entry or the other openmrs data collection modules, that support saving of obs with value_coded and value_drug.
CC @willa @jdick @burke @werick
@pascal, is the value_drug column in the obs table intended to be used exclusively for drug orders?
I’m not sure, but I don’t think so. I think the idea of obs and orders are separate.
The problem is that I don’t think you can save more than one value for an obs (e.g.
@nkimaina you only need to specify the “value” field using the drug UUID. The REST API will set the concept value_coded for you (see the rest API piece of code that does this). See the required payload below.
This issue was already fixed in this ticket https://issues.openmrs.org/browse/RESTWS-577, Just get the latest web services module.
Thanks guys, that fixed it. Using version 2.14 of REST module did it.