<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Intelligent Agents and Complex Event Processing to enhance Patient Monitoring</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lorenzo De Lauretis</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fabio Persia</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Stefania Costantini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Information Engineering</institution>
          ,
          <addr-line>Computer Science and Mathematics</addr-line>
          ,
          <institution>University of L'Aquila</institution>
          ,
          <addr-line>Via Vetoio, L'Aquila, 67100</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <fpage>212</fpage>
      <lpage>218</lpage>
      <abstract>
        <p>This paper describes a smart ecosystem able to continuously monitor patients' health condition, at home or at work or during recreational activities, by exploiting a creative blend of Medical Wearables, Intelligent Agents (IA) and Complex Event Processing (CEP). With the help of a smart application, that links together the Wearables and the power of IA and CEP, patients will be continuously and actively supervised during their daily activities. This can even save their lives, in case sudden or gradual issues should occur. Thanks to our system, patients with non-severe though potentially unstable chronic diseases will no longer overburden first-aid services. This is also useful for containing the spread of COVID-19. Specifically, in this paper we focus on automated vitals monitoring, electrocardiogram (ECG) analysis, and psoriasis detection. Experimental results carried out on real patients show how promising our approach is.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Intelligent Agents</kwd>
        <kwd>Complex Event Processing</kwd>
        <kwd>Event Query Language</kwd>
        <kwd>Interval Relationships</kwd>
        <kwd>Wearables</kwd>
        <kwd>Image Processing</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>The Coronavirus pandemic has highlighted telehealth as a crucial component of modern and
sustainable treatment. In fact, telemedicine’s primary purpose is to virtually erase the distance
between patient and physician, as well as to reduce time and expenses involved in healthcare
access. Consequently, in this context here we propose an approach which exploits in a synergistic
way wearable devices (such as portable ECG devices and pulse oximeters), Intelligent Agents
(IA), and Complex Event Processing (CEP) techniques, to create an integrated framework able
to follow the patient wherever (s)he is.</p>
      <p>
        In the literature, even if some works may appear similar to ours [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], they implement
standalone solutions with a single “brain”, monitoring a limited number of situations; in our work,
instead, we created a smart ecosystem, with more “brain-sectors” linked together, each one
specifically needed for some kind of calculations, that, together, have a very strong computational
power.
      </p>
      <p>The remainder of the paper is organized as follows. Section 2 describes the system architecture,
section 3 shows an overview of the experimental results, and section 4 concludes the paper and
outlines future work.</p>
    </sec>
    <sec id="sec-2">
      <title>2. System Architecture</title>
      <p>Our system consists of six main components: User and Doctor Interfaces - Android App,
Database and Web interface, Hardware, Intelligent Agents, Complex Event Processing and
Image Processing.</p>
      <p>Figure 1 depicts the entire workflow of our system. Specifically, to interact with the system,
ifrst of all the patient (possibly supported by a caregiver) downloads the Android application
on his/her smartphone. After downloading the app, (s)he can begin using it, inserting his/her
personal information, such as name and age. Then, (s)he can perform the manual data acquisition,
by entering the information listed in the so called activity within the green box in Figure 1.</p>
      <p>After inserting all the manual data, and after wearing suitable devices if needed, the patient
can proceed to the actual usage of the system.</p>
      <p>In all situations, if, after analyzing the data in connection to the sensations and wellbeing
impressions possibly provided by the patient, the patient turns out to be healthy, then our
system does nothing, except for providing reassurance and suitable advice (e.g., “stay seated for
some minutes, breath deeply and try to relax”), and reminding the patient of the medicines to
take. If minor issues are detected, then the system alerts the user using Android notifications. If
severe issues are detected, then the system alerts the doctor, and, if the situation is critical, it
alerts the first aid services.</p>
      <p>Oxygen saturation is obtained via the Arduino device. The device is connected via Bluetooth,
so the data are directly sent to the server through the application.</p>
      <p>The manual data and the oxygen saturation value are then sent to the DALI Intelligent Agents,
which proceed to searching for and identifying possible health issues. The agent coding has
been performed following the advice of medical doctors.</p>
      <p>After obtaining oxygen saturation, the patient can start the ECG acquisition process, by
connecting the related ECG device. After connecting, wearing the device, and acquiring the
data, those are automatically sent to the server for processing.</p>
      <p>The ECG data are then elaborated, and short-term events, if present, are detected; the data
are subsequently sent to the ISEQL engine, which is in charge of constantly checking for the
presence of health issues that cannot be seen by instantaneous analysis, but can be instead
detected via long-term observation, elaboration and aggregation of events (this by performing
“Complex Event Processing”).</p>
      <p>Additionally, the patient can also send pictures of his/her face and/or hand to be checked by
a doctor, in case (s)he wants her/him to better evaluate the situation. In the case of the face
picture, the image is directly sent to the doctor, who, after evaluating the patient’s appearance,
can decide, if the detected situation does not look good (e.g., excessive paleness with deep
dark circles), to alert either the user, providing suitable advice or making an appointment for a
face-to-face medical examination, and/or the first aid services. In the case of the hand picture, it
is automatically processed by our software, to find signs of hand disease. In particular, as a first
case study, we have considered psoriasis as it is a rather frequent pathology.</p>
      <sec id="sec-2-1">
        <title>2.1. Intelligent Agents</title>
        <p>
          In our work, we use DALI [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ] in order to implement a system composed by intelligent agents.
