I am little confused about the REST resource for Complex Obs. I am referring to 2 source files in webservices rest.
In ObsResource1_8, why do we assume that the complex value will always be raw data (raw view)? Do we assume that the valueComplex always to be serialized content? What if it was a json block or a reference to a “location” or “address_entry” or “provider” etc? Also the value representation for “RAW VIEW” gives out very little information about the data to be fetched from /obs/{uuid}/value.
"value": { "display": "raw file", "links": { "rel": "self", "uri": "http://localhost:8080/openmrs/ws/rest/v1/obs/e2821620-66ff-11e7-9951-0242ac110002/value" } }
IMHO, it ought to give out more info. maybe - display should be the string interpretation of the data, or indication of what type of value the /value will return.
"value": { "display": "Location: General OPD", "links": { "rel": "self", "type": "application/json", "uri": "http://localhost:8080/openmrs/ws/rest/v1/obs/e2821620-66ff-11e7-9951-0242ac110002/value" } }
I would expect corresponding behavior from the “ObsComplexValueController”. The code gives impression [ObsComplexValueController.getFile()] that the expected content is a file. Depending on the “accept” header (led by the previous link type), the corresponding type should be serialized and sent and not just byte stream (file or image). e.g. for “application/json” serialize to a json response.
Thoughts? Of course the above arguments are not valid if you are saying that valueComplex to be always serialized content (and not meant for references to another resource or a complex representation through JSON).