Previous Topic

Next Topic

Book Contents

Tip

One way to code a script that uses this type of relationship is to define the RefName path of each Weight item as a context-specific argument, as illustrated in the following script. This script compares the current weight, an item identified as an applied dependency, with the weight in the previous visit, an item identified as a dependency type dependency. The PastValue argument, defined in the context for each visit, has a value of the RefName path of the Weight item in the previous visit.

PastValue = patient.getargument("PastValue")
BaseWt = Patient.GetValueRF(PastValue, "", 0,0,0)
CurrWt = Patient.GetValueRF(Patient.GetCurPath(), "", 0,0,0)

Patient.RulePassed = TRUE
If (BaseWt <> 0 and CurrWt <> 0) Then
BaseLowWt = BaseWt - (BaseWt*.05)
BaseHiWt = BaseWt + (BaseWt*.05)
If (CurrWt < BaseLowWt or CurrWt > BaseHiWt) Then
Patient.RulePassed = FALSE
patient.addnamedvalue "QUERYTEXT",
"Weight change is more than 5% difference from
previous visit; please verify."
Else
Patient.RulePassed = TRUE
End If
End If

Send Feedback