************NOTE: this worked example section of the wiki is now out of date as GELLO is currently at R.2. This code will not work in later versions of the editor. We intend to update this section to R2 GELLO soon. ****************
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 and setting HasReferenceRange to true. 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 nCalcReferenceRange, not the ReferenceRange tag.
We'll keep it nice and simple and build on earlier work with our fruity friend again.
Open CEN13606-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.
Put the following GELLO v.1 code in the OnCalcReferenceRange tag, for the 'Weight' node:
let o:observation = parameter Let days28 = factory.duration(28,'d') Let DOB = Patient.date_of_birth Let DOBPlusFourWeeks = Patient.date_of_birth.add(days28) Let IsBabyApple: Boolean = DOBPlusFourWeeks.gte(factory.absolutetime("0").now()) let Result: String = if IsBabyApple = true then '30-70' else '150-200' endif Result
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'
MSH|^~\&|EDITOR^EDITOR:Unknown^L|MO^123^GUID|||20070424153908+1100||ORU^R01|XX04241539656.7589|P|2.3.1^AUS&&ISO^AS4700.2&&L|||||AUS PID|1||4024728675^^^AUSHIC^MC||Apple^Baby||20090609|M|||1 Woodgrove Lane^^Anytown^QLD^4556