You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Sowmya Vallabhajosyula <so...@zemosolabs.com> on 2016/04/22 07:55:35 UTC

Custom state values in CEP

Is there a way to store a custom state value along with triggering an
event? This would not only help in maintaining an audit of the values that
triggered the state, but also for some complex set of conditions - for e.g.
if the earlier state was triggered by the temperature of a patient, I do
not want to consider temperature in the subsequent state calculation.

At this point of time, I feel that for such a scenario I will have to go
with Data Streaming API and manage state on my own. Is that right?

Thanks and Regards,
Sowmya Vallabhajosyula

Re: Custom state values in CEP

Posted by Sowmya Vallabhajosyula <so...@zemosolabs.com>.
Thanks Till! I will try that out.

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Apr 22, 2016 at 3:14 PM, Till Rohrmann <tr...@apache.org> wrote:

> Hmm I think you won't come around the problem of deduplication because if
> you look for 2 events which are out of range and all of your 4 vitals are
> out of range, then you will have at least two matching sequences (given
> that you don't reuse the events). Maybe it's best to simply use a tumbling
> time window of 24 hours and then count the elements which are out of range
> for each user. That you can simply do with a fold function.
>
> Cheers,
> Till
>
> On Fri, Apr 22, 2016 at 11:22 AM, Sowmya Vallabhajosyula <
> sowmya.v@zemosolabs.com> wrote:
>
>> Hi Till,
>>
>> Thank you for the quick reply. May be you can help me find a way of doing
>> it in CEP.
>>
>> Scenario:
>>
>> If any of the patient vitals received in the last 24 hours are out of
>> range, I want to set the state as SIRS.
>>
>> In the sample code, I implement a Filter Function that identifies if the
>> vital is out of range. In reality, patient 3 should not be added to SIRS
>> (his temperature vital is already recorded or another record came in where
>> the temperature is still high which should be invalidated as well). Is
>> there a different way of achieving this? I cannot have a separate filter
>> for each vital as the order of vitals can be random.
>>
>> [image: Inline image 1]
>>
>> On Fri, Apr 22, 2016 at 2:35 PM, Till Rohrmann <tr...@apache.org>
>> wrote:
>>
>>> Hi Sowmya,
>>>
>>> I'm afraid at the moment it is not possible to store custom state in the
>>> filter or select function. If you need access to the whole sequence of
>>> matching events then you have to put this code in the select clause of your
>>> pattern stream.
>>>
>>> Cheers,
>>> Till
>>>
>>> On Fri, Apr 22, 2016 at 7:55 AM, Sowmya Vallabhajosyula <
>>> sowmya.v@zemosolabs.com> wrote:
>>>
>>>> Is there a way to store a custom state value along with triggering an
>>>> event? This would not only help in maintaining an audit of the values that
>>>> triggered the state, but also for some complex set of conditions - for e.g.
>>>> if the earlier state was triggered by the temperature of a patient, I do
>>>> not want to consider temperature in the subsequent state calculation.
>>>>
>>>> At this point of time, I feel that for such a scenario I will have to
>>>> go with Data Streaming API and manage state on my own. Is that right?
>>>>
>>>> Thanks and Regards,
>>>> Sowmya Vallabhajosyula
>>>>
>>>
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Sowmya Vallabhajosyula
>>
>
>


-- 
Thanks and Regards,
Sowmya Vallabhajosyula

Re: Custom state values in CEP

Posted by Till Rohrmann <tr...@apache.org>.
Hmm I think you won't come around the problem of deduplication because if
you look for 2 events which are out of range and all of your 4 vitals are
out of range, then you will have at least two matching sequences (given
that you don't reuse the events). Maybe it's best to simply use a tumbling
time window of 24 hours and then count the elements which are out of range
for each user. That you can simply do with a fold function.

Cheers,
Till

On Fri, Apr 22, 2016 at 11:22 AM, Sowmya Vallabhajosyula <
sowmya.v@zemosolabs.com> wrote:

> Hi Till,
>
> Thank you for the quick reply. May be you can help me find a way of doing
> it in CEP.
>
> Scenario:
>
> If any of the patient vitals received in the last 24 hours are out of
> range, I want to set the state as SIRS.
>
> In the sample code, I implement a Filter Function that identifies if the
> vital is out of range. In reality, patient 3 should not be added to SIRS
> (his temperature vital is already recorded or another record came in where
> the temperature is still high which should be invalidated as well). Is
> there a different way of achieving this? I cannot have a separate filter
> for each vital as the order of vitals can be random.
>
> [image: Inline image 1]
>
> On Fri, Apr 22, 2016 at 2:35 PM, Till Rohrmann <tr...@apache.org>
> wrote:
>
>> Hi Sowmya,
>>
>> I'm afraid at the moment it is not possible to store custom state in the
>> filter or select function. If you need access to the whole sequence of
>> matching events then you have to put this code in the select clause of your
>> pattern stream.
>>
>> Cheers,
>> Till
>>
>> On Fri, Apr 22, 2016 at 7:55 AM, Sowmya Vallabhajosyula <
>> sowmya.v@zemosolabs.com> wrote:
>>
>>> Is there a way to store a custom state value along with triggering an
>>> event? This would not only help in maintaining an audit of the values that
>>> triggered the state, but also for some complex set of conditions - for e.g.
>>> if the earlier state was triggered by the temperature of a patient, I do
>>> not want to consider temperature in the subsequent state calculation.
>>>
>>> At this point of time, I feel that for such a scenario I will have to go
>>> with Data Streaming API and manage state on my own. Is that right?
>>>
>>> Thanks and Regards,
>>> Sowmya Vallabhajosyula
>>>
>>
>>
>
>
> --
> Thanks and Regards,
> Sowmya Vallabhajosyula
>

Re: Custom state values in CEP

Posted by Sowmya Vallabhajosyula <so...@zemosolabs.com>.
Hi Till,

Thank you for the quick reply. May be you can help me find a way of doing
it in CEP.

Scenario:

If any of the patient vitals received in the last 24 hours are out of
range, I want to set the state as SIRS.

In the sample code, I implement a Filter Function that identifies if the
vital is out of range. In reality, patient 3 should not be added to SIRS
(his temperature vital is already recorded or another record came in where
the temperature is still high which should be invalidated as well). Is
there a different way of achieving this? I cannot have a separate filter
for each vital as the order of vitals can be random.

[image: Inline image 1]

On Fri, Apr 22, 2016 at 2:35 PM, Till Rohrmann <tr...@apache.org> wrote:

> Hi Sowmya,
>
> I'm afraid at the moment it is not possible to store custom state in the
> filter or select function. If you need access to the whole sequence of
> matching events then you have to put this code in the select clause of your
> pattern stream.
>
> Cheers,
> Till
>
> On Fri, Apr 22, 2016 at 7:55 AM, Sowmya Vallabhajosyula <
> sowmya.v@zemosolabs.com> wrote:
>
>> Is there a way to store a custom state value along with triggering an
>> event? This would not only help in maintaining an audit of the values that
>> triggered the state, but also for some complex set of conditions - for e.g.
>> if the earlier state was triggered by the temperature of a patient, I do
>> not want to consider temperature in the subsequent state calculation.
>>
>> At this point of time, I feel that for such a scenario I will have to go
>> with Data Streaming API and manage state on my own. Is that right?
>>
>> Thanks and Regards,
>> Sowmya Vallabhajosyula
>>
>
>


-- 
Thanks and Regards,
Sowmya Vallabhajosyula

Re: Custom state values in CEP

Posted by Till Rohrmann <tr...@apache.org>.
Hi Sowmya,

I'm afraid at the moment it is not possible to store custom state in the
filter or select function. If you need access to the whole sequence of
matching events then you have to put this code in the select clause of your
pattern stream.

Cheers,
Till

On Fri, Apr 22, 2016 at 7:55 AM, Sowmya Vallabhajosyula <
sowmya.v@zemosolabs.com> wrote:

> Is there a way to store a custom state value along with triggering an
> event? This would not only help in maintaining an audit of the values that
> triggered the state, but also for some complex set of conditions - for e.g.
> if the earlier state was triggered by the temperature of a patient, I do
> not want to consider temperature in the subsequent state calculation.
>
> At this point of time, I feel that for such a scenario I will have to go
> with Data Streaming API and manage state on my own. Is that right?
>
> Thanks and Regards,
> Sowmya Vallabhajosyula
>