-
Describe the bug var sr = new ServiceRequest
{
Subject = new ResourceReference
{
Reference="Patient/1",
}
};
// values Count is 0
var values = sr.ToTypedElement().Select("ServiceRequest.subject.where(resolve() is Patient)"); But the similar cases Patient patient = new()
{
Id = "1",
Active = true,
BirthDate = "2001-03-01"
};
Encounter encounter = new()
{
Contained = new List<Resource>() { patient },
Subject = new ResourceReference("#1")
};
// values Count is 1
var values = encounter.Select("Encounter.subject.where(resolve() is Patient)"); I use 3.3.0 version of |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 1 reply
-
Hi @whyfate , In your second example FhirPath can resolve the To overcome that, you can tell FhirPath how to resolve resource, like this: var context = FhirEvaluationContext.CreateDefault();
var client = new FhirClient("https//fhir.server.example");
var resolver = new WebResolver((uri) => client);
context.ElementResolver = (s) => resolver.ResolveByCanonicalUri(s).ToTypedElement();
var values = sr.Select("ServiceRequest.subject.where(resolve() is Patient)", context); In this case we tell FhirPath to request the server "https//fhir.server.example" to retrieve the resource. Assuming the resource ( |
Beta Was this translation helpful? Give feedback.
-
It's so complicated. |
Beta Was this translation helpful? Give feedback.
-
It is. But maybe you can explain your use case, and then there might be a better solution. For example, is your use case to retrieve ServiceRequest resources from a Fhir server with subject is Patient? Then you can write a search request to the server a let the server do the filtering. |
Beta Was this translation helpful? Give feedback.
-
I use spark as fhir server.
|
Beta Was this translation helpful? Give feedback.
-
I have never worked with resolvers in the firely-net-sdk library. For Spark would probably need to implement a custom resource resolver (IAsyncResourcesResolver/IResourceResolver) that can resolve resources from the database. |
Beta Was this translation helpful? Give feedback.
-
@kennethmyhra It's will be slowly.Maybe I don't want to verify whether it really exists. |
Beta Was this translation helpful? Give feedback.
-
There exists no such resolver server-side in Spark today. But I think Marco's example using the WebResolver client-side should be quite easy to implement without having to modify Spark's source code. Speed will of course depend on how many such resolve call you need to issue. |
Beta Was this translation helpful? Give feedback.
-
Emmm...but isn't that what the server should provide? |
Beta Was this translation helpful? Give feedback.
-
I have not worked much with FHIRPath and resolve, but I don't think there is a good way in the specification to issue such a FHIRPath to the server from a client? |
Beta Was this translation helpful? Give feedback.
-
@kennethmyhra @marcovisserFurore Thank you very much for your answers. |
Beta Was this translation helpful? Give feedback.
@kennethmyhra @marcovisserFurore Thank you very much for your answers.
I'll use
subject
to instead ofpatient
to searchServiceRequest
.This is best way for me right now.