Hey,
I am currently facing RESTWS-466 ticket, which is about exception thrown by webservices.rest when asking for encounter’s provider’s prefferedName when prefferedName is not defined.
Firstly, I was trying to reproduce this bug. I’ve just picked some random encounter’s UUID on my local 2.6-SNAPSHOT Reference Application distro and sent this URL to server:
rest/v1/encounter?patient=92e8860b-5669-459e-96c0-f7913a64e913&v=custom:(uuid,location:(uuid,name),encounterDatetime,encounterType:(uuid,name),provider:(uuid,preferredName))
It should return Encounter
represented as in diagram below:
Exception is thrown as expected.
I’ve looked into Encounter
model and noticed, that Provider
object is not in Encounter
directly, but it is contained in EncounterProviders
array.
I’ve tweaked URL so it looked like that:
rest/v1/encounter?patient=92e8860b-5669-459e-96c0-f7913a64e913&v=custom:(uuid,location:(uuid,name),encounterDatetime,encounterType:(uuid,name),encounterProviders:(provider))
That request’s response is returns correct custom Encounter, as defined in URL.
Next move, lets add custom representation of Provider to URL by changing provider
to provider:(uuid)
Boom, Exception
I’ve debugged some webservices.rest code and I spotted something weird in BaseDelegatingResource
’s method getCustomRepresentationDescription()
. This method parses custom representation properties from request URL String. Works nice, until there is no more than “2 levels of custom representation complexity” (IDK how to call that). For example:
custom:(patient:(gender))
- OK
getCustomRepresentationDescription()
is called twice.
- adds
patient
property to encounter’s description - adds
gender
property to patient’s description
custom:(patient:(person:(gender)))
- Exception
getCustomRepresentationDescription()
should be called 3 times.
- adds
patient
property to description - adds
perso
(Yes, no ‘n’ letter) property to description - exception before it could be called 3rd time.
My question is: Is custom representation limited to “2 levels of complexity” or is it a bug?
Anyway, its weird that Provider
object couldn’t be accessed directly from ‘Encounter’ (just as patient
→ gender
). Any ideas why is it happening?