Conversation must remain bounded
Participants ask open-ended questions, but clinical wording must come from approved content or a controlled education path rather than unrestricted model output.
How the National University of Singapore and Mahalo built Fenotype: a governed intermittent-fasting companion with participant coaching, nurse oversight, deterministic safety gates, and auditable AI-assisted routing.

“Mahalo has been highly responsive in translating detailed research feedback into practical improvements. Fenotype gives us a way to study a conversational behavioural intervention while retaining the structure, safety logic and inspectability required for research.”
Executive summary
Fenotype is a clinical-grade behavioural intervention built by the Institute for Digital Medicine at the NUS Yong Loo Lin School of Medicine. It supports intermittent-fasting study participants through a WhatsApp-style companion while giving nurses and researchers a control room for enrolment, safety review, adherence, content, analytics, simulation, and audit. The system combines deterministic state and safety rules with AI-assisted classification. The model labels intent and urgency; approved messages and knowledge provide the participant-facing clinical content.
The programme needed to coach participants every day without asking a clinician to type every reply and without allowing a general-purpose model to improvise medical advice. Web chat, mobile, and WhatsApp all enter one shared message pipeline. Participants can start and end fasts, ask questions, log weight and blood pressure, receive scheduled support, and complete behavioural activities. Study staff enrol participants, maintain approved content, monitor safety and adherence, inspect conversations, and test the real engine against simulated scenarios.
The challenge
Participants ask open-ended questions, but clinical wording must come from approved content or a controlled education path rather than unrestricted model output.
Crisis, symptom, blood-pressure, medication, pregnancy, and fasting-risk signals need deterministic handling before ordinary conversation or AI classification.
Participant coaching, biometrics, adherence, nurse review, scheduled activities, and research analytics need one operational record.
Goals, preferences, adherence, barriers, and recent context can shape support only when each decision remains traceable.
Researchers and clinical reviewers need simulation, adversarial scenarios, evaluation, and regression workflows before changing live behaviour.
A one-purpose form builder would have addressed only the simplest data-collection needs. A fully bespoke application could have reproduced the workflows but would have required the customer to fund and maintain a separate product foundation. Mahalo provided a configurable middle path: reusable clinical-research and connected-care infrastructure adapted around the programme. Five characteristics were especially relevant: 1. Configurable journeys. Participant, patient and staff experiences could be shaped around the programme rather than forced into a fixed generic sequence. 2. Longitudinal operation. Activities, content, reminders, follow-up and data could be organised over time. 3. Role-aware access. Researchers, clinicians, coaches, administrators and participants could receive different capabilities and visibility. 4. Integration readiness. Devices, external systems, identity services, data sources and exports could be incorporated where the programme required them. 5. Delivery partnership. Mahalo remained involved in interpretation, configuration, testing, release and support rather than handing over an isolated codebase.
The Mahalo solution
Web, mobile, and WhatsApp messages enter the same controlled handler, carrying channel context without creating separate conversational logic.
Fixed signal extraction and sticky safety routes run before classification, knowledge retrieval, coaching, or question handling.
The model classifies intent, sentiment, and urgency. Approved templates, message-library content, and grounded knowledge provide participant-facing clinical wording.
Staff enrol participants, monitor safety and adherence, review flagged turns, manage approved content, inspect analytics, and control feature rollout.
A state machine, scheduled questions, reminders, fasting events, measurements, and mechanism selection coordinate support over time.
Simulation, adversarial BioTwin scenarios, evaluation sets, QA checklists, shadow routing, and emergency switches make changes reviewable and reversible.
Information flow
Onboarding, activities, content, reports, and communication.
Configured program logic, timing, permissions, and longitudinal data.
Oversight, review, configuration, exceptions, and follow-up.
Connected devices, external systems, and structured downstream use.
Platform components
Implementation and delivery
Fenotype was rebuilt around the live operating model documented in its canonical technical guide. One React and Node application serves the participant and staff surfaces, while PostgreSQL and pgvector preserve the longitudinal record, approved knowledge, safety context, adherence, measurements, and audit evidence. The message pipeline is intentionally ordered: request validation, deterministic safety extraction, a hard safety gate, answer grading, AI-assisted classification, state transition, grounded response selection, final auditing, persistence, and nurse-alert creation. Experimental natural-conversation features remain off by default and can be force-disabled independently of the core programme.
Operational value
A participant companion that remains bounded by the approved programme.
Deterministic safety handling before any model call.
One longitudinal record across coaching, biometrics, adherence, research activity, and nurse review.
AI used for classification and constrained education rather than autonomous clinical decisions.
A staff control room for content, safety, analytics, adherence, testing, and rollout.
Durable evidence showing what happened, why a route was chosen, and what content was delivered.
Delivery lessons
A product can technically contain all required features and still fail to represent the way participants and staff move through the programme. Sequence, timing, ownership and exception handling need explicit design.
Devices, EHRs, payment processors, identity providers, AI models, content sources and institutional certification can determine the timeline. They are part of the product, even when Mahalo does not control them.
UAT should verify the complete result: what the participant did, what the staff member saw, what an external system recorded and what appeared in reporting or export.
Research and care programmes evolve. Approved changes should not make it impossible to reconstruct what was configured, tested, released and shown to users.
A well-delivered platform can improve operational capability. It does not by itself prove a clinical, behavioural or scientific result.
Mahalo perspective
“The goal was not to build a chatbot that could talk about everything. It was to create a governed digital companion that could support a fasting journey and recognise when ordinary coaching should stop and safety handling should begin.”
Fenotype is not a generic chatbot or a theory page. It is an operating Research + Care programme: participants receive daily behavioural support, measurements and safety handling, while nurses and researchers run enrolment, content, review, adherence, analytics, testing, and audit from one governed environment.
Tell us where to start: Research Care Both — the walkthrough is tailored to your answer.