From Diapers to Data: How AI is Transforming Postpartum Support

Creating a Chatbot for Postpartum Care

Shanzeh Haji
11 min readNov 22, 2023

The journey into motherhood is a celebration of life, love, and change.

Each mother’s experience in the weeks and months following childbirth is a unique story. These stories are filled with small victories, learning curves, and the immense love that grows with every sleepless night and lullaby.

This is the essence of the postpartum journey — a time of personal growth, bonding, and unparalleled love. But, this journey is a difficult one for many. The accumulation of sleepless nights can become overwhelming, stress may intensify, and one might find themselves feeling isolated along the way.

Outline of Article:

1. Introduction: Promoting postpartum well-being through emotional and physical practices and checkups.

1.1. Emotional and Physical Well-being

1.2. Postnatal Checkups

2. Status Quo: Companies driving innovation in postnatal care are Memora Health, Maven Clinic, Oath Care and BRIA.

2.1. Memora Health

2.2. Maven Clinic

2.3. Oath Care

2.4. BRIA

3. The Backbone of the Chatbot: GPT-3.5 Turbo uses a transformer architecture for generating human-like text.

3.1. GPT-3 and its Capabilities

4. Sourcing Information: The chatbot uses a dataset to provide relevant and science-backed answers.

4.1. Sourcing and Curating the Dataset

5. Using NLP to understand user inputs and generate responses.

5.1. Understanding User Inputs to Generate Responses

6. Future Enhancements and Scalability

Promoting postpartum well-being through emotional and physical practices and checkups.

1.1. Emotional and Physical Well-being

Sleep: New mothers often find themselves grappling with sleep deprivation due to the demands of caring for a newborn. To ensure a smoother recovery, it is advisable for them to seize the opportunity to rest when the baby sleeps.

On average, each new parent loses a staggering 109 minutes of sleep every night for the first year after having a baby.

The goal is to accumulate a sufficient amount of sleep throughout the day, ideally aiming for at least 7–9 hours of sleep per day. In addition to nighttime sleep, incorporating short naps whenever the baby rests can help new mothers maintain their energy levels and overall well-being.

Hydration: Proper hydration is a vital aspect of postpartum recovery, especially for mothers who are breastfeeding. Staying adequately hydrated not only supports overall health but also plays a crucial role in the production of breast milk.

New mothers are advised to aim for approximately 128 ounces (3.8 litres or 16 cups) of water per day. This ample fluid intake can help ensure that their bodies have the necessary resources to support hydration and the production of nutritious breast milk, providing essential nourishment for their infants.

Physical Activity: Engaging in appropriate postpartum exercises, as recommended by healthcare providers, can significantly aid in the recovery process for new mothers. It is recommended that they strive for at least 150 minutes of moderate-intensity aerobic physical activity per week. Activities such as brisk walking can be spread out over the week, for example, with 30 minutes of exercise on five separate days. Scientific evidence indicates that the risks associated with moderate-intensity aerobic activity, like brisk walking, are minimal for healthy pregnant women.

This regular physical activity not only promotes recovery but also offers several benefits, including reducing the risk of excessive weight gain, decreasing the likelihood of gestational diabetes, and alleviating symptoms of postpartum depression.

Good Nutrition: Maintaining a healthy and balanced diet is paramount for postpartum recovery and the ability to provide adequate care for a newborn. New mothers should focus on consuming a well-rounded diet that includes specific nutrients crucial for recovery and breastfeeding support.

Incorporate protein-rich foods 2–3 times per day (e.g., lean meat, poultry, fish, eggs, dairy, beans, nuts, and seeds) for tissue repair and breast milk production. Include iron-rich foods like lean beef to boost energy levels. Consume omega-3 fatty acid-rich foods, such as salmon, for the baby’s nervous system development. Incorporate low-fat dairy products for calcium, essential for bone health and milk production. Consume a variety of fruits and vegetables for vital vitamins, minerals, and fibre.

Aim for approximately 500 extra calories per day, focusing on nutrient-dense whole foods rather than processed options to support both breastfeeding and recovery. These dietary practices optimize recovery, maintain energy levels, and ensure the production of nutritious breast milk, benefiting both mothers and newborns.

1.2. Postnatal Checkups

Postnatal Visits: Regular postnatal checkups in the first 6 weeks are essential for promoting a healthy lifestyle, preventing diseases, and ensuring access to comprehensive sexual and reproductive healthcare. These postpartum visits provide a critical opportunity for healthcare providers to monitor the physical and emotional well-being of both the mother and the newborn. They involve assessing vital signs, evaluating the healing process after childbirth, and addressing any potential complications or concerns that may arise during this crucial period.

