Assistive Chatbots for healthcare: a succinct review

Basabdatta Sen Bhattacharya1,*, Vibhav Sinai Pissurlenkar2

1 Computer Science and Information Systems, BITS Pilani Goa Campus, Goa, India
2 Goa University, Goa, India

*<EMAIL_ADDRESS>
## Abstract

Artificial Intelligence (AI) for supporting healthcare services has never been
more necessitated than by the recent global pandemic. Here, we review the
state-of-the-art in AI-enabled Chatbots in healthcare proposed during the last
10 years (2013-2023). The focus on AI-enabled technology is because of its
potential for enhancing the quality of human-machine interaction via Chatbots,
reducing dependence on human-human interaction and saving man-hours. Our
review indicates that there are a handful of (commercial) Chatbots that are
being used for patient support, while there are others (non-commercial) that
are in the clinical trial phases. However, there is a lack of trust on this
technology regarding patient safety and data protection, as well as a lack of
wider awareness on its benefits among the healthcare workers and
professionals. Also, patients have expressed dissatisfaction with Natural
Language Processing (NLP) skills of the Chatbots in comparison to humans.
Notwithstanding the recent introduction of ChatGPT that has raised the bar for
the NLP technology, this Chatbot cannot be trusted with patient safety and
medical ethics without thorough and rigorous checks to serve in the ‘narrow’
domain of assistive healthcare. Our review suggests that to enable deployment
and integration of AI-enabled Chatbots in public health services, the need of
the hour is: to build technology that is simple and safe to use; to build
confidence on the technology among: (a) the medical community by focussed
training and development; (b) the patients and wider community through
outreach.

##  1 Introduction

