Page tree

Versions Compared


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

Node reference range calculation

GELLO code will be used to determine the reference range for a Physical Quantity. This functionality is crucial for the pathology domain. Patient characteristics such as age, gender, weight, pregnancy status and fasting status can be used in the GELLO v.1 algorithm. Reference Ranges can be simply set by typing the value in the ReferenceRange tag attribute and setting HasReferenceRange to trueTrue. However when the reference range changes depending on retrieved patient state data (from the virtual medical record (vMR) for example) you need to use GELLO in nCalcReferenceRangeOnCalcReferenceRange, not the ReferenceRange tag attribute.

Apple archetype example

We'll keep it nice and simple and build on earlier work with our fruity friend again.

Open CEN13606CEN-Apple.v1.xml one more time. What we are going to do is write GELLO v.1 that goes in the OnCalcReferenceRange tag on the RHS. As reference ranges normally apply in the human pathology domain, the GELLO that can describe them is really meant to be the result of GELLO query and processing on patient data such as age and gender, available from the PMS through the V.3 vMR interface. So for our apple example, it is best to specify a reference range for a 'humanoid' apple which will have some given date of birth.


  1. Set the HasReferenceRange RHS tag to True for 'Weight'.

  2. Put the following GELLO v.1 code in the OnCalcReferenceRange tagattribute, for the 'Weight' node:

    No Format
    let o:observation = parameter[1]
     Context CEN_Apple_v1::ArchetypeRoot
    Let days28: PQ = factory.duration(28,'d')
     Let DOB = Patient.date_of_birth
     Let DOBPlusFourWeeks = Patient.date_of_birth.add(days28)
     Let IsBabyApplePQ{value=28*24*60*60, unit='s'}
    Let dob: TS = vmr.patient.dob
    Let dobPlusFourWeeks: TS = dob + days28
    Let isBabyApple: Boolean =  DOBPlusFourWeeks.gte(dobPlusFourWeeks > factory.absolutetime("0").now())
    let ResultTS('now')
    Let result: String =
      if IsBabyAppleisBabyApple = true then '30-70'
         else '150-200'

  3. Cut and paste the following HL7 file text in its entirety into any text editor and save the file somewhere on your computer as a text file named 'BabyApple.oru'

    No Format
    PID|1||4024728675^^^AUSHIC^MC||Apple^Baby||2009060920210619|M|||1 Woodgrove Lane^^Anytown^QLD^4556

  4. Test the GELLO code by going File -> Load HL7 data -> BabyApple.oru from the Medical Objects Gello Editor we are working in. Hit the Green Run Arrow in the menu bar . Note the Result in the Variable Explorer tab of the bottom pane shows the correct value for this apple. Change the date of birth in the HL7 file to make the apple less and then more than four weeks old and see what happens.
    Here's the bit to change. (The date of birth format is YYYYMMDD):

  5. Exit the GELLO editor and check things out again. From the main MO Template Editor window, go File -> Load Gello model data -> BabyApple.oru. Go to Preview and see the displayed reference range for 'Weight'. Change the date of birth source data to an age older than 4 weeks old, reload and check things change accordingly.
  6. Save your work.



Table of Contents