By attending at least four postpartum visits in the first 6 weeks, women and newborns can benefit from comprehensive care that enhances their overall health and well-being during this transitional phase.

Home Visits: Early postnatal home visits play a vital role in supporting the establishment of breastfeeding and addressing any challenges related to attachment and positioning. These visits offer a personalized approach to care, allowing healthcare providers to assess the mother and infant in the comfort of their home environment. This setting is conducive to addressing specific concerns and providing tailored guidance on breastfeeding techniques, infant care, and postpartum recovery.

Home visits also facilitate a deeper understanding of the family’s dynamics and support system, enabling healthcare professionals to offer targeted assistance and education.

Companies driving innovation in postnatal care are Memora Health, Maven Clinic, Oath Care and BRIA.

2.1. Memora Health

Memora Health has developed SMS-based, digitized care programs to engage and support postpartum patients after they leave the hospital. The platform uses AI-backed, digitized care programs to proactively interact with patients from their homes and address patient responses in real-time, tailored to each patient’s needs.

This initiative aims to extend care to postpartum patients, empowering them to have a more connected care experience while reducing the burden on clinical and administrative care teams

2.2. Maven Clinic

Maven Clinic provides personalized, ongoing postpartum care to new moms and infants through direct communication with healthcare providers. The platform offers support groups and access to doulas, midwives, and nurses for postpartum care. Maven Clinic’s app aims to support new mothers after birth, offering features such as breastfeeding support, pelvic floor training, depression screening, and more.

By providing a comprehensive suite of postpartum care services and resources, Maven Clinic addresses the diverse needs of new mothers, offering a holistic approach to postnatal care and support.

2.3. Oath Care

Oath Care offers a digital platform that connects parents going through similar experiences to vent, ask for advice, and feel supported in expert-moderated groups. The platform provides a judgment-free, safe space for parents and offers instant answers to every parenting question. Oath Care also provides access to a team of medical experts, including perinatal wellness experts, marriage and family therapists, certified lactation consultants, and more, to offer evidence-based wisdom and personalized advice.

By leveraging digital connectivity and expert guidance, Oath Care aims to provide a supportive and informative environment for new parents, addressing the emotional nd informational needs that arise during the postpartum period.

2.3. BRIA

BRIA is a comprehensive virtual mental health clinic for women across reproductive life stages, including those in the postpartum period. The platform offers inclusive, comprehensive mental health services to support and treat mental health struggles as women navigate the postpartum period. BRIA clinicians, with many years of experience treating postpartum women, provide evidence-based treatments with compassion and empathy.

The platform addresses common postpartum mental health challenges, such as anxiety and anger, offering personalized care plans, therapy services, and additional medical services if required. BRIA’s goal is to ensure that women have timely access to high-quality mental healthcare across reproductive life stages, including postpartum and perimenopause.

The platform offers integrative services, including talk therapy, couples/sex therapy, fertility decision-making support, MD psychiatric care, hormonal assessments, ADHD care, sleep and nutrition coaching, and Care Coordinators to guide the recovery journey.

What I Created:

GPT-3.5 Turbo uses a transformer architecture for generating human-like text.

3.1. GPT-3 and its Capabilities

In order to create the chatbot, I used GPT-3.5 Turbo. GPT-3 (Generative Pre-trained Transformer 3) is an advanced language processing AI developed by OpenAI. It’s one of the largest and most sophisticated language models available, trained on a vast corpus of text data. This allows it to generate human-like text, understand and respond to user inputs, and even simulate conversations. Specifically for this chatbot, GPT-3 can provide realistic and empathetic responses, simulating a ‘digital companion’ for new mothers.

GPT-3.5 stands out due to its transformer architecture. Transformer architecture is a type of neural network designed to handle text sequences of varying lengths. The concept of transformers was based on a paper titled “Attention Is All You Need” which was published in 2017. The key concepts behind Transformers include positional encodings, attention, and self-attention.

Let’s say the user asks “What are the symptoms of postpartum depression?":

  1. Positional Encodings: These are used to help the model understand the position of words in a sequence, allowing it to interpret word order effectively. Given the input “What are the symptoms of postpartum depression?”, positional encodings would allow the model to recognize the order of the words and their relationships.
  2. Attention: The attention mechanism allows the model to focus on different parts of the input sequence, enabling it to capture the relationship between each word and other words within the same sentence.
  3. Self-Attention: This is a specific type of attention mechanism that allows the model to pay more attention to some inputs than others, regardless of where they show up in the input sequence. In our example, self-attention might help the model focus on the key terms “symptoms” and “postpartum depression” while giving less importance to words like “What” and “are”.

GPT-3.5 is also widely used since it has 175 billion parameters. In a language model like GPT-3.5, the parameters are the internal settings that the model learns from the text it’s trained on. These settings help the model understand language, generate responses, and make predictions.

