2010-12-17 Logic Planning Meeting
Participants
@Vibha Anand
@Steve McKee
@Tammy Dugan
@Burke Mamlin
@Nyoman Ribeka
@Darius Jazayeri
Roger Friedman
Background
This meeting was called to expand on the prior logic planning (see http://notes.openmrs.org/logicplanning). The goal was to decide on the best strategy for moving the logic service forward in a way that allows more people to begin using the service.
Notes
These notes were copied from http://notes.openmrs.org/logic-2010-12-17
Wiki page: http://openmrs.atlassian.net/wiki/x/PwtYAQ
Connect (NOT connect.openmrs.org): http://breeze.iu.edu/openmrs
Agenda
Review Arden grammar, decide on strategy for grammar (30 minutes)
Overall design of Tokens vs Rules vs Data Sources vs. "RuleProvider"s (30 minutes)
Decide on strategy for supporting compiled rules (from there)
Next Steps (15 minutes)
Grammar Thoughts
cdCount:= read Last {CD4Count from Obs} Where it Occurred Within Past 30 Days;
If (cdCount > 85.0) AND (cdCount < 95.0) then conclude True;
Last {CD4Count Where date within 30 Days and value < 85.0};
{Last CD4Count} Where date within 30 Days and value < 85.0
(Last {CD4Count Where date within 30 Days and value < 85.0} AND Last {WEIGHT Where date within 30 Days and value < 85.0}) OR First {CD4Count Where date within 30 Days and value < 85.0};
{Last CD4Count} Where value < 85.0;
{Last CD4Count} Where date > {First HIVDx from obs}
{Last CD4Count} Where date > {First HIVDx from obs}
({Last CD4Count} Where value < 85.0) AND ({Last Meds from Obs} Where value = Prescribed)
Transform (
First, Last, All, Min, Max, Count, Average, etc.
)key from datasource
datasource
components available for restrictions
return values
What to do with results whose datatype is date, e.g. "NEXT VISIT DATE"
.
How to do "first encounter that has location=Telephone and type=Registration"
now you'd have to do eval("encounter") and filter in Java
Need to handle correlations e.g.
visits with CD4 COUNT<350 and TEMPERATURE>100
patients with an obs group with ALLERGIC TO=Penicillin AND SEVERITY=Severe
patients with a visit V1 where CD4COUNT<200 AND TB DOES NOT EXIST and
a visit V2 where CD4COUNT<200 AND TB=Positive and
V1.date<V2.date
For a developer:
if (logic.eval(patient, "\{CD4 COUNT} > 350")) \{
// do something
}
if (logic.eval(patient, "last({CD4 COUNT}) > 350")) {
// do something when most recent CD4 is over 350
}
For a super user:
{{ Define a cohort with: LAST({CD4 COUNT}) > 350}}
A real example: "first WEIGHT after HIV PROGRAM ENROLLMENT"
—
Two example expressions:
Fetch me the last CD4 that is less than 350 and is also before DATE (returns a number)
Is the (last CD4 that is less than 350) before DATE? (returns boolean)
two options:
(a)(b)
TO DO:
5-10 realistic representative examples of expressions, ranging from simple to complex. Describe them in different hypothetical grammars and compare
condition
Return CD4 COUNT(s) less than 350
multiple conditions
Find encounters that are at Rwinkwavu Hospital of type Immunization
condition and aggregate
Return the most recent among [CD4 COUNT(s) less than 350|CD4 COUNT(s) less than 350]
aggregate and condition
Is "the most recent CD4 COUNT" less than 350?
relative query
Return the last SPUTUM CULTURE before TB PROGRAM COMPLETION
encounter-based criteria (i.e., condition and relative to a specific encounter)
Return Systolic BP and Diastolic BP from the last OUTPATIENT CONSULT visit
age-based criteria (i.e., condition and relative to patient's age at the time of test)
Return CD4 COUNT when patient was 18 months
rule that takes parameters
Put the example here:
Darius to write a snippet for RuleProvider and RuleFactory (refactor)
Agenda
Review Arden grammar, decide on strategy for grammar
Overall design of Tokens vs Rules vs Data Sources vs. "RuleProvider"s
Decide on strategy for supporting compiled rules
Recording
The link for the recording is: Recording Link (Expired on 03/31/2010)
Next Steps
Next meeting 12/17 from 2-4 PM ET