-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference resolution for Composition Bundle #11
Comments
References in the form There is an exception however, which is when all the related resources are delivered in the same bundle, e.g. via specifying |
Hi Pascal The resource references in my bundles Composition.sections conform to 'relative reference' but Resolved() fails to resolve them because the bundle isn't associated with a server and it can't derive the base part of the url. SwiftFHIR still attempts to resolve these by looking for the reference in the fullUrl elements of the resources in the bundle. However, none of the resources in the bundle have the fullUrl element present so they remain unresolved. While the reference values in my Composition.section(s) clearly aren't identity values - they are resourcetype/identity - given we are processing a Bundle, extracting the 'identity' part of the reference would permit a search of the bundle entries for resource.id. I note the FHIR spec documentation says "Applications reading a bundle should always look for a resource by its identity in the bundle first before trying to access it by its URL." Is this a possible future enhancement to Swift-FHIR?? I'm temporarily implementing it locally (by extending the code in Resolved() to additionally search on the ID part of the reference. However one thing I'm struggling with is how to provide a 'type' parameter value for the call to Resolve(). At the point I call this I know the type it should be but only have this as a String (from the first part of the reference) - how should I generate a Resource.Type value from a String - is there some clever Swift technique to do this? |
I see. I would experiment with these lines; I'd probably do an |
Sorry if this is a naive newbie question. I'm loading a Composition bundle from a file but when processing the sections, I'm running into problems resolving the section references to other resources in the bundle. In the Bundle I'm provided with, the references in the Sections have the form "resource_type/guid" - eg
"reference": "Condition/98d29b5a-da2b-4f48-99b8-53924642c9fd".
If I call the resolve() method on the section.entry[n], eg;
sec.entry![0].resolve(SMART.Condition, callback: { (resolvedResource: Resource?) -> Void in
I get the following from SwiftFHIR -
SwiftFHIR [Reference+Resolving.swift:128] resolve(_:callback:) WARNING: reference does not have a server instance, cannot resolve «Condition/e3d96a2e-abbe-4e78-93dd-e5870fc4f796»
Is this because the bundle has been loaded directly from a file - using bundle.instantiate() - rather than being loaded using the SMART.Client approach etc???
Removing the 'Condition/' from the reference in the file JSON makes no difference - the resolve() method still expects to find a server associated with the bundle.
So, is this just a current constraint of the Swift-FHIR library when processing file based bundles?
Investigating this also made me wonder how I would set the type: parameter of the resolve() method IF the reference only contained a GUID reference to the bundled resource. The Composition.section.references I'm provided with are of the form below but if they didn't have the 'resource type' part how would I set the 'expected type' parameter in the call to resolve() ???
"entry": [
{
"reference": "Condition/e3d96a2e-abbe-4e78-93dd-e5870fc4f796",
"display": "COFE-Diagnosis-Condition-Example-1"
},
{
"reference": "Condition/98d29b5a-da2b-4f48-99b8-53924642c9fd",
"display": "COFE-Diagnosis-Condition-Example-2"
}
]
And, by extension, does this mean that for a file based bundle, the section references should really be provided as 'contained' references/resources using the # prefix?
As always, the wisdom of the experienced would be appreciated
john
The text was updated successfully, but these errors were encountered: