Pregnancy Companion Chatbot Using
Pregnancy Companion Chatbot Using
Abstract—Pregnant ladies often become anxious and get is programmatically trained so that it can communicate with
curious about many questions and concerns. Mobile Health the user through text-based or voice-based interaction. The
services such as chatbots can be used to address these concerns, chatbot can be effectively used as an assistant to perform
helping them with authentic healthcare advice; accessible from functions which are traditionally carried out by humans, or as
remote locations irrespective of time and space. The paper a boundary tool to control a system of connected devices [3].
describes a pregnancy companion chatbot to help pregnant Text or messaging based chatbot designs have been
women during pregnancy. A questionnaire was designed for gradually changing to voice communication-based designs.
the expectant mothers and healthcare professionals who treat Voice interaction enabled microphones and smart speakers
them, to design the chatbot. The inputs were captured to verify
have played an important role in the chatbot evolution.
the feasibility, relevance, and technology acceptance for the use
case. Chatbot designs are slowly changing from text-based
Internet of Things, a concept of connected smart devices has
interaction to voice-based interaction. The pregnancy transformed the chatbot interaction.
companion chatbot was tested on Amazon Echo dot, a smart The healthcare domain is facing a range of challenges
speaker device supported by Amazon voice assistant Alexa. due to increasing service demand. Shortage of trained
Designing a chatbot on top of a custom Alexa skill allows professionals and their limited availability while providing
developers to use multiple Amazon Web Services. The design treatment to the patients is a major challenge. The main
has used AWS Lambda as a triggering function, Simple
reason for the problem is that healthcare practitioners have to
Notification Service for sending message notifications, Simple
overcome organizational, temporal and geographical barriers
Email Service for sending emails and DynamoDB as a
database. ‘Internet of Things’, the concept of connecting smart
to assist the patients. The availability of trained professionals
devices, makes the chatbot solution accessible at any time and to provide an authentic treatment within the appropriate time
from anywhere. is important for disease diagnosis, assisting patients having
cholesterol, blood pressure, diabetes or other severe diseases
Keywords— chatbot; pregnancy companion; Alexa; Amazon and for the treatment of pregnant women [4]. Mobile Health
Web Services; Internet of Things services resolve these concerns, helping patients with
authentic healthcare accessible from remote locations
I. INTRODUCTION irrespective of time and space. Traditional mHealth
applications were limited to basic functions such as
Pregnancy is often considered as a physically and recording exercise activities or counting calories burnt.
emotionally challenging phase for parents. Pregnant ladies However, mobile health applications are becoming more
experience a range of emotions and get anxious, curious adaptive and complex, providing advanced features like
about different questions. Now as most of them use smart disease diagnosis and assistive patient treatment. Chatbots or
devices, mobiles; pregnancy companion apps and the conversational agents come under the modern category of
technology can help them be to track their pregnancy and mHealth services. They use natural language and voice-
resolve their queries by accessing authentic web resources based interaction while communicating with the patients,
[1]. The paper describes a design of chatbot based pregnancy through a ‘question-answer oriented’ interface model [3].
companion to assist pregnant women in reducing their
anxiety by addressing their common concerns related to
II. BACKGROUND AND RELATED WORK
pregnancy. Chatbots are getting used efficiently in many
applications; especially the healthcare industry is using
A. Smart Phone apps as a companion for pregnancy
chatbots to assist patients by addressing their queries with
authentic advice. Nadia Tripp et al. in [1] have analyzed the pregnancy
companion apps. They have classified these apps in four
Changes in science and technology resulted in a gradual categories- interactive, informative, social media apps and
transformation of the information access methods. Artificial tools. The informative apps are based on a range of topics
intelligence and the latest computing solutions have made like pregnancy facts, baby development, diet information,
them much more efficient, simpler and user interactive. AI and maternal health. Interactive apps offer a more
technology makes knowledge easily accessible to the user. It personalized platform to the user for specific questions,
also detects and corrects errors while presenting the content alerts, notifications, fetus images, special recommendations
[2]. Interaction between the human user and the computing about health-related topics. The content shared is more
machine is the main part of the information exchange relevant and specific to the user requirements. The
process. Chatbot simplifies this interaction and makes it user- interactive apps too have popularity along with the
friendly. Intelligent conversation between humans and informative apps amongst the users. Authors have presented
machines is the prominent feature of a chatbot. The chatbot a statistical study and functionality verification analysis of
Authorized licensed use limited to: University of Edinburgh. Downloaded on June 15,2020 at 01:47:11 UTC from IEEE Xplore. Restrictions apply.
smartphone-based pregnancy companion apps available for the design; for creating HTTP endpoints to return JavaScript
the pregnant ladies, successfully highlighting their increasing Object Notation (JSON) responses, developing new models
acceptance and popularity amongst the expectant mothers. and while training the language model with sample
utterances. The design uses the Telegram messaging app. It
B. Chatbot features and implementation standards performs message encryption and offers a free, open-source
Chen Wei et al. in [5] describe the framework of a and secure platform. The chatbot tracks user location through
chatbot and list its eight main capabilities. Some of these Google Maps API.
features such as self- learning, Emotional Quotient, self- Multiple articles and research papers have underlined the
consciousness, Intelligence Quotient, and memory; can be increasing popularity and acceptance of pregnancy
used as a reference to explain the chatbot application of a companion mobile apps. The chatbot is more effective than a
pregnancy companion chatbot. smartphone app as it provides a voice interface through a
H. Hsin in [6] describes the implementation standards for personalized platform [3]. Current chatbot designs provide
a variety of mHealth applications. The authors also mention suggestions and tips on many topics like lifestyle, personal
the principles to modify healthcare applications. These wellbeing, healthy diet, and others. However some additional
implementation standards can be used as a reference while aspects are necessary to make these chatbots more relevant
structuring and designing chatbot applications. The standards for users; like maintaining a diary record to track routine
must meet four parameters- user experience/ adherence, data activities, and providing information specifically with respect
safety, data privacy, data integration, and effectiveness. The to the particular stages of pregnancy, and message
authors have also described challenges to handle these notification service in case of an emergency situation.
parameters.
III. DESIGN AND METHODOLOGY
C. Existing solutions
A. Technology Acceptance Survey
The BabyCenter website [7] managed by BabyCenter
LLC (Johnson & Johnson family of companies); offers Venkatesh et al. in [9] describe a model system to study
pregnancy, childcare, and related content. It also offers an the technology acceptance for a practical use case. The
online public discussion platform in the United Kingdom. It authors explain the ‘Unified Theory of Acceptance and Use
hosts a wide range of information content such as pregnancy of Technology’ (UTAUT) system to analyze the user
due-date calculator, articles about self-care during pregnancy acceptance of technology and the application use context.
and the post-pregnancy period, other features like. The The advanced version UTAUT2 deals with the technology
Facebook Messenger Bot captures the baby age, or specific application in private contexts. UTAUT2 can be considered
questions or concerns experienced by the user, to provide the as a reference while analyzing the impact of a chatbot in
focused content. The information and email contents are many applications. Researchers have already used the model
specific and exclusive to the user requirements [7]. But the in the context of mHealth applications. It focuses on aspects
chatbot solution is not as interactive and user appealing as such as Effort expectations, Performance expectations,
the main website is. Also, the chatbot doesn’t provide a Facilitating conditions, Social influences, Price values
voice-assisted interface to the user. Hedonic motivations and Habits [9]. A survey questionnaire
was designed using these features for pregnant women to
Lucia Vaira et al. in [8] highlight the significance of study the feasibility and acceptance of a voice interaction-
machine learning and artificial intelligence in the healthcare based chatbot in assisting them during the pregnancy. A set
sector. The authors discuss a model of a chatbot based on AI: of questions were framed to verify the primary familiarity of
‘MamaBot’, using machine learning algorithms and Natural the user with the smartphone or chatbots and to predict how
Language Processing. The MamaBot captures and addresses frequently they are using them. Multiple questions were
the concerns of pregnant women and their relatives. The asked to record user opinions while accepting the chatbot as
functionality of a chatbot to support mothers after pregnancy a pregnancy companion assistant and as a replacement tool
has also been addressed in the solution. The MamaBot for the traditional smartphone interaction [3].
mainly performs two functions: to handle the situation of
emergency (providing suggestions such as nearby hospitals
in the area) and to help pregnant women for their concerns
and queries (common diseases and symptoms, general
content about lifestyle or diet). The authors have considered
a long period of pregnancy and post-pregnancy while
designing the structure of the MamaBot. Given the larger
scope of relevant content, the prominent aspect of the chatbot
is its capacity to figure out the context from the input
requests to optimize the query responses. The pre-processing
of requests is performed by contextualizing layers to identify
the intents having specific keywords. The proposed design
[8] of the MamaBot is based on the conversational
interactions with the pregnant lady, during multiple
situations. The authors have used Microsoft Bot Framework6 Fig. 1. Survey summary- Acceptance of technology with respect to
UTAUT2 factors [3]
because of its aspects such as open-source platform,
documentation of examples and support to translate more
Almost all users were having a primary exposure for
than 30 languages. The cognitive service ‘Language
technology, but some of them accepted that they don’t use
Understanding Intelligent Service’ (LUIS) has been used in
chatbots more frequently. As most of the interviewees often
Authorized licensed use limited to: University of Edinburgh. Downloaded on June 15,2020 at 01:47:11 UTC from IEEE Xplore. Restrictions apply.
feel the need for a doctor’s advice in a day, they admitted platform that offers higher throughput with higher
that sometimes they can’t raise their queries or questions availability [12].
with someone. Although they prefer using a search engine
like Google to get the answers; they were in favor of a AWS SES is a cloud-based service that can be configured
chatbot to replace it. Users were asked to provide their for generating email notifications, transactional or marketing
consent for the UTAUT2 parameters on the scale of 1-5 emails. SES is a reliable, cost-effective, flexible and highly-
(strongly disagree, disagree, neutral, agree, strongly agree) scalable service useful for multiple use cases serving
while looking at the feasibility of a pregnancy companion different requirements [13].
chatbot. Figure 1 shows a statistical summary of the survey, Figure 2 displays the integrated system block diagram.
which highlights the positive user inclination towards a Voice communication can be observed between the pregnant
pregnancy companion chatbot. woman and the Alexa enabled Echo dot device [3]. Alexa
The survey analysis [3] interpreted from UTAUT2 Skills Kit (ASK) handles user requests captured in as an
factors resulted in a fairer analysis of the technology audio signal. It converts the audio input into the equivalent
acceptance. The responses from the users were helpful in text to detect the ‘intent’ or context of the request.
structuring the chatbot design features, making it a relevant Corresponding to the detected intent, the associated Lambda
and engaging tool for the users. function event gets evoked. Request response interaction
between the Lambda function and ASK takes place in the
JSON format [3]. Suitable actions are performed by Lambda
B. Design and Block diagram for the raised request, such as extraction of the data or
Alexa is a popular virtual voice assistant application generation of a response. The Lambda function interacts with
developed by Amazon. Devices like Amazon Echo Plus, AWS DynamoDB for data storage or data retrieval [3]. ASK
Echo Studio or Echo dot are enabled with Alexa. Alexa translates the responses sent by the Lambda function to audio
provides multiple functionalities like real-time data output for the user. SNS and SES are triggered through the
extraction, voice interaction, weather forecast, broadcasting, Lambda function to generate short text notifications or
smart audio-video streaming, tasks list management, home- emails in case of certain events.
automation control and others. Third-party users can also
configure these functionalities by designing and installing a
custom ‘skill’ on Alexa enabled smart speaker. The skill, just
like a mobile phone application allows the user to perform
certain defined tasks that involve features such as service
assistance or voice interaction. Alexa has become a popular
tool in realizing the concept of intelligent and interactive
chatbots [2].
Designing a chatbot on top of a custom Alexa skill allows
developers to utilize a range of Amazon Web Services like
AWS Lambda, Simple Email Service (SES), Simple
Notification Service (SNS) and DynamoDB.
AWS Lambda is a cloud computing platform that allows
users running code without managing or provisioning the
cloud servers. The developer is charged only for the compute Fig. 2. Integrated system block diagram
time consumed- no charge when the code doesn’t run. The
Lambda function codes are run on a computing infrastructure C. Data source selection
having high-availability. It also manages the administration An authentic and reliable data source is needed to extract
of cloud computing resources, capacity provisioning and the backend data which is used for the chatbot design.
automatic scaling, maintenance of the server and operating Considering these features a platform recommended by
system, code logging and monitoring. The developer just healthcare practitioners, the National Health Service (NHS)
supplies the Lambda function code in one of the supported website [14] was selected as a dataset source. NHS is the
languages, and the other services are handled by AWS national healthcare system in the United Kingdom. The
Lambda [10]. website offers information content about pregnancy such as
AWS DynamoDB is a NoSQL database service weekly guides, recommendations, and suggestions about
providing higher scalability and quick performance. relevant miscellaneous topics.
Developers don’t have to worry about the management of
hardware provision, replication, software patching, setup, IV. IMPLEMENTATION AND VERIFICATION
and configuration, or cluster scaling as this is handled by
DynamoDB. It also secures the sensitive data by encrypting A. Implementation aspects
it at rest, reducing the burden on the developer. It allows the
AWS Developer account and AWS Management console
creation and maintenance of any amount of data. More on,
account are needed to configure an Alexa skill with Amazon
DynamoDB serves incoming requests are any traffic level
Web Services. ASK Developer Console enables the
[11].
programmer to configure and publish a custom Alexa skill.
AWS SNS is a cloud-based notification service that can On the other side, the AWS Management console enables the
be used for generating message notifications from serverless programmer to utilize multiple AWS services, monitor cloud
and distributed applications. It is a durable and secure services, user and roles management, handle costing and
billing and execution permissions.
Authorized licensed use limited to: University of Edinburgh. Downloaded on June 15,2020 at 01:47:11 UTC from IEEE Xplore. Restrictions apply.
The developer can configure a custom dynamic skill The Lambda function was configured on top of a custom
using the ASK custom interaction model. The inbuilt template available in the AWS Serverless App
implementation logic for the voice interface interaction is Repository, to support ASK and NodeJS for the Lambda. It
defined while configuring the Alexa skill. The following imports all the necessary resources required. JavaScript and
sections were configured: Node.js 8.10 runtime was used to write the Lambda function
code. ‘Handler’ method was used in the code while
Invocation: A specific keyword or a phrase said by users processing the Alexa triggered events. The runtime runs the
while starting an interaction with the Alexa skill. handler method when some function is invoked and
Intents: Intent is a structural model for a particular completes the execution returning a response.
functionality where steps for voice interaction, list sample The Lambda function can be connected with the ASK by
user requests, and corresponding actions are defined. Intent updating the ‘Endpoint’ field. The Lambda function also
can have optional arguments such as slots. Slots are like needs access permissions to modify or access resources like
variables that can take values specified by some common SNS, SES and AWS DynamoDB.
characteristics like slots for exercise activity, day or time
duration. A custom slot type can also be configured if the DynamoDB database tables were configured to manage
intended slot is not there in the list of Amazon built-in slots. the dynamic and static backend data. It is important to
consider aspects such as data storage, scalability of resources
Sample utterances: Sample utterance is a list of probable and a possible rise in the number of users accessing the
phrases which likely to be said by users to invoke a specific system; while designing a data model structure. Table II
intent or as a response to certain defined questions. ASK displays the list of tables defined in DynamoDB.
searches for the best possible match of the input request in
the lists of sample utterances, to identify the intent.
TABLE II. SUMMARY OF TABLES DEFINED IN DYNAMODB
Dialog model: Dialog model is a structure where the
conversational steps are defined for the interaction between SN Table name Description
Alexa and the user to capture the mandatory data required to 1 PCCExerciseInfoDB
Manage a database to store the
invoke a particular intent. records of exercise activities
A database to capture personal
2 PCCPersonalInfoDB
The developer can also define and configure the intents, user details like name, contacts
dialog delegations, slots, and utterances in the ‘JSON editor’ Maintain a database to store the
3 PCCSleepInfoDB
records of sleep time durations
in JSON format. Table I displays a summary of intents A static database to store the
defined for different use cases of the design. The chatbot 4 PCCTableWeekInfoDB
week wise information content
initially records the pregnancy due date, to offer suggestions A static database to store the
5 PCCTopicTipsDB
and recommendations depending upon the ongoing week of topic wise information content
pregnancy. It also captures other personal details such as
name, mobile phone, and email. The developer must build and deploy the skill before
testing it. A valid AWS Lambda ARN endpoint is mandatory
TABLE I. SUMMARY OF INTENTS DEFINED for a skill to function.
SN Intent name Description
Capture an exercise activity record B. Testing and validation methodologies
1 ExerciseRecord in the Exercise diary, take inputs: Initially, the Echo dot device was tested after its setup by
Exercise duration and type
the awaking words and with commonly asked questions.
Share exercise diary records
2 EmailDiary through the email, capture inputs: ‘Utterance profiler’ can be used during the ‘Build’ phase
Start date, End date
to test the defined utterances before actually deploying the
Detect the topic in the user’s query
3 TopicTips
to provide relevant tips and content skill. Utterances are tested to verify if Alexa can identify or
Note down the symptom shared by invoke the desired intent or not. As the user is also asked to
4 CheckSymptoms
the user and check if it is a enter the inputs, the working of defined slots and dialog
commonly observed symptom in delegation can also be tested through the utterance profiler.
the specific pregnancy week However, it is not possible to verify the functioning of
Capture a record of sleep time
5 SleepRecord duration in the Sleep logs table,
subsequent actions as the Lambda function is not triggered
capture input: Sleep time while testing the utterances.
Detect the emergency situation and
6 EmergencyHandling notify the doctor & ambulance with
Once the skill is deployed, ‘Alexa Simulator’ is useful to
a mobile message and email test the functions without using any Alexa enabled smart
Share content about the symptoms speaker. Alexa Simulator supports text messaging as well as
7 SignsSymptoms commonly observed during the voice interaction, maintaining the session just like an actual
specific pregnancy week device. I/O section in the Alexa Simulator lists the
Provide general recommendations, interaction between user and Alexa as the input-output
8 Suggestions tips, suggestions for the specific
pregnancy week command interface in JSON format. Input JSON can be used
Provide information about the to crosscheck the handler parameters. Output JSON is useful
9 MomFeelings emotional feelings experienced to verify the Alexa responses, output speech parameters. The
during the specific pregnancy week ‘Device logs’ has information about events, sequential dialog
Share information regarding the steps execution with the exact timestamp.
10 BabyDevelopment status of baby development in the
specific pregnancy week AWS Management console can be referred to verify the
functioning of subsequent actions triggered by the Lambda
Authorized licensed use limited to: University of Edinburgh. Downloaded on June 15,2020 at 01:47:11 UTC from IEEE Xplore. Restrictions apply.
function code. ‘CloudWatch’ logs can be used while and popularity for different topics can be further analyzed to
debugging the errors and tracking the step-wise code keep a track of personal health, and well-being thereby
execution. The most expensive and the most recent Lambda monitoring the pregnancy. The data can also be utilized to
invocations are listed under the ‘CloudWatch Logs Insights’ improve the engagement of a user with the solution. As
section. anyone else can also interact with the smart speaker, security
and authentication is required to restrict the access to the
Amazon Alexa app can be used to test the Alexa skill on authorized user only.
a smartphone; it is available for Fire OS, Android and iOS-
based devices. The skill can be tested even before publishing
it, provided that the same Alexa developer account has been REFERENCES
used to access the app. The two main features of the app - [1] Nadia Tripp, Kirsten Hainey, Anthony Liu, Alison Poulton, Michael
Alexa history and App cards are useful for testing. App Peek, Jinman Kim, Ralph Nanan, “An emerging model of maternity
Cards provide contain a reply to the user along with the care: Smartphone, midwife, doctor?”, Women and Birth, November
2013
audio response. ‘Alexa history’ keeps a track of audio
[2] Ch.Sitha Mahalakshmi, T.Sharmila, S.Priyanka, Mr.Rajesekhar
interactions made with Alexa. It is useful to crosscheck if Sastry,Dr. B V Ramana Murthy and Mr.C Kishor Kumar Redd, “A
Alexa is successfully identifying an utterance or not. It can survey on various chatbot implementation techniques”, Journal of
also be used to figure out problems in audio interactions. Applied Science and Computations ISSN NO: 1076-5131 Volume VI,
Issue I, January 2019
[3] Sanket Sadavarte, “Pregnancy Companion Chatbot Using Amazon
V. CONCLUSION AND FUTURE SCOPE Echo Dot”, Masters project report submitted at Queen Mary
The chatbot solution offers suggestions and University of London, Aug 2019
recommendations depending upon the ongoing week of [4] Laumer, Sven, Maier, Christian, Gubler Fabian, “Chatbot acceptance
pregnancy; such as baby development, commonly in healthcare: Explaaining user adoption of conversational agents for
disease diagnosis”, 27th European Conference on Information
experienced emotional feelings, observed symptoms, Systems (ECIS), Stockholm & Uppsala, Sweden, June 8-14, 2019
suggestions, and recommendations about other relevant [5] Chen Wei, Zhichen Yu, Simon Fong, “How to Build a Chatbot
topics. The design also addresses one more limitation of the Framework and its Capabilities”, ICMLC 2018, February 26-28,
existing solutions, providing mobile message and email 2018, Macau, China
notification service in the case of an emergency. The chatbot [6] H. Hsin, “Towards a consensus around standards for smartphone apps
records daily sleep duration and regular exercise activities, and digital mental health”, World Psychiatry 18:1 - February 2019
by maintaining a diary log which is useful while consulting [7] BabyCenter, L.L.C, (2019). Babycenter website home page. [online]
the doctor. It also provides tips and information about Available from https://www.babycentre.co.uk/ [Accessed 04 July
2019]
multiple topics that are relevant during pregnancy like
exercise activities, alcohol consumption, smoking, vitamin [8] Lucia Vaira, Mario A. Bochicchio, Matteo Conte, Francesco
Margiotta Casaluci, Antonio Melpignano, “MamaBot: a System based
supplements, and healthy diet. on ML and NLP for supporting Women and Families during
Pregnancy”, IDEAS 2018, June 18–20, 2018
The paper presents a proof of concept model to analyze
the multiple possible services, which a pregnancy companion [9] Viswanath Venkatesh, James Y. L. Thong, Xin Xu, “Consumer
Acceptance and Use of Information Technology Extending the
chatbot can provide. The primary objective was the Unified theory of acceptance and use of technology”, MIS Quarterly
implementation of the probable use cases by applying a Vol. 36 No. 1, March 2012
suitable technology. The proposed solution is not a full-proof [10] Amazon Web Services (AWS), (2018). “What Is AWS Lambda?,
solution; however, it is possible to further extend its features Documentation” [online] Available from
and the technology application demonstrations to structure a https://docs.aws.amazon.com/lambda/latest/dg/welcome.html
complete solution. For instance, alert messages and email [Accessed 24 July 2019]
notification service can be applied in designing added [11] Amazon Web Services (AWS), (2018). “What Is Amazon
DynamoDB?, Documentation”. [online] Available from
functionality such as booking an appointment for the health https://docs.aws.amazon.com/amazondynamodb/latest/developerguid
checkup. e/Introduction.html [Accessed 04 July 2019]
The proposed approach of recording sleep time and [12] Amazon Web Services (AWS), (2018). “Amazon Simple Notification
Service, Overview”. [online] Available from
exercise activities from the user conversation can be replaced https://aws.amazon.com/sns/ [Accessed 04 July 2019]
with the help of smart fitness devices or body wearable’s to [13] Amazon Web Services (AWS), (2018). “Amazon Simple Email
record them automatically. Smart healthcare devices that Service, Overview”. [online] Available from
monitor personal health parameters such as blood oxygen https://aws.amazon.com/ses/ [Accessed 04 August 2019]
level, Electrocardiogram readings, heart rate, and body [14] National Health Service- Public Health England, (2018). “Week-by-
temperature; can be used along with the chatbot system to week guide to pregnancy”. [online] Available from
identify the emergency. https://www.nhs.uk/start4life/pregnancy/week-by-week/ [Accessed 24
July 2019]
The data captured by the chatbot can be used for building
predictive analytics. User questions, their timing, frequency
Authorized licensed use limited to: University of Edinburgh. Downloaded on June 15,2020 at 01:47:11 UTC from IEEE Xplore. Restrictions apply.