Import resources into clinFHIR Scenario Builder
March 26, 2017 1 Comment
Just a short note to let you know that I’ve added the ability to import resources directly into the clinFHIR Scenario Builder (people have asked about this for a while). There are 3 formats currently supported:
- A single Json resource
- A Json bundle
- An XML bundle
(Note that a single XML resource is not yet supported – just place it in a bundle if this is a problem right now)
To access this, load the scenario builder and click the ‘Import resource’ link in the middle of the navbar. You’ll get a dialog into which you can paste the text of the resource or bundle you want to import. You’ll get an error if you paste something invalid, but otherwise the resource/s should be imported into the Scenario Builder.
Note that the Xml import uses the currently selected Conformance server to perform the conversion from Xml to Json (suggested by Bob Milius) by POSTing the bundle to the Bundle endpoint as XML, and then reading it back as Json. I’ve tested using HAPI STU-3, but the other servers should work provided that they support the Bundle endpoint, and both Json & XML. This also means that the bundle must have a ‘type‘ value of collection.
You can include an id on your resource/s if you wish (but NOT on the bundle) – but if you do it’s your responsibility to ensure that it will be unique in the scenario you are building.
For bundles, the best strategy seems to be to include an entry.fullUrl with a uuid for each resource, and use that as the target of the references from other resources. The uuid will remain as the id for the resource in the Scenario Builder, and the references between resources should persist into the scenario. (This may cause some issues when saving the scenario to the Data Server – I need to look into that).