Versions Compared

Key

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

...

Lets have a look in the preview mode for what we have done. Click on Preview Archetype in the editor ` 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. 

Image Added

 

Notice the View HL7 button bottom right. This will show a sample HL7 v2 message for any archetype we enter data for in Preview. Try entering a value in a field and then finding it in the resulting HL7 message. (yes its a string type in the OBX and don't worry about PIT - its an Australian display segment)

Ok out and back in the main screen click on the Height ELEMENT and then in RHS click in the field next to ADLMatchType ( ie click on mtAny). We want Height and Weight to be Quantities - so they will have a unit and a value ( similar to the PQ data type in Gello, but not the same thing as these are different datatypes in the archetypes). So scroll through the pulldown menu ( click on the down arrow to the right ), until you find mtQuantity. Make it that and then unfold the Height ELEMENT back on LHS. Notice we have a child node called QuantityData there now. When you click on that and inspect its attributes the only thing you might want to change is the number of decimal places. To get some units, right click on QuantityData and choose New Child. Click on QuantityItem and enter units in the RHS - make it 'cm' for Height.

Image Added

 

Do all the same for Weight and make its units to be 'kg'.

Have a look in Preview and it should look like this:

Image Added

 

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

Time now to calculate the BMI. But first, what units does a BMI have? It's going to be a number, so you can make it one of the Integer options, or leave it as mtAny. The formula to calculate a BMI is weight in kilograms divided by height in meters squared. We will need to convert our cm units.

For the BMI ELEMENT node, click on [No Gello] field next to the isCalculated attribute on the RHS. Then click on the '...' far right hand side of this field:

Image Added

It should look familiar, as we are in a GELLO editor enviornment again ( but this time it's to do event handling for the archetype instance). Note the context statement is set up for this, and we will not need to return a GLIF Decision Result this time either. We want to return a number based on previously inputted values in the higher nodes. This is how to do it.

Let's set up the GLIF to allow population of the archetype we have so far. We can then use this to write code against.

Close out of the archetype editor, and then right click on the 'calculate BMI' action step. Go Edit Properties . Click on the bottom of the two Add buttons. Choose Add Archetype. Click on CEN.BodyMassIndex.v1. Leave everything else alone, then ok out twice. Save the GLIF file. Ok we have a green arrow in the action step now. Turn off the Allow Modifications button. Click on the new little green arrow in "Calculate BMI". Populate the archetype with the values as in the image, and go OK:

Image Added

Now go back into the archetype editor and open up the GELLO for isCalculated for the BMI node (the one lower down with the at-code of at0004).

We need to get any stored height and weight out of the archetype. Let's start with getting the height.

     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:

Image Added