STEP 1
Visits and tests, in order
Karim came for a check-up in March 2023, paying himself. In June 2024 his doctor referred him for lipids. In September 2025 he came back for a check-up with HbA1c.
Three visits, two ways of arriving. Both are kept.
A tour of the patient model
How IDH’s ten million records become a living profile for every patient and household, what each profile triggers, how the engine decides what to send, and how every reply, or silence, makes the next decision better.
Karim, Nour, Samia and Youssef are a made-up family used as the example throughout. Figures are IDH’s reported numbers or cited sources; drawings marked “illustration” show how a method behaves, not a forecast.
01 · The profile
A patient is not a row in a table. Each visit, result, message and reply is an event with a date, and the profile is what those events add up to.
STEP 1
Karim came for a check-up in March 2023, paying himself. In June 2024 his doctor referred him for lipids. In September 2025 he came back for a check-up with HbA1c.
Three visits, two ways of arriving. Both are kept.
STEP 2
His HbA1c moved from 5.6% to 6.1%. On the ADA’s thresholds, that moves him from normal to the pre-diabetes range, and the ADA recommends testing pre-diabetes at least once a year.
ADA Standards of Care in Diabetes 2025
STEP 3
In November 2026 his yearly recheck fell due and a WhatsApp reminder went out. He read it and did not reply.
That silence is data. It goes on the timeline like a result.
STEP 4
The engine reads the timeline into a short list of variables: his state, what is due, how he arrives, who pays, which channel he reads, what he consented to, and who his family is.
Every later chapter adds to this card or reads from it.
02 · The family
A household’s health is shared: habits, history and who books for whom. Linking family members turns four thin records into one fuller picture, and every link says where it came from.
STEP 1
Karim, his wife Nour, his mother Samia and his son Youssef each have their own record at IDH. Nothing yet says they belong together.
STEP 2
Nour named Karim as next of kin when she registered: a recorded link. Youssef’s booking used Karim’s phone number, and Samia’s home visit went to Karim’s address: inferred links, drawn dashed.
Inferred links are used for timing and for asking, never to show one person another’s results.
STEP 3
Samia’s own results show diabetes. That gives Karim a family history of diabetes, which the ADA lists as a reason to test. It stays marked “inferred” until Karim confirms the link in one tap.
ADA Standards of Care in Diabetes 2025, screening criteria
03 · Triggers
Some results are not just a state, they are the start of a story with a known shape. The engine keeps a library of these sequences, written and approved by IDH’s medical team, and starts the right one when its event appears in the records.
STEP 1
Nour’s pregnancy test at IDH comes back positive. That one result sets a due date about 40 weeks away and starts a sequence of checks for her, and later for the baby.
It also pauses things: while she is pregnant, she gets no unrelated offers.
STEP 2
WHO recommends at least eight antenatal contacts: by 12 weeks, then at 20, 26, 30, 34, 36, 38 and 40. The ADA recommends a gestational diabetes test at 24–28 weeks. The engine times IDH’s antenatal packages to those weeks; what goes in each package is the medical team’s call.
WHO antenatal care guideline 2016 · ADA Standards of Care 2025, rec. 2.27
STEP 3
At birth the baby becomes a new member of the household, linked to Nour and Karim. Egypt screens newborns for congenital hypothyroidism, for hearing at 3–7 days and for 19 genetic diseases. The engine reminds the parents of these national checks as a service, and of child checks IDH offers later.
Abdelmoktader et al., Ann Saudi Med 2013 · State Information Service, 2019 and 2021
STEP 4
If Nour had gestational diabetes, the ADA recommends a glucose test 4–12 weeks after the birth, then screening every 1–3 years for life. That becomes her next sequence.
Other events start sequences the same way: a result above range, a yearly check falling due, a marriage, since Egypt requires premarital tests before a marriage is registered.
ADA 2025, rec. 2.28–2.29 · Law 126 of 2008, art. 31-bis of Civil Status Law 143/1994
04 · User and customer
The same reminder lands differently on a patient whose insurer pays, one who pays himself, and one whose doctor sent him. The profile carries all three facts, so the action can differ.
STEP 1
Youssef is the user and his father is the customer. Samia’s and Nour’s tests are paid by their insurers. Karim pays for himself.
At IDH, 80% of patients in the first half of 2026 came through contracts. IDH earned EGP 170 a contract test against EGP 381 a walk-in test.
IDH 1H2026 results
STEP 2
Did a doctor refer them, or did they come for a check-up? Is a payer covering it, or do they pay themselves?
Referred patients get the reminder and, with their consent, their doctor gets an update. No payment goes to doctors. Self-pay patients see the price first, and get IDH’s offer when there is one.
STEP 3
Samia was referred and is covered, so her doctor is kept in the loop. Nour is covered, so her message says so. Karim and Youssef pay for themselves, so they get the self-pay offer IDH sets.
05 · Outside data
A lab sees a patient a few times a year. A wearable sees them every night. With the patient’s permission, that data can fill gaps between visits.
STEP 1
WHOOP has an official API: the member signs in and grants access to sleep, recovery, cycles and workouts. On iPhone, HealthKit lets the user grant each data type one by one; on Android, Health Connect asks for read permissions the same way. Results from other labs can be uploaded as a file.
WHOOP developer docs · Apple HealthKit docs · Android Health Connect docs
STEP 2
Sleep data tells the engine when Karim is usually up, so a reminder lands after he wakes. Any clinical use of wearable data needs a rule IDH’s doctors write and approve. The engine never reads a wearable as a diagnosis.
STEP 3
The Model Context Protocol lets an AI agent call a data source as a tool. We found no official WHOOP MCP server; the community ones say they are not affiliated with WHOOP. So we would build our own read-only connectors on each official API, behind the patient’s consent.
WHOOP developer docs and engineering blog, checked November 2026
06 · The Egyptian calendar
Timing is part of the profile. Some moments are shared by everyone in Egypt, some move with the lunar calendar, and some belong to one patient’s week.
STEP 1
Ramadan 1448 is expected to start on 8 February 2027, by Egypt’s astronomy institute’s estimate. The IDF and DAR guidelines ask people with diabetes to have a pre-Ramadan assessment 6–8 weeks before, which puts the window at 14–28 December 2026. Eid al-Adha is expected around 16 May 2027, and World Diabetes Day is 14 November every year.
NRIAG via Al-Masry Al-Youm · IDF-DAR Diabetes and Ramadan Practical Guidelines 2021
STEP 2
The lunar year is about 354 days, so Ramadan, and the pre-Ramadan check window with it, moves earlier every year. A fixed “February campaign” would drift out of step; the engine computes the window each year from the expected start date.
Official dates depend on moon sighting; 2028 and 2029 are computed estimates
STEP 3
The engine also learns when each person reads. For Karim, evenings work and mornings do not; in Ramadan his pattern shifts later. Each pattern is learned from his own replies, so no one is assumed to keep anyone else’s hours.
Example of what is learned for one patient · not data
07 · Channels
WhatsApp, iMessage, SMS and email each have their own rules and their own readers. The engine keeps, for each person, which channels they agreed to and which they actually read.
STEP 1
WhatsApp marketing needs opt-in, caps how many marketing messages each user receives from all businesses, and lets users turn offers off. Apple’s Messages for Business reaches iPhone users in Messages, but Apple publishes no country list, so availability in Egypt is a question for Apple. SMS and email carry STOP and unsubscribe.
In October 2026, iPhones carried 17.9% of Egypt’s mobile web traffic.
Meta WhatsApp Business Platform docs · Apple Messages for Business docs · StatCounter, Oct 2026
STEP 2
Karim reads WhatsApp in the evening, has not agreed to SMS and leaves email unopened. Nour uses an iPhone, so iMessage is an option if Apple offers it in Egypt. Samia has no WhatsApp and reads SMS.
STEP 3
If WhatsApp’s per-user limit blocks a marketing message, Meta asks businesses to wait at least 24 hours before trying again. If a patient turns WhatsApp offers off, marketing on WhatsApp stops; another channel is used only if they agreed to it separately.
Meta: per-user marketing template limits, error 131049, June 2026
08 · The decision
Every night, for every patient with something due, the engine scores each thing it could do and does the best one that the rules allow.
STEP 1
Each action is a package, a channel, a time and an offer. Its score is the chance Karim books and comes, times what the visit is worth, minus the cost of sending, minus fatigue.
What a visit is worth has two parts: the health priority IDH’s doctors give the rule, and the margin from IDH’s own price list. Fatigue grows with each recent message to him and to his household.
STEP 2
Six options for Karim tonight, including sending nothing. The bars show how the scores compare.
Illustration of the method, not a forecast
STEP 3
SMS is out: he has not agreed to it. 23:30 is out: it falls in quiet hours. Of what is left, the HbA1c check with IDH’s self-pay offer, on WhatsApp at 21:00, scores best.
STEP 4
Two days after a message he read and did not answer, fatigue is higher for every option. Waiting now scores best, so nothing is sent tonight.
09 · Learning
Nothing the engine sends is wasted. A booking, a “not now” and no answer at all each teach it something about this patient, and about patients like him.
STEP 1
No reply lowers that hour and channel for him. “Remind me next week” snoozes, and keeps his interest on record. Declining an offer lowers that offer. Stop switches consent off. A booking is a success label for that exact action, and the visit’s result updates his state.
STEP 2
Early on, the engine is unsure which of three ways of sending the same reminder works best. It mostly sends its best guess and sometimes tries the others. As replies come in, the estimates narrow and the best way stands out.
Thompson sampling, a standard bandit method · illustration, not data
STEP 3
Records become features, the model re-scores, decisions go out, replies come back into the records. A random holdout gets no message, so the lift is measured, and the model’s predicted chances are checked against what actually happened.
10 · Guardrails
A model that only chased bookings would message too often. Caps, gaps, cool-downs and quiet hours sit outside the model, so it cannot learn its way around them. IDH sets every number.
STEP 1
Karim’s November: a reminder on the 3rd; a second campaign on the 5th is blocked as too soon; the World Diabetes Day campaign goes out on the 14th. On the 19th he taps “Remind me next week”, so a campaign on the 24th is blocked and the reminder returns on the 26th, as he asked.
STEP 2
Nour has a check due on the 26th too. The household cap moves hers to the 27th, each to their own number, so one home never gets a pile of messages on one evening. Nothing about one person’s health is sent to another.
Messages go out at hours IDH allows, never in quiet hours.
STEP 3
If he taps Stop on the 28th, marketing ends at once: his consent flag flips, and only service messages he asked for, such as results, continue.
Opt-out required by Egypt’s Law 151/2020 and WhatsApp’s policy
11 · The data
HIPAA is the United States’ health privacy law. Egypt’s Law 151 of 2020 is the law that governs here; we hold ourselves to HIPAA’s Privacy and Security Rules as well, because they spell out the safeguards a health record deserves.
STEP 1
The Security Rule asks for administrative, physical and technical safeguards. Administrative: a risk analysis, a named security lead, access by role and trained staff. Physical: records stay in IDH’s own cloud environment. Technical: unique log-ins, encryption, audit logs and automatic log-off.
HIPAA Security Rule, 45 CFR Part 164, Subpart C
STEP 2
A reminder says a check is due and how to book; it never carries a result. Results open only after sign-in. Each role sees only what its task needs: the contact centre sees the booking, not the results.
HIPAA Privacy Rule, minimum necessary standard, 45 CFR 164.502(b) and 164.514(d)
STEP 3
Every vendor that stores or processes records signs a business associate agreement. A channel that will not sign one never carries a result. If a breach happens, affected patients are told without unreasonable delay and within 60 days of its discovery.
There is no official HIPAA certificate; compliance is shown by audit, and we will open ours to IDH.
45 CFR 164.502(e), 164.504(e) · Breach Notification Rule, 45 CFR 164.404
12 · People and machines
Machines are good at reading ten million records every night. People are good at judgement, medicine and the things a rule did not foresee. The engine is built so each does its part, and each learns from the other.
STEP 1
The engine reads, scores, times and learns. IDH’s medical team owns the rules, packages and texts. The commercial team owns offers and the calendar. The contact centre takes the replies the engine cannot read. Patients own their consent, their family links and the data they choose to share.
STEP 2
When the model spots a new pattern, it proposes a cohort; a doctor approves, edits or rejects it. A free-text reply goes to the contact centre. Small timing changes inside the rules apply on their own and are logged.
STEP 3
Every approve, edit and reject is a label. Over time the engine proposes more of what IDH’s doctors accept, and the queue gets shorter without the rules getting looser.
Sources
Karim, Nour, Samia and Youssef, their results, dates and messages are made-up examples. Bars and curves marked “illustration” show how a method behaves; they are not data or forecasts.