Keywords
Artificial intelligence, depression, detection, tuberculosis, Natural Language Processing
This article is included in the Artificial Intelligence and Machine Learning gateway.
This article is included in the AI in Medicine and Healthcare collection.
Major Depressive Disorder (MDD) can occur in patients with tuberculosis. The purpose of this research was to develop an early detection system for MDD and conduct an accuracy test.
The MOODMIND application uses Natural Language Processing (NLP) with sentiment analysis techniques. MOODMIND offers both speech and text options and is available in Indonesian/English. The screening results were compared with physician clinical interview. Single blinding was used so that doctor was unaware of the application test.
The app asks open- and closed-ended questions for MDD identification based on the DSM-5. The test results were divided into non-depressive (none or at-risk) and suspected depression groups. Among the 21 subjects, MOODMIND showed 67% (95% CI: 9.4–99.2%) sensitivity and 100% (95% CI: 81.5–100%) specificity.
MOODMIND demonstrated accuracy results in pilot study but required advanced research with more sample and diverse settings. Ease is advantageous because the steps are simple, but it can be improved by adding words related to depression in the lexicon adjustment for increasing diagnostic performance.
Artificial intelligence, depression, detection, tuberculosis, Natural Language Processing
We have carefully revised the manuscript in response to the reviewers’ feedback and made several important improvements.
First, the title has been adjusted to Pilot Feasibility Study. This change ensures that the study is positioned appropriately as an early-stage evaluation rather than a definitive diagnostic validation.
Second, 95% confidence intervals have been added to the sensitivity and specificity results.
We also clarified that structured diagnostic interviews such as SCID or MINI were not used as the reference standard. Instead, physician clinical interviews were employed, and this is acknowledged as a methodological limitation.
In addition, expert validation was conducted prior to pilot testing, involving primary care physicians and IT specialists.
The rationale for the selected risk thresholds has also been clarified.
We further added a statement acknowledging that suicidality screening is not yet integrated into the current version of MOODMIND, recognizing this as an important area for future development to ensure patient safety.
Finally, claims regarding performance and applicability have been made more cautious, emphasizing that these findings are preliminary and require validation in larger and more diverse populations.
See the authors' detailed response to the review by Masab Mansoor
Tuberculosis (TB) is a chronic infectious disease that requires at least 6 months of therapy. Psychiatric conditions are important because patients with TB can experience social stigma, worries about their illness, or difficulties during treatment. Depression has a strong effect on negative outcomes.1 Individuals who undergo treatment with second- and third-line medications are at a greater risk of stigma and depression.2
Depression also affects the immune system by lowering CD3, CD4, C8, and lymphocyte.3 Low serum anti-inflammatory cytokine levels are observed in patients with Major Depressive Disorder (MDD)-TB. Recognition of MDD in patients with TB will be more appropriate for diagnosis, treatment, and prognosis.4
Afaq et al. (2023) reported that 35% of TB patients diagnosed with depression in varying levels.5 Researchs in Indonesia stated that the proportion of depression in TB patients is 5.38%6 and in MDR TB (Multidrug Resistance Tuberculosis) of 68.3% consists of mild, moderate, and severe.7 The integration of mental health services in the management of TB patients still faces obstacles, namely the lack of patient knowledge about depression.8 Patients feel unnecessary or even reluctant to have a depression screening because they are worried about receiving a double stigma. The obstacle experienced by officers is limited time in service.5,9
The prevalence of major depression is 322 million worldwide10 and some patients do not seek help. Major depression has the potential to lead to suicide. Questionnaires and screening tools have been developed, but most use closed-ended questions, such as the Mental Health Screening Tool for Depressive Disorders (MHS:D).11
Zotova et al. (2024), researched on the use of Patient Health Questionnaire-9 (PHQ-9) and stated that respondents’ understanding of the PHQ-9 question is sometimes incorrect, one of which is due to different cultures.12 The Beck Depression Inventory-Second Edition (BDI-II) uses longer questions.8 PHQ-9 and BDI-II have been validated in a wide range of populations, but limited patient involvement and understanding of the questions. Obstacles can occur in individuals with low literacy, or in diseases (e.g. TB) that are susceptible to stigma. A dialogue-based digital approach can be more interactive and adapted to the context of the disease. The conversation-based screening method is expected to be more convenient and accepted by users in multicultural background.
Natural Language Processing (NLP) is an artificial intelligence capable of analyzing and interpreting words.13 NLP can be used remotely for the real-time detection of depression. Studies have built systems with NLP to analyze the signs of depression based on comments on social media, such as mental health. The researchers compared mental health with the PHQ-9 to determine the accuracy of the system.14
The NLP techniques used include sentiment analysis, linguistic markers, word embedding, convolutional neural networks, recurrent neural networks, and large language models. Sentiment analysis examines the tone of emotions in a text, referring to depression if a negative language is identified.15
Based on the above description, a web-based application was built to screen for MDD using sentiment analysis. The software provides an alternative with open-ended questions on the two key symptoms for the diagnosis of major depression in both Indonesian and English. Through early detection, it is hoped that depression can be treated immediately and that this will increase the chances of successful treatment.
A. MOODMIND development
The project is part of an effort to examine tuberculosis patients holistically by developing AI-based tools for detecting MDD.
1. Ethical considerations
The ethics committee of YARSI University reviewed the ethical clearance number 114/KEP-UY/EA.20/III/2025.
2. Implementation
MDD is diagnosed if it meets the criteria of five or more symptoms (there is at least one symptom point a or b) for at least two weeks.16 Figures 1 and 2 illustrate the concept of MOODMIND, respectively.
The software can be accessed via the following link: https://moodmind-two.vercel.app/.
MOODMIND used Next.js for Frontend Framework, Tailwind CSS, and Web Speech API for Speech Recognition. The Programming Languages are TypeScript and JavaScript.
VoiceChat.tsx manages the voice input, transcripts, and conversation flow control. UseSpeech.ts for customizing hooks to control speech recognition status. The scripts provide questions and response scripts.
The detection approach was based on several text-based indicators derived from voice transcription, namely, language patterns and depression-related keywords.
Users open the web-based application and answer system questions using voice or text. The system processes the transcription using sentiment analysis. The results of the analysis are displayed in visual and narrative forms.
MOODMIND was adapted with a custom sentiment dictionary, focusing on common terms in Bahasa Indonesia that were reported by patients with TB when experiencing emotional distress.
As part of its natural language processing features, this system is equipped with a sentiment analysis module to evaluate the emotions contained in voice recognition transcripts. Sentiment analysis aimed to identify the emotional orientation (positive, negative, or neutral) of a statement, which, in this context, was used to detect indications of mood and enthusiasm in patients. Sentiment analysis was performed using the sentiment library, an open-source JavaScript library that supports lexicon-based analysis.
Lexicon adjustments for Indonesian
By default, a sentiment library supports the English language. To support Indonesians, a special dictionary (lexicon), consisting of a list of words and their sentiment scores, was identified.
This list of words was based on commonly used terminology to express negative emotional states, and was obtained through discussions between research members (Figure 3).
Sentiment analysis process
After the user provides voice input, which is then transcribed into text, the system performs sentiment analysis of the text. The following functions were used to perform the analysis (Figure 4). The getSentiment function accepts three parameters: the transcribed text, the sentiment dictionary, and the language code (“id” for Indonesian or “en” for English). If the selected language was Indonesian, the library was registered using a specially compiled dictionary.
Analysis results
The result object returned by the analysis () function contains several attributes that provide an overview of the emotional content of the analyzed text, including the score of text sentiment (positive, negative, or neutral), comparative (the normalized score value relative to the number of tokens), tokens resulting from text segmentation, words identified as having sentiment meaning, and positive/negative words recognized in the text.
By integrating this sentiment analysis, the system automatically detects emotional indicators and provides additional data for depression-screening processes. If negative sentiments related to feelings or interests are found in the last two weeks, then it is followed by closed questions.
Classification Rules
Given the pilot nature of this study, the threshold is not statistically optimized but is intended to detect MDD with clinical logic. The threshold values used for risk categorization are derived from clinical references (DSM-5).
Expert Validation
Prior to the pilot implementation, MOODMIND was reviewed through expert validation. A psychiatrist and two primary care physicians evaluated the clinical relevance of the question flow, mapping the symptoms to the DSM-5 criteria, and categorization of screening results. An information technology expert assesses technical implementations, including speech-to-text processing and lexicon integration.
B. Accuracy test
Quantitative research was carried out with a cross-sectional design and aimed at testing the accuracy of MOODMIND. The research population was drug-sensitive TB patients accompanied by YARSI TB Care cadres. The inclusion criteria were patients aged 17-65 years, had undergone TB treatment for more than 1 month, and were willing to be the subject of the study. Exclusion criteria include patients who could not be contacted and had incomplete data.
Informed Consent was carried out in writing using an electronic questionnaire. Parents or guardians would be asked for written consent (using an electronic questionnaire) for patients who are 17 years old. The samples were taken by purposive sampling in the May-July 2025.
Data collection was obtained by interview, comparing the results of detection with MOODMIND physician clinical interview. The standard reference for MDD in this study was a clinical interview by a physician using diagnostic criteria based on the DSM-5.16 The doctor asked 9 questions systematically consisting of MDD symptoms (2 core symptoms and 7 additional symptoms), then classified as MDD if there were at least 5 symptoms (at least 1 core symptom accompanied by additional symptoms). The interview was conducted for 10-15 minutes (A list of questions is available in the Data Availability section link).
Structured interviews such as SCID (Structured Clinical Interview for DSM Disorders) or MINI (Mini International Neuropsychiatric Interview) were not used, this was a methodological limitation. Univariate analysis using Microsoft Excel to calculate sensitivity, specificity, positive predictive value, and negative predictive value. Single blinding was done to the doctor so that she did not know the results of detection with MOODMIND.
Expert feedback results in improvements in audio clarity and transcription synchronization. Improvements were made to the naturalness of the sound. After revision, the system was considered stable and easy to use for pilot testing.
MOODMIND users can select the languages (English and Indonesian) (Figure 5a). Users can choose either the written or voice mode of conversation (Figure 5b). Users’ answers were categorized into 3, namely not depressed (score/symptom = 0), at risk of depression (score/symptom = 1-4), and suspected depression (score/symptom ≥ 5) (Figure 5c). The word “Suspected depression” was used because the diagnosis by the doctor must be carried out and the patient should receive the necessary consultation. The role of a doctor/officer cannot be replaced by AI because of empathy and direct interaction with a human being. MOODMIND does not currently include a suicidality referral flow. In clinical implementation, it is necessary to ensure patient safety. Figure 6 shows the MOODMIND System Processing Pipeline.

