So far we have retrieved the reticulocytes observation. This time we will test the value of that against a threshold, and if abnormal generate an onscreen comment.
This will be in the form of a new observation. This can be persisted if the mode metadata is changed to 'Server' .
Lets get the value of the observation, check it against a threshold and then generate the comment as a system generated observation. Replace the previous GELLO file with the following from the line that starts with "Let incoming_retic.."
Let incoming_retic_value: PQ = observations->select(observationCode.implies(retic_LN).value)
->sortedBy(dateTime).last().value.oclAsType(PQ)
--do Booleans or Tests
Let highRetics: Boolean = If incoming_retic_value.oclIsDefined() then
if incoming_retic_value > PQ{value = 100, unit = '10*9/L}
then true
else false endif
else false endif
-- prepare comment
Let commentCode:CD =CD{code = '8251-1', codeSystem = '2.16.840.1.113883.6.1', cod
eSystemName ='LOINC', displayName = ST{value='Comment'}}
Let highReticsCommentObs: Observation = Observation{observationCode = commentCode,
value = ST{value = 'Raised reticulocytes, consider haemolytic anaemia and blood loss as causes.'}
}
-- result
Let result:Sequence(Observation)
= Sequence{highReticsCommentObs
}
result
-----------------
And after running this we can see the result in the variables on LHS:
But what does this look like back in EO?