DALI is an agent-oriented logical language derived from Prolog, and, similarly to it, is based
on the logic programming paradigm. It has been fully implemented, on the basis of a fully
logical semantics. Exploiting the DALI language, we defined two intelligent agents: the Patient
agent and the Doctor agent. The Patient agent analyses the patient’s vital parameters (heart rate,
saturation, minimum and maximum pressure, temperature, weight) taken by wearable devices
or by the patient, and returns immediate feedback on each of them.
        </p>
        <p>It also acts as an e-health companion, reminding the user to take pills at the correct time,
sending a reminder for temperature, blood pressure and weight measurements. The Doctor
agent receives messages from the Patient agent, analyzes the communicated problem, e.g., fever
or tachycardia, and responds by suggesting a medication to take or, in case of serious danger,
it suggests going to the Emergency Room. Events currently detected by our DALI intelligent
agents are angina pectoris, tachicardia, bradhicardia, hypoxia, hypertension and fever (Figure 2).</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Complex Event Processing</title>
        <p>
          The language we exploit in order to carry out Complex Event Processing tasks in this context is
named ISEQL (it stands for “an Interval-based Surveillance Event Query Language”); some of
the authors of this paper defined it in [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] and extended it in [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]. The proposed language extends
relational algebra and the well-known Allen’s interval relationships [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], is very flexible and
useful to efectively define event models in video surveillance [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] and social network analysis
domains, and is also eficiently implemented exploiting a very quick algorithm [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] which is
several times faster and scales better than state-of-the-art approaches [
          <xref ref-type="bibr" rid="ref8 ref9">8, 9</xref>
          ], while being much
better suited for real-time event processing. Here we use it to efectively model and detect
short-term and long-term events in patient’s ECGs.
        </p>
        <sec id="sec-2-2-1">
          <title>2.2.1. Short-term event detection</title>
          <p>
            A Short-term Event is an event to be detected within the context of a single ECG measurement.
To detect such events, we must analyze the ECG signal in depth using specific criteria stored in
the knowledge base and complying with the guidelines found in the literature [
            <xref ref-type="bibr" rid="ref10">10</xref>
            ]. As shown
in Figure 3, the events automatically discovered in this stage thanks to the D-Heart device1 are
the QT interval, the QTC interval, the RR interval, the QRS interval and the PR interval.
          </p>
          <p>
            Moreover, on top of such events, we define specific additional event models in ISEQL, aimed
at identifying possible anomalies in ECGs, thus extending the literature in the context of their
automatic analysis. More specifically, the events are modeled in ISEQL and associated with
their severities on a scale from 0 (lowest severity) to 3 (highest severity - in such a case, a
medical doctor is automatically alerted). One example is the Too Long QT interval, which could
be potentially very dangerous. Additionally, exploiting its cardinality constraints [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ], ISEQL
allows to easily identify the ECG(s) of the patient where a dangerous scenario (such as a Too
Long QT interval) occurs more than once.
          </p>
        </sec>
        <sec id="sec-2-2-2">
          <title>2.2.2. Long-term event detection</title>
          <p>
            Working on aggregated data at a diferent resolution, such as examining the results of several
ECG measurements taken in specified wider temporal windows, allows a detailed long-term
analysis of the patient’s clinical history. Here, we focus on the detection of diferent categories
of long-term events. In fact, on the one hand we identify some possible long-term anomalies
exploiting ISEQL; for instance, the specific scenario shown in Figure 4 is easily detectable via
ISEQL, exploiting the cardinality constraints [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ].
          </p>
          <p>
            On the other hand we also implement specific algorithms for detecting the Atrial Fibrillation
(AF) and the Wolf-Parkinson-White (WPW) syndromes [
            <xref ref-type="bibr" rid="ref11">11</xref>
            ].
          </p>
        </sec>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Image Processing</title>
        <p>We defined an image processing algorithm aimed at elaborating and extracting features from
images, in order to evaluate the condition of the patient’s hand, and possibly diagnose the
presence of psoriasis. In order to correctly elaborate the image of a person’s hand, and make it
1
2
3
4</p>
        <p>5 ti6me (day7s)
temporal window
8
“visible” to the computer, we exploit one of the most used software for image elaboration, that
is named ImageMagick2.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Experimental Results</title>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion</title>
      <p>In this paper, we proposed an integrated framework aimed at actively supporting patient
monitoring by exploiting an innovative combination of wearables, DALI intelligent agents
and Complex Event Processing. The developed framework also includes an efective image
processing algorithm for psoriasis detection. Preliminary experiments conducted on real patients
confirm the validity of the proposed approach.</p>
      <p>Future work will be devoted to extend the system in many ways; in fact, the intelligent agent