Artificial Intelligence (AI) today has reached a stage where it is being
perceived as a serious existential threat to the human kind
(https://www.bbc.co.uk/news/world-us-canada-65452940), particularly with the
recent introduction of the conversational agent ChatGPT
(https://openai.com/blog/chatgpt). Belonging to the genre of Generative AI,
the ChatGPT is essentially a deep neural network that has been trained over
humongous sets of data over a period of around 7-8 years. This may be thought
akin to training a baby from childhood to a stage where not only can they
converse on the matters that they were trained on, but they can also tap into
their past conversational experience to interact on matters that were not
explicitly in their training framework. Indeed, conversational agents,
commonly and succinctly referred to as Chatbots (Robots that can
chat/converse/interact), was first proposed at the AI lab of Massachusetts
Institute of Technology, USA [51], even if the idea of a thinking and
interacting machine can be traced back to the famous imitation games proposed
by Alan Turing [49]. For healthcare, the emphasis on assistive AI has never
been greater than around the time of the recent global pandemic. As the
doctors, nurses and carers themselves became affected physically and mentally
by the virus, and often forced to be off work due to long term effects of the
disease, the burden on the medical services globally reached unprecedented
levels. In particular, mental health has emerged as a major long term effect
of the pandemic, even if it often tends to go unreported, perhaps due to
inhibition of the patients to share their mental state and feelings, not to
mention the attached stigma (https://www.psychiatry.org/patients-
families/stigma-and-discrimination). One example of Nations trying to address
this issue is the dedicated page for mental health of adolescents
(https://www.youngminds.org.uk/) in the United Kingdom (UK), a section of the
society that was one of the hardest hit by the pandemic. Furthermore, the
National Health Services (NHS), UK have self-assessment pages for Mood of
adolescents [38] and Depression [37], which have a text-based user interface
and have a Question and Answer (Q&A) format. Even before the pandemic hit
though, an independent review recommendation led by Dr. Eric Topol during
2018-19 (https://topol.hee.nhs.uk/the-topol-review/; on invitation by the UK
Government) projects that around 80% or more of patients and medical staff
will use and/or benefit from using AI for “Speech recognition and natural
language processing (NLP)” (see p 26 Fig 1); in this context, the report
outlines how recent advances in the speech recognition (SR) technology “now
presents a valuable tool for clinical documentation – the benefit for the
healthcare workforce to focus on patient interaction and care rather than the
computer screen and keyboard is clear. This is likely to have a major impact
in primary care, as well as outpatients and emergency departments in
hospitals.” The Topol review further outlines how an existing Chatbot is being
used for triaging mental health patients in London, and the future
possibilities (interested readers may refer to section 3.1.5 in the report).

In this brief review, our objective is to highlight the Chatbots that were
developed and designed specifically for healthcare (both mental and physical)
applications during the last ten years i.e. between 2013 – 2023. In addition,
we focus on Chatbots that (claim to) have used AI as a technology in
developing the Chatbots. Here, we note that rule-based algorithms such as
decision trees very much falls under the purview of AI as well as Machine
Learning (ML), the latter itself being a subset of the former. Our reference
to the term ‘Chatbot’ in this article refers to all conversational agents that
use AI (rule-based & other ML) algorithms and can communicate with the user
autonomously and require minimal support from human-in-the-loop.

In our literature survey, we have come across several Chatbots, both for
mental and physical health, that are led by not-for-profit agencies and
Institutions (including Higher Education, Medical, and Research Institutes and
Organisations). A significant factor in the testing and deployment of Chatbots
is their acceptance by the medical community as assistive tools. A survey and
analysis study on a cohort of 100 professionals and experts in mental health
[47] report that 23% of the participants thought that Chatbots were
unimportant, and only 11% thought that they were very important; the remaining
thought they were somewhat important. Furthermore, most respondents were not
aware of available Chatbots, although 80% of them thought they were likely to
prescribe assistive Chatbots within the next five years. The other major
inhibitive factor may be attributed to a perception that over time, Chatbots
may replace or reduce the number of medics in the profession. In this
scenario, the recommendations for education and training to inform and
familiarise the medical community with AI technology seems apt and timely. At
the same time, [33] raise the important issue of assessment of the Chatbots in
terms of their efficacy in patient recovery. On this, the term ‘recovery’ is
brought to the fore and the need for a consensus on the definitive (set of)
symptom(s) that would define recovery in specific psychiatric conditions is
emphasised. Here, we note the importance of evaluating the ‘Chatbot as an
evaluator’ using appropriate metrics.

In addition to non-commercial Chatbots, we have come across a few commercial
ones that can be accessed at a cost to the individual or employer, of which we
found three organisations that have dedicated Chatbots designed for mental
health consultancy and education. We note that this is not by any means an
exhaustive list of available commercial applications; rather a list selected
based on their accessibility and user ratings on the web. Furthermore, and to
the best of our knowledge, we did not come across a commercial deployment of
Chatbots for physical health consultancy and treatment; thus, all the
commercially available Chatbots that we have discussed here are for mental
well-being. The greater emphasis on digital intervention for mental health may
be attributed to the flagging of several psychiatric and psychological
illnesses as a global health issue by the World Health Organisation, leading
to an increased funding for research on viable options for treatment, therapy
and outreach. In a recommendation for research on mental health in the USA,
conversational agents (i.e. Chatbots) as Behavioural Intervention Technologies
(BITs) [35] is mentioned as a viable pathway. However, the main hurdle at the
time was the NLP interface that proposed the Relational Frame Theory (RFT)
(“which posits that humans use linguistic frames to understand the world
around them, and subsequently solve problems.”) as a means to design
conversational agents that can be deployed for assessment of mental health
patients. The emphasis was on building conversational interface that are
informed by standard practices in psychological therapy.

Implementation of software for Chatbots is mainly via two modes: (a) Stand-
alone computers or laptops; here, the conversational agent software either
needs to be installed on the machine and executed locally, or is made
available on a cloud server via a web browser. (b) Smart phones and tablets:
here, the conversational agents are software applications (‘Apps’) that
execute on the Google Android or Apple iOS operating systems (OS), available
to install on the mobile devices from the Google Play and Apple stores
respectively. Some of these Apps also run on the Microsoft Windows OS and thus
can be accessed on stand-alone computers and laptops. Chatbots that are
available via web browsers can also be accessed from these mobile devices.

Overall, while several Chatbots are available (commercially) as well as being
developed currently, a lot needs to be done in terms of rigorous testing and
assessment to build confidence in the technology and integrate them with
existing public health services. The relevance of Chatbots for medical
intervention and support is made evident by a plethora of review articles that
were published within a short span of 7-8 years; we make a brief overview of
selected existing review articles in Sec. 2. In Sec. 3 we discuss Chatbots
that are developed for mental healthcare; Chatbots that are led by Academic
and Medical Research Institutes and Organisations and are in several pre-
deployment phases are presented in Sec. 3.1; Chatbots that are deployed
commercially are discussed in Sec. 3.2. In Sec. 4, we discuss the Chatbots for
physical healthcare and wellbeing, all of which are in the research and
development phases. We discuss our findings from this review and conclude the
paper in Sec. 5.

##  2 Existing literature surveys

Four researches over a period of 2 years (2017 – 2019) capture well the
progress of conversational agents in healthcare, which we present here ([29,
44, 1, 5]). We have observed some differences in terminology regarding the
different phases of the Chatbot life-cycle. Thus, while reading the papers, we
classified the phases of the Chatbot life-cycle broadly into 5 categories
(https://chatbotsmagazine.com/the-bot-lifecycle-1ff357430db7) viz. (i)
research and design (ii) software development and implementation (iii) pilot
testing (iv) deployment (v) post-deployment testing and evaluation. The post-
deployment maintenance phases are irrelevant for this review as we did not
find any non-commercial Chatbot currently in healthcare that are in this
stage; for the commercial Chatbots, we do not have enough information to be
able to comment on this. For the benefit of the reader, we would like to note
here that testing of Chatbots in healthcare needs ‘clinical trials’ to ensure
patient safety and efficacy of treatment. Randomised Control Trials (RCT) [23]
is considered as the gold standard in clinical trials. Many of the Chatbots
for mental health that are discussed here underwent RCT for pilot testing; PHQ
(Public Health Questionnaire) and GAD (General Anxiety Disorder) metrics are
used for quantitative evaluation of Depression and Anxiety levels in patients
(for example, see https://talk2gether.nhs.uk/quick-self-assessment/)
participating in clinical trials for piloting/evaluating Chatbot efficacy.

The systematic review by [29] helped us to understand the breadth of the work
done in the area of our interest i.e. Chatbots in healthcare. In fact, the
authors mention that this is the first instance of a review on conversational
agents in healthcare where these agents can also communicate in modes other
than in natural language e.g. facial expressions, body movements. After a
thorough process of reviewing existing research reports, the authors focus on
14 reports on conversational agents that are out of the development phases and
passed the pilot phase, with the strict condition that the agents were tested
on human users (those that were not, are excluded from their review). We note
that the authors mention chatbots and Embodied conversational agents (ECA)
only as subsets of the umbrella term ‘conversational agents’; chatbots are
those that has the “ability to engage in small talk and casual conversation”;
ECAs involve a computer generated ‘avataar’ and provide an illusion of a
‘face-to-face’ communication with a human. Of the 14 conversational agents
reviewed, 5 were ECAs and 2 were chatbots. (Readers may note that to avoid
terminology clash, we have used the upper-case for ‘c’ in ‘Chatbot’, a term
that we have used to refer to all conversational agents in our review,
including ECAs). The authors specify six fundamental attributes as design
choices for conversational agents as well as technical measures for evaluating
their efficacy (See their Boxes 1 and 2 respectively). Overall, the review
findings indicates an alarming gap in consensus among research groups and
institutions on testing and evaluating methodologies for conversational
agents. Furthermore, the review recommends incorporating patient safety as an
evaluative metric for conversational agents.

In a scoping review, [44] focus on ECAs for mental health only, and identify
49 studies in the field. The higher count than that reported in [29] is
because this study includes ECAs that are also in the development or pilot
phases. The communication with the ECAs were primarily through speech
($\approx 37\%$), facial expressions ($\approx 31\%$) and hand and body
gestures ($\approx 29\%$). Furthermore, $\approx 53\%$ of the ECAs targetted
Autism Spectrum disorder (ASD), and around $\approx 20\%$ targetted
depression. And yet, only 7 of the 49 ECAs reported here moved beyond the
pilot phase. Out of these, 6 were in the evaluation phase (2 each in ASD and
depression, 1 each in substance use and psychotic disorder), and only 1
(depression) reached the implementation (i.e. deployment) phase. For ASD, ECAs
were mainly used for education and skills training purposes where the ECA is
posited as the trainer or coach. For depression too, the ECAs were used as a
virtual coach or healthcare personnel; interventions were through counselling,
skills training and cognitive behavioural therapy (CBT). We did not find a
specific reference to the ECA in depression that is counted as ‘implemented’.
In agreement with that reported in [29], the evaluation of the ECA
‘performance’ in psychotherapy for each of the 7 disorders reviewed here
varies across studies both in terms of the evaluation criteria and
methodologies. The author recommend low tech, robust, simple technology for
ECAs, which will facilitate fast progression from the development and pilot
phases to deployment for ‘routine clinical practice’ in a safe and effective
manner.

Another scoping review [1], focussing on the Chatbots for mental healthcare
(only), report a mind boggling 15000 available mobile healthcare apps, out of
which 29% were for mental healthcare. Of these, the majority used decision
tree algorithms for developing the Chatbots; 2 research papers proposed
supervised learning and reinforcement learning (RL) algorithms respectively;
another 2 claimed AI-based rules for their Chatbots, but failed to specify the
exact methodologies and network architecture. The interest in the research
community seems recent, starting around 2005; around 50% of the research were
during the period 2016 - 2019. More than 17 countries worldwide are involved
in research in this area, out of which only 4 developing countries are
involved. The authors seem to make a subtle hint that developing countries
could benefit more from this technology compared to developed countries. On
this, we note that one way of building acceptance of Chatbots in developing
countries, suggested by [45] while warning on a looming “mental health
epidemic” in India, could be by integration of the technology with indigenous
language and culture.

Around the same time, [5] made a scoping review with a focus on the efficacy
of available Chatbots in mental healthcare (only). The authors note that
Chatbots can make valuable contributions to the psychotherapy procedures where
contact time between patient and the practitioner is not essential, for
example psycho-education, goal-setting conversations, therapeutic writing.
Furthermore, an empathetic Chatbot may be more accepted by the patients and
practitioners. They recommend quality checks on patient safety when working
with Chatbots, as well as a need for evolving psychotherapy database of the
existing bots.

The systematic review by [29] indicates that there is an equal number of
conversational agents in physical (8) and mental health (8) (and one chatbot
reported as being piloted for both physical and mental health; see their Table
3) that are developed and piloted on human users. Existing commercial Chatbots
were not discussed, perhaps because they did not meet the selection criteria
for the review. Indeed, a few commercial Chatbots are mentioned in [5], with a
note that these are not ‘empirically tested’.

Our review adds value to the above-mentioned literature survey in three
aspects: First, our interest is in Chatbots that incorporate AI as a
technology (for example Decision Trees, NLP, DL) for patient support, therapy,
as well as educational and coaching activities. Second, wherever available, we
are interested in the specific AI technique used to design and develop the
Chatbot. Last but not the least, we report on the current status of the
Chatbots that we have discussed here.

For this brief review, we did not make a comprehensive coverage of all
available Chatbots in healthcare. Rather, we have taken cues from the
bibliography of the existing reviews, a strategy termed as ‘backward
snowballing’. Next, we have used the Google Search Engine (GSE) with search
keywords consisting of those from the specific bibliography. Of the several
such references, we have focussed only on Chatbots that used AI technology for
patient treatment and therapy. In addition, for App-based Chatbots, we have
considered only two that ranked high on user ratings, at the same time had
‘AI’ mentioned in their description.

##  3 Chatbots for mental health and wellbeing

In Sec. 3.1, we discuss selected Chatbots in mental healthcare that are being
developed by leading Academic, Research and Medical Institutions and are not
yet deployed for wider public health services. We have come across several
commercial Chatbots that highlight their use of AI technology. However, and
understandably so, we did not find the specifics of the AI technique used to
design and develop these Chatbots. In Sec. 3.2 we discuss selected
commercially available Chatbots that scored well on user/customer review
ratings.

###  3.1 Non-commercial Chatbots

The most trialed non-commercial Chatbot currently is ‘Woebot’ [19]. The
conversational agent was built using Decision Tree and appropriate NLP
algorithms and needs to be installed as a software in a stand-alone computer.
All conversational responses are stored in a database. The specific area of
application is Cognitive Behavioural Therapy (CBT) for anxiety and mood
disorder targeting young adults that are college going students. During an
evaluation exercise, participants were tutored on ‘how to use’ Woebot. There
were several categories on which Woebot could provide therapy. PHQ-9 score (“a
9-item self report questionnaire that assesses the frequency and severity of
depressive symptomatology within the previous 2 weeks.” [19]) was used to
assess the state of the participants. Results showed that there was a
significant improvement in the mean PHQ-9 score compared to controls in the
mental condition of participants with 2 weeks of therapy. This was similar to
other mobile app based interventions [50, 26, 10], however, the time taken for
symptom improvement was in a quarter of the time (2:8 weeks). The only other
study that is reported to have a significant effect within 2 weeks is a
software application for treating borderline personality disorder. Readers may
note that the proposed software applications viz. Mobilyz [10], Mobiletype
[26] were for dealing particularly with depressive disorders. A comparison
between mobile-based and stand-alone-computer-based intervention for
depression showed that using mobile did not in any way affect the efficacy of
the programme [50]. However, these software applications were not Chatbots,
rather, they were strategies to use technology for coaching and therapy under
the supervision of medical practitioners. However, and more recently, [22]
studied the efficacy of Woebot on a cohort of 95 adults (age range 19 – 43
years) all of who were suffering from either depression or anxiety. This
research finds that improvement after a 2-week program via Woebot was no
different than that obtained via simple techniques such as “regular emails
sent to [sic] people”. Furthermore, they reported a higher attrition rate in
the cohort that were taking the Woebot-based therapy, which the authors
speculate to be linked to Chatbots “still grappling with limitations in terms
of content”. In making this remark, the authors are not just pointing to
Woebot, rather to all such that are available to use.

In the aftermath of the Covid pandemic, a web-based conversational Chatbot
‘Mental health Intelligent information Resource Assistant’ (MIRA) was proposed
[39] in Canada. The authors claim that what sets MIRA apart in current times
is that it supports “a wide range of mental health disorders”. The application
itself is built on Rasa, an open source conversational AI platform that is
described as ‘human, smart, and intelligent’(https://rasa.com/blog/the-humans-
behind-the-bots-andrea-kelemen/). The questionnaire was created by a trained
psychiatrist, which was then improved over several iterations by a
multidisciplinary, multicultural team of researchers; the target beneficiaries
of this Chatbot were the healthcare workers and their families in the Alberta
and Nova Scota provinces of Canada. Thus, MIRA is not meant for providing
healthcare solutions and services to patients; rather, the main purpose is to
provide information to users. Since the publication of this article, MIRA
seems to have developed further; the latest updates are available
here:https://www.mymira.ca/index.html.

In a series of researches under the Northern Periphery and Arctic Programme
(NPAP; https://chatpal.interreg-npa.eu/), [9] proposed ChatPal, an Android-
and ios App-based Chatbot primarily targetting the mental health and well-
being of the rural population. Chatpal was tested on a cohort of around 348
citizens in the age range of $18-73$ years and with various professions such
as students, teachers, assistant nurses, unemployed. Of these, 18% thought
ChatPal was ‘very useful’, 53% thought it was ‘somewhat useful’, 10% rated it
as neutral; the remaining did not report the bot to be useful at all. When the
cohort were asked how much they believed the Chatbot changed their mental
wellbeing, 83% reported either slight improvement or none at all. Overall, the
authors did not notice any significant improvement in mental wellbeing using
ChatPal; however, they propose blending the tool in normal mental health
services such as to support the practitioners. We note that in an earlier
report where these authors assessed the demand for a Chatbot from participants
of a workshop [43], it seemed that participants liked the idea of the Chatbot
regularly checking-in with the user, asking questions about emotional state or
mood and tracking this over time. For repeated use of the Chatbot,
participants felt that reflecting on previous conversations would be
beneficial. Many also thought that the Chatbot should provide a space to share
thoughts and feelings but also provide information. However, when indeed the
Chatbot was proposed, and then tested on a different cohort, the outcome was
certainly not as positive as during the assessment task. This indicates the
complexity and variability in design and implementation of Chatbots. ChatPal
is an ongoing development project, where the latest report is on
implementation of event logging facilities to record and analyse the usage of
the bot [7].

Another Chatbot ‘iHelpr’ [13, 12] is a text-based interactive Chatbot intended
to provide mental health support in the workplace. The iHelpr is a web-based
self-assessment tool and is reported to be available for six well-being
indicators viz. stress, anxiety, depression, sleep and self esteem. A high
score implied that the employee needed help, and were directed to a helpline
number and an emergency contact. The Chatbot is developed using the bot
development framework by Microsoft’s Cognitive Services, “an Application
Programming Interface (API) that can process natural language, enable a
Chatbot to recognise speech, and image-processing technology” [11].
Furthermore, through knowledge engineering in the form of extensive
interactions with domain experts (clinical psychologists), a database was
created that stores coping strategies and questionnaire scores. The iHelpr is
embedded within an online self help portal called Inspire Support Hub, and
refers to the database for providing its responses and scores to the user.

An interesting application developed and trialed at the Ulm University,
Germany [4], is a script-based conversational agent, which they call Software
agent providing an Intervention for Self-help to Uplift psychological
wellbeing (“SISU”). SISU is indeed a Chatbot, but it is different in providing
support for therapeutic writing. Writing one’s negative life events, past or
ongoing, is well known to be therapeutic and is a recommended strategy for
healing and upliftment of mood. In the trial conducted with SISU and reported
to be the first of it’s kind, SISU guided participants to write everyday for a
set time on some negative life event of their choice. Thereafter, based on
principles of Acceptance and Commitment Therapy (ACT) and narrative
psychology, SISU guided each participant to reduce negative thoughts and
feelings. The application is intended to be accessible via mobile and is
linked to the text-based services of the mobile network. However, we did not
find any reference to use of AI tools for designing SISU (see
https://oparu.uni-ulm.de/xmlui/handle/123456789/45489).

A generative Chatbot was proposed by [36] as a communication interface to
relieve stress. The model is trained using two LSTM networks and a SVM
classifier is used to detect the mood and then provide an appropriate
response. An attention mechanism is embedded in their algorithm, where the bot
is shown as responding in a sensible manner in a simple conversational
exchange. However, the paper did not elucidate on deployment or future plans
along such lines.

In summary, among the Chatbots that are being developed and disseminated by
not-for-profit organisations, MIRA and Chatpal are in several stages of
clinical trials, and seem to have a definite plan for deployment in the near
future. While Woebot has been clinically trialled by several research groups,
we did not find any resource indicating plans for integration with health
services for the wider community. Along similar lines, we haven’t seen
instances of plans for piloting and deployment for the remaining Chatbots that
we discussed here.

###  3.2 Commercially available Chatbots

  * •

Tess is a web-based chatbot devised by X2AI Inc. (https://tess.x2ai.com/) with
access interface via SMS (on mobile) and Facebook Messenger application. In a
technical report (where authors are affiliated to X2AI), [25] provides a
synopsis on the three stages of Tess’s design and implementation. The
technology is based on machine learning algorithms integrated with psycho-
educational concepts and is said to be developed in conjunction and
collaboration with trained mental health professionals. They refer to Tess as
a “psychological artificial intelligence service”, designed to provide much
needed support to healthcare professionals, primarily targetting the services
in United States (US) and Canada, whose mental unwellness often goes
unreported. In the second phase, extensive effort was put in terms of
scripting Tess’s database by skilled professionals. The third phase is
reported as a work in progress (during 2019) where Tess was being prepared to
be tested on patient groups.

Today, on their website, X2AI claims that “Tess has been clinically validated
to help people feel better: Chatting with Tess was found to reduce symptoms of
depression (-13%) and anxiety (-18%).” Indeed, [20] performed a randomised
control trial to observe the efficacy of Tess on University students in the
USA. They reported a significant decrease in both depression and anxiety
levels after 2–4 weeks, measured on PH-9 and GAD-7 scales respectively and
using multivariate analysis of covariance (manova). The average age of the 74
participants was 22.9, where 70% were female, and 51% and 41% were of Asian
and White respectively. The control group in the study were given access to an
‘e-book on depression among college students’
(https://www.nimh.nih.gov/health/publications/depression-listing), as opposed
to communicating with Tess like the test groups. Also, there were two test
groups; one that received daily message from Tess on varying contents over a
period of 2 weeks, and the other that received biweekly message from Tess but
on a specific content over a period of 4 weeks. Both test groups showed
significant decrease in symptoms upon interacting with Tess. However, user
satisfaction survey received a mixed response with many participants reporting
Tess getting confused and misunderstanding when receiving unexpected user
input.

Another study [16], while looking at efficacy of Tess to deal with depressive
symptoms, was unique in providing an insight into the chatbot’s framework,
i.e. how would the users be taken through the contents implementing BITs. The
paper explains the ‘module’ format of Tess and studies the chatbot by
observing how 354 users interacted with Tess’s depression modules. Overall,
their study recommends further work that needs to be done to make current
Chatbots to be user friendly as well as trustworthy in context to the job that
it is entrusted with.

Similar recommendations were also provided in a commentary [48] on a
feasibility study addressing pediatric obesity [46], a public health matter of
growing concern in the USA, that used Tess for CBT of obese children. [48]
raises some very apt and timely concerns, the most important of which are:
first, there is still not enough labelled data available for Tess to perform
reliable therapy; second, not enough safety and privacy related concerns are
addressed, especially where children are concerned; third, the cohort on which
Tess was tested was from 9-18 years that seemed generic rather than targetted
and personalised treatment, considering children grow at faster and variable
rates specifically during this age range.

From this review, our assessment is that Tess looks promising in terms of
coaching- and conversational therapy-based treatments, albeit with a lot of
gaps that needs to be improved upon as a continuous process based on usage
feedbacks and other indicators. However, we did not try this ourselves as that
would require requesting paid access on their website.

  * •

Wysa is an App-based interactive Chatbot for Anxiety Therapy
(https://www.wysa.com/). It is rated 4.7 stars on Google Play store and is
also available on Apple store. The AI agent, Wysa, provides interactive
content that are tailored to users for boosting mental health. In the UK, the
organisation works with the NHS by supporting “patients through the NHS
pathway starting from prevention support in the community, through interactive
e-triage , waitlist support, AI guided CBT practice and relapse
prevention.”(https://www.wysa.com/nhs). Their case study findings are
summarised as: up to 80% employees in a workplace “saw their self-resilience
improve after talking to Wysa for 8 weeks”, up to 91% employees “rated their
conversations with Wysa as positive / helpful” (https://www.wysa.com/case-
studies-and-reports).

Similar to Tess, clinical evidences of Wysa’s impact are reported in several
researches; six of these are mentioned on their website
(https://www.wysa.com/clinical-evidence), out of which, only one study did not
have any authors affiliated to Wysa [30], and tested the efficacy of the Wysa
app on reducing symptoms of depression and anxiety in a cohort of orthopedic
patients with chronic musculoskeletal pain. Participants were adults between
the age of 18 and 83 years, was undergoing treatment for orthopedic pain at
the time of recruitment, and scored $\geq 55$ on the Patient-Reported Outcomes
Measurement Information System (PROMIS), indicating presence of depression and
anxiety in these patients. There were a total of 61 participants with a median
age of 55 years and 87% female. Over a period of 2 months of usage of the Wysa
app, as well as to a new feature on the app specifically developed for users
with chronic pain. The retention rate was 84%; further, patients who completed
the study were classified into ‘high’ and ‘low’ users of the app using
statistical analysis. They report a significant decrease in anxiety scores
among high users of the Wysa app, as well as a clinically meaningful decrease
in depression scores (see figures 3 – 6 in [30]).

Previously, [24] reported Wysa as an ‘empathy-driven’ chatbot and tested its
feasibility in improving mental well-being in a cohort recruited globally and
who self reported depression using the PHQ-9 score. Here too, users were
pooled into two groups viz. ‘high’ and ‘low’ users for analysing the data
collected from participants over a period of approximately 8 weeks. Overall,
the study reports an improvement in mood and depression among high user
participants. The authors note that future work should record more
longitudinal data points.

In the remaining four publications that are highlighted on the company website
(all of which were reported during 2022), the research primarily focussed on
understanding engagement of the users with the Wysa app; their interest group
were patients with chronic pain who are often affected by mental health
deterioration. The collective findings of these four researches provided
directions for future improvements. Based on the publications and other
resources available via their website, we speculate that the Wysa app is in
the post-deployment testing phase. Their trial outcomes show promise and needs
further evidence of efficacy and patient safety via longitudinal studies.

  * •

Wisdo is available via the Google Play and Apple stores. Their website
homepage carries the slogan ‘AI-Driven Peer Support Community’
(https://wisdo.com/). Indeed, the keyword ‘loneliness’ stands out in the
showcased applications on their Resource page (https://resources.wisdo.com/),
a rising trend especially among the elderly, but also among the young,
including the workplace. The app relies on community support, including from
people who have experienced similar circumstances to the user. In that regard,
the app tries to personalise individual support in terms of both approach and
content. Statistics demonstrating impact of the Wisdo app is reported under
the ‘Results’ tab of their webpage, claiming upto 60% reduction in loneliness,
37% reduction in depression and 39% increase in overall improved health among
users; also, using the app contributed to a reduction of around 1900 US
Dollars per year in medial expenses for individual users. Furthermore, user
retention is reported as 82% over a period of 12 months. Reports on the app
are disseminated via blogs and press releases, and can be accessed via their
website.

We have downloaded and tested the app on android. It provides a questionnaire
targeting social media presence, availability of someone to talk to who has
either gone through in the past, or going through, similar mental health
issues as that of the user. Medical support is provided by humans, and not any
AI agent. Thus, it is not clear as to how is the design of the App based on AI
tools. The Wisdo App is rated 3.5 stars on the Google Play store.

We would also like to note an iOS App-based Chatbot ‘Shim’, that was developed
by a Swedish company ‘Hello Shim’ and has since been acquired by Kry
(https://nordic9.com/news/kry-acquired-hello-shim-a-swedish-chatbot-provider-
for-improving-mental-well-being-news0874638850/). Previously, [31] had tested
the efficacy of Shim on a cohort of 28 participants in the age range 26–49
years and randomised in a 1:1 ratio. They reported 78.6% participants to be
active at least 50% of the days. Furthermore, feedback from participants on
the content and functionalities of the app that provided some useful data on
user’s perspective and requirement from Chatbots in general. In addition, the
responses indicated a tendency to develop a ‘bond’ with the bot as a ‘medium’
which are said to be supported by literature. Overall, Shim was reported to
have ‘performed well’ in comparison to Woebot (see Sec 3.1). Current status of
Shim is not available to the best of our knowledge. Also, we did not find any
reference to its underlying technology i.e. whether AI was used in developing
the bot.

Below, we discuss Chatbots that are proposed for Physical health and well-
being.

##  4 Chatbots for general assistive healthcare

Of the numerous endeavours or propositions of Chatbots for general medical
healthcare, we discuss a selected few below to highlight the different areas
where Chatbots are deemed to be useful viz. pediatric, pre-conception care,
oncology, old age.

The ECA Gabby was designed by [21] to assist women of the minority communities
in the USA on ‘preconception care’ (PCC), including mitigating risk factors
prior to pregnancy, addressing issues like family planning, and such, towards
a healthier pregnancy and post-natal phases. In that sense, Gabby acted as a
‘Virtual Patient Advocate’ (VPA). Pilot tests showed that an average of 23
health risks were identified by each participant out of which they discussed
11 risks on the average with Gabby. Overall, Gabby was deemed as a promising
means to mitigate the risk factors for preconception care.

‘Pharmabot’ is proposed as a human machine interface in pediatric medicine by
[18]. The Chatbot providing information about general health problems in
children and prescribing medicines. With the objective to complement the role
of a pharmacist for pediatric medicine, Pharmabot was developed using Visual
C# and Microsoft Access as the front- and back-ends respectively, running on a
stand-alone computer. Pharmabot is reportedly capable of prescribing generic
medicines, along with information on dosage, possible side effects, and other
drug related ‘small prints’. For this, a database is used. The authors
reported statistical tests where responses from Pharmabot were validated with
those from students and professionals in the field of medicine i.e. the domain
experts.

[6] have designed, developed and piloted an ECA over a period of two months on
a culturally mixed cohort (122 participants, 21-69 years age range) in the USA
to study effectiveness of digital interventions on improving lifestyle
(physical activity and diet). The ECA is called by the name of ‘Karen’ and the
software needs installation and runs on a stand-alone computer. The ECA’s
knowledge-base (i.e. the database of possible questions and corresponding
answers) is carefully designed by the authors based on the goals of this
digital intervention. Two specific themes are followed by the ECA, viz. ACT
and DIET, where the ECA assumes the role of a health counseller to improve
pysical activity and fruit and vegetable consumption respectively. Their pre-
pilot hypothesis was a positive impact of both ACT and DIET interventions.
Physical activity was measured using the International physical activity
questionnaire (IPAQ); fruit and vegetable consumption was measured using the
“NIH/NCI Fruit and Vegetable Scan (FVS)” (see Sec. 2.1. in [6] for further
details on FVS). Their study showed a strong support for one of their four
hypotheses; the DIET intervention scheme showed a statistically significant
increase in FVS for all participants who completed the study (93% of the
participants). Overall, the study demonstrated that integrating digital agents
for counselling in lifestyle changes is a promising trend, in spite its
challenges in deployment for public health services.

In a series of research, [41, 40] look into integrating ECA for informed
decision making (IDM) in prostrate cancer treatment. Their research is
focussed on African American (AA) males who are disproportionately prone to
prostrate cancer. However, decision making about available treatment options
is not straightforward; towards this, [41] propose the use of ‘computer-based
decision aids’ (CBDAs) that “include increased knowledge, enhanced informed
decision-making self-efficacy, and reduced decisional conflict regarding
cancer screening and/or treatment”. They propose dissemination of information
to make informed choices through ECAs to patients. They introduce ‘iDecide’,
an ECA running on a stand-alone computer; algorithmic details are not
specified, however, based on the descriptions and demonstrations, we speculate
that it is rule-based. It had two sections, one of which was mainly
educational about prostrate cancer, and the other engaged patients to prepare
them for IDM [40]. Their pilot study on AA males from South Carolina, USA,
showed statistically significant improvement in prostrate cancer knowledge,
although IDM post-intervention was not tested. In what seems like an
evaluative study of using a ‘smartphone Chatbot’ for supporting older patients
undergoing chemotherapy as a cancer treatment at home, [42] report that use of
Chatbots in this regard is feasible. The use of Chatbot is reported to have
saved 6 hours per nurse-time per patient. They concluded that in their ‘first
phase of deployment’, they found that Chatbots are a feasible option in their
set objectives, and expressed a positive note on integration and acceptance by
the local medical community in the near future. The only note on the exact
technology used is that “the application was a semi-automatised messaging
system running on smartphones”. Indeed, as (relatively, in context) early as
2016, a clinical trial conducted for cancer research at the Boston Medical
Center, USA, had already implemented an ECA, ‘Study Buddy’, as an ‘ECA
Oncology Trial Advisor’ [8]. Study Buddy was used for advising patients “on
chemotherapy regimens, promoting protocol adherence and retention, providing
anticipatory guidance and answering questions, serving as a conduit to capture
information about complaints or adverse events, providing a venue for
communicating about updates.” It was web-based and could be accessed by
patients anywhere, anytime. Particulars about the design and development of
Study Buddy, and indeed its pilot procedures, are not specified on the
website.

Efficacy of Chatbots to overcome loneliness as well as eating disorders is
addressed by [28]. They called their ‘e-Health service’ as PACO consisting of
two ECAs. However, their study did not show any major effects on the two
stated disorders by using PACO. Furthermore, not only did they receive lower
than expected participation in response to their advertisements, older adults
in general were found to be reluctant altogether to participate in e-Health
care. These results provide valuable insight for Chatbot developers.

Basit Ali and colleagues proposes a generic Chatbot [2] that can be used for
domain specific applications. Our interest is whether this Chatbot can be
applied for medical diagnosis, which is what we focussed on when we read their
article. The proposed Chatbot using three layers of typical machine learning
tools to segregate and classify sentences, domain specific or otherwise. The
first layer is a support vector machine (SVM) that categorises the input text,
and associates a label with each sentence, that indicates the ‘intent’ of the
sentence. The second layer does a pattern matching using cosine similarity
measure between user inputs and the stored dataset. The third layer is a
codec; a Bi-Long Short Term Memory (LSTM) is used as an encoder, and another
LSTM is used as a decoder. The authors created a dataset that contain around
0.136 million question-and-answer (Q&A) pairs that is used to train their
model. There were 27 intent labels. Qualitative testing was done alongside
quantitative testing. However testing protocols are not elucidated.

Besides the above, we found a plethora of articles that have used deep and
shallow learning techniques to build Chatbots. For example, an AI-based
Chatbot [27] uses Decision Tree algorithm for disease detection using input
text from patients and provides prescriptions. The authors refer to the
Chatbot as ‘Smart Doctor’. There is no report on testing and analysis of this
Chatbot though. Along similar lines, K-Nearest Neighbour (KNN) classifiers
were used in a Chatbot to identify disease based on user input of symptoms
[32]. The testing of the framework is not clear, and the authors provide only
snapshots of bot responses that matched their expectation. Another NLP-based
Chatbot is proposed for similarity query-based assistance to patients by
discussing the ailment and prescribing medicine [34]. A research published
during covid 2019 presents a query-based Chatbot [3] that acts as a domain
expert and provides answers to any queries that a patient may have. Users need
to log in to the system with a username and password, which they can set
during initial registration that in turn required users to share their key
identification information for example gender, age, and contact details. The
paper does not discuss matters on user data protection. Another effort to
provide Chatbot assistance for covid related cases propose a Amazon Web
Service (AWS)-based application using Amazon Lex for the bot design and AWS S3
services for data storage [15]. The authors refer it as Co-bot and display a
set of simple queries related to Covid diagnosis. Snapshots of responses are
provided as demonstration of the Co-bot response, and upto 70% accuracy on the
trained bot responses is reported. Furthermore, the co-bot is shown to supply
general information on Covid 19. As the application is hosted by AWS, we
presume that the bot is intended to be accessible on any digital device. The
authors do not talk about the testing rigour and methodologies. [14] suggest
that Reinforcement learning to train a Chatbot ensemble may provide greater
flexibility in terms of the capability to provide medical assistance for wider
variety of health conditions. In summary, we find that while there are indeed
AI-based Chatbots for generic medicine and treatment, little is known about
their advancement to deployment in healthcare presently.

##  5 Discussion

Point-of-contact automation as an assistive tool in healthcare in the form of
conversational agents is an attractive proposition. In this brief review, we
have used the term Chatbots to represent machines that can communicate
interactively and thus act as conversational agents. Our focus is on Chatbots
that are enabled by Artificial Intelligence (AI). One of the primary
challenges in the successful deployment of AI-enabled Chatbots in healthcare
currently is a lack of trust and reliability on the technology. The first and
foremost concern with machine-dependent healthcare is patient safety, followed
by patient data confidentiality. It is thus not surprising that experts are
now emphasising on ‘Trustworthy’ and ‘Ethical’ AI. There are primarily two
modes of incorporating AI in Chatbots: (a) Supervised learning, where the
knowledge-base of the machine is a finite universe, and it is trained to
respond appropriately within this universe; (b) Unsupervised learning, where
the machine learns by itself to respond to unknowns within a finite universe
when trained with ‘experiential’ examples from that universe. Needless to
mention, hybrid modes (a combination of supervised and unsupervised) can also
be used, such as generative AI eg. ChatGPT. Indeed, the advent of ChatGPT has
set a high benchmark for natural language processing (NLP) skills of machines.
However,as of now, its general responses cannot be trusted with making
decisions and taking actions without evaluation by a human.

In our review, we have come across two types of (AI-enabled) Chatbots in
healthcare; some that are designed for mental (eg. depression, anxiety)
healthcare, and others that are intended for physical (eg. diabetes, cancer)
healthcare. Of these, the Chatbots for mental healthcare are comparatively at
an advanced stage of development. The ones that are currently advertised as
‘deployed’ are commercial, and available at a cost to individuals and
organisations; we have highlighted three such organisations that claimed using
AI for developing the software for their respective Chatbots. The non-
commercial Chatbots are led by not-for-profit-organisations viz. Higher
Education, Research and Medical Institutions, and are in several stages of the
Chatbot software development life-cycle. The most advanced stages that we have
come across for these non-commercial Chatbots for mental healthcare is that of
clinical trial for pilot tests before deployment. Furthermore, the most
promising (as indicated on their websites) are the Chatbots MIRA (Canada) and
Chatpal (Norther Periphery and Arctic Programme). Besides these, Woebot, a
Chatbot for youth (college going) mental health, was used for clinical trials
by several research groups outside of the proposing organisation; however, we
did not find any references to current or future plans for Woebot. Several
interesting Chatbots are proposed for general healthcare (eg Pharmabot for
Pediatrics, Gabby for gynaecology, iDecide for oncology), many of which were
pilot tested with clinical trials. We did not find any references to their
current status or future plans for integration with public health services.

Our study indicates that there are huge opportunities for AI-enabled Chatbots
in healthcare in both public and private sectors (eg. see [17]). In spite,
there is a lack of trust in the technology among both the healthcare
professionals and patients. To address this issue, an important step would be
to initiate widespread collaboration and co-ordination between the medical and
technology professionals to improve the Chatbot technology based on
user/patient evaluation and feedbacks. Furthermore, rigorous evaluation via
clinical trials is essential to establish reliability in terms of patient
safety and data protection. From the patients’ perspective, one way to build-
up trust gradually on Chatbots could be by involving medical professionals
‘human-machine-interaction-loop’. Other than trust, some studies reported that
patients of mental health expressed frustration and dissatisfaction over the
reduced NLP skills of the Chatbot. With the arrival of ChatGPT, that may not
be a cause for concern in times to come; using ‘narrow AI’ and/or ‘prompt
engineering’ tactics, ChatGPT may well be trained to cater to bespoke
healthcare services. While a lot has been achieved on the AI-enabled Chatbot
technology, a lot still needs to be done for widespread integration with
existing healthcare systems.

Being a brief and focussed review, we did not study several other non-AI
Chatbots in healthcare (eg. Amaha, Sanvello) that score well in terms of user
reviews Google Play Store. Furthermore, we do not claim to have covered all
AI-enabled Chatbots, and neither is it feasible for this brief report in the
interest of space. A wider review of Chatbots in healthcare, both in public
and private sectors, that are not based on AI technology would be an
interesting area to consider as future work.

The recent global pandemic has emphasised the need for integration of
assistive digital machine intelligence in the healthcare services. Such
assistance from intelligent human-machine interactive technology (AI-enabled
Chatbots) will only make healthcare systems stronger and better prepared for
the future.

## References

  * 1. A. A. Abd-alrazaaq, M. Alajlani, A. A. Alalwan, et al.  An overview of the features of chatbots in mental health: a scoping review.  International Journal of Medical Informatics, 132:1–7, 2019.
  * 2. B. Ali, V. Ravi, C. Bhushan, M. Santohosh, and O. S. Shankar.  Chatbot via machine learning and deep learning hybrid.  In Modern Approaches in Machine Learning and Cognitive Science: A Walkthrough, pages 255–265. Springer Nature Switzerland, 2021.
  * 3. L. Athota, V. Shukla, N. Pandey, and A. Rana.  Chatbot for healthcare system using artificial intelligence.  In Proceedings of International Conference on Reliability, Infocom Technologies and Optimization, pages 619–622, 06 2020.
  * 4. E. Bendig, B. Erb, D. Meißner, N. Bauereiß, and H. Baumeister.  Feasibility of a software agent providing a brief intervention for self-help to uplift psychological wellbeing (“sisu”). a single-group pretest-posttest trial investigating the potential of sisu to act as therapeutic agent.  Internet Interventions, 24:100377, 02 2021.
  * 5. E. Bendig, B. Erb, L. Schulze-Thüsing, and H. Baumeister.  The next generation: Chatbots in clinical psychology and psychotherapy to foster mental health – a scoping review.  Verhaltenstherapie, 08 2019.
  * 6. T. Bickmore, D. Schulman, and C. Sidner.  Automated interventions for multiple health behaviors using conversational agents.  Patient education and counseling, 92, 06 2013.
  * 7. F. Booth, C. Potts, R. Bond, M. Mulvenna, C. Kostenius, I. Dhanapala, A. Vakaloudis, B. Cahill, L. Kuosmanen, and E. Ennis.  A mental health and wellbeing chatbot: user event log analysis.  In Press, 2023.
  * 8. U. Boston Medical Center.  Study buddy (an eca oncology trial advisor) for cancer trials, 2016.
  * 9. K. Boyd, C. Potts, R. Bond, M. Mulvenna, T. Broderick, C. Burns, A. Bickerdike, M. Mctear, C. Kostenius, A. Vakaloudis, I. Dhanapala, E. Ennis, and F. Booth.  Usability testing and trust analysis of a mental health and wellbeing chatbot.  In Proceedings of the $33^{rd}$ European Conference on Cognitive Ergonomics, pages 1–8, 10 2022.
  * 10. M. Burns, M. Begale, J. Duffecy, D. Gergle, C. Karr, E. Giangrande, and D. Mohr.  Harnessing context sensing to develop a mobile intervention for depression.  Journal of medical Internet research, 13:e55, 08 2011.
  * 11. G. Cameron, D. Cameron, G. Megaw, R. Bond, M. Mulvenna, S. O’Neill, C. Armour, and M. McTear.  Best practices for designing chatbots in mental healthcare - a case study on ihelpr.  In Proceedings of British HCI 2018. Belfast, UK, pages 1–5. BCS Learning and Development Ltd., 2018.
  * 12. G. Cameron, D. Cameron, G. Megaw, R. Bond, M. Mulvenna, S. O’Neill, C. Armour, and M. McTear.  Towards a chatbot for digital counselling.  In Proceedings of British HCI 2017 Sunderland UK, pages 1–7. Digital Make Believe, 2018.
  * 13. G. Cameron, D. Cameron, G. Megaw, R. Bond, M. Mulvenna, S. O’Neill, C. Armour, and M. McTear.  Assessing the usability of a chatbot for mental health care.  Lecture Notes in Computer Science, 11551:121–132, 2019.
  * 14. H. Cuayáhuit, D. Lee, S. Ryu, Y. Cho, S. Choi, S. Indurthi, S. Yu, H. Choi, I. Hwang, and J. Kim.  Ensemble-based deep reinforcement learning for chatbots.  Neurocomputing, 366, 08 2019.
  * 15. P. Das, I. Nath, A. Banerjee, and L. Sahoo.  Co-bot: An intelligent technique for designing a chatbot for initial covid-19 test.  Journal of Computer Science Research, 4, 12 2022.
  * 16. G. Dosovitsky, B. Pineda, N. Jacobson, C. Chang, M. Escoredo, and E. Bunge.  Artificial intelligence chatbot for depression: Descriptive study of usage.  JMIR Formative Research, 4:e17065, 11 2020.
  * 17. Druid.  Virtual healthcare: How is conversational AI changing the game?, 2023\.
  * 18. B. Eleonor, V. Comendador, B. M. B. Francisco, J. S. Medenilla, S. M. T. Nacion, and T. B. E. Serac.  Pharmabot: a pediatric generic medicine consultant chatbot.  Journal of Automation and Control Engineering, 3(2):137–140, April 2015.
  * 19. K. K. Fitzpatrick, A. Darcy, and M. Vierhile.  Delivering cognitive behavior therapy to young adults with symptoms of depression and anxiety using a fully automated conversational agent (woebot): A randomized controlled trial.  JMIR Mental Health, 4:e19, 06 2017.
  * 20. R. Fulmer, A. Joerin, B. Gentile, L. Lakerink, and M. Rauws.  Using psychological artificial intelligence (tess) to relieve symptoms of depression and anxiety: Randomized controlled trial (preprint).  Journal of Medical Internet Research, 5, 02 2018.
  * 21. P. Gardiner, M. Hempstead, L. Ring, T. Bickmore, L. Yinusa-Nyahkoon, H. Tran, P.-O. M, K. Damus, and B. Jack.  Reaching women through health information technology: The gabby preconception care system.  American journal of health promotion: AJHP, 27:eS11–eS20, 01 2013\.
  * 22. S. Gutu, A. Cosmoiu, D. Cojocaru, T. D, C. Popoviciu, C. Giosan, and C. Turturescu.  Bot to the rescue? effects of a fully automated conversational agent on anxiety and depression: A randomized controlled trial.  Annals of Depression and Anxiety, 8, 08 2021.
  * 23. E. Hariton and J. J. Locascio.  Randomised controlled trials - the gold standard for effectiveness research.  BJOG, 125:1716, 12 2018.
  * 24. B. Inkster, S. Sarda, and V. Subramanian.  A real-world mixed methods data evaluation of an empathy-driven, conversational artificial intelligence agent for digital mental wellbeing.  JMIR mHealth and uHealth, 6:e12106, 09 2018.
  * 25. A. Joerin, M. Rauws, and M. Ackerman.  Psychological artificial intelligence service, tess: Delivering on-demand support to patients and their caregivers: Technical report.  Cureus, 11, 01 2019.
  * 26. S. Kauer, S. Reid, A. Crooke, A. Khor, S. Hearps, A. Jorm, L. Sanci, and G. Patton.  Self-monitoring using mobile phones in the early stages of adolescent depression: Randomized controlled trial.  Journal of medical Internet research, 14:e67, 06 2012.
  * 27. R. Z. Khan, A. A. Zardar, and Z. Bhatti.  Artificial intelligence based smart doctor using decision tree algorithm.  Journal of Information and Communication Technology, 11(2):1–5, 2017.
  * 28. L. L. Kramer, L. van Velsen, J. L. Clark, B. C. Mulder, and E. de Vet.  Use and effect of embodied conversational agents for improving eating behavior and decreasing loneliness among community-dwelling older adults: Randomized controlled trial.  JMIR, 6(4):1–14, 2022.
  * 29. L. Laranjo, A. G. Dunn, H. L. Tong, A. B. Kocaballi, J. Chen, R. Bashir, D. Surian, B. Gallego, et al.  Conversational agents in healthcare: a systematic review.  Journal of American Medical Informatics Association, 25(9):1248–1258, July 2018.
  * 30. A. Leo, M. Schuelke, D. Hunt, J. Metzler, J. Miller, P. Arean, M. Armbrecht, and A. Cheng.  A digital mental health intervention in an orthopedic setting for patients with symptoms of depression and/or anxiety: Feasibility prospective cohort study.  JMIR Form Res, 6(2):e34889, 2022.
  * 31. K. Ly, A.-M. Ly, and G. Andersson.  A fully automated conversational agent for promoting mental well-being: A pilot rct using mixed methods.  Internet Interventions, 10, 10 2017.
  * 32. R. Mathew, S. Varghese, S. Joy, and S. Alex.  Chatbot for disease prediction and treatment recommendation using machine learning.  In Proceedings of the $3^{rd}$ International Conference on Trends in Electronics and Informatics, pages 851–856, 04 2019.
  * 33. R. Meadows, C. Hine, and E. Suddaby.  Conversational agents and the making of mental health recovery.  DIGITAL HEALTH, 6:205520762096617, 11 2020.
  * 34. H. Mendapara, S. Digole, M. Thakur, and A. Dange.  Ai based healthcare chatbot system by using natural language processing.  International Journal of Scientific Research and Engineering Development, 4, 2021.
  * 35. A. Miner, A. Chow, S. Adler, I. Zaitsev, P. Tero, A. Darcy, and A. Paepcke.  Conversational agents and mental health: Theory-informed assessment of language and affect.  In Proceedings of the Fourth International Conference on Human Agent Interaction, pages 123–130, 10 2016.
  * 36. V. More, V. Koli, V. Vijaykumar, and V. Jethani.  Chatbot for mental well-being.  ITM Web of Conferences, 40:03019, 01 2021.
  * 37. NHS-UK.  Depression self-assessment, 2023.
  * 38. NHS-UK.  Mood self-assessment, 2023.
  * 39. J. M. Noble, A. Zamani, M. A. Gharaat, et al.  Developing, implementing, and evaluating an artificial intelligence–guided mental health resource navigation chatbot for health care workers and their families during and following the covid-19 pandemic: Protocol for a cross-sectional study.  JMIR Research Protocol, 11(7):1–17, 2022.
  * 40. O. L. Owens, T. Felder, A. S. Tavakoli, A. A. Revels, D. B. Friedman, C. Hughes-Halbert, and J. R. Hebert.  Evaluation of a computer-based decision aid for promoting informed prostate cancer screening decisions among African American men: iDecide.  American Journal of Health Promotion, 33:267–278, 2019.
  * 41. O. L. Owens, D. B. Friedman, H. Brandt, J. Bernhardt, and J. R. Hebert.  An iterative process for developing and evaluating a computer-based prostate cancer decision aid for african american men.  Health Promot Pract., 16:642–65, 2019.
  * 42. A. Piau, R. Crissey, D. Brechemier, L. Balardy, and F. Nourhashemi.  A smartphone chatbot application to optimize monitoring of older patients with cancer.  International Journal of Medical Informatics, 128, 05 2019.
  * 43. C. Potts, E. Ennis, R. Bond, M. Mulvenna, M. Mctear, K. Boyd, T. Broderick, M. Malcolm, L. Kuosmanen, H. Nieminen, A. Vartiainen, C. Kostenius, B. Cahill, A. Vakaloudis, G. McConvey, and S. O’Neill.  Chatbots to support mental wellbeing of people living in rural areas: Can user groups contribute to co-design?  Journal of Technology in Behavioral Science, 6, 12 2021.
  * 44. S. Provoost, H. M. Lau, J. Ruwaard, and H. Riper.  Embodied conversational agents in clinical psychology: a scoping review.  Journal of Medical Internet Research, 19(5):1–18, 2017.
  * 45. O. Singh.  Chatbots in psychiatry: Can treatment gap be lessened for psychiatric disorders in india.  Indian Journal of Psychiatry, 61:225, 05 2019.
  * 46. T. Stephens, A. Joerin, M. Rauws, and L. Werk.  Feasibility of pediatric obesity and prediabetes treatment support through tess, the ai behavioral coaching chatbot.  Translational Behavioral Medicine, 9:440–447, 05 2019.
  * 47. C. Sweeney, C. Potts, E. Ennis, R. Bond, M. Mulvenna, S. O’Neill, M. Malcolm, L. Kuosmanen, C. Kostenius, A. Vakaloudis, G. Mcconvey, R. Turkington, D. Hanna, H. Nieminen, A.-K. Vartiainen, A. Robertson, and M. Mctear.  Can chatbots help support a person’s mental health? perceptions and views from mental healthcare professionals and experts.  ACM Transactions on Computing for Healthcare, 2:1–15, 07 2021.
  * 48. D. Thompson and T. Baranowski.  Chatbots as extenders of pediatric obesity intervention: an invited commentary on “feasibility of pediatric obesity & pre-diabetes treatment support through tess, the ai behavioral coaching chatbot”.  Translational Behavioral Medicine, 9:448–450, 05 2019.
  * 49. A. Turing.  Computing machinery and intelligence.  Mind, 59:433–460, 1950.
  * 50. S. Watts, A. Mackenzie, C. Thomas, A. Griskaitis, L. Mewton, A. Williams, and G. Andrews.  Cbt for depression: A pilot rct comparing mobile phone vs. computer.  BMC psychiatry, 13:49, 02 2013.
  * 51. J. Weizenbaum.  Eliza—a computer program for the study of natural language communication between man and machine.  Communications of the ACM, 9(1):36–45, 1966.


28 ! \---- STAGE I: assign first ghost to 2nd-order accuracy \-----

29

30 ! *Note*: we are using fourth-order accurate derivatives in the residuals
for the

31 ! second-order scheme

32

33 ! In parallel we add extra points in the tangential direction on parallel
boundaries

34 ! (otherwise we would use extrapolated values which is probably ok)

35

36 setIndexBoundsExtraGhost()

37 if( dispersive.eq.0 )then

38 assignInterfaceGhost22c()

39 else if( useNonlinearModel.eq.0 )then

40 assignDispersiveInterfaceGhost22c()

41 else

42 assignNonlinearInterfaceGhost22c()

43 end if

44 resetIndexBounds()

45

46 ! \---- STAGE II: assign two ghost to 4th-order accuracy \-----

47 ! Macro to assign ghost values:

48 if( dispersive.eq.0 )then

49 assignInterfaceGhost24c()

50 else if (useNonlinearModel.eq.0) then

51 ! dispersive case

52 assignDispersiveInterfaceGhost24c()

53 else

54 assignNonlinearInterfaceGhost24c()

55 end if

56 periodicUpdate2d(u1,boundaryCondition1,gridIndexRange1,side1,axis1)

57 periodicUpdate2d(u2,boundaryCondition2,gridIndexRange2,side2,axis2)

58 end if ! \----- end assign ghost using jump conditions \-----

59 end if

###  F.2 assignNonlinearInterfaceGhost24c

Here is a listing of the fortran code that defines the Maxwell-MLA interface
algorithm for fourth-order accuracy on curvlinear grids. The code is written
with the bpp macro preprocessor from Overture.

⬇

1! \--------------------------------------------------------------------------

2! Macro: Assign interface ghost values, DIM=2, ORDER=4, GRID=Curvilinear

3! NONLINEAR DISPERSIVE CASE \-- MLA

4! \--------------------------------------------------------------------------

5#beginMacro assignNonlinearInterfaceGhost24c()

6

7 ! ****************************************************************

8 ! *********** DISPERSIVE, 2D, ORDER=4, CURVILINEAR **************

9 ! ****************************************************************

10

11

12! \--- initialize some forcing functions \---

13do n=0,nd-1

14 fev1(n)=0.

15 LfE1(n)=0.

16 fEt1(n)=0.

17 fEtt1(n)=0.

18

19 fev2(n)=0.

20 LfE2(n)=0.

21 fEt2(n)=0.

22 fEtt2(n)=0.

23

24 fevx1(n)=0.

25 fevy1(n)=0.

26 fevx2(n)=0.

27 fevy2(n)=0.

28 if (dispersionModel1 .ne. 0) then

29 do jv=0,numberOfPolarizationVectors1-1

30 fpv1(n,jv)=0.

31 LfP1(n,jv)=0.

32 fPt1(n,jv)=0.

33 fPtt1(n,jv)=0.

34

35 fpvx1(n,jv)=0.

36 fpvy1(n,jv)=0.

37 end do

38 endif

39 if (dispersionModel2 .ne. 0) then

40 do jv=0,numberOfPolarizationVectors2-1

41 fpv2(n,jv)=0.

42 LfP2(n,jv)=0.

43 fPt2(n,jv)=0.

44 fPtt2(n,jv)=0.

45

46 fpvx2(n,jv)=0.

47 fpvy2(n,jv)=0.

48 end do

49 endif

50end do

51! forcing functions for N

52if (nonlinearModel1 .ne. 0) then

53 do jv = 0,numberOfAtomicLevels1-1

54 fnv1(jv) = 0.

55 fntv1(jv) = 0.

56 enddo

57endif

58if (nonlinearModel2 .ne. 0) then

59 do jv = 0,numberOfAtomicLevels2-1

60 fnv2(jv) = 0.

61 fntv2(jv) = 0.

62 enddo

63endif

64

65

66 ! =============== start loops ======================

67 beginLoopsMask2d()

68

69 nn=nn+1

70

71 ! here is the normal (assumed to be the same on both sides)

72 an1=rsxy1(i1,i2,i3,axis1,0) ! normal (an1,an2)

73 an2=rsxy1(i1,i2,i3,axis1,1)

74 aNorm=max(epsx,sqrt(an1**2+an2**2))

75 an1=an1/aNorm

76 an2=an2/aNorm

77 tau1=-an2

78 tau2= an1

79

80 ! Evaluate the jump conditions using the wrong values at the ghost points

81 evaluateNonlinearInterfaceEquations2dOrder4()

82

83

84 ! here is the matrix of coefficients for the unknowns
u1(-1),v1(-1),u2(-1),v2(-1)

85 ! Solve:

86 !

87 ! A [ U ] = A [ U(old) ] - [ f ]

88

89

90 ! write(debugFile,’(" interface:E: initialized,it=",2i4)’) initialized,it

91 if( .false. .or. (initialized.eq.0 .and. it.eq.1) )then

92 ! form the matrix (and save factor for later use)

93 if( nn.eq.0 )then

94 write(*,’(" Interface42c: form matrix and factor, it=",i4)’) it

95 end if

96

97 ! Equation 0:

98 ! 0 [ u.x + v.y ] = 0

99 aa8(0,0,0,nn) = -is*8.*rsxy1(i1,i2,i3,axis1,0)*dr114(axis1) ! coeff of
u1(-1) from [u.x+v.y]

100 aa8(0,1,0,nn) = -is*8.*rsxy1(i1,i2,i3,axis1,1)*dr114(axis1) ! coeff of
v1(-1) from [u.x+v.y]

101 aa8(0,4,0,nn) = is* rsxy1(i1,i2,i3,axis1,0)*dr114(axis1) ! u1(-2)

102 aa8(0,5,0,nn) = is* rsxy1(i1,i2,i3,axis1,1)*dr114(axis1) ! v1(-2)

103

104 aa8(0,2,0,nn) = js*8.*rsxy2(j1,j2,j3,axis2,0)*dr214(axis2) ! coeff of
u2(-1) from [u.x+v.y]

105 aa8(0,3,0,nn) = js*8.*rsxy2(j1,j2,j3,axis2,1)*dr214(axis2)

106 aa8(0,6,0,nn) = -js* rsxy2(j1,j2,j3,axis2,0)*dr214(axis2)

107 aa8(0,7,0,nn) = -js* rsxy2(j1,j2,j3,axis2,1)*dr214(axis2)

108

109 ! Equation 1:

110 ! 1 [ u.xx + u.yy ] = 0

111

112 setJacobian( aj1, axis1)

113

114 dr0=dr1(axis1)

115 ds0=dr1(axis1p1)

116 aLap0 = lapCoeff4a(is,dr0,ds0)

117 aLap1 = lapCoeff4b(is,dr0,ds0)

118

119

120 ! dr1a(0:2) = dsBig in tangential directions if avoidInterfaceIterations=1

121 ds0 =dr1a(axis1p1)

122 aLapSq0 = lapSqCoeff4a(is,dr0,ds0)

123 aLapSq1 = lapSqCoeff4b(is,dr0,ds0)

124

125 setJacobian( aj2, axis2)

126 dr0=dr2(axis2)

127 ds0=dr2(axis2p1)

128 bLap0 = lapCoeff4a(js,dr0,ds0)

129 bLap1 = lapCoeff4b(js,dr0,ds0)

130

131

132 ! dr2a(0:2) = dsBig in tangential directions if avoidInterfaceIterations=1

133 ds0 = dr2a(axis2p1)

134 bLapSq0 = lapSqCoeff4a(js,dr0,ds0)

135 bLapSq1 = lapSqCoeff4b(js,dr0,ds0)

136

137

138 ! Equation 1:

139 aa8(1,0,0,nn) = an1*aLap0/mu1 ! coeff of u1(-1) from [n.(u.xx + u.yy)]

140 aa8(1,1,0,nn) = an2*aLap0/mu1

141 aa8(1,4,0,nn) = an1*aLap1/mu1 ! coeff of u1(-2) from [n.(u.xx + u.yy)]

142 aa8(1,5,0,nn) = an2*aLap1/mu1

143

144 aa8(1,2,0,nn) =-an1*bLap0/mu2 ! coeff of u2(-1) from [n.(u.xx + u.yy)]

145 aa8(1,3,0,nn) =-an2*bLap0/mu2

146 aa8(1,6,0,nn) =-an1*bLap1/mu2 ! coeff of u2(-2) from [n.(u.xx + u.yy)]

147 aa8(1,7,0,nn) =-an2*bLap1/mu2

148

149 ! Equation 2:

150 ! 2 [ v.x - u.y ] =0

151 ! a8(2,0) = is*8.*ry1*dx114(axis1)

152 ! a8(2,1) = -is*8.*rx1*dx114(axis1) ! coeff of v1(-1) from [v.x - u.y]

153 ! a8(2,4) = -is* ry1*dx114(axis1)

154 ! a8(2,5) = is* rx1*dx114(axis1)

155 ! a8(2,2) = -js*8.*ry2*dx214(axis2)

156 ! a8(2,3) = js*8.*rx2*dx214(axis2)

157 ! a8(2,6) = js* ry2*dx214(axis2)

158 ! a8(2,7) = -js* rx2*dx214(axis2)

159

160 curl1um1 = is*8.*rsxy1(i1,i2,i3,axis1,1)*dr114(axis1) ! coeff of u(-1)
from v.x - u.y

161 curl1vm1 = -is*8.*rsxy1(i1,i2,i3,axis1,0)*dr114(axis1) ! coeff of v(-1)
from v.x - u.y

162 curl1um2 = -is* rsxy1(i1,i2,i3,axis1,1)*dr114(axis1) ! coeff of u(-2) from
v.x - u.y

163 curl1vm2 = is* rsxy1(i1,i2,i3,axis1,0)*dr114(axis1) ! coeff of v(-2) from
v.x - u.y

164

165 curl2um1 = js*8.*rsxy2(j1,j2,j3,axis2,1)*dr214(axis2) ! coeff of u(-1)
from v.x - u.y

166 curl2vm1 = -js*8.*rsxy2(j1,j2,j3,axis2,0)*dr214(axis2) ! coeff of v(-1)
from v.x - u.y

167 curl2um2 = -js* rsxy2(j1,j2,j3,axis2,1)*dr214(axis2) ! coeff of u(-2) from
v.x - u.y

168 curl2vm2 = js* rsxy2(j1,j2,j3,axis2,0)*dr214(axis2) ! coeff of v(-2) from
v.x - u.y

169

170 aa8(2,0,0,nn) = curl1um1/mu1

171 aa8(2,1,0,nn) = curl1vm1/mu1

172 aa8(2,4,0,nn) = curl1um2/mu1

173 aa8(2,5,0,nn) = curl1vm2/mu1

174

175 aa8(2,2,0,nn) = -curl2um1/mu2

176 aa8(2,3,0,nn) = -curl2vm1/mu2

177 aa8(2,6,0,nn) = -curl2um2/mu2

178 aa8(2,7,0,nn) = -curl2vm2/mu2

179

180

181 ! \-------------- Equation 3 \-----------------------

182 ! [ tau.{ (uv.xx+uv.yy)/eps -alphaP*P.tt } ] = 0

183 ! P.tt = c4PttLEsum * L(E) + c4PttLLEsum* L^2(E) + ...

184 ! coeff of P is not used, thus set to 0

185 c4PttLEsum1 = 0.

186 c4PttLLEsum1 = 0.

187 c4PttLEsum2 = 0.

188 c4PttLLEsum2 = 0.

189 aa8(3,0,0,nn) = tau1*( aLap0*( 1./epsmu1 -alphaP1*c4PttLEsum1/epsmu1 ) -
aLapSq0*alphaP1*c4PttLLEsum1/epsmu1**2 )

190 aa8(3,1,0,nn) = tau2*( aLap0*( 1./epsmu1 -alphaP1*c4PttLEsum1/epsmu1 ) -
aLapSq0*alphaP1*c4PttLLEsum1/epsmu1**2 )

191 aa8(3,4,0,nn) = tau1*( aLap1*( 1./epsmu1 -alphaP1*c4PttLEsum1/epsmu1 ) -
aLapSq1*alphaP1*c4PttLLEsum1/epsmu1**2 )

192 aa8(3,5,0,nn) = tau2*( aLap1*( 1./epsmu1 -alphaP1*c4PttLEsum1/epsmu1 ) -
aLapSq1*alphaP1*c4PttLLEsum1/epsmu1**2 )

193

194 aa8(3,2,0,nn) =-tau1*( bLap0*( 1./epsmu2 -alphaP2*c4PttLEsum2/epsmu2 ) -
bLapSq0*alphaP2*c4PttLLEsum2/epsmu2**2 )

195 aa8(3,3,0,nn) =-tau2*( bLap0*( 1./epsmu2 -alphaP2*c4PttLEsum2/epsmu2 ) -
bLapSq0*alphaP2*c4PttLLEsum2/epsmu2**2 )

196 aa8(3,6,0,nn) =-tau1*( bLap1*( 1./epsmu2 -alphaP2*c4PttLEsum2/epsmu2 ) -
bLapSq1*alphaP2*c4PttLLEsum2/epsmu2**2 )

197 aa8(3,7,0,nn) =-tau2*( bLap1*( 1./epsmu2 -alphaP2*c4PttLEsum2/epsmu2 ) -
bLapSq1*alphaP2*c4PttLLEsum2/epsmu2**2 )

198

199

200 ! \-------------- Equation 4 \-----------------------

201 ! [ (u.xx+u.yy).x + (v.xx+v.yy).y ] = 0

202

203 setJacobian( aj1, axis1)

204

205 ! dr1a(0:2) = dsBig in tangential directions if avoidInterfaceIterations=1

206 dr0=dr1a(axis1)

207 ds0=dr1a(axis1p1)

208

209 aLapX0 = xLapCoeff4a(is,dr0,ds0)

210 aLapX1 = xLapCoeff4b(is,dr0,ds0)

211

212 bLapY0 = yLapCoeff4a(is,dr0,ds0)

213 bLapY1 = yLapCoeff4b(is,dr0,ds0)

214

215 setJacobian( aj2, axis2)

216

217 ! dr2a(0:2) = dsBig in tangential directions if avoidInterfaceIterations=1

218 dr0=dr2a(axis2)

219 ds0=dr2a(axis2p1)

220

221 cLapX0 = xLapCoeff4a(js,dr0,ds0)

222 cLapX1 = xLapCoeff4b(js,dr0,ds0)

223

224 dLapY0 = yLapCoeff4a(js,dr0,ds0)

225 dLapY1 = yLapCoeff4b(js,dr0,ds0)

226

227

228 ! 4 [ (u.xx+u.yy).x + (v.xx+v.yy).y ] = 0

229

230 aa8(4,0,0,nn)= aLapX0*c1**2

231 aa8(4,1,0,nn)= bLapY0*c1**2

232 aa8(4,4,0,nn)= aLapX1*c1**2

233 aa8(4,5,0,nn)= bLapY1*c1**2

234

235 aa8(4,2,0,nn)=-cLapX0*c2**2

236 aa8(4,3,0,nn)=-dLapY0*c2**2

237 aa8(4,6,0,nn)=-cLapX1*c2**2

238 aa8(4,7,0,nn)=-dLapY1*c2**2

239

240 ! \---------------- Equation 5 (2nd-order) \-----------------

241

242 ! [ ( {(Delta v).x - (Delta u).y}/(epsmu) - alphaP*( Py.ttx - Px.tty) )/mu
] =0

243 !

244 ! P.tt = c2PttLEsum * L(E)

245

246 ! coeff of P is set to 0

247 c2PttLEsum1 = 0.

248 c2PttEsum1 = 0.

249 c2PttLEsum2 = 0.

250 c2PttEsum2 = 0.

251

252 eqnCoeff = ( 1./epsmu1 - alphaP1*c2PttLEsum1/epsmu1 )/mu1

253 eqnCoeffb = -alphaP1*c2PttEsum1/mu1 ! added sept 16, 2018

254 aa8(5,0,0,nn)=-bLapY0*eqnCoeff + curl1um1*eqnCoeffb

255 aa8(5,1,0,nn)= aLapX0*eqnCoeff + curl1vm1*eqnCoeffb

256 aa8(5,4,0,nn)=-bLapY1*eqnCoeff + curl1um2*eqnCoeffb

257 aa8(5,5,0,nn)= aLapX1*eqnCoeff + curl1vm2*eqnCoeffb

258

259 eqnCoeff = ( 1./epsmu2 - alphaP2*c2PttLEsum2/epsmu2 )/mu2

260 eqnCoeffb = -alphaP2*c2PttEsum2/mu2 ! added sept 16, 2018

261 aa8(5,2,0,nn)=-(-dLapY0*eqnCoeff + curl2um1*eqnCoeffb)

262 aa8(5,3,0,nn)=-( cLapX0*eqnCoeff + curl2vm1*eqnCoeffb)

263 aa8(5,6,0,nn)=-(-dLapY1*eqnCoeff + curl2um2*eqnCoeffb)

264 aa8(5,7,0,nn)=-( cLapX1*eqnCoeff + curl2vm2*eqnCoeffb)

265

266

267 ! \------- Equation 6 \-----

268 ! [ nv.( c^2*Delta^2(E) - alphaP*Delta(Ptt) )/mu ] = 0

269

270 ! 6 [ n.Delta^2 u/eps ] = 0

271

272 if( setDivergenceAtInterfaces.eq.0 )then

273 ! use Eqn 6

274 ! NOTE: LE = c^2*Delta(E) and LLE = (c^4*Delta^2) E

275 ! Note: the coeff of L(E) in Delta(Ptt) is the coeff of E in Ptt

276 ! Note: the coeff of LL(E) in Delta(Ptt) is the coeff of LE in Ptt

277

278 c2PttEsum1 = 0.

279 c2PttLEsum1 = 0.

280 c2PttEsum2 = 0.

281 c2PttLEsum2 = 0.

282

283 aa8(6,0,0,nn) = an1*( aLapSq0/epsmu1 -alphaP1*( c2PttEsum1*aLap0 +
c2PttLEsum1*aLapSq0/epsmu1 ) )/mu1

284 aa8(6,1,0,nn) = an2*( aLapSq0/epsmu1 -alphaP1*( c2PttEsum1*aLap0 +
c2PttLEsum1*aLapSq0/epsmu1 ) )/mu1

285 aa8(6,4,0,nn) = an1*( aLapSq1/epsmu1 -alphaP1*( c2PttEsum1*aLap1 +
c2PttLEsum1*aLapSq1/epsmu1 ) )/mu1

286 aa8(6,5,0,nn) = an2*( aLapSq1/epsmu1 -alphaP1*( c2PttEsum1*aLap1 +
c2PttLEsum1*aLapSq1/epsmu1 ) )/mu1

287

288 aa8(6,2,0,nn) =-an1*( bLapSq0/epsmu2 -alphaP2*( c2PttEsum2*bLap0 +
c2PttLEsum2*bLapSq0/epsmu2 ) )/mu2

289 aa8(6,3,0,nn) =-an2*( bLapSq0/epsmu2 -alphaP2*( c2PttEsum2*bLap0 +
c2PttLEsum2*bLapSq0/epsmu2 ) )/mu2

290 aa8(6,6,0,nn) =-an1*( bLapSq1/epsmu2 -alphaP2*( c2PttEsum2*bLap1 +
c2PttLEsum2*bLapSq1/epsmu2 ) )/mu2

291 aa8(6,7,0,nn) =-an2*( bLapSq1/epsmu2 -alphaP2*( c2PttEsum2*bLap1 +
c2PttLEsum2*bLapSq1/epsmu2 ) )/mu2

292 end if

293

294 ! \------- Equation 7 \------

295 ! [ tv.( c^4*Delta^2(E) - alphaP*c^2*Delta(P.tt) - alphaP*P.tttt) ]=0

296

297 ! 7 [ tau.Delta^2 v/eps^2 ] = 0

298 ! Note: the coeff of L(E) in Delta(Ptt) is the coeff of E in Ptt

299 ! Note: the coeff of LL(E) in Delta(Ptt) is the coeff of LE in Ptt

300

301 c2PttEsum1 = 0.

302 c2PttttLEsum1 = 0.

303 c2PttLEsum1 = 0.

304 c2PttttLLEsum1 = 0.

305 c2PttEsum2 = 0.

306 c2PttttLEsum2 = 0.

307 c2PttLEsum2 = 0.

308 c2PttttLLEsum2 = 0.

309

310 coeffLap1 = -alphaP1*( c2PttEsum1 + c2PttttLEsum1 )/epsmu1

311 coeffLapSq1 = 1./epsmu1**2 -alphaP1*( c2PttLEsum1 + c2PttttLLEsum1
)/epsmu1**2

312

313 coeffLap2 = -alphaP2*( c2PttEsum2 + c2PttttLEsum2 )/epsmu2

314 coeffLapSq2 = 1./epsmu2**2 -alphaP2*( c2PttLEsum2 + c2PttttLLEsum2
)/epsmu2**2

315

316 aa8(7,0,0,nn) = tau1*( coeffLapSq1*aLapSq0 + coeffLap1*aLap0 )

317 aa8(7,1,0,nn) = tau2*( coeffLapSq1*aLapSq0 + coeffLap1*aLap0 )

318 aa8(7,4,0,nn) = tau1*( coeffLapSq1*aLapSq1 + coeffLap1*aLap1 )

319 aa8(7,5,0,nn) = tau2*( coeffLapSq1*aLapSq1 + coeffLap1*aLap1 )

320

321 aa8(7,2,0,nn) =-tau1*( coeffLapSq2*bLapSq0 + coeffLap2*bLap0 )

322 aa8(7,3,0,nn) =-tau2*( coeffLapSq2*bLapSq0 + coeffLap2*bLap0 )

323 aa8(7,6,0,nn) =-tau1*( coeffLapSq2*bLapSq1 + coeffLap2*bLap1 )

324 aa8(7,7,0,nn) =-tau2*( coeffLapSq2*bLapSq1 + coeffLap2*bLap1 )

325

326

327

328 ! save a copy of the matrix

329 do n2=0,7

330 do n1=0,7

331 aa8(n1,n2,1,nn)=aa8(n1,n2,0,nn)

332 ! a8(n1,n2)=aa8(n1,n2,0,nn)

333 end do

334 end do

335

336

337 ! solve A Q = F

338 ! factor the matrix

339 numberOfEquations=8

340 call dgeco( aa8(0,0,0,nn), numberOfEquations, numberOfEquations,
ipvt8(0,nn),rcond,work(0))

341

342 end if

343

344

345 ! Save current solution to compare to new

346 q(0) = u1(i1-is1,i2-is2,i3,ex)

347 q(1) = u1(i1-is1,i2-is2,i3,ey)

348 q(2) = u2(j1-js1,j2-js2,j3,ex)

349 q(3) = u2(j1-js1,j2-js2,j3,ey)

350

351 q(4) = u1(i1-2*is1,i2-2*is2,i3,ex)

352 q(5) = u1(i1-2*is1,i2-2*is2,i3,ey)

353 q(6) = u2(j1-2*js1,j2-2*js2,j3,ex)

354 q(7) = u2(j1-2*js1,j2-2*js2,j3,ey)

355

356 ! subtract off the contributions from the initial (wrong) values at the
ghost points:

357 do n=0,7

358 f(n) =
(aa8(n,0,1,nn)*q(0)+aa8(n,1,1,nn)*q(1)+aa8(n,2,1,nn)*q(2)+aa8(n,3,1,nn)*q(3)+\

359
aa8(n,4,1,nn)*q(4)+aa8(n,5,1,nn)*q(5)+aa8(n,6,1,nn)*q(6)+aa8(n,7,1,nn)*q(7)) -
f(n)

360 end do

361

362 ! solve A Q = F

363 job=0

364 numberOfEquations=8

365 call dgesl( aa8(0,0,0,nn), numberOfEquations, numberOfEquations,
ipvt8(0,nn), f(0), job)

366

367

368 if( useJacobiUpdate.eq.0 )then

369 u1(i1-is1,i2-is2,i3,ex)=(1.-omega)*u1(i1-is1,i2-is2,i3,ex) + omega*f(0)

370 u1(i1-is1,i2-is2,i3,ey)=(1.-omega)*u1(i1-is1,i2-is2,i3,ey) + omega*f(1)

371 u2(j1-js1,j2-js2,j3,ex)=(1.-omega)*u2(j1-js1,j2-js2,j3,ex) + omega*f(2)

372 u2(j1-js1,j2-js2,j3,ey)=(1.-omega)*u2(j1-js1,j2-js2,j3,ey) + omega*f(3)

373

374 u1(i1-2*is1,i2-2*is2,i3,ex)=(1.-omega)*u1(i1-2*is1,i2-2*is2,i3,ex) +
omega*f(4)

375 u1(i1-2*is1,i2-2*is2,i3,ey)=(1.-omega)*u1(i1-2*is1,i2-2*is2,i3,ey) +
omega*f(5)

376 u2(j1-2*js1,j2-2*js2,j3,ex)=(1.-omega)*u2(j1-2*js1,j2-2*js2,j3,ex) +
omega*f(6)

377 u2(j1-2*js1,j2-2*js2,j3,ey)=(1.-omega)*u2(j1-2*js1,j2-2*js2,j3,ey) +
omega*f(7)

378 else

379 ! Jacobi-update

380 wk1(i1-is1,i2-is2,i3,ex)=(1.-omega)*u1(i1-is1,i2-is2,i3,ex) + omega*f(0)

381 wk1(i1-is1,i2-is2,i3,ey)=(1.-omega)*u1(i1-is1,i2-is2,i3,ey) + omega*f(1)

382 wk2(j1-js1,j2-js2,j3,ex)=(1.-omega)*u2(j1-js1,j2-js2,j3,ex) + omega*f(2)

383 wk2(j1-js1,j2-js2,j3,ey)=(1.-omega)*u2(j1-js1,j2-js2,j3,ey) + omega*f(3)

384

385 wk1(i1-2*is1,i2-2*is2,i3,ex)=(1.-omega)*u1(i1-2*is1,i2-2*is2,i3,ex) +
omega*f(4)

386 wk1(i1-2*is1,i2-2*is2,i3,ey)=(1.-omega)*u1(i1-2*is1,i2-2*is2,i3,ey) +
omega*f(5)

387 wk2(j1-2*js1,j2-2*js2,j3,ex)=(1.-omega)*u2(j1-2*js1,j2-2*js2,j3,ex) +
omega*f(6)

388 wk2(j1-2*js1,j2-2*js2,j3,ey)=(1.-omega)*u2(j1-2*js1,j2-2*js2,j3,ey) +
omega*f(7)

389 end if

390

391

392 endLoopsMask2d()

393 ! =============== end loops =======================

394

395 ! fill ghost lines using 4th order IC results

396

397 if( useJacobiUpdate.ne.0 )then

398 ! Jacobi-update: now fill in values

399 beginLoopsMask2d()

400 u1(i1-is1,i2-is2,i3,ex)=wk1(i1-is1,i2-is2,i3,ex)

401 u1(i1-is1,i2-is2,i3,ey)=wk1(i1-is1,i2-is2,i3,ey)

402 u2(j1-js1,j2-js2,j3,ex)=wk2(j1-js1,j2-js2,j3,ex)

403 u2(j1-js1,j2-js2,j3,ey)=wk2(j1-js1,j2-js2,j3,ey)

404

405 u1(i1-2*is1,i2-2*is2,i3,ex)=wk1(i1-2*is1,i2-2*is2,i3,ex)

406 u1(i1-2*is1,i2-2*is2,i3,ey)=wk1(i1-2*is1,i2-2*is2,i3,ey)

407 u2(j1-2*js1,j2-2*js2,j3,ex)=wk2(j1-2*js1,j2-2*js2,j3,ex)

408 u2(j1-2*js1,j2-2*js2,j3,ey)=wk2(j1-2*js1,j2-2*js2,j3,ey)

409

410 u1(i1- is1,i2- is2,i3,hz)=wk1(i1- is1,i2- is2,i3,hz)

411 u2(j1- js1,j2- js2,j3,hz)=wk2(j1- js1,j2- js2,j3,hz)

412 u1(i1-2*is1,i2-2*is2,i3,hz)=wk1(i1-2*is1,i2-2*is2,i3,hz)

413 u2(j1-2*js1,j2-2*js2,j3,hz)=wk2(j1-2*js1,j2-2*js2,j3,hz)

414 endLoopsMask2d()

415 end if

416

417

418#endMacro

## References

  * [1] J. W. Banks, W. D. Henshaw, Upwind schemes for the wave equation in second-order form, J. Comput. Phys. 231 (17) (2012) 5854–5889.
  * [2] J. Angel, J. W. Banks, W. D. Henshaw, High-order upwind schemes for the wave equation on overlapping grids: Maxwell’s equations in second-order form, J. Comput. Phys. 352 (2018) 534–567.
  * [3] J. B. Angel, J. W. Banks, W. D. Henshaw, M. J. Jenkinson, A. V. Kildishev, G. Kovačič, L. J. Prokopeva, D. W. Schwendeman, A high-order accurate scheme for Maxwell’s equations with a generalized dispersive material model, J. Comput. Phys. 378 (2019) 411–444.
  * [4] J. W. Banks, B. B. Buckner, W. D. Henshaw, M. J. Jenkinson, A. V. Kildishev, G. Kovačič, L. J. Prokopeva, D. W. Schwendeman, A high-order accurate scheme for Maxwell’s equations with a generalized dispersive material (GDM) model and material interfaces, J. Comput. Phys. 412 (2020) 109424, 34\.
  * [5] A. Siegman, Lasers, University Science Books, 1986.
  * [6] R. W. Ziolkowski, J. M. Arnold, D. M. Gogny, Ultrafast pulse interactions with two-level atoms, Phys. Rev. A 52 (1995) 3082–3094.
  * [7] A. S. Nagra, R. A. York, FDTD analysis of wave propagation in nonlinear absorbing and gain media, IEEE T. Antenn. Propag. 46 (3) (1998) 334–340.
  * [8] S.-H. Chang, A. Taflove, Finite-difference time-domain model of lasing action in a four-level two-electron atomic system, Opt. Express 12 (16) (2004) 3827–3833.
  * [9] S. I. Azzam, A. V. Kildishev, R.-M. Ma, C.-Z. Ning, R. Oulton, V. M. Shalaev, M. I. Stockman, J.-L. Xu, X. Zhang, Ten years of spasers and plasmonic nanolasers, Light: Science & Applications 9 (1).
  * [10] J. Trieschmann, S. Xiao, L. J. Prokopeva, V. P. Drachev, A. V. Kildishev, Experimental retrieval of the kinetic parameters of a dye in a solid film, Opt. Express 19 (19) (2011) 18253–18259.
  * [11] S. I. Azzam, J. Fang, J. Liu, Z. Wang, N. Arnold, T. A. Klar, L. J. Prokopeva, X. Meng, V. M. Shalaev, A. V. Kildishev, Exploring time-resolved multiphysics of active plasmonic systems with experiment-based gain models, Laser Photonics Rev. 13 (1) (2018) 1800071.
  * [12] S. I. Azzam, K. Chaudhuri, A. Lagutchev, Z. Jacob, Y. L. Kim, V. M. Shalaev, A. Boltasseva, A. V. Kildishev, Single and multi-mode directional lasing from arrays of dielectric nanoresonators, Laser Photonics Rev. 15 (3) (2021) 2000411\.
  * [13] S. I. Azzam, A. V. Kildishev, Time-domain dynamics of saturation of absorption using multilevel atomic systems, Opt. Mater. Express 8 (12) (2018) 3829–3834.
  * [14] S. I. Azzam, A. V. Kildishev, Time-domain dynamics of reverse saturable absorbers with application to plasmon-enhanced optical limiters, Nanophotonics 8 (1) (2018) 145–151.
  * [15] S. I. Azzam, A. V. Kildishev, Ch. 6: Multi-level carrier kinetics models for computational nanophotonics, in: D. H. Werner, S. D. Campbell, L. Kang (Eds.), Nanoantennas and Plasmonics: Modelling, design and fabrication, Institution of Engineering and Technology, Stevenage, UK, 2020, pp. 189–205.
  * [16] R. H. Pantell, H. E. Puthoff, Fundamentals of quantum electronics, John Wiley & Sons, 1969.
  * [17] D. J. Bergman, M. I. Stockman, Surface plasmon amplification by stimulated emission of radiation: quantum generation of coherent surface plasmons in nanosystems, Phys. Rev. Lett. 90 (2) (2003) 027402.
  * [18] M. I. Stockman, Spasers explained, Nature Photonics 2 (6) (2008) 327–329.
  * [19] X. F. Li, S. F. Yu, Design of low-threshold compact au-nanoparticle lasers, Opt. Lett. 35 (15) (2010) 2535–2537.
  * [20] D. G. Baranov, E. Andrianov, A. P. Vinogradov, A. A. Lisyansky, Exactly solvable toy model for surface plasmon amplification by stimulated emission of radiation, Opt. Express 21 (9) (2013) 10779.
  * [21] N. Arnold, K. Piglmayer, A. V. Kildishev, T. A. Klar, Spasers with retardation and gain saturation: electrodynamic description of fields and optical cross-sections, Opt. Mater. Express 5 (11) (2015) 2546–2577.
  * [22] G. V. Kristanz, N. Arnold, A. V. Kildishev, T. A. Klar, Power balance and temperature in optically pumped spasers and nanolasers, ACS Photonics 5 (9) (2018) 3695–3703.
  * [23] J. Bravo-Abad, S. Fan, S. G. Johnson, J. D. Joannopoulos, M. Soljačić, Modeling nonlinear optical phenomena in nanophotonics, J. Lightwave Technol. 25 (9) (2007) 2539–2546.
  * [24] O. Reshef, E. Giese, M. Z. Alam, I. D. Leon, J. Upham, R. W. Boyd, Beyond the perturbative description of the nonlinear optical response of low-index materials, Opt. Lett. 42 (16) (2017) 3225–3228.
  * [25] S.-L. Chua, B. Zhen, J. Lee, J. Bravo-Abad, O. Shapira, M. Soljačić, Modeling of threshold and dynamics behavior of organic nanostructured lasers, J. Mater. Chem. C 2 (2014) 1463–1473.
  * [26] A. Pusch, S. Wuestner, J. M. Hamm, K. L. Tsakmakidis, O. Hess, Coherent amplification and noise in gain-enhanced nanoplasmonic metamaterials: A Maxwell–Bloch langevin approach, ACS Nano 6 (3) (2012) 2420–2431.
  * [27] D. J. Trivedi, D. Wang, T. W. Odom, G. C. Schatz, Model for describing plasmonic nanolasers using Maxwell-Liouville equations with finite-difference time-domain calculations, Phys. Rev. A 96 (5).
  * [28] R. W. Boyd, Nonlinear optics, Academic press, 2020.
  * [29] L. Allen, J. H. Eberly, Optical resonance and two-level atoms, Vol. 28, Courier Corporation, 1987.
  * [30] A. Taflove, Finite-difference time-domain model of lasing action in a four-level two-electron atomic system: erratum, Opt. Express 14 (4) (2006) 1702\.
  * [31] A. Taflove, S. C. Hagness, Computational electrodynamics: the finite-difference time-domain method, Artech house, 2005.
  * [32] A. Maimistov, A. Basharov, S. Elyutin, Y. M. Sklyarov, Present state of self-induced transparency theory, Physics Reports 191 (1) (1990) 1–108.
  * [33] C. Jirauschek, M. Riesch, P. Tzenov, Optoelectronic device simulations based on macroscopic Maxwell–Bloch equations, Advanced Theory and Simulations 2 (8) (2019) 1900018.
  * [34] K. Yee, Numerical solution of initial boundary value problems involving Maxwell’s equations in isotropic media, IEEE T. Antenn. Propag. 14 (3) (1966) 302–307.
  * [35] B. Bidégaray, Time discretizations for Maxwell–Bloch equations, Numerical Methods for Partial Differential Equations: An International Journal 19 (3) (2003) 284–300.
  * [36] O. Saut, Computational modeling of ultrashort powerful laser pulses in a nonlinear crystal, J. Comput. Phys. 197 (2) (2004) 624–646.
  * [37] A. Bourgeade, O. Saut, Numerical methods for the bidimensional Maxwell–Bloch equations in nonlinear crystals, J. Comput. Phys. 213 (2) (2006) 823–843.
  * [38] M. Riesch, C. Jirauschek, mbsolve: An open-source solver tool for the Maxwell–Bloch equations, arXiv e-prints (2020) arXiv:2005.05412.
  * [39] W. D. Henshaw, A high-order accurate parallel solver for Maxwell’s equations on overlapping grids, SIAM J. Sci. Comput. 28 (5) (2006) 1730–1765.
  * [40] W. D. Henshaw, Ogen: An overlapping grid generator for Overture, Research Report UCRL-MA-132237, Lawrence Livermore National Laboratory (1998).
  * [41] G. S. Chesshire, W. D. Henshaw, Composite overlapping meshes for the solution of partial differential equations, J. Comput. Phys. 90 (1) (1990) 1–64.
  * [42] B. Alpert, L. Greengard, T. Hagstrom, Nonreflecting boundary conditions for the time-dependent wave equation, J. Comput. Phys. 180 (2002) 270–296.
  * [43] J. Fang, L. Prokopeva, J. Trieschmann, N. Arnold, A. V. Kildishev, Photonicsgain-0d (Nov 2012).