Provide a simple worked example for the MO Template Editor that shows how modular archetypes can be combined.
Archetypes may be combined into one template. The advantage of this is that archetype modules can be write once - use many times, in different report and user contexts. By way of example you may have the talked about top ten archetypes and a couple more that make up a fair chunk of the EHR content, and then choose to combine these in certain ways for certain situations. Thus a discharge summary could contain (at least) a current medication list, allergies and history of encounter; and the clinical coding department could receive an initial patient separation notice including a brief cut down history of encounter, while pharmacy could receive a list of added medications. So this example shows the use case of combined archetype modules that comprise sometimes just parts of the originating archetypes. We have heard this use case in several places now.
But let's start with a simple combination of archetypes into a Template. In this case - the apple archetype is joined with orange and mango archetypes and we will do some Gello enabled adding up of weight and cost.
Some necessary files are located in CEN-Fruit.zip
Now we will add some GELLO and some nodes that calculate the total cost and weight for the Fruit template. Make a CLUSTER in the Fruit template below the mangoes CLUSTER. Call it 'Grand totals for fruit'. Under this put two ELEMENTS named 'Total Fruit Cost' and 'Total Fruit weight'. Give 'Total Fruit Cost' two decimal places. Make their data types (at ADLMatchType on the RHS) to be 'mtQuantity'. Make their units to be '$' and 'g'. (Go here if you can't remember how to do this). Add this GELLO to isCalculated for 'Total Fruit Cost':
Context CEN_Fruit_v1::ArchetypeRoot Let applesCost: PQ = template.Fruit.Apples.Apples.components->firstN(5)->last().value.oclAsType(PQ) Let orangesCost: PQ = template.Fruit.Oranges.Oranges.components->firstN(6)->last().value.oclAsType(PQ) Let mangoesCost: PQ = template.Fruit.Mangoes.Mangoes.components->firstN(5)->last().value.oclAsType(PQ) applesCost + orangesCost + mangoesCost |
Here's some code for 'Total Fruit Weight':
Context CEN_Fruit_v1::ArchetypeRoot Let applesWt: PQ = template.Fruit.Apples.Apples.components->firstN(4)->last().value.oclAsType(PQ) Let orangesWt: PQ = template.Fruit.Oranges.Oranges.components->firstN(5)->last().value.oclAsType(PQ) Let mangoesWt: PQ = template.Fruit.Mangoes.Mangoes.components->firstN(4)->last().value.oclAsType(PQ) applesWt + orangesWt + mangoesWt |
Test it in preview mode. What happens? It doesn't work (yet) as we need to set BubbleEventsUp to be 'True' for all the CLUSTER nodes in the Fruit template, as well as the ENTRY and any items nodes in the component archetypes (located below where we are working in the LHS; the tags for each being located at the top on the RHS.