We conducted tests on 21 patients with TB in Central Jakarta between May and July 2025 (Figure 7). The average age of patients was 41.4 years with an age range of 19-64 years. The patient was guided by the researcher when using MOODMIND, whereas the doctor was blinded and did not know the results of the software detection.
Table 1 shows a comparison of MOODMIND detection with the physician clinical interview, while Table 2 shows the accuracy level of the software. The sensitivity was 67% (95% CI: 9.4–99.2%), and specificity was 100% (95% CI: 81.5–100%), reflecting the limited precision due to small sample size. The small number of samples was considered in interpreting the results of sensitivity and specificity.
| AI MOODMIND | Autoanamnesis | Total | |
|---|---|---|---|
| Negative | Positive | ||
| Negative | 18 | 1 | 19 |
| Positive | 0 | 2 | 2 |
| Total | 18 | 3 | 21 |
The MOODMIND application was equipped with sentiment analysis by searching for keywords and analyzing sentiments in Indonesian. The Lexicon technique is used to make a list of words and score sentiments for each word.17 Other research has identified the keywords depression, symbols, and expressions through social media.18,19 Existing depression detection systems/applications such as “Mental Care” which asked 21 questions to respondents,20 Multi-Gated LeakyReLU processed depressive language using CNN,21 while another study analyzed expressions that did not directly use specific words.22
The results of this pilot study obtained a sensitivity of 67%. MOODMIND can be used as an initials screening tool in a variety of settings, not only in healthcare but also in the community. However, for negative cases with high risk, it is recommended to continue undergoing further clinical assessments. High-risk MDD-TB patients include MDR TB,23 have comorbidities,24 and get stigmatized.25
Artificial intelligence usually requires the ability of the user.26 However, MOODMIND is very easy to operate, which can reduce issues related to human resources. The main requirements are a device and an internet connection. This tool is an inspiration for the development of similar types in other countries according to the local language, minimizing the gap between the detected cases and the actual number of cases. The variation of words related to depression still adjusts to the current condition, so it must be continuously updated to increase sensitivity from time to time. PHQ-9 is a questionnaire that has been tested to have high validity. However, conversation-based MOODMIND with open-ended questions can offer advantages compared to standard questionnaires that are underutilized.
More sample research is needed to determine the accuracy of MOODMIND in a real-world setting. The absence of structured diagnostic interviews (e.g., SCID or MINI) limits diagnostics to reference standards. In addition, bridging the results of screening to electronic medical records can be a useful alternative for monitoring the mental health of patients with chronic diseases such as tuberculosis. Advanced versions should incorporate suicide risk screening and referral mechanisms.
MOODMIND, an artificial intelligence based on Natural Language Processing, can be used as an MDD detection tool. The diagnostic performance in this pilot study still required further exploration accompanied by research with a larger sample. This tool supports mental health monitoring but does not replace the role of doctors. This could also be an idea for AI development in some countries to detect MDD as early as possible.
Source code available from: https://github.com/incrementalstudios/mood-mind
Archived software available from: https://doi.org/10.5281/zenodo.1679311027
License: MIT License
The dataset as the basis for the accuracy test findings can be accessed at the link: https://doi.org/10.5281/zenodo.17114938.28 We also include the approval sheets and interview guides in the link.
Data are available under the terms of the Creative Commons Zero v1.0 Universal
| Views | Downloads | |
|---|---|---|
| F1000Research | - | - |
|
PubMed Central
Data from PMC are received and updated monthly.
|
- | - |
Competing Interests: No competing interests were disclosed.
Reviewer Expertise: Machine Learning, artificial intelligence, health informatics, Large language models, Machine vision
Is the rationale for developing the new software tool clearly explained?
Partly
Is the description of the software tool technically sound?
Partly
Are sufficient details of the code, methods and analysis (if applicable) provided to allow replication of the software development and its use by others?
No
Is sufficient information provided to allow interpretation of the expected output datasets and any results generated using the tool?
Partly
Are the conclusions about the tool and its performance adequately supported by the findings presented in the article?
No
Competing Interests: No competing interests were disclosed.
Reviewer Expertise: General and cardiac physiology, genetics, Pediatrics,
Is the rationale for developing the new software tool clearly explained?
No
Is the description of the software tool technically sound?
Partly
Are sufficient details of the code, methods and analysis (if applicable) provided to allow replication of the software development and its use by others?
No
Is sufficient information provided to allow interpretation of the expected output datasets and any results generated using the tool?
Partly
Are the conclusions about the tool and its performance adequately supported by the findings presented in the article?
Partly
References
1. Sweetland A, Kritski A, Oquendo M, Sublette M, et al.: Addressing the tuberculosis–depression syndemic to end the tuberculosis epidemic. The International Journal of Tuberculosis and Lung Disease. 2017; 21 (8): 852-861 Publisher Full TextCompeting Interests: No competing interests were disclosed.
Reviewer Expertise: Major depressive disorder, digital mental health, brain stimulation
Is the rationale for developing the new software tool clearly explained?
Partly
Is the description of the software tool technically sound?
No
Are sufficient details of the code, methods and analysis (if applicable) provided to allow replication of the software development and its use by others?
No
Is sufficient information provided to allow interpretation of the expected output datasets and any results generated using the tool?
Partly
Are the conclusions about the tool and its performance adequately supported by the findings presented in the article?
No
Competing Interests: No competing interests were disclosed.
Reviewer Expertise: Machine Learning, artificial intelligence, health informatics, Large language models, Machine vision
Alongside their report, reviewers assign a status to the article:
| Invited Reviewers | |||
|---|---|---|---|
| 1 | 2 | 3 | |
|
Version 2 (revision) 19 Mar 26 |
read | ||
|
Version 1 13 Oct 25 |
read | read | read |
Provide sufficient details of any financial or non-financial competing interests to enable users to assess whether your comments might lead a reasonable person to question your impartiality. Consider the following examples, but note that this is not an exhaustive list:
Sign up for content alerts and receive a weekly or monthly email with all newly published articles
Already registered? Sign in
The email address should be the one you originally registered with F1000.
You registered with F1000 via Google, so we cannot reset your password.
To sign in, please click here.
If you still need help with your Google account password, please click here.
You registered with F1000 via Facebook, so we cannot reset your password.
To sign in, please click here.
If you still need help with your Facebook account password, please click here.
If your email address is registered with us, we will email you instructions to reset your password.
If you think you should have received this email but it has not arrived, please check your spam filters and/or contact for further assistance.
Comments on this article Comments (0)