Stream: implementers
Topic: Question on Storing FHIR resource state as extension
Nath (Jan 19 2020 at 05:09):
Hello Friends,
I have a webapp UI which accepts input from the user for 2 or more observation resources and when "Save" button clicked updates the FHIR resource /observation. The requirement is that I need to track each save operation like a history say save1. i.e. each save operation involve storing /observation resource1 version1, /observation resource2 version1 . Lets say the user updated 3 times, we have save1, save2, save3 in the history.
Now the user choose save2, I should display save2 corresponding /observation resource values in UI.
My question is what is the best place to store the save history information.
I am thinking to store the history object in Patient resource as an extension. Is this approach correct ?.
Is any other resource will be better and how should I store it i.e. extension etc.. ?
Could you please give me some ideas?.
thanks
Nath
Lloyd McKenzie (Jan 19 2020 at 06:07):
Why wouldn't you just use the built in history capability and store each version? If the version 'chooses' save 2, then create version 4 which is a mirror of what version 2 was.
Nath (Jan 19 2020 at 14:54):
thanks @Lloyd McKenzie . I assume when you said "builtin history", this is the history for each resource. Right?. The issue here is that UI Panel contains not just one single resource. UI Panel contains 2 or more observation/encounter/procedure etc.. resources and at the end there is a button "Save". For example, UI has 2 resources R1 and R2. Now when "Save" button clicked, both R1 and R2 is saved. So, somewhere I should store "Save1" which represents the version that was saved for each resource. So, this is storing version history for group of resources where resource can be anything encounter or procedure or observation.. Hope this clarifies.
Patrick Werner (Jan 19 2020 at 16:44):
Saving the history through an extension seems to be bad practice. Why you don't just use a Bundle to point to your UI Components?
Then you can choose a Version of the Bundle and this version has version aware links to the actual resources.
Nath (Jan 19 2020 at 18:29):
thanks @Patrick Werner . Sorry I am new to FHIR and with limited knowlege I had, for some reason I thought bundle was not persisted in the storage.The reason being that I saw bundle usage more in search where returnBundle(..) so I always thought its a wrapper resource to return search results. If bundle is like any other resource persisted, then I can use the bundle and version. thanks all for your kind help.
Lloyd McKenzie (Jan 19 2020 at 18:32):
Bundle or List are possibilities. Bundles aren't persisted when submitting a transaction or messages, but they're certainly stored when you use them for Bundles or Collections. Whether you choose to use Bundle or List depends on whether you want the versions to be contained or not
Patrick Werner (Jan 19 2020 at 18:32):
Oh i made a mistake in my last post. I meant the Composition Resource
Patrick Werner (Jan 19 2020 at 18:33):
You could use it to point to the relevant resources. Or as Lloyd mentioned a List resource. Both will provide better searchability as your resources are not „hidden“ behind a Bundle
Nath (Jan 19 2020 at 21:09):
thank you so much @Patrick Werner and @Lloyd McKenzie for your kind help and idea. truly appreciate it. I looked at Composition and List.
I looked at List and that seems to contain entry array
"entry" : [{ // C? Entries in the list
"flag" : { CodeableConcept }, // Status/Workflow information about this item
"deleted" : <boolean>, // C? If this item is actually marked as deleted
"date" : "<dateTime>", // When item added to list
"item" : { Reference(Any) } // R! Actual entry
}],
Composition seem to contain sections array.
Is FHIR Composition more like OO composition (i.e. lifetime of contained depends on the container)?
Sorry still not able to understand difference between List vs Composition vs Bundle .
Can you please kindly elaborate this line "Whether you choose to use Bundle or List depends on whether you want the versions to be contained or not".
I would like the versions of the contained resources stored in either List or Composition. So, which resource contains versions? Is it List or Bundle or Composition
Lloyd McKenzie (Jan 19 2020 at 23:28):
List is a flat collection with optional ordering. Composition is a hierarchical ordering with tight control over rendering, typically used for creating documents. Both of them organize by referencing their content, not packaging it directly. Bundle is a physical organizer. It has no meaning of its own, but it allows packaging of resources to ship them around as a group. A FHIR document is actually a FHIR Bundle that starts with a Composition resource (that defines the hierarchy and the rendering) along with whatever other resources are relevant.
Nath (Jan 20 2020 at 00:50):
thank you so much @Lloyd McKenzie for explaining and it helped me choose the type.
Richard Townley-O'Neill (Jan 20 2020 at 07:31):
Why not use Provenance here?
Nath (Jan 20 2020 at 16:16):
thanks @Richard Townley-O'Neill . Seems like Provenance resource is a better choice. Let me read up more.
Last updated: Apr 12 2022 at 19:14 UTC