<div dir="ltr"><br> Hehe, well, we could argue that english is not a formal language and as so may be ambiguous... ;)<br><br> How I would do it? My first try would be:<br><br>$l1 : LabResult( value < 1, $date1:date, eval( inLastMonth($date1) )<br>
$l2 : LabResult( value < 1, $date2:date > $date1, eval( inLastMonth($date2) )<br>
$l3 : LabResult( value < 1, $date3:date > $date2, eval( inLastMonth($date3) )<br>not LabResult( date > $date1 && < $date2, this not in ($l1, $l2, $l3) ) <br><br> Let us know what you come up with. :)<br>
<br> []s<br> Edson<br>
<br><br><div class="gmail_quote">2008/7/30 Yoni Mazar <span dir="ltr"><<a href="mailto:y.mazar@gmail.com">y.mazar@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi again,<br>
<br>
Sorry for nagging, but I'm failing again and again to implement simple<br>
business logic using rules.<br>
Lets assume, we have LabResult facts with date and value fields. The<br>
business requirement is to detect "patients that have at least 3 consecutive<br>
LabResults with value<1 in the last month".<br>
detecting one fact is simple:<br>
LabResult(value<1 && eval(inLastMonth(date)))<br>
But detecting 2 consecutive facts, actually requires that there is not a<br>
third fact in the middle with value >= 1!<br>
something like:<br>
<br>
LabResult(value<1, date1:date, eval(inLastMonth(date1))),<br>
LabResult(value<1, date2:date, eval(inLastMonth(date2))),<br>
eval(date1.before(date2)),<br>
not( LabResult(value>=1, date3:date, eval(inLastMonth(date3))),<br>
eval(date1.before(date3))<br>
eval(date3.before(date2)) )<br>
<br>
Now, imagine how to detect 3 consecutive facts...<br>
<br>
Does someone has a simple idea how to implement this? How comes that one<br>
English sentence is translated to so many lines of code?<br>
<br>
Thanks for the help, Yoni<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/Finding-a-sequence-within-the-data-tp18738051p18738051.html" target="_blank">http://www.nabble.com/Finding-a-sequence-within-the-data-tp18738051p18738051.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>