scieee AI-readable full text Open interactive document viewer

Generic data processing & analysis architecture of a personal health system to manage daily interactive sessions in patients with major depression

Bresó Guardado, Adrián

Abstract

[EN] The World Health Organization (WHO) considers Major Unipolar Depression as a significant cause of disability worldwide (globally, more than 350 million people of all ages suffer from depression). This common mental disorder spends many economic and clinical resources and it is sometimes responsible for patient suicides. The work presented in this Master Thesis document describes the design and implementation of a generic Data Processing & Analysis module which has been included within the Personal Health System developed in the Help4Mood Research European Project [FP7 ICT-248765]. The aim of Help4Mood is to develop a computational distributed system to support the treatment of people with Major Depression in the community. It is focused on reducing depressive symptoms, improving functioning, and preventing the recurrence of symptoms in the future. The developed Data Processing & Analysis module is the mechanism responsible of: i) The analysis of the objective and subjective inputs received from the user; ii) The inference of clinical concepts and the production of a set of activities to be suggested by the system during the treatment of depression; iii) The planning of the most appropriate interactive sessions based on the inferred activities; iv) The generation of adequate emotional responses represented in the Help4Mood¿s Virtual Agent to better engages the patient with the use of the system and to facilitate a better adherence to the treatment process; and v) The summarization of the relevant clinical information about the progress of the patient every week. The results of this work suggests that the generic Data Processing & Analysis module is useful for managing flexible and personalised sessions in the treatment of the depression, and it is able to be adapted to other clinical domains. It provides a systematic framework for data collection, processing and analysis which improves the continuous monitoring and treatment of the patients. Additionally, our module improves the communication between patients and clinicians by facilitating the joint reflexion about the evolution and improvements in wellbeing at the different stages of the treatment

Full text