will cope with many other health issues, the set of short-term and long-term events detectable
via ISEQL will be expanded, and the psoriasis detection algorithm will be able to automatically
detect other skin diseases.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A. H.</given-names>
            <surname>Jabber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Obied</surname>
          </string-name>
          ,
          <article-title>A multi-agent system in e-health systemimplementing ebdi model</article-title>
          ,
          <source>Turkish Journal of Computer and Mathematics Education</source>
          <volume>12</volume>
          (
          <year>2021</year>
          )
          <fpage>2845</fpage>
          -
          <lpage>2859</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>S.</given-names>
            <surname>Costantini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Tocchio</surname>
          </string-name>
          ,
          <article-title>About declarative semantics of logic-based agent languages</article-title>
          , in: M.
          <string-name>
            <surname>Baldoni</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          <string-name>
            <surname>Endriss</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Omicini</surname>
          </string-name>
          , P. Torroni (Eds.),
          <source>Declarative Agent Languages</source>
          and
          <string-name>
            <surname>Technologies</surname>
            <given-names>III</given-names>
          </string-name>
          , Third International Workshop, DALT 2005,
          <article-title>Selected</article-title>
          and
          <string-name>
            <given-names>Revised</given-names>
            <surname>Papers</surname>
          </string-name>
          , volume
          <volume>3904</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2005</year>
          , pp.
          <fpage>106</fpage>
          -
          <lpage>123</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Helmer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Persia</surname>
          </string-name>
          ,
          <article-title>Iseql, an interval-based surveillance event query language</article-title>
          ,
          <source>International Journal of Multimedia Data Engineering and Management (IJMDEM) 7</source>
          (
          <issue>2016</issue>
          )
          <fpage>1</fpage>
          -
          <lpage>21</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>F.</given-names>
            <surname>Persia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Helmer</surname>
          </string-name>
          ,
          <article-title>A framework for high-level event detection in a social network context via an extension of ISEQL</article-title>
          ,
          <source>in: 12th IEEE International Conference on Semantic Computing, ICSC</source>
          <year>2018</year>
          , Laguna Hills, CA, USA, January 31 - February 2,
          <year>2018</year>
          , IEEE Computer Society,
          <year>2018</year>
          , pp.
          <fpage>140</fpage>
          -
          <lpage>147</lpage>
          . doi:
          <volume>10</volume>
          .1109/ICSC.
          <year>2018</year>
          .
          <volume>00028</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J. F.</given-names>
            <surname>Allen</surname>
          </string-name>
          ,
          <article-title>Maintaining knowledge about temporal intervals</article-title>
          ,
          <source>Commun. ACM</source>
          <volume>26</volume>
          (
          <year>1983</year>
          )
          <fpage>832</fpage>
          -
          <lpage>843</lpage>
          . URL: https://doi.org/10.1145/182.358434. doi:
          <volume>10</volume>
          .1145/182.358434.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>F.</given-names>
            <surname>Persia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Helmer</surname>
          </string-name>
          ,
          <article-title>An event detection framework supported by a smart graphical user interface</article-title>
          ,
          <source>in: 2016 IEEE 17th International Conference on Information Reuse and Integration (IRI)</source>
          ,
          <year>2016</year>
          , pp.
          <fpage>490</fpage>
          -
          <lpage>495</lpage>
          . doi:
          <volume>10</volume>
          .1109/IRI.
          <year>2016</year>
          .
          <volume>72</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D.</given-names>
            <surname>Piatov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Helmer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Dignös</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Persia</surname>
          </string-name>
          ,
          <article-title>Cache-eficient sweeping-based interval joins for extended allen relation predicates</article-title>
          ,
          <source>The VLDB Journal</source>
          (
          <year>2021</year>
          )
          <fpage>1</fpage>
          -
          <lpage>24</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>T. Y. C.</given-names>
            <surname>Leung</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. R.</given-names>
            <surname>Muntz</surname>
          </string-name>
          ,
          <article-title>Query processing for temporal databases</article-title>
          ,
          <source>in: ICDE</source>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Khayyat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Lucia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ouzzani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Papotti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.-A.</given-names>
            <surname>Quiané-Ruiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Kalnis</surname>
          </string-name>
          ,
          <article-title>Fast and scalable inequality joins</article-title>
          ,
          <source>VLDB J</source>
          .
          <volume>26</volume>
          (
          <year>2017</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fayn</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Conti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Fareh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Maison-Blanche</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Nony</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rubel</surname>
          </string-name>
          ,
          <article-title>Interactive and dynamic ECG analysis</article-title>
          .
          <article-title>Is it just an IDEA or a clinically relevant approach?</article-title>
          ,
          <source>J Electrocardiol 29 Suppl</source>
          (
          <year>1996</year>
          )
          <fpage>21</fpage>
          -
          <lpage>25</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>B. T.</given-names>
            <surname>Fengler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W. J.</given-names>
            <surname>Brady</surname>
          </string-name>
          , C. U. Plautz,
          <article-title>Atrial fibrillation in the wolf-parkinson-white syndrome: Ecg recognition and treatment in the ed</article-title>
          ,
          <source>The American Journal of Emergency Medicine</source>
          <volume>25</volume>
          (
          <year>2007</year>
          )
          <fpage>576</fpage>
          -
          <lpage>583</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>