The number of parameters in a model is important because it affects the model’s ability to capture complex patterns in the data. A larger number of parameters allows the model to capture more intricate patterns. On the other hand, a smaller number of parameters may limit the model’s ability to capture complex patterns, potentially leading to underfitting.

The chatbot uses a dataset to provide relevant and science-backed answers.

4.1. Sourcing and Curating the Dataset

The dataset plays a crucial role in shaping the functionality and effectiveness of the chatbot. It acts as a foundational knowledge base from which the chatbot draws its responses. The dataset used in the project is structured into several ‘tags’, each representing a specific topic relevant to new mothers, such as “breastfeeding-challenges,” “physical-recovery-postpartum,” or “nutrition-postpartum.” For each tag, there are associated ‘patterns’ and ‘responses’.

  1. Patterns: These are typical user queries or statements that the chatbot might encounter. They serve as examples of how users might phrase their questions or concerns. For instance, under the tag “breastfeeding-challenges,” patterns include statements like “I’m having trouble breastfeeding” or “Breastfeeding is painful.” These patterns train the chatbot to recognize user inputs that fall under each specific tag.
  2. Responses: These are pre-formulated answers that the chatbot can provide in response to the recognized patterns. They are crafted to be informative, supportive, and tailored to the context of each tag. For example, for the “breastfeeding-challenges” tag, the responses offer advice on seeking guidance from lactation consultants or healthcare professionals. The differentiation factor of this chatbot is that the responses are crafted through data backed by scientific studies (ex. the amount of exercise, the amount of water to drink, the food that is best, etc.)

To sum it up, when a user inputs a query, the chatbot compares it against the patterns in the dataset. Once it finds a match or a close similarity, it selects a corresponding response from the associated tag. This dataset-driven approach ensures that the chatbot’s responses are relevant and specific to the needs and concerns of new mothers.

Using NLP to understand user inputs and generate responses.

5.1. Understanding User Inputs to Generate Responses

  1. Tokenization and Text Preprocessing: Initially, the user’s input text is broken down into smaller units called tokens which are typically words. This process also involves cleaning and normalizing the text, such as converting it to lowercase, removing punctuation, and handling special characters.
  2. Pattern Matching and Intent Recognition: The tokenized input is then analyzed for pattern matching. The chatbot uses algorithms to compare the input against the ‘patterns’ in its dataset. This step is crucial for intent recognition — understanding what the user is asking or talking about. Advanced techniques like vectorization (converting tokens into numerical values) and semantic analysis (understanding the meaning behind words) are also used.
  3. Contextual Understanding: For more advanced responses, the chatbot employs contextual understanding, which means it takes into account not just the current input but also previous interactions. This can involve maintaining a conversation state or using context-aware algorithms that understand the sequence and relevance of inputs over a conversation.
  4. Generating Responses: Once the intent is recognized, the chatbot selects an appropriate response from its dataset. In models like GPT-3.5, this might also involve generating a response that’s not pre-scripted but constructed on the spot, all of which the chatbot does. This is where GPT-3.5’s language generation capabilities come into play, using its understanding of language structures and contexts to create responses that are coherent, relevant, and empathetically aligned with the user’s input.

Future Enhancements and Scalability

6.1. Upcoming Features

My plan for this digital platform is to enable users to log and track various health metrics, such as sleep patterns, hydration, and emotional states, creating a ‘digital diary’ of their postpartum journey. This continuous tracking provides valuable insights into their well-being, highlighting patterns that could indicate a deeper issue, like PPD.

But more than a tracking tool, I want to combine the built AI chatbot, to simulate supportive conversations, much like those with a trusted friend. I want to program a feature that initiates check-ins, offers words of encouragement, and provides gentle reminders for self-care activities, contributing to the user’s emotional well-being.

By utilizing AI, this platform transcends the limitations of traditional methods. It eliminates the need for scheduling appointments, thus eradicating any associated stigmas of seeking help. The AI chatbot component allows for anonymity and a judgment-free experience, empowering mothers to open up about their struggles.

By identifying trends in the data, it can also suggest when a user may need to seek further help, bridging the gap between technology and traditional healthcare services.

I appreciate your reading, and I hope you learnt something 😊. Feel free to connect with me on Linkedin and send me a note if you enjoyed reading this post or have any questions. You can also follow my Medium page and remain updated on all the content I produce! Check out my GitHub repository to learn more about the code.

--

--

Shanzeh Haji
Shanzeh Haji

Written by Shanzeh Haji

I'm a 15y/o longevity enthusiast on a mission to make a positive contribution to society by exploring ways to increase lifespan

No responses yet