UNIVERSITAT POLITÈCNICA DE VALÈNCIA DEPARTAMENTO DE SISTEMAS INFORMATICOS Y COMPUTACIÓN Generic Data Processing & Analysis Architecture of a Personal Health System to Manage Daily Interactive Sessions in Patients with Major Depression MASTER THESIS IN ARTIFICIAL INTELLIGENCE, PATTERN RECOGNITION AND DIGITAL IMAGING (IARFID) Presented by: Adrián Bresó Guardado Supervised by: Dr. Juan Miguel García-Gómez Dr. Juan Martínez-Miranda Valencia – España September 2013 Master Thesis, 2013 Adrián Bresó 2 Master Thesis, 2013 Adrián Bresó 3 Contents Acknowledgements .................................................................................................... 5 Abstract ....................................................................................................................... 7 Acronyms & Abbreviations ......................................................................................... 9 Introduction .............................................................................................................. 11 1.1. Motivation .................................................................................................... 11 1.2. The Help4Mood Project ................................................................................. 12 1.3. Objectives .................................................................................................... 16 1.4. Contributions ................................................................................................ 16 1.5. Contents ...................................................................................................... 17 State of the Art ......................................................................................................... 19 2.1. Decision Support Systems ............................................................................. 19 2.2. Personal Health Systems ............................................................................... 20 2.3. Emotional Virtual Agents ............................................................................... 21 The Data Analysis and Session Planning System.................................................... 25 3.1. DASPS Functionalities ................................................................................... 25 3.2. General Architecture ..................................................................................... 25 Deliberative Components ......................................................................................... 27 4.1. The Inference System ................................................................................... 27 4.1.1. The Data Analysis Module (DA) .................................................................. 27 4.1.2. Knowledge Extraction Module (KE) ............................................................. 30 4.1.3. The Knowledge Inference Module (KI) ....................................................... 31 4.2. The Session Planner Module (SP) ................................................................... 34 4.3. The Event Generator Module (EG) ................................................................. 39 Emotional Component .............................................................................................. 41 5.1. The Cognitive-Emotional Module (CE) ............................................................ 41 Patient Progress Report ........................................................................................... 47 6.1. Visual Appearance ........................................................................................ 47 6.2. Clinical Summarization .................................................................................. 49 Evaluation ................................................................................................................. 51 7.1. Internal Tests ............................................................................................... 51 7.2. External Tests .............................................................................................. 53 Conclusions & Future work ...................................................................................... 57 Bibliography .............................................................................................................. 59 Annex A - Available defined tasks in the system ............................................................ 63 Annex B - UserInputFromDM.xsd template (data coming from GUI to DASPS) ................ 65 Annex C - TaskPlanning.xsd template ........................................................................... 69 Master Thesis, 2013 Adrián Bresó 4 Master Thesis, 2013 Adrián Bresó 5 Acknowledgements First I am greatly thankful to my supervisors and friends Dr. Juan Miguel García-Gómez and Dr. Juan Martínez-Miranda for their advice in this Master Thesis and for they daily support. Furthermore I would also like to acknowledge with much appreciation the crucial role of Informatics Biomedical Research Group 1 (IBIME) staff from Universitat Politècnica de València 2 (UPV), who provided me the possibility to complete this Master Thesis. All of them help me during more than three years in this and other projects with their enthusiasm, talent and sense of humour. From Dr. Montserrat Robles and my Master Thesis supervisors, to all my colleagues: Miguel Esparza, Dr. Salvador Tortajada, Javier Juan, Alfonso Pérez, and Dr. Javier Vicente, and specially Carlos Sáez and Dr. Elíes Fuster. This Master Thesis has been performed within the Help4Mood FP7 European Project [ICT-248765], so I want to thank all the work done by the different partners involved in the project: Edinburgh's School of Informatics 3 , I2CAT 4 , Babes-Bolyai University 5 , FVA 6 , OBS Medical 7 , Universitat Politècnica de Catalunya 8 , and The School of Mathematical and Computer Sciences at Heriot-Watt University 9 . Special thanks to Dr. Colin Matheson and Dr. Maria Wolters who are the coordinators of the project. Finally, special thanks to my family for their patience and support. I am especially grateful to my wife for all her patience and understanding, my pretty daughter and my near future son. 1 http://www.ibime.upv.es/ 2 http://www.upv.es/ 3 http://www.ed.ac.uk/schools-departments/informatics/ 4 http://www.i2cat.net/es 5 http://www.ubbcluj.ro/ 6 http://www.fvaweb.it/ 7 http://www.obsmedical.com/ 8 http://www.upc.edu/ 9 http://www.macs.hw.ac.uk/ Master Thesis, 2013 Adrián Bresó 6 Master Thesis, 2013 Adrián Bresó 7 Abstract The World Health Organization 10 (WHO) considers Major Unipolar Depression as a significant cause of disability worldwide (globally, more than 350 million people of all ages suffer from depression). This common mental disorder spends many economic and clinical resources and it is sometimes responsible for patient suicides. The work presented in this Master Thesis document describes the design and implementation of a generic Data Processing & Analysis module which has been included within the Personal Health System developed in the Help4Mood 11 Research European Project [FP7 ICT-248765]. The aim of Help4Mood is to develop a computational distributed system to support the treatment of people with Major Depression in the community. It is focused on reducing depressive symptoms, improving functioning, and preventing the recurrence of symptoms in the future. The developed Data Processing & Analysis module is the mechanism responsible of: i) The analysis of the objective and subjective inputs received from the user; ii) The inference of clinical concepts and the production of a set of activities to be suggested by the system during the treatment of depression; iii) The planning of the most appropriate interactive sessions based on the inferred activities; iv) The generation of adequate emotional responses represented in the Help4Mood’s Virtual Agent to better engages the patient with the use of the system and to facilitate a better adherence to the treatment process; and v) The summarization of the relevant clinical information about the progress of the patient every week. The results of this work suggests that the generic Data Processing & Analysis module is useful for managing flexible and personalised sessions in the treatment of the depression, and it is able to be adapted to other clinical domains. It provides a systematic framework for data collection, processing and analysis which improves the continuous monitoring and treatment of the patients. Additionally, our module improves the communication between patients and clinicians by facilitating the joint reflexion about the evolution and improvements in wellbeing at the different stages of the treatment. 10 World Health Organization (WHO / OMS): http://www.who.int/mental_health/mhgap/evidence/depression/en/ 11 Help4Mood Project website: http://help4mood.info/site/default.aspx Master Thesis, 2013 Adrián Bresó 8 Master Thesis, 2013 Adrián Bresó 9 Acronyms & Abbreviations CA Candidate Activity CBT Cognitive behavioural therapy CDS Clinical Decision Support System CDSS Clinical Decision Support System CE Cognitive Emotional CESD4 Center for Epidemiological Studies Depression Scale (4 items) DA Data Analysis DASPS Data Analysis and Session Planning System DM Dialog Manager DMC Daily Mood Check DSS Decision Support System ECA Embodied Conversational Agent EEG Electroencephalography EG Event Generator EHR Electronic Health Record FB Fact Base HIS Health Information System HL7- CDA Health Level 7 Clinical Document Architecture ICE Internet Communication Engine ICT Information and Communication Technologies IE Inference Engine IVA Intelligent Virtual Agents KB Knowledge Base KE Knowledge Extraction KI Knowledge Inference NTQ Negative Thoughts Questionnaire PAM Personal Ambient Monitoring PA Planned Activity PHQ9 Patient Health Questionnaire (9 items) PHS Personal Health System PMS Personal Monitoring System PoC Point-of-Care RBS Rule Base System RMT Remote Patient Monitoring and Treatment SP Session Planner VA Virtual Agent WHO World Health Organization WM Working Memory XML Extensible Markup Language Master Thesis, 2013 Adrián Bresó 16 3 I2CAT was involved on: Telecommunications and dissemination activities 4 Babes-Bolyai University was involved on: Clinical expertise. 5 FVA was involved on: Graphical development of the VA and GUI of the system. 6 OBS Medical was involved on: Exploitation of the project’s outcomes. 7 Universitat Politècnica de Catalunya was involved on: Personal Monitoring System. 8 HWU The School of Mathematical and Computer Sciences was involved on: Dialogue Manager. Table 1: The Help4Mood Consortium 1.3. Objectives In the context of the Help4Mood project the work described in this document is focused in the development of two main parts that form the DASPS of the PHS: 1. The design and implementation of a flexible and modular architecture responsible of the (1) processing and analysis of the objective and subjective data gathered from the patient; (2) the inference of clinical information that allow the continuous assessment of the patient’s wellbeing; (3) the planning of personalised and adaptive daily sessions; and (4) the generation of an easy to digest weekly summary report to inform the clinicians about the evolution of the patient. 2. The development of a Cognitive-Emotional module which is responsible to produce adequate emotional responses in the VA during the interaction with the patient. These emotional responses simulate a therapeutic empathic behaviour in the VA when interacting with the patient. 1.4. Contributions As a result of the Data Analysis and Session Planning System (DASPS) presented in this Master Thesis document, we highlight the following major contributions: i. The implementation of a script which collects and extracts useful information from the patient sensors in order to detect the changes in the patient’s daily activity patterns; Master Thesis, 2013 Adrián Bresó 17 ii. The implementation of an Inference System containing two inter-related Rule Base Systems (RBSs). The first engine infers clinical concepts. The second infers a set of recommended activities to be suggested by the system during the treatment of depression from the clinical concepts previously inferred (and other variables); iii. The implementation of a planning algorithm based on patient’s historical data and stamina to produce the content of the personalized daily sessions for the treatment of Major Depression; iv. The adaptation and evaluation of a computational architecture of emotions to produce adequate emotional responses in a VA during the interaction with people with Major Depression; and v. The implementation of a summarized document based on AORTIS clinical summarization model which informs about the relevant patient progress. Currently, some of these contributions have directly derived into the publication (or submission) of several research papers as follows: Related Area Publication Affective Computing Modelling Therapeutic Empathy in a Virtual Agent to Support the Remote Treatment of Major Depression Juan Martínez-Miranda, Adrián Bresó, Juan Miguel García-Gómez. In Proceedings of the 4th International Conference on Agents and Artificial Intelligence (ICAART). Vol 2, 264-269. Feb 2012. Vilamoura, Portugal. 2012 Affective Computing The Construction of a Cognitive-Emotional Module for the Help4Mood‘s Virtual Agent Juan Martínez-Miranda, Adrián Bresó, Juan Miguel García-Gómez. Proceedings of the 1st Workshop on ICT applied to Mental Health. Spain (1) 2012:34- 39. 2012 Pattern Recognition Monitoring changes in daily actigraphy patterns of free-living patients Elíes Fuster-García, Javier Juan-Albarracín, Adrián Bresó, Juan Miguel García-Gómez. Accepted at International Work-Conference on Bioinformatics and Biomedical Engineering, IWBBIO-2013, Granada, Spain. 2013 CDSS A Clinical Decision Support System to Manage Daily Interactive Sessions in Patients with Major Depression Adrián Bresó, Juan Martínez-Miranda, Elíes Fuster-García, Carlos Sáez, Montserrat Robles, Juan M García-Gómez. Jornada de Investigación ITACA 2013, Valencia, Spain. 2013 CDSS A Flexible Computational Architecture for a Personal Health System to Support the Treatment of Depression. Adrián Bresó, Juan Martínez-Miranda, Juan Miguel García-Gómez. 2013 In preparation iHealth Help4Mood - Supporting Joint Sense Making in the Treatment of Major Depressive Disorder M. Wolters, C. Burton, C. Matheson, Adrián Bresó, A. Szentagotai, J. Martinez- Miranda, E. Fuster, J. Rosell, C. Pagliari y B. McKinstry. Workshop on Interactive Systems in Healthcare (WISH), Washington DC , 2013. Under review Table 2: Publications related with the Master Thesis 1.5. Contents In the following Chapter 2 we present a review of the state of the art in the research topics related with the work developed in this Master Thesis: the field of Clinical Decision Support Systems (CDSS) as the basis of the DASPS architecture, complemented with a brief review of other related Personal Health Systems. Moreover, a review of some works in the field of Virtual Emotional Agents is also presented as the roots of the cognitive-emotional component described in Chapter 5. The design and implementation of the different modules of the DASPS are described in detail in the Chapters 3, 4, 5 and 6. In particular, Chapter 3 presents an Master Thesis, 2013 Adrián Bresó 18 overview of the DASPS architecture and the different modules that are integrated within it. Chapter 4 shows the modules that form the deliberative process of the DASPS while Chapter 5 shows the module that produce the emotional process. The design and development of the clinical summary report as a relevant output of the DASPS is presented in the Chapter 6. Chapter 7 summarises the evaluation and results obtained from the real pilots. Finally, the conclusions of this Master Thesis are described in the Chapter 8. Master Thesis, 2013 Adrián Bresó 19 Chapter 2 State of the Art 2.1. Decision Support Systems Clinical Decision Support Systems (CDSS or CDS) are interactive systems that assist physicians and other health professionals with making clinical decisions based on a given set of health information, such as determining a patient’s diagnosis [14]. Fully computerized CDSS typically consist of three parts; Knowledge Base (KB), Inference Engine (IE), and User Interface (see Figure 6). The KB contains rules and associations which most often take the form of “ if-then ” rules. The IE combines the rules from the KB with the patient data. The resulting analyses are displayed through the User Interface, which also takes input from the user that can result in new queries and exploration of alternative scenarios. Figure 6: Typical CDSS architecture There is growing recognition that CDSS holds great potential to improve health care quality, possibly even increase efficiency and reduce health care costs, and reduce patient inconvenience [15]. CDSS can provide support to clinicians at various stages in the care process, from preventive care through diagnosis and treatment to monitoring and follow up. It can be focused in a lot of clinical domains, such as diabetes [16], Heart Failure [17], or mental health disorders [18] [19] [20] [21] [22] [23] [24] [25]. In the field of mental health, a comprehensive search of PubMed and Google Scholar identified three early stage DSS projects to improve diagnosis, one implementing a standardized interview [25], and two based on machine learning, one from EEG [24] and one from clinical input [22] [23]. For the treatment, management or follow up of the Major Depression disorder there are currently two commonly used different approaches: Medication or Psychotherapy as the Cognitive-Behaviour Therapy (CBT). The main algorithms for adjusting patients’ medications during the treatment of Major Depression that have been reported in the literature are the TMAP algorithm [20] and its successor, the STAR*D algorithm [26]. The Texas Medication Algorithm Project (TMAP) guidelines are based on serial mood monitoring at 2-4 weekly intervals and was drawn up by consensus in 1999 [27]. The TMAP algorithm has been successfully implemented in a CDSS [20]. According to Trivedi and Daly’s review of CDSS for the TMAP and STAR*D guidelines [28], the main role for a CDSS in this context is to ensure health care practitioners can easily access the algorithm and obtain correct information about suggested next steps at the point of care. Master Thesis, 2013 Adrián Bresó 20 Fortney et al. [21] developed a web-based decision support system (NetDSS 16 ) that supports depression care manager activities based on evidence. These activities are addressing on education and activation, self-management, symptom monitoring, counseling adherence, medication adherence, etc. Additionally, this system includes standardized questionnaires (such as PHQ9 or Blessed Orientation-Memory-Concentration) in order to evaluates de depression level and the comorbidities (such as panic disorder, anxiety disorder, alcohol use disorder). The developed DSS of Fortney [21] is similar than the DASPS module described in this Master Thesis but we added an analysis of activity data collected with actigrapy devices (not only with the subjective data provided by the patient through the user interface), a flexible and dynamic daily session planning, and the generation of adequate emotional responses to the patient’s inputs during the daily sessions. CCBT systems are fully focused to support CBT. These self-help systems have the potential to increase the capacity of mental health services, and to overcome some of the barriers to accessing mental health services, including stigma, traveling time for rural patients, treatment delays, and the low availability of skilled clinicians [29]. Examples of available CCBT packages for the treatment of depression include Beating the Blues 17 [30], Cope [31], MoodGym 18 [32] and ODIN 19 [33]. There are several studies in which the efficiency of the CCBTs is evaluated [34] [35] [36] [37]. In general, the CCBTs improve the effectiveness in the treatment and reduce the symptoms of depression. In the context of this Master Thesis, we will extend the definition of CDSS to cover intelligent, adaptive, interactive monitoring: existing health information is used to determine and to decide what other pieces of self-reported health information need to be collected in order to arrive at a comprehensive view of a patient’s mental and emotional state. This functionality will be the cornerstone of the patient-side DASP module as one of the key features of Help4Mood. To our knowledge, this is the first CDSS that assess the patient data, infers the adequate clinical concepts, infer a set of activities to suggest configuring a personalised daily session and complemented with an emotional response based on the events produced during the interaction. Nevertheless, it is important to notice that our DASPS module is focused CBT- like therapy interaction and at the moment it does not implement support for pharmacological treatment of Major Depression. 2.2. Personal Health Systems Health care systems are changing their approach from reactive (based on managing a person’s disease) to preventive (based on managing a person’s health) in order to provide high-quality and safe care, to reduce economic burden, to improve the competitiveness and interoperability leading to technology advances, and to educate and to empower patients. Personal Health Systems (PHS) allow assisting in providing continuous and personalized health services to individuals regardless of location to improve lifestyle management and prevention, early diagnosis, treatment, and disease management [38]. Additionally, PHS reduces costs in the medium-long term. We can see the PHS as an evolution of the CDSS. Personal Health Systems have evolved towards ubiquity, connectivity and information sharing. Therefore, PHS are CDSS with added layers that allow a continuous connectivity (both patients and clinicians with), communication and better data acquisition. In the literature, there is a good number of PHS developed and integrated into different clinical domains, such as diabetes [39]. One particular domain in which different PHSs are recently focused is in the treatment of mental health disorders. In particular, we can find in the literature several examples such as P4Well (Pervasive Personal and PsychoPhysiological 16 Depression CSS: https://www.netdss.net/ 17 Beating the Blues CCBT: http://www.beatingtheblues.co.uk/ 18 MoodGym CCBT: https://moodgym.anu.edu.au/welcome 19 ODIN CCBT: http://www.kpchr.org/feelbetter/ Master Thesis, 2013 Adrián Bresó 21 management of WELLness) [40], which applies CCBT methods focused in stress. Krefting et al. [41] shows a PHS that acquires bio-signals from the patient during the sleep period in order to diagnosis and treat sleep disorders. Moreover, quite a few EC research projects [42] have been focused in the treatment of mental health disorders. In particular OPTIMI 20 , MONARCA 21 , PSYCHE 22 and ICT4Depression 23 propose similar objectives to Help4Mood for the remote monitoring and treatment of Major Depression and bipolar disorder. The OPTIMI project is concerned with innovative monitoring technologies, in particular electroencephalography (EEG). Other modalities include voice analysis, physical activity monitoring, and computerised diaries. ICT4Depression emphasizes medication adherence. Monitoring is mainly based on mobile phones and wireless bio-signal sensors; urinalysis to determine the amount of medication taken is also considered. Unlike Help4Mood, which focuses on unipolar Major Depression, the MONARCA project is mainly concerned with monitoring the activity of people with bipolar disorder. Devices used include a mobile phone and a wrist worn activity monitor, galvanic skin response using a custom sensor integrated into a sock and also periodic measurements of EEG. They also track GPS location, nutrition, household activity, amount and quality of sleep and voice analysis from mobile phone conversations. Like MONARCA, PSYCHE has a particular focus on bipolar disorder. However, their multi-parametric monitoring system is based on innovative textile platforms and portable sensing devices. In addition to voice analysis, heart rate variability, respiratory rate, activity, sleep pattern, and peripheral measures in cardiovascular and respiratory functioning, PSYCHE also tracks biochemical markers, electro dermal response, as well as the secretion of stressrelated hormones. Finally, the UK project Personalised Ambient Monitoring 24 (PAM) develops monitoring approaches for people with bipolar disorders. They use sensors situated in patient’s home to collect information on light and sound levels, movement information, and aspects of TV usage. Information about activities and mood is collected via a mobile phone interface. There are some differences between the Data Processing and Analysis Module of the PHS presented in this Master Thesis regarding the others PHS referred above. Our Data Processing and Analysis Module provides a high and standardized module integration, a clinical concepts inference, an adequate emotional response, and a flexible and dynamic planning of daily interactive sessions 2.3. Emotional Virtual Agents Virtual Agents (VAs) or Intelligent Virtual Agents (IVA) are a combination of virtual reality and agent technology that allow users to interact with the machine through complex (such as natural speech, gestures, facial expressions, and gaze) or simple (such as questionnaire) procedures, engaging face-to-face relationships. VAs are autonomous and intelligent entities in virtual environments with appearances as human, animal or fictional characters. For several decades, the growing interest in the development of VAs has encouraged the improvement in the realism of graphics and the agent behaviour. One of the most important improvements is the modelling of emotions as part of the VA’s behaviour (Emotional Virtual Agents). Picard et al. [43] said that the main benefit of providing intelligent agents with emotions is that agents are able to simulate the understanding of human emotions producing less frustrating systems to interact with the user, facilitating human-machine interface and increasing the believability of the system. Well-designed VAs have demonstrated better mechanisms to motivate users [44] and lead to higher user engagement than traditional static visual user interfaces [45]. 20 OPTIMI European Project: http://www.optimiproject.eu/ 21 MONARCA European Project: https://monarca.dk/ 22 PSYCHE European Project: http://www.psyche-project.org/ 23 ICT4Depression European Project: http://www.ict4depression.eu/ 24 PAM European Project: http://www.pam-research.org/ Master Thesis, 2013 Adrián Bresó 22 The development of virtual counsellors is one of the applications of virtual agents that has concentrated good efforts in recent years. In the treatment of mental health disorders is necessary to create an intimacy relationship between the patient and the clinician to achieve a better sharing of personal information. Some works as the proposed by Kang and colleagues et al. [46] showed a study in which associated intimate self-disclosure and nonverbal VA behaviour during counselling interactions. They demonstrated that appropriate VA nonverbal behaviour got highly intimate self-disclosure and the final session results would be better. In the Help4Mood project, the VA is an Embodied Conversational Agent (ECA) with the aim to establish an adequate relationship with the user to promote a better treatment adherence. Currently, there are many promising examples of ECA-based interfaces in mental health applications. Bickmore et al. [47] developed an agent who encouraged people with schizophrenia to adhere to their medication regime, as well as an agent who provided discharge information to people with depression who were about to leave the hospital where they had been admitted for treatment. Pontier et al. [48] showed that it is feasible to administer a standardised questionnaire for assessing depression, in this case the Beck Depression Inventory, using an ECA. Rizzo [49] and colleagues lead the SimCoach project 25 , in which a web-based virtual human healthcare helps military personnel and family members in multiple areas including depression, stress, brain injury, substance abuse, suicide, rehabilitation, reintegration and other relevant specialties offering expert advice and healthcare information. The main goal of SimCoach is engaging the user for gathering user healthcare information, understanding their situations, monitoring their healthcare, giving advices and assistance, and recommending initiate a traditional treatment when needed. A common characteristic of these VAs used in mental health applications is the modelling of adequate emotional responses that enhances the interaction with the user. The production of a consistent emotional behaviour in VAs is achieved through the modelling of emotional processes based on psychological theories of emotions. The most relevant emotions theories are summarized in Scherer et al. [50] [51]: Adaptation, Dimensional, Appraisal, Motivational, Circuit, Basic emotion, Lexical, and Social constructivist. The selection of a specific emotion theory as the basis of a computational model depends on the aspects of emotion that the computational model tries to represent. Some computational models of emotion combine theories to represent different components and phases of the emotion phenomenon. The theory of emotion that is most often used as a basis for computational models of emotions is the cognitive appraisal theory [52] [53]. Appraisal theories of emotions assume that the events in a person’s environment are constantly evaluated by the individual. This cognitive evaluation (or appraisal) process leads to an emotional response (according to the events relevance for the person) which in turn generates a specific behaviour to cope with the appraised events. One of the reasons for the success of this theory in computational modelling is that it provides an explanation for the connection between cognition and emotion. This, in turn, helps in the construction of artificial systems that simulate complex human-like behaviours. Moreover, appraisal theories of emotion appear to be the most comprehensive way to represent the complexity of the emotion process, covering the whole path from low-level appraisals of the eliciting event to high-level influence over behaviour [54]. The proposed cognitive-emotional module developed for Help4Mood and presented in Chapter 5 is based on this cognitive appraisal theory of emotions. Several computational architectures based on the appraisal theory of emotions (see Figure 7) have been developed since the early 90’s (Ar [55], FAtiMA [56], Alma [57], MA [58], among some others), most of them focused on the construction of believable characters within virtual environments. The development of virtual characters based on appraisal theories has allowed the creation of real-time interactive characters that exhibit emotions in order to make them more compelling, more realistic, more able to understand human motivational state, or more able to induce desirable social effects in the users. 25 http://ict.usc.edu/prototypes/simcoach/ Master Thesis, 2013 Adrián Bresó 23 Figure 7: A history of computational models of emotions (from [59]). The emotional component (i.e. the mechanism to produce the adequate emotional responses in the VA during the interaction with the user) of the DASPS module has its roots in the appraisal theory of emotions. In particular, one of the existent computational architectures of (FAtiMA – FearNot!) emotion has been adapted and integrated with the deliberative component to produce the whole cognitive and emotional behaviour in the Help4Mood’s VA as it is explained in the following chapters. Master Thesis, 2013 Adrián Bresó 24 Master Thesis, 2013 Adrián Bresó 25 Chapter 3 The Data Analysis and Session Planning System The Data Analysis and Session Planning System (DASPS) is one of the three main components of the Help4Mood project. It implements the Data Processing & Analysis layer of the PHS. It has been conceived as the module responsible to analyse relevant patient’s data, plan the daily interactive sessions and recommend the activities as part of the treatment of Major Depression. Moreover, the interaction style displayed through the dialogues and through the non-verbal communication in the VA is another functionality implemented in the DASPS module which would facilitate an active involvement and communication of both the patient and the clinician during specific stages of the treatment. 3.1. DASPS Functionalities The main functionalities of the DASPS are: i. The data analysis for the identification of activity and sleep patterns applied to the data coming from the PMS; ii. The inference of clinical concepts and the inference of tasks recommended the patient during the daily sessions as part of the treatment; iii. The control of the interactions between the patient and the VA by planning the different activities which the VA offers during the daily sessions. These activities will gather information of specific mood-related data that complements the data collected through the PMS and will provide relevant feedback and recommend basic CBT-based exercises to the patient; iv. The generation of a set of different emotional reactions according with the events produced during the session. These emotional reactions will be expressed through particular phrases in the dialogue (managed by the DM) and displayed via facial expressions and head movements (managed by the graphical component of the VA); and v. The summarization of a clinical report of the patient’s health and well-being to the clinician acting as a decision aid during the treatment based on the collected information during the daily sessions. This report will highlight the main trends in the patient’s mood, behaviour, cognitive and psychomotor function, either graphically (e.g. activity and mood graphs over time) or as a short textual summary. 3.2. General Architecture Based on the Help4Mood project requirements, the main development tasks of the DASPS were concentrated in the design of a flexible architecture capable of inferring and producing the appropriate events and actions which occur during a session to lead the behaviour of the VA. The development of a scalable architecture (Figure 8) has been developed thinking in an easy customization and extension with the addition of new future functionalities and its adaptation to other PHS used for the treatment of a different disease. Six components have been developed into the DASPS, all of them integrated as a Java packages. The modules (which are showed in Figure 8) are:  Data Analysis (DA), which collects and extracts useful information from the PMS in order to detect the changes in the patient’s daily activity patterns. Master Thesis, 2013 Adrián Bresó 32 Type of rule Description Execution (code: 3) Normal activity. Interruption (code: 4) This must be executed immediately, clearing the current plan. Normally, this kind of activities finishes the system execution. Bridge (code: 5) Similar than interruptions but it allows the normal execution of the rest of the plan after its execution. Control (code: 6) Special rule which is used for managing some aspects of the SP Table 4: Type of Candidate Activities More than 140 rules have been implemented in the CLP rules file of the KI as we show in the next examples (Figure 16, Figure 17 and Figure 18): Figure 16: Example I of a rule defined in the KI.clp file Figure 17: Example II of a rule defined in the KI.clp file Master Thesis, 2013 Adrián Bresó 33 Figure 18: Example III of a rule defined in the KI.clp file Given the good integration between JESS and Java, both CLP files (KI.clp and KE.clp) use Java classes structures in order to manage the data which we imported to the CLP files as follows: (import es.upv.ibime.bmg.h4m.dss.data.commontypes.CandidateActivity) (import es.upv.ibime.bmg.h4m.dss.data.commontypes.Description) (import es.upv.ibime.bmg.h4m.dss.data.commontypes.Parameters) (import es.upv.ibime.bmg.h4m.dss.data.commontypes.ParameterConcept) (import es.upv.ibime.bmg.h4m.dss.data.commontypes.ParameterRule) (import es.upv.ibime.bmg.h4m.dss.jess.data.*) (import es.upv.ibime.bmg.h4m.dss.jess.Utils); Figure 19: External imports from CLP files Additionally, we defined some Jess templates in both CLP files (KI.clp and KE.clp) to customize internal and temporary data as follows: Figure 20: Internal templates defined in the CLP files The KB of the KI reloads the historic data from the persistent file every session and updates this data until the end of the current interactive session. So the KI collects in this persistent file all the valuable information that is restored in the next daily session. The persistent file is a XML-based file (that uses the corresponding XSD schema) in which we store all the relevant information of the patient generated during each daily session as follows: (deftemplate questionFeedback (slot questionnaire) (slot questionNumber (type INTEGER)) (slot value (type INTEGER))(slot evaluationFeedback)) (deftemplate questionnaireFeedback (slot questionnaire) (slot value (type INTEGER)) (slot evaluationFeedback)) (deftemplate inference (slot task)) (deftemplate executeRule (slot rule)) (deftemplate variable (slot name) (slot value)) (deftemplate totalScoreQuestionnaire (slot questionnaireName) (slot totalValue) (slot evaluationFeedback)) Master Thesis, 2013 Adrián Bresó 34 <?xml version= "1.0" encoding= "UTF-8" standalone= "yes" ?> <JessData xsi:schemaLocation= "C:\Users\ADRIAN\workspace\H4M_DSS/config/configdss/docs/jessData.xsd" xmlns= "urn:data.jess.dss.h4m.bmg.ibime.upv.es" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" > <data name= "Sleep_Questionnaire_Complete" value= "OK" date= "2013-07-19T13:10:32.699+02:00" code= "80000200" ontology= "Internal" value2= "" idSession= "8rrf7tihadijdh0q4pd1kgna39" /> <data name= "DailyMoodCheck_1_Completed" value= "40" date= "2013-07-19T12:52:26.298+02:00" code= "80000116" ontology= "Internal" value2= "NORMAL" idSession= "j132cc2haoj137hjl36uhuouou" /> <data name= "Report_Visualitation_Completed" value= "Not Defined" date= "2013-07-22T18:06:16.704+02:00" code= "80000164" ontology= "Internal" value2= "Response from DM" idSession= "v81taa8vuusmrch1fkdj0blamc" /> <data name= "Select_Session_Type_Selection" value= "Long_Session" date= "2013-07-22T14:04:00.616+02:00" code= "80000199" ontology= "Internal" value2= "80000196" idSession= "1lp0a2hkfj2f8487e6mqihlucp" /> <data name= "lastReport" value= "OK" date= "2013-07-22T18:07:09.593+02:00" code= "80000165" ontology= "Internal" value2= "Update value by the System" idSession= "vjtahh8hls2245nka8a1030j8t" /> <data name= "Activity_Sleep_Time" value= "347.0" date= "2013-07-22T18:06:47.396+02:00" code= "30000402" ontology= "Internal" value2= "20130625" idSession= "vjtahh8hls2245nka8a1030j8t" /> </dataCollection> </JessData> Figure 21: JessData.xml file 4.2. The Session Planner Module (SP) The Session Planner Module is the mechanism responsible for planning the patient’s activities during the daily sessions. The SP is dynamic and flexible because is able to adapt the daily session in each iteration. It is able to make a new plan if necessary by adding, removing and/or changing the order of the activities in real time. The SP plans the more adequate daily session to the patient based on:  Clinical requirements: The clinicians can update the configuration file (TaskPlanning.xml) in order to define the set of available activities, the periodicity of the activities and the priority of the activities to be offered to the patient. This configuration file allows the clinician (or technical) to customize the daily sessions according to the particular needs of each patient (even for each stage of the treatment) for each medical centre, and for each clinician (according to his/her preferences).  Patient stamina: Stamina refers to the ability to maintain prolonged physical or mental effort. We obtain the patient stamina from a GUI question: “What length of session would you prefer? Choose one option: (1) Long session, (2) Medium length session, (3) Short session”.  Past daily sessions: The SP stores all the sessions in order to manage the periodicity of the executed activities.  User feedback on the current session: Some user responses can modify the current content of the session such as the activities refused or the score obtained in the questionnaires. The first step in the pipeline (see Figure 22) of the SP module is the interruption detector. The SP looks for a bridge or interruption (e.g. the execution of a Crisis plan triggered by a requesting of the user in the GUI or triggered by a low score detected in one of the questions of the PHQ-9 questionnaire) into the inferred set of CAs received from the Inference System. If the SP finds some interruption, the SP will cancel the current plan and it will select the interruption as the next task to execute. If it finds a bridge, the SP select the bridge as the next task to execute but it doesn’t remove the current plan. Master Thesis, 2013 Adrián Bresó 35 Figure 22: Pipeline of the Session Planner Module In all the other cases, the SP will continue executing the pipeline and will classify the Candidate Activities into:  Required: All the required activities received from the Inference System must be added as content of the actual session. Examples of this type of activity include the daily mood check questionnaire (to be executed in every session) the displaying of the summary report or the PHQ-9 questionnaire (which are executed weekly).  Optional: These CAs can be included or skipped from the content of the actual session depending on past sessions and on the pre-defined values associated with this type of activity: minimum frequency and maximum frequency. These frequencies represent how often the activities need to be executed within a week. Examples of these activities include the speech analysis (which can be executed e.g. at least once per week and a maximum of three times per a week) or the monitoring of negative thoughts (which can be executed e.g. at least three times per week and a maximum of seven times per week, i.e. daily). Additionally, this kind of CAs are classified into: o Available: whose minimum number of executions (minFrec) can be still achieved in the remaining days of the week. So, we CAN include it in the current plan. maxFrec of task > number of executions of the task this week (1) o Mandatory: that necessarily needs to be included in the current session to reach the minimum number of executions (minFrec) in a week. So, we MUST include it in the current plan. minFrec of task > number of executions of the task this week && (minFrec of task - number of executions of the task this week) <= rest of the days (2) Master Thesis, 2013 Adrián Bresó 36 o Discarded: that reached the maximum number of executions in a week (maxFrec) and is not considered for the current session. So, we MUST REMOVE it from the current plan. maxFrec of task <= number of executions of the task this week (3) In order to carry out this classification, the SP needs the information of the TaskPlanning.xml (see XSD template in Annex C) file. In the following example, there are defined two CAs, one defined as Required and other defined as Optional . <item> <description> <code>10000100</code> <snomed>NO</snomed> <name>Report_Ready</name> </description> <enable>YES</enable> <typeOfItem>REQUIRED</typeOfItem> <priority>100</priority> <minFrec>0</minFrec> <maxFrec>0</maxFrec> <codeOfDataInDB></codeOfDataInDB> <repeatable>NO</repeatable> <constrains> <constrain> <constrainDescription> <code>10000012</code> <snomed>NO</snomed> <name>Welcome_Reminder</name> </constrainDescription> <constrainType>BEFORE</constrainType> </constrain> <constrain> <constrainDescription> <code>10000011</code> <snomed>NO</snomed> <name>Welcome</name> </constrainDescription> <constrainType>BEFORE</constrainType> </constrain> <constrain> <constrainDescription> <code>10000102</code> <snomed>NO</snomed> <name>Generate_Report</name> </constrainDescription> <constrainType>ENABLEBY</constrainType> </constrain> <constrain> <constrainDescription> <code>10000121</code> <snomed>NO</snomed> <name>Farewell</name> </constrainDescription> <constrainType>AFTER</constrainType> </constrain> </constrains> </item> <item> <description> <code>10000300</code> <snomed>NO</snomed> Master Thesis, 2013 Adrián Bresó 37 <name>Speech_Activity</name> </description> <enable>YES</enable> <typeOfItem>OPTIONAL</typeOfItem> <priority>20</priority> <minFrec>3</minFrec> <maxFrec>5</maxFrec> <codeOfDataInDB>80000130</codeOfDataInDB><!--Speech_Complete--> <repeatable>NO</repeatable> <constrains> <constrain> <constrainDescription> <code>10000012</code> <snomed>NO</snomed> <name>Welcome_Reminder</name> </constrainDescription> <constrainType>BEFORE</constrainType> </constrain> <constrain> <constrainDescription> <code>10000011</code> <snomed>NO</snomed> <name>Welcome</name> </constrainDescription> <constrainType>BEFORE</constrainType> </constrain> <constrain> <constrainDescription> <code>10000121</code> <snomed>NO</snomed> <name>Farewell</name> </constrainDescription> <constrainType>AFTER</constrainType> </constrain> </constrains> </item> Figure 23: Example of Report_Ready and Speech_Activity Candidate Activities definition in the TaskPlanning.xml file After the classification, the next step in the pipeline (see Figure 22) of the SP module is the Clustering process. The SP clusters the classified CAs into three groups: Long Session, Medium Session, and Short Session. The resulting classification of the CAs allows the SP to carry out the different group sessions using the following criteria:  Short Session: all mandatory CA.  Medium Session: all mandatory CA + (available CA)/2.  Long Session: all mandatory CA + available CA. The SP algorithm to cluster the session is as follows: For each candidateActivity in setOfCandidateActivities { If (candidateActivity.getState(taskState.mandatory)) { sessionMedium.add(candidateActivity); sessionLong.add(candidateActivity); sessionShort.add(candidateActivity); } If (candidateActivity.getState(taskState.available)) { sessionLong.add(candidateActivity); Master Thesis, 2013 Adrián Bresó 38 If (alternate) { sessionMedium.add(candidateActivity); alternate=false; } else{alternate=true:} } } Figure 24: Algorithm to cluster CAs in different sessions After the clustering, the SP module sorts the CAs using the information of the TaskPlanning.xml file. Besides the frequency (minFrec and maxFrec) and other attributes, clinicians can establish in this xml file some values such as the priority of the activity or the order constrains (AFTER, BEFORE, ENABLEBY or BLOCKBY) in order to carry out the CAs sorting task. The SP creates all the possible sequences which satisfy the pre-defined constrains. After this, the SP selects the best combination using the priorities as a discriminant. Finally, the first CA of the generated plan is selected (and deleted from the plan) in order to send it to the next module of the DASPS, the Event Generator Module. The selected CA is called Planned Activity (PA). In order to better understand the pipeline of the SP Module, three different scenarios are represented in the following Figure 25, Figure 26, and Figure 27: Figure 25: Example I of the SP Module execution. In the first scenario (Figure 25), the SP receives six CAs from the KI. Four of them are required, so they are included in the actual plan. Other two CAs are Optional and we need to classify them into available, mandatory or discarded to make the different session configurations. Regarding the Speech_Activity, the SP gathers from the historical data that this activity has been completed once during the current week. The defined minFrec of this CA is 1 and the maxFrec is 3. So the SP meets the goal and the SP can plan it more times this week because it is under the maxFrec limit. So, the SP classifies the Speech Activity as Available. Regarding the Negative_Thoughts_Activity we found the same case, the SP can plan it more times during the current week and then it is labelled also as Available. In order to cluster the different configurations of the sessions, the SP uses only the required CAs to get the Short Session. To get the Medium Session, the SP uses the required CAs and only one available activity (the one with the major priority). Finally, to get the Long Session, the SP uses all the required and available CAs. Master Thesis, 2013 Adrián Bresó 39 In the second example (Figure 26) the Speech_Activity has been completed twice during the current and the value of the maxFrec is set to 2. So the SP must not plan this CA and it is labelled as discarded. Figure 26: Example II of the SP Module execution. Finally, in the last example (Figure 27) we consider that today is the last day of the week (there are 6 weeklySessions completed) and that the Negative_Thoughts_Activity has been performed four times in the week. Since its minimum frequency is set to five, this CA is labelled as mandatory. The SP must plan it in each one of the configuration sessions. Figure 27: Example III of the SP Module execution. 4.3. The Event Generator Module (EG) The EG is the mechanism responsible of the translation of the Planned Activity into a specific Event and it also generates the appropriate XML-based message to communicate with the CE module. Once the activities of the session have been planned in the SP, each activity is produced at different times during the session. The Planned Activity is passed to the event Master Thesis, 2013 Adrián Bresó 40 generator module, which is responsible for formatting the specific activity as the Event that the CE module can appraise. An example of the generated events in this module includes “Suicidal_Thoughts_Detected” which is inferred from the Crisis Plan activity (see Table 5). When the CE module receives this input, the appraisal process is performed and a XML-based message containing the specific task , and emotion to be executed by the VA during the next cycle of interaction is sent to the Dialogue Manager. The DM then implements the specific dialogue acts to generate the VA’s phrases and display the corresponding facial expressions and/or head movements to represent the generated emotion. Similarly to the KE, KI and SP modules, the EG has been designed to easily implement further events that will produce new behaviours in the VA during the sessions. Some examples about of parsing Planned Activities to Events are showing in the Table 5. Normally, this parsing is based on last KE evaluation. Planned Activity KE Assessment Event DailyMoodCheck_1 (code: 30000031) Normal or null Ready_For_DailyMoodCheck (code: 40000031) Good Ready_For_DailyMoodCheck_Good_Assessment (code: 400000311) Bad Ready_For_DailyMoodCheck_Bad_Assessment (code: 400000312) DailyMoodCheck_2 (code: 30000032) Normal or null Ready_For_Second_Question_DailyMoodCheck (code: 40000032) Good Ready_For_Second_Question_DailyMoodCheck_Good_Assessment (code: 400000321) Bad Ready_For_Second_Question_DailyMoodCheck_Bad_Assessment (code: 400000322) Crisis Plan (code: 30000091) Any case Suicidal_Thoughts_Detected (code: 400000912) Introduce_PHQ9 (code: 30000200) Normal or null Ready_For_PHQ-9 (code: 40000200) Good Ready_For_PHQ-9_Good_Assessment (code: 400002001) Bad Ready_For_PHQ-9_Bad_Assessment (code: 400002002) Table 5: Examples of Planned Activities parse to Events. Although the whole EG functionality is not complex, it is important to maintain a correct parsing of the information between SP and EG (i.e. transform the planned activity into a specific event) facilitating the independence and modularity of each module. Moreover, the events generated by the EG can be reformatted to be adapted for a different GUI (e.g. in a different PHS which does not necessarily uses a Virtual Agent for the interaction with the patient) and display the relevant information about the disease treatment. For the Help4Mood approach, when the SP has an empty plan and can’t select a plannedActivity, it sends a NULL to the EG. When the EG receives a NULL value, it transforms this signal into a new Event that indicates that it has arrived at the end of the current session. This information will be used by the other modules on the Help4Mood system to e.g. execute all the necessary steps to finishes the execution of the system. Master Thesis, 2013 Adrián Bresó 41 Chapter 5 Emotional Component 5.1. The Cognitive-Emotional Module (CE) The Cognitive-Emotional module is the mechanism responsible of inferring an adequate and coherent emotion during the interaction with the user. This emotion is displayed by the VA with the aim to improve the VA-patient interaction, fostering the use of the system and encouraging patients to complete longer daily sessions. The selected architecture to implement our cognitive-emotional module is FAtiMA (FearNot Affective Mind Architecture) [56]. FAtiMA is based on appraisal theory, implementing the OCC model [63] which defines a hierarchical organization of 22 emotion types (Figure 28). In OCC the appraisal process is carried out through the assessment of events that occur in the environment relating to the individual’s goals , standards and attitudes . According to this model each event in the agent’s environment is appraised according to the good or bad consequences of the event (for the own agent or for others); also if the detected event is a result of an action (performed by the self or others) and the aspect of the existent objects in the environment, then the corresponding emotion is generated. Figure 28: The OCC Model [63] The implementation of the cognitive-emotional module in this Master Thesis [10] has been done through the development of a stand-alone Java application which makes use of the FAtiMA software libraries. The developed software includes mechanisms for handling and generating messages to interact with the rest of the Help4Mood components. Also, the design and implementation of the interface to get and set the required data in the FAtiMA architecture was developed. The cognitive-emotional module (Figure 29) receives from the EG the specific event and uses a set of pre-defined emotional reactions, action tendencies, goals and actions in order to generate the agent’s behaviour. All the VA emotions, emotional reactions, action tendencies and goals involved in the appraisal mechanism are defined in XML-based Master Thesis, 2013 Adrián Bresó 48  Header: In this area the report displays the information of the period date, and the name and identification of the patient  Overall Progress: This text is generated by the Natural Language Processing component of the Help4Mood system. It summarises textually the data collected with the Daily Mood Check and the Negative Thoughts Questionnaires.  Summary Plot: This easy-to-understand plot is generated by the Data Analysis module (see section 4.1.1). It presents the progress of the sleep quality and the amount of activity detected in the patient. It also detects changes in daily physical activity patterns to try to contribute to a better assessment of the progress about the patient’s wellbeing.  Session Statistics: In this area the report shows important information about the scores of the PHQ9, and best and worst results regarding the data from the sensor devices.  Thoughts: This table summarizes the thoughts selected by the patient in the negative thoughts questionnaire.  Mood Records: This area contains two plots. The first one displays the scores of the Daily Mood Check questionnaire. The second one presents the same information but grouped in a period of a week. Both plots are generated by the DA module (see section 4.1.1).  Activity Record: These plots are very useful in order to known the adherence and the reliability of the gathering data from the PMS. These plots show (daily and weekly) the sleep and activity periods, and the no data period. Both plots are also generated by the DA module (see section 4.1.1). Figure 37: Example of progress patient report Master Thesis, 2013 Adrián Bresó 49 6.2. Clinical Summarization Clinical summarisation is the process by which relevant information is electronically summarised and presented at the point of care. Feblowitz et al [60] proposed the first conceptual model (AORTIS) for describing and understanding clinical summarisation. Laxmisan et al. [67] used AORTIS model in order to compare the general clinical summary screens of different Electronic Health Record System (EHRs) such as Open MRS, Epic, or Star Panel. The AORTIS model identifies five distinct stages of clinical summarisation: 1. Aggregation: is the collection of clinical data from various available sources. 2. Organisation: is the structuring of data according to some underlying principle without condensing, altering, or interpreting it. Common organisation operations are grouping (e.g. by data type or origin of service), sorting (e.g. by date or alphabetically), and periodization (e.g. by urgency or specialty). 3. Reduction and/or Transformation: reduction is the process of filtering salient information from the database without altering it to decrease the amount of data presented (e.g. show only the most recent values or the data from a single location). Transformation is the process of altering how the data is viewed or how the data is presented in order to facilitate understanding (e.g. statistical medians or percentiles). 4. Interpretation: Is the application of the general medical knowledge to a single data type in order to identify abnormally high or low results. 5. Synthesis: is the combination of two or more data elements along with knowledgebased interpretation of patient state to yield meaning or suggest action. Following the AORTIS model of Feblowitz [60], se implemented the patient report functionality in the DASPS (the Manager Report Generator module) taking into account the different proposed strategies (see Figure 39): 1. Aggregation: We collect clinical data from different sources, all of them nurtured at different point of times during the interactive sessions: (1) from the KE module, (2) from the KI module, (3) from the DA module, and (4) from the DM component. All these data are stored into the jessData.xml persistent file. 2. Organization: We organize these data grouping them by date and session. 3. Reduction and/or Transformation: We filter the original information by a selected period (normally, last four weeks). Additionally, the DA module transforms the data of the PMS into valuable and understandable information (e.g. higher and lower values, means, etc.) and stores it into the jessData.xml file. 4. Interpretation: The interpretation of the information is carry out in DA module. The clinicians of the consortium spent a lot of time discussing about what would be the best way to graphically represent the data of the patient and to detect normal or abnormal behaviour. This clinical knowledge was implemented into the DA module in order to generate all the plots of the report including the Summary the Mood and the Activity plots. 5. In this stage, we include the definition of the report template. Clinicians agreed on a format for the visualization of information. This report must be a single sheet with the appearance and the information presented in Figure 37. We used the JasperReport library 28 in order to define de template and generate the final version of the report. 6. Synthesis: In briefInfo.xml file (Figure 38) we combine all the information which will be added to the report. This file is sending to the JasperReport Library and parsing it using the defined template of the report to generate the final PDF document. Finally, this PDF report can be sent to the clinicians and also visualised by the patient. 28 http://community.jaspersoft.com/project/jasperreports-library Master Thesis, 2013 Adrián Bresó 50 Figure 38: Example of the briefInfo.xml file Figure 39: Pipeline of the patient report generation Master Thesis, 2013 Adrián Bresó 51 Chapter 7 Evaluation 7.1. Internal Tests In order to test the correct functionality of the developed rules in the KE and KI modules, a JAVA standalone application previously developed in the IBIME group was adapted for assessing the efficiency and effectiveness of the implementation. It provides automatic data generation and combination, Jess rules execution, multi tabular results view and execution time measuring. This tester tool was very usefully in order to fix rule execution problems (mainly syntactic problems). Figure 40 shows the tester in the prototype implementation of the Help4Mood Data Processing and Analysis Module. Figure 40: Java standalone tester tool We also developed an additional Java standalone application to visualise and manage the content of the jessData.xml file (Figure 41 and Figure 42) which is encrypted due to medical legal restrictions. This tool (called jessDataViewer) allowed us to test if the data are generated and stored correctly during the execution of the patient’s sessions. Master Thesis, 2013 Adrián Bresó 52 Figure 41: JessDataViewer Java standalone application (table view) Figure 42: JessDataViewer Java standalone application (tree view) Master Thesis, 2013 Adrián Bresó 53 An additional Java application was also developed to simulate the exchange of information between the DASPS module with the rest of the components of the Help4Mood system. This tool, called GUI_Simulator.java (Figure 43), allow us the testing of the complete functionality of the DASPS module by simulating the inputs and outputs of the PMS and the DM components of the full PHS facilitating all the internal tests without a full system integration. We simulated the activity data received from the PMS at the beginning of the daily session and we generate the initial message to be sent to the DM: the LogIn_Message. With this initial message the system (i.e. a new session) starts. The GUI_Simulator shows us the System Inference inferences, the classification of the CAs by the SP, the past planning, the provider planning, the current PA, the KE assessment, and the final message that the EG sends to the DM (which contains the task and the emotion to be executed by the Virtual Agent). After this execution, we can simulate the response of the DM in order to make a realistic interaction between the components like a real daily interactive session with the patient. Figure 43: Screenshot of GUI_Simulator.java Additionally we can visualise (and modify) the current state of the jessData.xml to test the correct functionality of the storage system (Figure 41 and Figure 42). The results obtained with the GUI_Simulator were the expected results. All implemented rules and the rest of the modules implementation worked properly. So these results met the expectations of the clinicians and technicians of the project. 7.2. External Tests For the evaluation of the whole system, the Help4Mood consortium planned to carry out three real pilots to obtain feedbacks from patients and clinicians (see Table 6). For these pilots, the Master Thesis, 2013 Adrián Bresó 54 consortium provides to a set of selected patients with a laptop with the Help4Mood system, a set of sensors devices and a questionnaire that the clinician administered during an exit interview to collect the feedback from the patient about the system. Functionalities Prototype Stage First Intermediate Final Welcome x x x Daily Mood Check x x x Actigraphy x x x Closing Summary x x x PHQ-9 x x Negative Thought Questionnaire x x Speech Data x x Crisis Plan x x Summary Report x x Sleep Questionnaire x x Behaviour Activation x Relaxation x Attentional Bias Modification (x) Table 6: Planning of the three Help4Mood pilots Currently, the consortium only carried out the first pilot but the current state of the architecture described in this Master Thesis is able to carry out the complete functionality for the second pilot. The first pilot involved 13 participants (see Table 7) using the system during 7 days. Participants were aged between 18 and 64 inclusive. They had a previous episode of Major Depression Disorder diagnosed by a general practitioner, psychiatrist or clinical psychologist between 6 and 18 months previously, but were either fully recovered or had only residual mild depressive symptoms. Country Participants Male Female All Scotland 2 0 2 Romania 4 3 7 Catalonia 2 2 4 Table 7: Participants distribution in the first prototype. The first prototype was the simplest of the three planned pilots. Only four tasks were provided to the patient through the VA (see Table 6), so the duration of the daily sessions were very short. This causes that the whole functionality of the SP module was not full exploited at this stage (not much tasks for planning during a session). Moreover, the period of data collection was also short and the DA module could not get important conclusions about patient’s activity patterns. In general, during this pilot the system described in this work was operated below its full potential. The conclusions obtained from the first pilot related with the architecture described in this Master Thesis are summarized as follows:  The perception of the emotional responses in the VA was divided in the participants of the pilot. While some of them notice the positive reactions in the VA, some other state that the emotional behaviour of the VA was flat.  For clinicians, patient-adapted displays and summaries of Help4Mood data can be important tools for structuring and optimally using the limited time that clinicians Master Thesis, 2013 Adrián Bresó 55 get to spend with patients. In this way, far from replacing or undermining the therapeutic relationship between patient and clinician, Help4Mood can actually strengthen it.  Help4Mood can provide a systematic framework for data collection within clinical studies and trials.  Help4Mood can provide a data representation that future evidence-based rules can build on. Master Thesis, 2013 Adrián Bresó 56 Master Thesis, 2013 Adrián Bresó 57 Chapter 8 Conclusions & Future work The original objectives of the work proposed in this Master Thesis have been met in the following way:  We developed a modular, standard, and flexible DASPS based on established standards of communication and data representation (communication: XML; clinical terms: SNOMED CT). In this sense, our DASPS can be adapted to other clinical scenario in which Remote Patient Monitoring and the delivery of daily sessions are important aspects of the treatment (e.g. other mental disorders). The developed DASPS component contained a deliberative component: Inference System (DA+KI+KE), Session Planner, and Event-Generator; and an emotional component: Cognitive-Emotional module.  By means of the DA module, we analysed the data collected from the PMS to detect changes in the patterns of physical activity of the patient. We can identify these changes by representing the analysed data in a plot (see Figure 11).  We developed the KI and KE modules using the JESS library and expert clinical knowledge from clinicians of the Help4Mood consortium. Our Inference System is able to generate clinical tasks and clinical concepts (using SNOMED CT terminology or internal codification). Currently there are implemented more than 40 clinical tasks to be used during the VA-patient interactive sessions (see Annex A).  We implemented a customizable, adaptive, and flexible Session Planner module (SP) that generates a personalised patient-based daily session. This daily session is updated during the session according to the patient answers and the clinician preferences facilitating the adherence of the patient to the treatment.  The system is able to gather data related to the patient’s mood by offering activities based on Cognitive Behaviour Therapy (CBT), such as the innovative Negative Thoughts Questionnaire (NTQ), psychomotor speech tasks, and Daily Mood Check (based on CESD4)..  We stored all the important information generated during the sessions in order to prepare a weekly clinical progress patient report (see Figure 37). The report can be visualised by the patients and send it to the clinicians.  In order to improve and promote the patient adherence and the patient acceptance of the system, (1) the Cognitive-Emotional module adds adequate emotional responses during the interaction with the patient, (2) the Session Planner module adapts the tasks and the duration of the session on the fly according with the patient stamina, and (3) we evaluated the system in a real pilot in order to obtain patient and clinical feedback which we use for the further improvement of the system.  We implemented a Cognitive-Emotional Module which has been the initial step towards the construction of a therapeutic empathy model [68] aimed to better adapt the emotional responses in the VA to the patient’s inputs. Master Thesis, 2013 Adrián Bresó 64 something positive about the future 30000154 Ask if it is possible to describe the positive situation Ask_For_Positive_Situation_Text 30000155 Request the free text describing the positive situation Request_Positive_Situation_Tex t 30000156 Ask if it is possible to describe the positive situation Ask_Explore_Positive_Situation 30000157 It shows to the patient some positive thoughts. The patient must select one of them. Select_Positive_Thought 30000158 The patient needs more positive thoughts choices Select_Positive_Thought_Again 30000191 End of "Negative Thoughts" activity End_Negative_Thoughts_Activit y 30000200 Task to ask the user whether to start the PHQ9 questionnaire (frequency: each 7 days) Introduce_PHQ9 30000201 It shows the PHQ9 task to the user. Request_PHQ9 30000300 This task proposes to the patient three issues in order to record the patient voice. Speech_Activity 30000091 This task is launched when the total score of the DMC questionnaire or the question number 9 of the PHQ9 is under the threshold. Crisis_Plan 30000092 This task is launched when the user press crisis plan button Crisis_Plan_User_Button 10000040 This task proposes to the user the length of the session: Long, Medium, or Short. (related with patient stamina) Select_Session_Type 10000041 This sleep questionnaire contains 9 questions (qualitative and quantitative) Sleep_Questionnaire 30000093 User press logout button Logout_User_Button 30000094 User press Send_Report button Send_Report_User_Button 10000101 “This is the report…” Display_Report 10000100 “The report is ready, do you want view it?” Report_Ready 10000102 The report is generated and store in the hard disk Generate_Report Table 8: Available defined tasks in the system Master Thesis, 2013 Adrián Bresó 65 Annex B - UserInputFromDM.xsd template (data coming from GUI to DASPS) <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- UserInputFromDM --> <xs:schema xmlns="urn:userInputFromDM.data.ke.dss.h4m.bmg.ibime.upv.es" targetNamespace="urn:userInputFromDM.data.ke.dss.h4m.bmg.ibime.upv.es" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com="urn:commonTypes.data.dss.h4m.bmg.ibime.upv.es" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"> <xs:annotation> <xs:appinfo> <jaxb:globalBindings> <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" /> </jaxb:globalBindings> </xs:appinfo> </xs:annotation> <xs:import namespace="urn:commonTypes.data.dss.h4m.bmg.ibime.upv.es" schemaLocation="commonTypes.xsd"/> <!--userInputFromDM--> <xs:element name="userInputFromDM"> <xs:complexType> <xs:sequence> <!--Description--> <xs:element name="description" type="com:Description" minOccurs="1" maxOccurs="1"/> <!--timestamp--> <xs:element name="timestamp" type="xs:dateTime" minOccurs="1" maxOccurs="1"/> <!--result--> <xs:element name="result" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="OK"/> <xs:enumeration value="NO"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="input" minOccurs="0" maxOccurs="1" type="Input"/> </xs:sequence> </xs:complexType> </xs:element> <!-- Input --> <xs:complexType abstract="true" name="Input"/> <!--Questionnaire--> <xs:complexType name="Questionnaire"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--scores--> <xs:element name="scores"> <xs:complexType> <xs:sequence> <!--score--> <xs:element name="score" type="Score" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="Score"> <xs:complexContent> Master Thesis, 2013 Adrián Bresó 66 <xs:extension base="Input"> <xs:sequence> <!--questionNumber--> <xs:element name="questionNumber" type="xs:int"/> <!--value--> <xs:element name="value" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!--Diary--> <xs:complexType name="Diary"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--length--> <xs:element name="length" type="xs:int"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!--Speech--> <xs:complexType name="Speech"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--changeInSpeaking <xs:element name="changeInSpeaking"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:enumeration value="0"/> <xs:enumeration value="1"/> <xs:enumeration value="-1"/> </xs:restriction> </xs:simpleType> </xs:element> <!--changeInIntonation--> <xs:element name="changeInIntonation"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:enumeration value="0"/> <xs:enumeration value="1"/> <xs:enumeration value="-1"/> </xs:restriction> </xs:simpleType> </xs:element> <!--WavFilePath--> <xs:element name="WavFilePath" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!--Game--> <xs:complexType name="Game"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--changeInReaction--> <xs:element name="changeInReaction"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:enumeration value="0"/> <xs:enumeration value="1"/> <xs:enumeration value="-1"/> </xs:restriction> </xs:simpleType> </xs:element> <!--changeInScore--> <xs:element name="changeInScore"> <xs:simpleType> <xs:restriction base="xs:int"> <xs:enumeration value="0"/> Master Thesis, 2013 Adrián Bresó 67 <xs:enumeration value="1"/> <xs:enumeration value="-1"/> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!--Selector--> <xs:complexType name="Selector"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--selections--> <xs:element name="selections"> <xs:complexType> <xs:sequence> <!--selection--> <xs:element name="description" type="com:Description" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!--Free Text--> <xs:complexType name="FreeText"> <xs:complexContent> <xs:extension base="Input"> <xs:sequence> <!--inputText--> <xs:element name="inputText" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:schema> Master Thesis, 2013 Adrián Bresó 68 Master Thesis, 2013 Adrián Bresó 69 Annex C - TaskPlanning.xsd template <?xml version="1.0" encoding="UTF-8"?> <!-- tasksPlanning SCHEMA --> <xs:schema xmlns="urn:tasksplanning.data.sp.dss.h4m.bmg.ibime.upv.es" targetNamespace="urn:tasksplanning.data.sp.dss.h4m.bmg.ibime.upv.es" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:com="urn:commonTypes.data.dss.h4m.bmg.ibime.upv.es" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"> <xs:annotation> <xs:appinfo> <jaxb:globalBindings> <jaxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" /> </jaxb:globalBindings> </xs:appinfo> </xs:annotation> <xs:import namespace="urn:commonTypes.data.dss.h4m.bmg.ibime.upv.es" schemaLocation="commonTypes.xsd"/> <!--tasksPlanning--> <xs:element name="tasksPlanning"> <xs:complexType> <xs:sequence> <!--item--> <xs:element name="item" type="Item" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <!-- each item defines one candidateActivity which will be planned by the Session Planer --> <!--Item --> <xs:complexType name="Item"> <xs:sequence> <!--description--> <xs:element name="description" type="com:Description" minOccurs="1" maxOccurs="1"/> <!-- code, snomed, name --> <!--enable--> <xs:element name="enable" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="YES"/> <xs:enumeration value="NO"/> </xs:restriction> </xs:simpleType> </xs:element> <!--typeOfItem--> <xs:element name="typeOfItem" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="REQUIRED"/> <!-- These activities don't need the MinFrec/MaxFrec because they will be plan allways --> <xs:enumeration value="OPTIONAL"/> <!-- These need the MinFrec/MaxFrec in order to decide if they will be plan or not --> </xs:restriction> </xs:simpleType> </xs:element> <!--priority--> <xs:element name="priority" type="xs:int" minOccurs="1" maxOccurs="1"/> <!-- 1...100 --> <!--minFrec--> <xs:element name="minFrec" type="xs:int" minOccurs="0" maxOccurs="1"/> <!-- 1...7 --> <!--maxFrec--> <xs:element name="maxFrec" type="xs:int" minOccurs="0" maxOccurs="1"/> <!-- 1...7 --> <!--codeOfDataInDB--> <xs:element name="codeOfDataInDB" type="xs:string" minOccurs="0" maxOccurs="1"/> Master Thesis, 2013 Adrián Bresó 70 <!-- These atribute is needed if item is Optional.The system use this atribute in order to looking for the past executionons of the activity. With this information, the SP is enable to plan or not the item depending of the MinFrec/MaxFrec.--> <!--repeatable--> <xs:element name="repeatable" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="YES"/> <xs:enumeration value="NO"/> </xs:restriction> </xs:simpleType> </xs:element> <!--constrains--> <xs:element name="constrains"> <xs:complexType> <xs:sequence> <!--constrain--> <xs:element name="constrain" type="Constrain" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> <!--Constrain--> <xs:complexType name="Constrain"> <xs:sequence> <!--constrainDescriptions--> <xs:element name="constrainDescription" type="com:Description" minOccurs="1" maxOccurs="1"/> <!-- code, snomed, name --> <!--constrainType--> <xs:element name="constrainType" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="AFTER"/> <!--If this exists, it must plan AFTER than original activity--> <xs:enumeration value="BEFORE"/> <!--If this exists, it must plan BRFORE than original activity--> <xs:enumeration value="BLOCKBY"/> <!--If this exists, the original activity is not planning--> <xs:enumeration value="ENABLEBY"/> <!--This must exists, in order to plan the original activity--> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:complexType> </xs:schema>