Inspiration
MamáMind is an AI-powered WhatsApp nutrition companion designed to empower pregnant women with culturally relevant, trimester-specific dietary guidance, backed by real-time research and credible citations. Our mission is to enhance maternal health by providing accessible, personalized nutrition support, particularly for women in underserved regions where prenatal care is limited.
Globally, over 800 women die daily from preventable pregnancy-related causes, with 94% of these deaths occurring in low-resource settings (WHO, 2023). Malnutrition is a key contributor, yet many women lack tailored dietary guidance. With over 2 billion WhatsApp users worldwide, this platform offers an unparalleled opportunity to reach women in the Global South. We envisioned: What if a world-class AI nutritionist could deliver life-saving advice through the world’s most popular chat app?
What it does
MamáMind is a WhatsApp-based chatbot that supports pregnant women by:
- Onboarding Users: Collects text-based input on pregnancy stage (trimester), dietary preferences (e.g., vegetarian, vegan), allergies (e.g., peanuts), cultural cuisines (e.g., Nigerian, Indian, etc), and conditions (e.g., anemia) to personalize the experience.
- Generating Meal Plans: Delivers a 7-day vegan meal plan with breakfast, lunch, dinner, and two snacks, tailored to user preferences and pregnancy needs. Users can select a day (e.g., "Monday") and meal (e.g., "Breakfast") to view detailed recipes, nutritional benefits, and citations.
- Answering Nutrition Queries: Responds to dietary questions (e.g., “Is turmeric safe during pregnancy?”) with evidence-based answers using the Perplexity Sonar API.
- Prompting Sharing: Offers to share meal plans with partners or family (e.g., text/PDF generation).
How we built it
- Backend: Developed using Python and Django, with a modular architecture for handling user interactions and state management. The
BotLogicclass manages conversation flow, integrating with Twilio’s WhatsApp API via a webhook. - AI Integration: Utilizes the Perplexity Sonar API to generate meal plans and answer Q&A, delivering JSON-formatted responses with meal details, recipes, nutritional benefits, and citations (e.g., WHO, ACOG). The
SonarAPIclass handles API calls and JSON parsing. - Database: Django ORM (SQLite for development) stores user profiles (
User), meal plans (MealPlan), and preferences (DietaryPreference,PregnancyCondition) for persistence. - Messaging: Twilio WhatsApp API ensures reliable message exchange, with message length capped at 1500 characters to comply with the 1600-character limit.
- Input Handling: Text-based input (e.g., “Vegetarian” instead of radio buttons) is parsed to match predefined options, enhancing flexibility but requiring robust error handling.
- Testing: Used Ngrok for local webhook testing, with logging to debug issues like state transitions and API response parsing.
Challenges we ran into
- Context Retention: Dynamically tracking user context (e.g., trimester, allergies, cultural preferences) across multiple states was complex, requiring a state machine (
AWAITING_TRIMESTER,AWAITING_MEAL_SELECTION). - Cultural Relevance: Balancing evidence-based nutrition (e.g., iron for anemia) with culturally familiar meals (e.g., Fonio Pancakes for Nigerian users) demanded careful prompt engineering for the Sonar API.
- Twilio Constraints: The 1600-character limit necessitated truncation logic for meal details, and sandbox restrictions (e.g., phone number whitelisting) delayed early testing.
Accomplishments that we're proud of
- End-to-End Flow: Built a functional WhatsApp chatbot from onboarding to meal plan generation and meal detail retrieval, all within a text-based interface.
- Sonar Integration: Successfully integrated the Perplexity Sonar API to deliver real-time, citation-backed meal plans and Q&A responses, with sources like PubMed and ACOG.
- Cultural Sensitivity: Incorporated culturally relevant dishes (e.g., Fonio Pancakes, Kenkey) for diverse users, enhancing accessibility for all countries.
- Health Equity Focus: Addressed a critical maternal health gap with a low-bandwidth, WhatsApp-based solution suitable for low-resource settings.
- Robust Error Handling: Implemented logging and fallback mechanisms to handle invalid inputs and API errors, ensuring a smooth user experience.
What we learned
- AI in Maternal Health: AI can transform maternal nutrition, but trust hinges on cultural alignment, credible citations, and empathetic tone tailored to expectant mothers.
- WhatsApp’s Potential: As a widely adopted platform, WhatsApp is an underutilized channel for delivering scalable, life-saving health interventions in low-connectivity regions.
- User-Centric Design: Starting with the lived experiences of pregnant women—rather than clinical assumptions—leads to more impactful product decisions.
- Technical Insights: Managing conversation states in a text-based chatbot requires careful state tracking, and Twilio’s character limits demand concise, prioritized messaging.
- Time Management: Prioritizing core features (meal plans, Q&A) over secondary ones (tips, sharing) was critical under hackathon constraints.
What's next for MamáMind
Complete Core Features:
Multilingual Support: Add Hindi, Swahili, and Spanish flows to reach broader audiences.
Community Partnerships: Collaborate with midwives, NGOs, and maternal health organizations to deploy MamáMind in low-resource regions.
Enhanced Features: Introduce mood tracking, mental health support, and postpartum nutrition guidance.
Public Beta: Launch a beta for 1,000 mothers by Q4 2025, gathering feedback to refine UX and features.
Scalability: Optimize for high user volumes with async processing and cloud deployment (e.g., AWS).
MamáMind: Nourishing Expectant Mothers, One Chat at a Time 🌟
Built With
- django
- perplexity
- postgresql
- python
- sonar
- twilio
- twilio-whatsapp-sandbox
Log in or sign up for Devpost to join the conversation.