MamaCare AI Methodology

MamaCare was built in safety-first layers so accuracy and trust could be improved step by step. The guiding principle: in maternal health, a warm answer must still be safe, grounded, and able to escalate. Retrieval and safety are kept deliberately separate so each can be reviewed on its own.

01
Curate a trusted maternal knowledge layer
The highest-trust layer is hand-curated KnowledgeCard JSON — structured cards with a title, trimester, topic tags, common mother-style questions, a plain-language answer, "when to seek care" guidance, and danger signs. Curated cards prevent the assistant from answering mothers with raw report fragments or invented detail.
02
Add a lexical FAQ fast path for must-answer questions
Critical maternal questions ("Is my baby moving enough?", "What foods should I avoid?") must never be missed. A lexical matcher scores the question against each card's keywords and common questions and answers directly when the match is strong — protecting must-answer coverage before semantic search runs.
03
Build a local semantic RAG pipeline
When the fast path is weak, the full application embeds cards with sentence-transformers/all-MiniLM-L6-v2 and retrieves the nearest cards from a persistent ChromaDB index. Semantic retrieval handles paraphrased and natural phrasing; lexical matching protects the critical questions. Running locally keeps the prototype usable without an external API.
04
Enforce safety guardrails outside retrieval
A small, explicit rule engine runs before answer generation. It detects emergency symptom patterns (heavy bleeding, no fetal movement, severe headache, convulsions), self-harm and crisis language, medication and dosage requests, privacy risks (names, numbers, contacts), and out-of-scope topics. Emergencies and crises escalate immediately; dosage advice is blocked. Keeping safety deterministic makes it auditable with clinicians rather than hidden in a model.
05
Format a warm, grounded, cited response
The response layer turns the retrieved card into a supportive answer in plain language, attaches "when to seek care" notes, surfaces danger signs where relevant, and cites the source card. When trusted grounded context is weak, it uses an uncertainty fallback and points the mother to a midwife or antenatal clinic instead of guessing.
06
Govern with an ITU-aligned ML pipeline
For scaling, the project follows an ITU-style ML pipeline view — trusted data sources, collection, preprocessing, modelling, policy enforcement, distribution, and continuous improvement — with MLflow supporting experiment tracking, a model registry, evaluation, and artifact management. This makes knowledge growth and clinician review repeatable and accountable.

Why separate retrieval from safety?

A single model that both retrieves and judges safety is hard to audit and easy to jailbreak. By making safety a deterministic, reviewable rule layer that sits in front of retrieval, MamaCare can be checked line-by-line with safety and clinical stakeholders, and emergencies are handled the same way every time regardless of phrasing. This is the design choice that makes the assistant appropriate for a sensitive domain.

📄 Documentation 💡 Use Cases 🤖 Open AI Sandbox →