Stream: dotnet
Topic: Cannot resolve resource reference
Jeff Chen (Feb 18 2020 at 06:13):
Hi all,
I validated Observation resource and its subject reference "http://example.org/fhir/Patient/2a51042a-2bf1-40d0-8ca4-22180b4c964d " to Patient resource ( resource id is 2a51042a-2bf1-40d0-8ca4-22180b4c964d )
But the warning shown below:
[WARNING] Cannot resolve reference http://example.org/fhir/Patient/2a51042a-2bf1-40d0-8ca4-22180b4c964d (at Observation.subject[0])"}
How do I fix it?
Thanks
Kenneth Myhra (Feb 18 2020 at 07:47):
The Patient 2a510(...) at example.org does not exist, set ValidationSettings.ResolveExternalReferences to false
Jeff Chen (Feb 18 2020 at 08:09):
@Kenneth Myhra
if Patient resource is local file(.json), how do i assign to reference of the Observation ?
How does reference look like ?
Thanks
Kenneth Myhra (Feb 18 2020 at 08:56):
Is everything you are trying to validate contained in one Bundle?
Jeff Chen (Feb 18 2020 at 09:14):
Hi @Kenneth Myhra
Kind of confused about "Bundle" ?
In my case, I have two two local resources ("Observation" and "Patient"). Observation has reference to Patient.
If i change reference as web api and respond json (the Patient resource), I don't know why reference can not be resolved.
Is anything i misunderstand?
Thanks for your quick reply
Kenneth Myhra (Feb 18 2020 at 09:31):
The validator cannot pick up local resources from disk, it would need a FHIR REST API if the reference is an external resource. If everything is contained in a Bundle like seen below it can validate it without a FHIR REST API.
{ "resourceType": "Bundle", "id": "bundle-example", "meta": { "lastUpdated": "2014-08-18T01:43:30Z" }, "type": "searchset", "total": 3, "link": [ { "relation": "self", "url": "https://example.com/base/MedicationRequest?patient=347&_include=MedicationRequest.medication&_count=2" }, { "relation": "next", "url": "https://example.com/base/MedicationRequest?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2" } ], "entry": [ { "fullUrl": "https://example.com/base/MedicationRequest/3123", "resource": { "resourceType": "MedicationRequest", "id": "3123", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: 3123</p><p><b>status</b>: unknown</p><p><b>intent</b>: order</p><p><b>medication</b>: <a>Medication/example</a></p><p><b>subject</b>: <a>Patient/347</a></p></div>" }, "status": "unknown", "intent": "order", "medicationReference": { "reference": "Medication/example" }, "subject": { "reference": "Patient/347" } }, "search": { "mode": "match", "score": 1 } }, { "fullUrl": "https://example.com/base/Medication/example", "resource": { "resourceType": "Medication", "id": "example", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: example</p></div>" } }, "search": { "mode": "include" } } ] }
Kenneth Myhra (Feb 18 2020 at 09:32):
If you try this example which reference a working FHIR REST API with resources that exists it will validate successfully
{ "resourceType": "MedicationRequest", "id": "3123", "status": "unknown", "intent": "order", "medicationReference": { "reference": "http://spark.poplin.no/fhir/Medication/example" }, "subject": { "reference": "http://spark.poplin.no/fhir/Patient/example" } }
Jeff Chen (Feb 18 2020 at 10:11):
Good, I gonna try the second way.
But, I want my resources to be private and can't upload to spark.
Can I work on my own server (like spark) with FHIR .NET API for uploading resources ?
Thanks !!
Kenneth Myhra (Feb 18 2020 at 10:26):
Yes, you can clone the repository and run either Spark.Web (.NET Core version) or Spark (.NET Framework version), there are separate branches for each FHIR Version stu3/master and r4/master, there is also a possibility to run the docker images documented in the README.
If you want to set up a version using the NuGet packages there is a Quick start guide here http://firelyteam.github.io/spark/quickstart
Jeff Chen (Feb 19 2020 at 05:51):
UPDATE
I found i don't need spark, and I only set up a FhirClient on my server which gives FHIR format response, json/xml.
So, Observation reference to my api of Patient resource would be alright.
(ಠ‿ಠ)
Last updated: Apr 12 2022 at 19:14 UTC