Stream: smart
Topic: cliet-js with resolveReferences
Josh Mandel (Jun 04 2021 at 16:28):
@Vladimir Ignatov at http://docs.smarthealthit.org/client-js/client I'm seeing some examples that look like they're missing curly braces, like:
client.request(
"Encounter/518a522a-4b10-47db-9daf-53b726d32607",
resolveReferences: [ "serviceProvider" ]
);
--- when I add curly braces in my own invocations like
smart.patient
.request("Observation?code=4548-4&_sort:desc=date&_count=10", {
resolveReferences: ["entry.resource.subject"]
})
nothing seems to happen -- am I using this feature incorrectly? (I was expecting to see the library make an extra query to resolve Observation.subject and mount it in place.)
Vladimir Ignatov (Jun 04 2021 at 17:21):
Thanks for pointing that out. I will fix the docs and add the curly braces. Otherwise, does it work with ["subject"]
instead of ["entry.resource.subject"]
?
Josh Mandel (Jun 04 2021 at 18:26):
Yes, ["subject"]
works, thanks! I couldn't predict this from the docs, though. Docs also refer to context
and {Response}.context.
, which I couldn't understand @Vladimir Ignatov (I'd propose different language but I'm unsure of the intent.)
Vladimir Ignatov (Jun 04 2021 at 19:37):
Right, mixing real things like serviceProvider
with imaginary ones like context
or Response
is a poor choice of words. The intent was say that:
- The path is relative to the current resource (
subject
instead ofentry.resource.subject
) - The path can have arbitrary depth but should exclude the last
reference
segment (a.b.c
resolves{current resource}.a.b.c.reference
but mounts at{current resource}.a.b.c
)
Josh Mandel (Jun 04 2021 at 19:40):
Awesome -- that's much clearer! Thanks.
Last updated: Apr 12 2022 at 19:14 UTC