Using Logical Models with conman Scenario Builder

The scenario builder in conman is intended to allow you to build ‘graphs’ of resources to tell some clinical story – or scenario. By default it uses instances of core resource types (though profile support is on the road map), but you can also use instances of logical models that have been created in the clinFHIR Logical Modeller as well.

The main reason why you would do this, to to be able to add elements to a resource instance that is not in the core resource. This will become an extension in a ‘real’ resource, but it’s handy to be able to do this ahead of creating the extension (and the definition) to make sure that the new element is needed – and validate properties like the data type, multiplicity & so forth. You might also do this is proposing a change to the core specification as well.

However, it’s important to remember that instances of these models will not be saved on a FHIR server – the elements will either be dropped or the instance rejected, depending on the server.

The overall process to do this is as follows:

  1. Build the model using the clinFHIR Logical Modeler. Generally, you’d base the model on a core type and amend as desired.
  2. Add the model to the scenario
  3. Build the scenario

Lets look at each of these steps.

1. Build the model

2. Add the model to the scenario

This is done in the scenario definition (and must be added here before being used in a graph). In the ‘types’ tab, there is a section for Logical models just below the core types. There’s a plus (‘+’) symbol to the right, clicking that will bring up the following dialog:

Screen Shot 2018-09-05 at 8.43.45 AM

 

The drop down will show all the Logical models that have been created on the conformance server defined in the track description. Selecting one of these, along with a brief description is the easiest way to add the model.

However, if the model you want is not on the conformance server, then you can add a url to it manually in the second box. Note this is the direct url to the model – conman will attempt to load it directly from that location. This has the advantage that it doesn’t need to be on a FHIR server, as long as it is directly accessible (Though you do need the full url).

If you update the model after adding it to the scenario, then you don’t need to add it again – the most recent version is always used when adding an instance to a graph (see note below).

3. Build the scenario

This is the same as using core types – you just select the model rather than the core type in the selector, and it works in the same way as a core type with respect to adding data and creating references. But there are a few things to watch out for.

  • The structure of the model in the graph is the structure as it exists when it is added to the graph. If you update the model after adding it, it will NOT be updated.