From dai to AI: Lahore experiments with a virtual midwife
Aga Khan University’s annual Paediatrics & Child Health Conference on Saturday. Photo Express
A year ago, Dr Maryam Mustafa and her team from LUMS visited a basic health unit on the outskirts of Lahore to evaluate its new digital government system meant to track medicines and generate electronic medical records. But the system ran only on desktops — and the electricity was out.
Without power, even the simple printed slip needed to see a doctor couldn't be issued. Patients were turned away and asked to return the next day.
"As a technologist, I believe electricity is beyond my control," Dr Mustafa said during her keynote address at Aga Khan University's annual Paediatrics & Child Health Conference on Saturday. The theme was 'Catalysing Change in a World in Polycrisis'. "What I can control," she added, "is how I design for the worst-case scenario, which is: no electricity."
In Pakistan, the worst-case scenario is alarmingly bad. Women here are over 12 times more likely to die during childbirth than women in high-income countries. There are fewer than five midwives for every 10,000 people. At this rate, Pakistan will not reach even the most basic maternal healthcare standards for another 25 years — unless something drastically changes.
That change, according to Dr Mustafa, lies in Artificial Intelligence (AI).
"Pakistan is primed to leverage digital technologies, particularly AI tools, to close this gap," she said. But there's a major barrier: Pakistan has one of the largest mobile phone ownership gender gaps in Asia — at 37%. Most women either don't own a phone or share one within their household. And platforms like WhatsApp, which require a single SIM per user, aren't designed for shared usage.
Despite this, Dr Mustafa dreamed of using AI to collect patient data and build electronic medical records (EMRs) through speech input and Natural Language Processing (NLP). The model she envisioned would listen to women and tell them — based on their medical history — when they needed to seek care. AI, she pointed out, is particularly powerful at detecting early risks like preeclampsia or postpartum hemorrhage using predictive models and ultrasound images. Chatbots can guide nurses through antenatal care step-by-step. Even in areas without trained sonographers, AI-powered ultrasounds can detect complications like fetal growth restriction. And speech-to-text tools can generate medical records instantly, allowing clinics to focus more on patients and less on paperwork.
But there was a problem. When Dr Mustafa's team approached hospitals in Punjab to begin building an AI model, the infrastructure just wasn't there. Most facilities only had paper registers that couldn't be scanned or digitized.
"Much of our medical data is fragmented, paper-based, or not digitised at all," she said. "And where digital systems do exist, they often lack clean, structured data — making it difficult to train reliable AI systems."
If they wanted to make AI work for all pregnant women in Pakistan — not just those visiting private hospitals — they had to get creative.
Doctors typically have just five to six minutes per patient. Dr Mustafa's team believed AI should free up this time by automating medical histories. They needed a virtual midwife — a chatbot that could ask the patient questions like: How many children do you have? How many were C-sections?
They also had to develop a Pakistan-specific medical language model that understood local terminology and expressions.
The result? By the time a patient walks into the doctor's office, AI has already turned their conversation with the chatbot into a structured medical record on the doctor's desktop. The Large Language Model (LLM) suggests follow-up questions and helps fill any data gaps. The doctor only needs to verify the record and add their examination notes — the rest is already there.
The breakthrough came in the form of WhatsApp.
Instead of building a whole new system, they designed a simple solution: Patients can use any phone (their own, a neighbor's, or one provided by the hospital) to message a designated WhatsApp number. All they have to do is send their CNIC number. The system then pulls up their existing medical history and fills in the conversation thread — so they're not starting from scratch each time they use a different phone.
A pilot of this system is underway at Shalimar Hospital, where patients interact with a virtual midwife on WhatsApp. Her questions are stored as part of their medical file, so when they eventually see a doctor, their full case history is already in place.
This approach also solves a critical challenge in maternal care: mobility. Many women move to their maternal homes in another city during pregnancy. The new doctor rarely has access to their prior records, unless they carry a physical file or recount everything verbally.
Dr Mustafa's solution? A QR code linked to a patient's EMR. Any clinician can scan it to access the entire medical history and add to it. This enables seamless care across clinics and hospitals — and ensures that no reports, lab results, or test data go missing. Whenever a new entry is added, the system alerts the designated clinician.
The pilot is also being rolled out at Gurkhi Trust & Teaching Hospital and Lady Willingdon Hospital in Lahore.
This might not be the high-tech, big-budget AI story you'd expect. But in a country where a power cut can shut down an entire clinic, it just might be the most practical revolution we need.