...
Age:
$patient.getAge() > 5
checks if the patient is older than 5 years.$patient.getAgeInMonths() < 3
checks if the patient is less than 3 months.$patient.getAgeInWeeks() < 12
checks if the patient is less than 12 weeks.$patient.getAgeInDays() < 10
checks if the patient is less than 10 days.$patient.getAge() > 18 && $patient.getAge() < 70
checks if the patient is between the age of 18 and 70 years.
Gender:
$patient.getGender().equals("M")
checks if the patient is male.$patient.getGender().equals("M") || $patient.getGender().equals("F")
checks if the patient is male OR female.
Age & Gender:
$patient.getGender().equals("F") && $patient.getAge() > 18
checks if the patient is a female older than 18 years.$patient.getGender().equals("M") || $patient.getAge() > 20
checks if the patient is either a male or is older than 20 years.
Observation Value:
$fn.getLatestObsByConcept("CIEL:1234").getValueText().equals("PREGNANT")
checks if the patient has a recent observation indicating pregnancy.$fn.getLatestObsByConcept("2a86e48c-76ef-479f-815f-d7c1701e8fb7").getValueBoolean() == true
checks if the patient
Note:CIEL:1234
used in example a) is concept mapping while2a86e48c-76ef-479f-815f-d7c1701e8fb7
used in example b) is concept’s uuid.The method called after
getLatestObsByConcept()
expression depends on the data type of the concept passed in the parameter. For instance in example a) above, the concepts data type is text while in example b) the data type is boolean.
-$fn.getLatestObsByConcept("CIEL:1234").getValueNumeric()
for value numeric
-$fn.getLatestObsByConcept("CIEL:1234").getValueCoded()
for value coded
Time of the day:
$fn.getTimeOfTheDay() == 14
checks if the (current) time of the the day at the time of creating the Observation is the specified time in the criteria. In our example, the expression checks if the time of the day is 2pm. Note thatgetTimeOfTheDay()
returns the hour of the day in 24hr format.
Person Attributes:
Note that you person attributes need to be set. Therefore make sure that person attributes are set for the attribute expressions to work. Find more on how to manage person attributes here.$patient.getAttribute("Ethnicity").getValue() == "Maasai"
check if there is the person is ofMaasai
ethnicity. The ‘Maasai’ in this example is the attribute value while the ‘Ethnicity’ is attribute type.
Complex Criteria reference:
($patient.getGender().equals("F") && $patient.getAge() > 18) || ($patient.getGender().equals("M") && $patient.getAge() < 18)
checks the patient is either a female older than 18 years or a male who is less than 18 years of age.$patient.getAge() >= 1 && $patient.getAge() <= 3
evaluates to true if the patient is one, two or 3 years old.You can come up with criteria expressions using the values of the current Obs. For example:-
BMI - criteria expression would require the use of formula. If person’s weight and height are in kg and cm, then the formula would be weight/ ((1/100 x height) power 2) or weight/ ((1/100 x height) x (1/100 x height)). Here is an example of an expression that will return true if BMI is greater than 25.
"($fn.getCurrentObs("c607c80f-1ea9-4da3-bb88-6276ce8868dd", $obs).getValueNumeric() / (($fn.getCurrentObs("a09ab2c5-878e-4905-b25d-5784167d0216", $obs).getValueNumeric() / 100) * ($fn.getCurrentObs("a09ab2c5-878e-4905-b25d-5784167d0216", $obs).getValueNumeric() / 100))) > 25"
Note:c607c80f-1ea9-4da3-bb88-6276ce8868dd
is the uuid(conceptRef) for weight concept anda09ab2c5-878e-4905-b25d-5784167d0216
is the uuid(conceptRef) for height concept.
Strict Ranges
In the case where multiple concept reference ranges are evaluated to true, then we use the strictest range.
...