# Introduction epression can be identified as a significant medical disorder that affects more than 264 million people [1] every year all around the world. Depression goes unrecognized and untreated most of the time due to lack of knowledge in this area, and even the treatment starts, it is regularly hard to identify its visibility. Apart from that, the world health organization has mentioned that depression goes untreated due to the untrained medical officers and lack of resources. Due to the mentioned scenarios, it poses several challenges to diagnose and treat depressed patients. In previous studies, depression diagnosis is often based on subjective screening questionnaires or structured clinical interviews that rely on timely in-person visits as well as accurate recollections by the patient. This makes early detection of depression symptoms exceedingly difficult among this population. There are different types of depression categories identified [2], [3] in the world, but all those types share the same characteristics such as sleep variations, physical inactivity and mood swings. Apart from the detrimental effect on activities, it can lead to other problems such as reduced social interaction, drug abuse, a decrease of personal hygiene, increased alcohol use, and neglecting medicines [3]. Researchers have proved that people can use technology to manage their day to day tasks without any hassle [4]. At the same time people tend to use technical equipment to monitor their fitness activities. Due to that reason, we proposed implementing a comprehensive solution that will monitor depression using a fitness band and a mobile phone. The rest of this paper is organized as follows. In section II, the Related work will be introduced. Then, System architecture will be discussed on Section III after that, the data analysis and methodology are explained in section IV. Section V contains the implementation results of the proposed system. Section VI concludes the research paper. # II. # Related Work This part of the literature study will review existing approaches about depression diagnosis. Traditionally psychiatrists are specialized to work in anxiety and depression disorders. It has mainly focused on subjective screening and laboratory-based approaches [5]. Recently there has been an advent of studies into cellular sensor networks and intelligent environments for remote monitoring applications. As a result, a significant portion of researchers have tried to develop mobile apps and social network behavioral patterns to diagnose affective conditions, such as emotion, social alienation and frustration. In this section, in this section, we present relevant works that used to develop health data. The research of CARDIA [6], Fit flex [7] have used wrist-worn actigraphy monitors to collect sleep data. This model has facilitated to measure the sleep parameters of a depressive personnel. The Research of interactive virtual agent-based health care delivery network [8] of Sim Sei, was able to develop decision making support mechanism through an integrated system. A Reduced Region of Interest (ROI) based research on static facial emotions have used local binary patterns as the extraction technique [9]. The researchers were able to find out the significant six facial features. The heart rate variability research was able to introduce wearable equipment to detect depression based on cardiograph data. [10] Compared to the existing work in mental health monitoring [8,9], "Dheergayu" is distinct in following features, Dheergayu proposes an integrated system for monitoring Depressive Disorders, and the solution centralized with enabling multi-health data capturing and analyzing models. The centralized model be able to sense and produce the severity level of depressive cases. # III. # System Architecture When designing "Dheergayu" we introduce an automated framework with two (2) distinct components. The patient data is cached into the application persistence and it will be synchronized into "Google Fit API" services by preconfigured user time intervals. # IV. # Methodology This project is about developing a clinical depression assistant which gives depression severity status based on Heart Rate Variability [12], Cyclic Alternation Pattern [13] and Random Eye Movement [14] of sleep, Static facial features [15] and Dynamic facial features [16] of a patient. The stated patient data access from the patient's fitness tracker and Camera of a smartphone via developed application. Under the methodology, reviews the analysis of each health data of a patient, to produce suggestions and further recommendations to improve decision making for caretakers and doctors. The goal of this project design is, assist patients in their difficult situations with the help of minimum user interactions. # a) Research Dataset The availability of empirical data is of vital significance for the evaluation of the research problem. The used datasets are important for model creations and feature extractions. Due to the delicate existence of clinical records, the dataset distribution is neither large nor unrestricted. Under the research of depression analysis, we used the following data sources [17] Eye aspect ratio concept which defined in the "Real-Time Eye Blink Detection using Facial Landmarks" research paper which based on the work by Soukupova and Cech [22] used to identify the blinks of the depressed person. As shown in Fig. 4 this feature only extracts the eye of the provided video and each eye is represented using six coordinates. The EAR method used for this feature is mentioned below, EAR value is constant when the eye is open, but the value will drop to zero when a blink occurs. By using the landmark distance (1) this feature has ability to identify the blinks of the depressed person. After identifying the blink count this feature should identify whether this blink count is normal or related to depression. According to [23] depressed people have a low blink rate. It has been reported that the normal spontaneous blink rate is between 12 and 15/min [24]. By getting these mentioned points this feature will generate a report that indicates the depression rate by using the blink rate. # d) Analysis of Static Facial Features The development of facial image analyzing plays an important role in the face recognition field [25]. As well as the observation of facial emotions of a depression patient is provided huge support for decision making for the treatments by recognizing the depression level of the patient. This analysis of static facial images could give the early mentioned support in an effective way. # i. Data Acquisition CK+48 facial emotion dataset [20] were used to model development. The stated dataset contains 981 facial expressions in 48x48 dimensions and are categorized to 7 emotions as anger, contempt, disgust, fear, happiness, sadness and surprise. In the Preprocessing stage translating facial images into grayscale images. Face recognition and facial landmarks detection done by using the C++ library called Dlib [26]. Emotion detection is done with feeding coordinates data of those extracted facial landmarks that are vectorized to Support Vector Machines classifier called Support Vector Classification with linear kernel. It could get 88% accuracy of emotion detection through 10 runs. # iii. Depresssion Analysis As shown in Fig. 5 we developed a Hidden Markov Model (HMM) based component to get the depression status of a patient using previous emotion data by setting initial values with the prior knowledge and HMM provides the depression level in a probabilistic way. Use of the previous status of the patient supports the creation of a network to identify the depression pattern. # e) Analysis of Heart Rate Variability Under the research study of HRV model development following datasets [17], [18] were used. The datasets contained cardiograph data of 185 patients who had depressive disorders and 145 subjects were selected as control group (nondepressive disorders). Total 257 subjects were selected for model development. Data set contains attributes such as HRV, blood pressure, age, gender with 14 columns and 257 rows. In the data preprocessing stage, Principal Component Analysis used to manage the dataset more effectively. In HRV detection, HRV is the physiological phenomenon of the variation in the time interval between consecutive heartbeats in milliseconds [27]. Using logistic regression model analysis, the HRV, based on the age, gender, blood pressure and HRV rate. Model used fitness band data for its predictions. Model provides 94% of accuracy of the training dataset. According to [28] depression patients have a lower HRV than normal people. and HRV depends on the age limit of the person. As shown in Fig. 6 the describes the performance of the evaluated model. (2) This is the technique that used to provide the probabilistic result based on the historical predicted data. Analyzing historical data, "Dheergayu" can predict more accurate results based on the user data and history results. # f) Analysis of Depressive Sleep i. Data Acquisition Under the study, data [17][18] [19] of the total 671 participants with evidence of having sleep disorders, 142 subjects were selected (Insomnia -63, Obstructive Sleep Disorder -36, normal controls -43). The selected proportion has Sleep Obstructive Disorder (OSA) [29], Insomnia [30]. The subject's sleep was recorded from Electroencephalogram (EEG) channels, epochs of 30 seconds. ii. Data Preprocessing # Results and Outcomes After performing the test phase, we found that there are significant differences between healthy and depression groups. At research beginning, the system accuracy will evaluate with modular based testing. Under the testing phase we used sixteen ( 16) real-world respondents for result evaluation. The system test was conducted with two scenarios. # a) Modular Based Testing From the 16 respondents, 14 responses are selected into modular based testing. Under the testing process 2 cases are classified as positive cases (Clinically identified as having depression disorder), 2 participants of 16 eligible participants were dropped from the analysis because of missing data and anomalies. ? !(& ! ? ! (?)(4) # b) Mediator Based Testing In Mediator Based testing approach, stress tested with developed mediator of cloud server. The mediator developed with ensemble learners. In the prediction analysis that focused on depression, 2 participants of 16 eligible participants were dropped from the analysis because of missing data and anomalies. As shown in Table IV, tested with a 14% depression population. As shown in Table V, the mediator was able to reach a 92% success ratio. # Conclution This research was carried out to identify the depression of clinically identified patients in a more accurate and efficient way with the help of machine learning and visual computing technologies that are widely used today. "Dheergayu" application, which is the outcome of this research, is fully equipped with four different features to monitor depression of a specific person. Most importantly this app will generate a report by using the outputs of all four features that will help the doctors to identify depression with different aspects. Face is one of the most important and versatile features when it comes to depression analyzing. Throughout the research "Dheergayu" team were able to identify different facial aspects of a person that can vary overtime due to the depression. "Dheergayu" application has the ability to capture videos and pictures of depressed people and get the outcome which is depression status by using the trained models and algorithms that are developed to monitor depression by using visual aspects of the face. Sleep and HRV are the other two features that "Dheergayu" team has identified during the research, which has a great impact and variance with depression. Application always communicates with the fitness band to collect sleep and HRV data of the person and it will be processed with the developed models and algorithms in a backend cloud server. Since these two features are using a smart watch, "Dheergayu" application has the capability to monitor live data in every movement. Complete application is responsible for maintaining records that are generated by all four features and the novelty of this research is that there is no such solution to monitor depression with such a lowcost equipment and such features that are mentioned in the research paper. Since all the machine learning models and algorithms that are implemented in this solution has a higher accuracy, "Dheergayu" application can provide a comprehensive solution to the depression disorder. 12![Fig. 1: High-level Architecture of Dheergayu Cloud Deployed Services When designing Dheergayu Cloud services, we considered the possibility of scaling, availability and higher efficiency of designed architecture. By this implementation it is possible to deliver services for multiple stakeholders such as patients, caretakers and doctors. The designed architecture can communicate through API Request/Response Handler. Each of the data for core modules are accessed by developed Model Mediator. Each core module uses inhouse AWS Relational Database Services as a persistence layer. Under the methodology, will explain the procedure of each underlying component. Cloud API services deliver the Google Firebase Services, Google Secure Signing Authentications and Firestore Services to the entire system.](image-2.png "Fig. 1 .Fig. 2 :") ![[18][19][20][21].](image-3.png "") 1![Datasets were used to Studies b) System Methodology As shown in fig. 3 explains the workflow of depression analysis process. The outputs are aggregated into Overall Severity Signal. Stated outputs are probabilistic signals which are bundled with each classified outcome.](image-4.png "Table 1 :") 3![Fig. 3: High level data analyzing architecture](image-5.png "Fig. 3 :") 4![Fig. 4: Sample eye-blink capturing image, In respectively into p1-p6 facial coordinates](image-6.png "Fig. 4 :") 5![Fig. 5: The Workflow of Static Facial Feature Analysis](image-7.png "Fig. 5 :") 6![Fig. 6: confusion matrix of results As shown in Fig. 7 diagram the analysis part model identifies the risk class and normal class based on the training data. Risk class has more probability to be a depression patient.](image-8.png "Fig. 6 :") 7![Fig. 7: Test Results outcomes To add probabilistic outputs for logistic regression results were used Bayesian techniques (2).](image-9.png "Fig. 7 :") 8![Fig. 8: Workflow of Raw EEG Translation process. The outputs are aggregated into a CAP data block Initially raw EEG Data Blocks transferred into Cyclic Alternation Pattern (CAP) Translator Module (fig 8) of 30 epoch periods. First CAP Translator Module computes and generates datagram based on sleep event (See table II) of ith transmitted file.](image-10.png "Fig. 8 :") 9![Fig. 9: Workflow of Depressive sleep classification model development First, the loaded datagram contains, the records of Total Sleep Time (TST), Total Time in Bed (TIB), Sleep Efficiency (SE), The densities of each sleep stage (S1, S2, S3), REM Density (RD). The dataset is small, to eliminate unbalanced partitioning, model used discretization techniques to split data sets with prior, split factors. The discretization used depressive sleep type for further splitters. In this sleep component analysis development, we used, Random Forest algorithm for classification. This model used discretization split for training and testing. After initial modeling, the Sleep analysis model uses three optimization techniques to improve accuracy of the algorithm. In the Grid SearchCV optimization, find the best possible ensemble learner with given Hyper parameter sets. In process k-fold validation used for compute accuracy of the optimized model. The given k value (any discrete number) and model with parameters ? can compute error in K th as follows (3)](image-11.png "Fig. 9 :") 3ModelCompon entdepressNon-depressAvg. probabilityLogistic RegressionHRV2%98%0.88RandomForestSleep1%99%0.92ClassifierSupportVectorStatic Face 4%96%0.89MachineKerassequential modelDynamic Face3%97%0.87(3 layers)As shown as table III, the modules were testedon isolated environments to identify the base mark ofeach individual component. All the developedcomponents have reached a success ratio of 0.82. Allthe testing dataset were not used to modeldevelopment. 4DepressNon-depressInput data212 5DepressNon-depressAverage Probabilityresults2120.82VI. © 2020 Global Journals * References Références Referencias 1 Feb-2020 22 World Health Organization * 7 Types of Depression You May Not Know About NSchimelpfening Verywell Mind 22 04-Feb-2020. Feb-2020 * Diagnostic and Statistical Manual of Mental Disorders (DSM-5®)," GoogleBooks * lr =&id=JivBAAAQBAJ&oi=fnd&pg=PT18&dq= rela ted:fQyv5Jjgfj8J:scholar.google.com/&ots=ceVM_ 4JJB9&sig=TQygVD5_W07Wy8KdAE2smRQ8sRY &redir_esc=y#v=onepage&q&f=false Feb-2020 22 * 10 Ways Technology Has Reshaped the Modern Workplace | QuickFMS APrasad QuickFMS 30 2020. Oct-2020 * Feature Selection and Classification of Electroencephalographic Signals: An Artificial Neural Network and Genetic Algorithm Based Approach -Turker Tekin Erguzel, Serhat Ozekes TTErguzel SOzekes OTan SGultekin Selahattin Gultekin 1 2015. Jan-1970 Oguz Tan SAGE Journals * 10.1177/1550059414523764 Feb-2020 22 * Self-reported and measured sleep duration: how similar are they? DSLauderdale KLKnutson LLYan KLiu PJRathouz Epidemiology 20 Nov-2008. Feb-2020 * Utility of the Fitbit Flex to evaluate sleep in major depressive disorder: A comparison against polysomnography and wristworn actigraphy JCook MPrairie DPlante Available: 10.1016/j. jad.2017.04.030 Journal of Affective Disorders 217 2017. Accessed 30 October 2020 * SimSensei 2020. Oct-2020 30 Ict.usc.edu * A reduced region of interest based approach for facial expression recognition from static images KChitta NNSajjan 2016 IEEE Region 10 Conference (TENCON) 2016 * Wearable depression monitoring system with heart-rate variability TRoh SHong H.-JYoo 36th Annual International Conference of the IEEE Engineering in Medicine and Biology Society Amazon Web Services, Inc 2014. 2014. 2020. Jul-2020 17 Amazon EC2 Instance Types -Amazon Web Services * (PDF) Heart rate variability: A review 12 ResearchGate, 2020. [Online * Heart_Rate_Variab Jul-2020 17 * Cyclic Alternating Pattern in Obstructive Sleep Apnea Patients with versus without Excessive Sleepiness SKorkmaz NBilecenoglu MAksu TYoldas 2018. May 16. July 17, 2020 * Rapid-Eye-Movement-Sleep (REM) Associated Enhancement of Working Memory Performance after a Daytime Nap EY YLau MLWong KN TLau FW YHui C.-HueiTseng 10.1371/journal.pone.0125752 PLOS ONE 17 Jul-2020 * Emotion Recognition from 2D Facial Expressions BTaha DHatzinakos 2019 IEEE Canadian Conference of Electrical and Computer Engineering (CCECE) 2019 * Use and Usefulness of Dynamic Face Stimuli for Face Perception Studies-a Review of Behavioral Findings and Methodology KDobs IBülthoff JSchultz 10.3389/fpsyg.2018.01355/full 2018. July 13. July 17, 2020 * Sleep Data -National Sleep Research Resource -NSRR RMueller Slepdata.org 2020. Jul-2020 17 * v1.0.0 CP Sleep Database 17 2020. Jul-2020 Physionet.org * ISUC-SLEEP Dataset | A comprehensive public dataset for sleep researcher Sleeptight.isr.uc.pt 17 2020. Jul-2020 * CK+ Facial Expression Detection Kaggle.com 17 2020. Jul-2020 * Challenges in Representation Learning: Facial Expression Recognition Challenge | Kaggle Kaggle.com 17 2020. Jul-2020 c/challenges-in-representation-learningfacial-expression-recognition-challenge/data * Realistic Speech-Driven Facial Animation with GANs KVougioukas SPetridis MPantic Available:10.1007/s11263-019-01251-8[Accessed30 International Journal of Computer Vision 128 5 2019 * Staring Down Death: Is Abnormally Slow Blink Rate a Clinically Useful Indicator of Acute Suicide Risk Thomas&Joiner Melanie&Hom Megan&Rogers Carol&Chu Ian&Stanley Gary&Wynn PeterGutierrez 10.1027/0227-5910/a000367 Crisis 37 2016 * Changes in blink rate and ocular symptoms during different reading tasks AAAbusharha 10.2147/OPTO.S142718 Clin Optom (Auckl) 9 2017 * How do depressed and healthy adults interpret nuanced facial expressions? JKGollan MMccloskey DHoxha EFCoccaro Journal of abnormal psychology Nov-2010 * CDlib Library Jul-2020 17 * How do depressed and healthy adults interpret nuanced facial expressions? JKGollan MMccloskey DHoxha EFCoccaro Journal of abnormal psychology Nov-2010 * Depression and heart rate variability in patients with coronary heart disease RMCarney KEFreedland Cleveland Clinic Journal of Medicine 76 Suppl_2 Jan. 2009 * Obstructive sleep apnea: a growing problem KKMotamedi ACMcclary RGAmedee The Ochsner journal 17 2009. Jul-2020 * Insomnia and its impact on physical and mental health JFernandez-Mendoza ANVgontzas Current psychiatry reports 17 Dec-2013. Jul-2020