A hybrid system of rules and an LLM that turns multimodal health data into a simple, reliable weekly note

Every Monday, a review of the week for each patient: rules decide the content, a language model writes it.

  • Generative AI

Every Monday, the EmoDTx app looks back at the patient’s week and writes them a short note: what changed in mood, activity or routine, in plain sentences. The material is multimodal: a mood estimated from the voice or the face, steps, movements, the answers to a questionnaire. Writing this note by hand for each patient is impossible. Handing it as it is to a language model would be reckless: the person reading it is being treated for depression.

Asking a model for text takes one line of code, but the real work lies in everything around it: deciding what is worth saying without a model, never providing data that identifies the patient, proofreading every sentence, ensuring a note is always generated even when the model is down, never sending the same note twice or repeating information from one Monday to the next, and respecting a predefined cost limit.

As a co-founder of Emobot, I built this chain with the team: a hybrid system, in which rules decide and the model only writes.

The result

Perspective drawing of a machine, read from left to right. On the left, four strips side by side, a week of each kind of data: a curve, seven bars, a way between three places, a form. Dashed arrows lead them to a row of six thin gates, one of which carries a filled bar; then come a typewriter with a page coming out of it, the page with each of its lines ticked, and a phone showing the note: a few sentences and a curve leaving a band. Depending on the step: three rows of seven cells, the days measured for each signal, one row struck out, and one cell for the questionnaire; nine weeks on a curve, a band for the usual, the last week outside it, and six lamps of which one is lit; two sheets, one with seven bars, the other struck out, with a face, lines, a calendar and a curve, and, on the machine, a small sheet of five bars between the gates and the typewriter; three stairs, from the fast model to the fixed text, under a spending gauge, and a fixed text set beside the machine; two drafts, one struck out, with a filled word and a line going past a mark, the other accepted; a row of weeks with several under a brace, and two identical sheets giving a single note.

What was done

  1. 01

    Finding

    Rules that decide, with no model, what is notable about the week against the patient’s usual, in a way that can be replayed exactly.

    Python · NumPy

  2. 02

    Anonymous sheet

    Summary of the week in a few numbers, the only content handed to the model: nothing in it points to the patient.

    Python · Pydantic

  3. 03

    Writing

    Note written in an imposed format by a fast model, backed by a more powerful one, then by a fixed text: there is always a note.

    Claude · Amazon Bedrock

  4. 04

    Proofreading

    Automatic check of the length, language and vocabulary of every note, with no model, before anything is sent.

    Python

  5. 05

    Cost

    Spending ceilings per call, per day and per month: beyond them, the fixed text takes over.

    Python

  6. 06

    Sending once

    Fingerprint of each note’s data, so a week can be run again with nothing rewritten or sent again.

    Python · MySQL

  7. 07

    Quality monitoring

    Every fallback note and a sample of the accepted ones reread by the team, personal data masked, with alerts when quality drops.

    Amazon CloudWatch

  8. 08

    Versions

    Versioned instructions, never changed in place: each note keeps track of the version that wrote it.

    MySQL

  9. 09

    Tests

    Reference weeks replayed with every change: the same finding must come out, exactly.

    pytest

  10. 10

    In the app

    Monday note, those of past weeks, and a waiting card while the week is not ready.

    React Native · TypeScript

Perspective drawing of a machine, read from left to right. On the left, four strips side by side, a week of each kind of data: a curve, seven bars, a way between three places, a form. Dashed arrows lead them to a row of six thin gates, one of which carries a filled bar; then come a typewriter with a page coming out of it, the page with each of its lines ticked, and a phone showing the note: a few sentences and a curve leaving a band. Depending on the step: three rows of seven cells, the days measured for each signal, one row struck out, and one cell for the questionnaire; nine weeks on a curve, a band for the usual, the last week outside it, and six lamps of which one is lit; two sheets, one with seven bars, the other struck out, with a face, lines, a calendar and a curve, and, on the machine, a small sheet of five bars between the gates and the typewriter; three stairs, from the fast model to the fixed text, under a spending gauge, and a fixed text set beside the machine; two drafts, one struck out, with a filled word and a line going past a mark, the other accepted; a row of weeks with several under a brace, and two identical sheets giving a single note.

How it works

  1. Scroll: the drawing follows.

  2. 01 / 06

    Check what the week allows saying

    A week of raw measurements does not read by itself: we first check what was actually measured, signal by signal. A signal covered too little is set aside: nothing will be said about it. If nothing is sound enough, the patient receives a neutral message, and the model is not even called.

  3. 02 / 06

    Choose what to say, with no AI

    What the note will say is decided by code, not by the model. We compare the week with the patient’s usual, computed with statistics that one exceptional day does not distort. Rules then look for a clear change, a trend over several weeks, a rhythm that repeats, a harder week or a steady one, and a fixed order settles between them. The same computation, replayed later, gives exactly the same finding.

  4. 03 / 06

    Give the model only what it needs

    We pass to the model only a sheet of a few numbers: deviations, days of the week, a direction of change. No name, identifier, date or raw measurement is sent. The patient’s first name appears only on the phone, in the greeting of the home screen: the note itself holds none.

  5. 04 / 06

    Have it write, with a safety net

    A fast model writes the note, in an imposed format: three fields, nothing else. If it fails or runs late, a more powerful model takes over. If that one fails too, or if the spending ceiling is reached, we use a fixed text. The patient always receives a note, and the bill never goes beyond what was planned.

  6. 05 / 06

    Proofread every sentence before sending

    We proofread every note automatically, with no model: length of each field, patient’s language, then lists of forbidden words, starting with those that touch on distress. A refused note is handed to the next model, then replaced by the fixed text. The safety instructions given to the model are written by clinicians, apart from the instructions on tone, and the note never takes the place of the questionnaire’s alert.

  7. 06 / 06

    Never repeat, never send twice

    Every note carries the fingerprint of the data that produced it. If the jobs run again over a week already done, the same fingerprint comes out: nothing is recomputed, rewritten or sent again, and the notification leaves only once. A finding made one week then serves as the basis for the following weeks, so the note does not repeat the same thing Monday after Monday.

Specifications

Role
Co-founder and chief product officer; design and development, with Emobot’s team
Built with
Python · Claude · Amazon Bedrock · React Native