Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Click on the Edit Archetypes button Image RemovedImage Added  and you get the Medical Objects Template Editor screen opening:

...

Right click on Items and go Add Element, do this four times.

Image RemovedImage Added

 

Click on the first ELEMENT. Then right click on it. Give it a Local term name of 'Height'. name the following two ELEMENTS 'Weight' and 'BMI' . Leave the fourth ELEMENT blank. In fact the fourth element is just there as it is a good idea  to have some blank elements in reserve for if you want to extend the archetype at a later time. Hide it away now by clicking on it and saying False for VisibleAtStart in RHS .

...

Lets have a look in the preview mode for what we have done. Click on Preview Archetype in the editor Image RemovedImage Added` The fields are blank as this is the default UI representation for the 'Any' datatype which is the default for the ELEMENT nodes we have done. We will add some types soon. 

...

Now we should save the archetype as we go,  so do this by clicking any time on the  exit button in the top menuImage RemovedImage Added and then clicking on again in the GLIFEditor top menu , and unfolding.

...

     Context CEN_BodyMassIndex_v1::ArchetypeRoot
Let ht: PQ = template.BMI.items.Height.value.oclAsType(PQ)
ht.value

 

Because we are setting the context to be that of the root of the archetype CEN_BodyMassIndex_v1 we are stepping down through the tree to height which is an Observation then we are getting the value out of that as a PQ. Then for testing purposes we are returning a number which is the value of the PQ. Let's test that in preview mode:

 

Well thats a pretty bad BMI value if it was for real! So let's trust we are on the right path with the GELLO and go back to the GELLO editor and complete the code:

     Context CEN_BodyMassIndex_v1::ArchetypeRoot
 
     Let ht: PQ = template.BMI.items.Height.value.oclAsType(PQ)
Let wt: PQ = template.BMI.items.Weight.value.oclAsType(PQ)
     --- get result
Let htInMetres: Real = ht.value/100
wt.value/(htInMetres.power(2))

In preview:

Image Added

Good, so close out of the archetype and save the GLIF file. Now lets run the GLIF and see if we get all that working:

Image Added

The GLIF is running past the Calculate BMI action step so we can fix that up by unclicking on the Run button, then go back to edit mode with the Allow Modifications button, and right click on the Action step , go Edit Properties, then click on Wait for Action Done and Ok. Now in Run mode it pauses on the Action step so we click the green arrow in the green Action step and we have some persisted data.

Now we need to go back to the "Overweight" arrow GELLO for the subsequent decision (yep after Allow Modifications).

We need a way to get at the persisted archetype data in particular the BMI value, to do a GLIF Decision Result for this and the other decision execution arm. We use a dot notation to get at the path for the required archetype node ( the '1.1.3') and this forms part of a local variable the used to select the correct Observation presenting through the vmr. The way to find the dot path is to use the Select Archetype Path button Image Added back in the archetype editor. Here is the entire GELLO code for this decision ( its been a long tutorial!):

     Context GLIF_VMR::GLIFDecisionNode
     Let derivedArchetypeNodeValue:CD = CD {code = '1.1.3',
codeSystem = 'CEN.BodyMassIndex.v1',
codeSystemName = 'CEN.BodyMassIndex.v1'}

Let BMI_Obs: Observation = vmr.observations ->select(observationCode.implies(derivedArchetypeNodeValue).asBoolean())->last()
Let BMI : Real = BMI_Obs.value.oclAsType(REAL).value

Let q: String = "Is patient overweight?"
Let aWeight: Integer = 50
     Let result:GLIFDecisionResult =
     if not BMI.oclIsDefined() then
GLIFDecisionResult{Question = q,Answer = unknown, Reason = "No BMI data entered",Weight = aWeight}
else
if BMI > 25
then
GLIFDecisionResult{Question = q,Answer = true, Reason = "Patient is overweight",Weight = aWeight}
else
GLIFDecisionResult{Question = q,Answer = false, Reason = "Patient is notoverweight",Weight = aWeight}
endif
endif

result


And again putting similar code but with changes in the other decision arrow and running the GLIF file with a height entered on 180 cm and a weight of 90 kg we get:

Image Added

 

Notice the changed name for the other arrow. All we have so far really is whether the patient is overweight or not. We should add another arrow called "Underweight" for a BMI below say 18.5 .Then we could adjust the code for "Not overweight" and call it " Normal weight"

Anyway thats it for now. Next tutorial will be on using GELLO code in Patient states and the use of Branch and Sync Nodes.