Versions Compared

Key

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

...

Here is some GELLO code to calculate BMI:

 

 imports HL7_v2_VMR_V1
 Context SinglePatient
 Let allWeights:Sequence(Observation) = vitals.weight
 Let allHeights:Sequence(Observation) = vitals.height
 Let mostRecentWeight:Observation = allWeights->sortedBy(dateTime)->last()
 Let mostRecentHeight:Observation = allHeights->sortedBy(dateTime)->last()
 Let wt:Real 
 
= mostRecentWeight.value.oclAsType(PQ).value
 Let ht:Real = mostRecentHeight.value.oclAsType(PQ).convert('m').value
 Let BMI: Real = wt/ht.power(2)
 If BMI < 18.5 then 'Underweight'
 else If BMI >= 18.5 and BMI < 25 then 'Normal'
 else If BMI >= 25 and BMI < 30 then 'Overweight'
 else 'Obese'
 endif
 endif
 endif 
 

Using fifthTest.xml, here is the result:

...