Stream: implementers
Topic: Inline Contained resources?
Grahame Grieve (Nov 04 2016 at 05:14):
GF#6800 - any comments on this task?
nicola (RIO/SS) (Nov 04 2016 at 06:00):
This is very convenient. I think, it could be used for representation not only contained but any referenced resources (for example when you do search with _include/_revinclude). In aidbox we decided to implement special parameter in operations, which makes server inline all resolvable refs in bundle/resource.
Grahame Grieve (Nov 04 2016 at 06:12):
have you looked at the _history operation? that's pretty much what it is
nicola (RIO/SS) (Nov 04 2016 at 06:14):
@Grahame Grieve Is this message related to transaction log?
Grahame Grieve (Nov 04 2016 at 06:20):
yes oops
Lloyd McKenzie (Nov 06 2016 at 14:57):
I'm not a fan of inlined contained resources because you still have to handle resolution if the contained resource is referenced from multiple places. It also makes finding where a referenced resource lives much harder if there can be multiple references. And it would provide a reason for some to abuse containment because they like nesting.
Grahame Grieve (Nov 06 2016 at 22:28):
but references from multiple places is very definitely an edge case
Paul Knapp (Nov 07 2016 at 11:45):
So instead of:
<Resource>
...
<patient reference="uri"/>
...
</Resource>
we'd have
<Resource>
...
<patient>
....
<birthdate value="2001-04-18">
....
</patient>
...
</Resource>
Grahame Grieve (Nov 07 2016 at 12:07):
yes
Lloyd McKenzie (Nov 08 2016 at 02:58):
References from multiple places is certainly an edge case, but it's one that can't be ruled out and that systems will therefore need to support - which takes away much of the benefit of inlining and adds significant complexity.
Paul Knapp (Nov 10 2016 at 07:56):
If you are doing resource inlining why wouldn't it be inlined everywhere it is referenced?
Grahame Grieve (Nov 10 2016 at 19:02):
size? logical fact?
Lloyd McKenzie (Nov 10 2016 at 20:17):
Looping? :)
Simon Knee (Nov 11 2016 at 12:58):
<Flag>
<id value="7cb73a48-090d-469a-a2b2-04f1e6b11ea3"/>
<meta>
<profile value="http://fhir.nhs.net/StructureDefinition/spine-ris-flag-1-0"/>
</meta>
<!--contained patient resource-->
<contained>
<Patient>
<id value="20daadee-26e1-4d6a-9e6a-7f4af9b58877"/>
<meta>
<profile value="http://fhir.nhs.net/StructureDefinition/spine-ris-patient-1-0"/>
</meta>
<identifier>
<system value="http://fhir.nhs.net/Id/nhs-number"/>
<value value="1234567890"/>
</identifier>
<!--DOB added-->
<birthDate value="2005-01-01"/>
<!--GP Organization referenced.-->
<careProvider>
<reference value="#79600119-ebaf-4362-bb89-d473a33b1675"/>
</careProvider>
</Patient>
</contained>
<!--sibling contained GP Organization resource-->
<contained>
<Organization>
<id value="79600119-ebaf-4362-bb89-d473a33b1675"/>
<meta>
<profile value="http://fhir.nhs.net/StructureDefinition/gpconnect-organization-1"/>
</meta>
<identifier>
<system value="http://fhir.nhs.net/Id/ods-organization-code"/>
<!--GP Practice Code-->
<value value="B86022"/>
</identifier>
<!--GP Practice Name-->
<name value="Wood Town GP practice"/>
</Organization>
</contained>
<status value="active"/>
<period>
<start value="2015-02-04"/>
</period>
<subject>
<reference value="#20daadee-26e1-4d6a-9e6a-7f4af9b58877"/>
</subject>
<code>
<coding>
<system value="http://fhir.nhs.net/ValueSet/risk-indicator-type-1-0"/>
<code value="FGM"/>
</coding>
</code>
</Flag>
Simon Knee (Nov 11 2016 at 13:04):
Question relating to example Flag resource just posted. Can a resource contain 2 sibling resources with an internal reference from one contained sibling to the 2nd contained sibling resource? See example. I think this is legal based on FHIR standard 'A contained resource SHALL only be included in a resource if something in that resource (potentially another contained resource) has a reference to it'. Can anyone confirm this is legal FHIR? Thanks
Lloyd McKenzie (Nov 11 2016 at 13:55):
@Simon Knee Yes, that's legal. Contained resources can point to each other
Kevin Mayfield (Nov 11 2016 at 18:29):
@Simon Knee but if you follow NRLS project that contained Patient resource isn't needed.
Kevin Mayfield (Nov 11 2016 at 18:29):
<Flag>
<Subject value="https://pds.proxy.nhs.net/Patient/1234567890" />
<code>
<coding>
<system value="http://fhir.nhs.net/ValueSet/risk-indicator-type-1-0"/>
<code value="FGM"/>
</coding>
</code>
</Flag>
Paul Knapp (Nov 11 2016 at 19:42):
That isn't a valid construction, would need to be:
<Flag>
<status value="active"/>
<subject>
<reference value="https://pds.proxy.nhs.net/Patient/1234567890"/>
</subject>
<code>
....
</code>
</Flag>
Paul Knapp (Nov 11 2016 at 19:54):
@Grahame Grieve @Lloyd McKenzie So is your view that rather than placing one instance of all contained resources in 'contained' inlined means that we place one instance in a place of use with all other places of use using a local reference? Then rather than building an internal reference table of the contained resources directly from 'contained' we would first have to preprocess the entire tree to build the table of contained resources from the supplied instance. More work and no real space or complexity saving.
Grahame Grieve (Nov 11 2016 at 20:40):
inlining contained resources certainly makes reference resolution much more complicated if you're still going to allow references to contained resources. yes
Grahame Grieve (Nov 11 2016 at 20:42):
note that this was discussed on the FHIR-I call, and the task was closed. The outcome of our discussion is that inlining contained resources would create many issues, and the practical issues here are not strong. We will work on better aggregation approaches across the RESTful API to reduce the interest in containing resources that don't need to be contained (slightly different issue, but causally related)
Kevin Mayfield (Nov 12 2016 at 17:32):
Thanks that would be very useful. I'm noticing a increasing number of cases where HL7v3 is being converted to FHIR verbatim and so including a lot of unnecessary information.
Grahame Grieve (Nov 13 2016 at 10:57):
that's an occupational hazard in v3 countries. In my country, you'd replace 'v3' with 'cda'
Simon Knee (Nov 14 2016 at 10:05):
@Lloyd McKenzie Thanks for quick FHIR response.
Simon Knee (Nov 14 2016 at 10:06):
@Kevin Mayfield the example I included was for the FGM messaging interface. I understand the e-RS project were discussing using inline contained resources - did this get agreement?
Kevin Mayfield (Nov 14 2016 at 10:56):
@Simon Knee It is at the moment. We've not officially fed back comment though. The main issue for us is it's differences from NRLS version of DocumentReference. We will probably have to convert e-RS DocumentReference to SNOMED and remove the inline resources (or convert the NRLS version).
Last updated: Apr 12 2022 at 19:14 UTC