Health patterns for AI agents (beta)
What changed in a patient's record and what recurs, computed by fixed statistical rules: trends, deviations from the person's usual level and symptom recurrence, each with its period, evidence and limitations; not diagnoses.
Anpheros computes what changed in a patient's record and what recurs, by fixed statistical rules, and hands each finding to your application or AI agent with its period, the resources behind it, the method version and its limitations. A model no longer has to guess a trend from a handful of numbers: it gets the trend, the uncertainty around it and the data to cite.
Beta. In the sandbox it works with any sandbox credential (sk_test_… keys and sandbox OAuth connections). On production records it runs only under a patient's OAuth consent that includes the separate anpheros/patterns permission; production API keys get 403.
What it finds
| Type | Question it answers | Method |
|---|---|---|
trend |
Is a measurement going up or down over the window? | Theil–Sen slope (the size of the change) on one value per day (weekly medians for dense watch data); the test is a self-normalised trend test on the ranks of the values (Kiefer–Vogelsang–Bunzel), with its p-value read at the strongest day-to-day memory the data cannot rule out (the upper 99% bound of the memory parameter d, estimated by tapered local Whittle, the largest over several frequency bands so a slow component under a faster one is not missed) from null tables simulated on ranks for each series length, so it holds for short memory, long memory and very slow drifts alike; needs at least 20 values outside lab results, and is not computed (too_persistent) when the values wander too slowly to tell a trend from the person's own variation; lab results keep Mann–Kendall |
trend (change_between_results) |
How did a lab test with two to five results change? | First and last result, with the latest against the report's reference range; described, not tested |
trend (event_rate_change) |
Is a symptom recorded more or less often? | Symptom days over days the person logged anything, last 30 days against up to 150 days before (the rest of the window, at least 30), an exact test on days (mid-p) stratified by the previous active day (with or without the symptom, and how many days before), so the days inside one episode do not count as independent evidence |
baseline_deviation |
Is the last week unusual for this person? | Last 7 days against days 8–60, Mann–Whitney or an autocorrelation-adjusted difference of means (the autocorrelation from consecutive days, or from successive values for a measurement recorded every few days), widened further when the strongest day-to-day memory the last 180 days cannot rule out (upper 99% bound of d) calls for more; needs 20 days with data in the last 180 |
trend (step_change) |
Did a measurement move to a new level from one day on and stay there? | The split with the largest difference between the mean before and after (at least 10 days with data on each side); the test is the self-normalised change-point statistic of Shao and Zhang, with its p-value read at the strongest memory the data cannot rule out (the upper 99% bound of d, estimated around the two means so that a real step is not mistaken for memory, the largest over several frequency bands); not computed (too_persistent) when the values wander too slowly; measurements with a threshold, not lab results |
recurrence |
Do symptom episodes come back at regular intervals? | Intervals between episode starts, seeded Monte Carlo against episodes placed at random |
recurrence (day_of_week) |
Is a symptom recorded more or less often on one weekday? | Symptom days over days the person logged anything, per weekday against the other days, Fisher's exact test (mid-p), the smallest p times 7; the 5 most recorded symptoms |
recurrence (time_of_day) |
Is a symptom recorded at other hours than the person's other entries? | Start of each symptom day in local time against the hours of the person's other entries (a Rayleigh-type test of the mean clock time, seeded permutation); only when at least 80% of the symptom days have a local time; the 5 most recorded symptoms |
recurrence (morning_vs_evening) |
Is blood pressure different in the morning (04:00–11:59) than in the evening (17:00–23:59)? | Same-day differences (t-test, adjusted when consecutive days are alike), or days with only one of them (Welch) when fewer than 10 days have both; local time only |
trend (episode_duration) |
Are a symptom's episodes getting longer or shorter? | Episodes counted on the days with entries (a day without any entry neither ends nor lengthens one, so a pause in recording does not look like a shorter episode), episodes at the edges of the window left out; Mann–Kendall with the Theil–Sen slope against the episode start, corrected when consecutive episodes are alike; the 5 most recorded symptoms |
trend (episode_severity) |
Is a symptom's intensity per episode rising or falling? | The mean of the 0–10 intensities recorded on each episode's days (the mean, so that recording more days of an episode does not raise it), same test; the 5 most recorded symptoms |
recurrence (month_of_year) |
Is a measurement different in some months of the year, the same way every year? | Only in a window of at least 730 days with about 2 years of data, otherwise in not_computed (window_too_short): one median per calendar month of each year, the months compared across years with an F test, a steady rise or fall over the period fitted together with the months and kept apart; measurements with a threshold, not lab results |
association (around_medication_start, sandbox) |
Is a symptom recorded more or less often from the start of a medication? | Symptom days over active days in the 30 days from the start against up to 90 days before, the same exact test stratified by the previous active day |
association (after_short_sleep, sandbox) |
Is a symptom recorded more often on days after less than 6 hours of sleep? | Days with sleep measured and an entry by the person, short against longer nights, Fisher's exact test |
association (around_medication_stop, sandbox) |
Is a symptom recorded more or less often in the 30 days after a medication was recorded as stopped? | Symptom days over active days in the 30 days after the end of effectivePeriod, against up to 90 days before it (not before the medication's start), the same exact test stratified by the previous active day; the 3 most recent stops and the 5 most recorded symptoms |
association (measurement_around_medication_stop, sandbox) |
Is a measurement different in the 30 days after a medication was recorded as stopped? | One value per day before and after the stop, difference of means with a t-test widened for neighbouring days that are alike: by the larger of a short-memory factor and the exact factor of the strongest memory the window cannot rule out (upper 99% bound of d); measurements with a threshold, not lab results |
association (co_occurrence, sandbox) |
Are two symptoms recorded on the same days more or less often than if they came and went independently? | Only days on which the person recorded something besides these two symptoms (so that a day opened only to record one of them does not distort the comparison), Fisher's exact test (mid-p), widened when the symptoms come in episodes; pairs among the 5 most recorded symptoms only |
association (after_low_activity, sandbox) |
Is a symptom recorded more often on the day after a day with few steps? | Days after a day with entries and without the symptom; few steps = the person's own lowest quarter of daily steps, not a population cut-off; Fisher's exact test (mid-p); the 5 most recorded symptoms |
convergence (recent_changes_together, sandbox) |
Did several things change in the same recent period? | No new test: groups at least two recent changes (an unusual week, a symptom more or less often) that are each statistically supported; says only that they happened together |
All tests of one run are corrected together (Benjamini–Hochberg). A finding is statistically_supported only when the corrected q-value is below 0.05 and the change is at least the threshold for that measurement.
What it is not
- Not a diagnosis. Findings describe the record; they never name a condition or recommend a treatment change. Every finding carries
safety.not_a_diagnosis = trueandsafety.causal_claim = false. - Not a cause. A change after a new medication, or two things recorded together, is not evidence that one caused the other. Associations say only that two things happened around the same time; each carries
confounding_possibleandnot_causal, and only medication starts and stops, sleep, steps and pairs among the five most recorded symptoms are tested, not every pair. Findings around a medication never suggest starting, stopping or changing it: their text ends with "Talk to your doctor before you start, stop or change a medicine." (around a start: "before you stop or change a medicine"). With sandbox credentials only for now. - Not an AI model, and not clinically reviewed yet. Every number comes from fixed, versioned statistical rules; no AI model analyses the data. The thresholds for a meaningful change were set with AI assistance and have not yet been reviewed by a clinician; each finding says so in
review.thresholds_reviewed_by_clinician. The engine is tested on synthetic patients with known planted patterns (see Validation on synthetic data): at twice each method's threshold, the planted pattern is found in 2% to 100% of the simulated people depending on the method; 1.5% of the simulated people without any planted pattern show a supported finding in one analysis (up to 3.5% in the hardest scenario), and 30% at least once when they are analysed every week for a year (6% would see one shown under the display rule below). That is an internal statistical test, not clinical validation.
Try it
Every sandbox project has 30 synthetic patients, and six of them carry a planted pattern. Find one with GET /fhir/R4/Patient?identifier=https://anpheros.com/fhir/sid/sandbox-persona|<key>.
| Patient | What was planted | What the engine reports |
|---|---|---|
| p01 Andrei Popescu | Daily home blood pressure, falling by about 8/5 mmHg over six months | trend.decreasing for systolic (8480-6); the smaller diastolic fall (8462-4) shows as a level step |
| p06 Giulia Rossi | A headache every 7 days, give or take one | recurrence.intervals for headache (R51) |
| p17 Ciarán Murphy | Fatigue on about half of the last 30 days, against 1 day in 12 before | frequency.increased for fatigue (R53) |
| p19 Felix Gruber | Resting heart rate from a watch, about 9 bpm above his usual level in the last week | baseline.higher for resting heart rate (40443-4) |
| p20 Ivana Horvat | Resting heart rate from a watch, settling by about 30 bpm over six months | trend.decreasing for resting heart rate (40443-4) |
| p30 Jan Kowalczyk | Dense watch and home data with nothing planted | no supported finding: the engine stays quiet |
Projects created before 16 October 2026 get these patterns after resetting their synthetic patients from the dashboard; a reset replaces any changes made to them.
curl -s https://platform.anpheros.com/v1/patients/$PATIENT/patterns?window_days=180 \
-H "Authorization: Bearer $ANPHEROS_KEY"
With the TypeScript SDK (@anpheros/sdk 0.2.0 or later):
const run = await anpheros.patterns.run(patientId, { window_days: 180, min_strength: 'moderate' });
for (const f of run.findings) console.log(f.summary_text, f.statistically_supported, f.limitations.map(l => l.code));
With the MCP server, ask your agent "What changed in this patient's record over the last six months?": it calls get_health_patterns, and can follow up with get_pattern_evidence, get_series and compare_periods. POST /v1/context adds a patterns section for questions about change and relationships, or when you ask for the patterns need.
Endpoints
| Endpoint | What it returns |
|---|---|
GET /v1/patients/{id}/patterns |
a run: findings, what could not be computed and why, next_steps, what consent left out; filters window_days (30–730), end, types, min_strength |
GET /v1/patients/{id}/patterns/{finding_id} |
one finding, recomputed for the same window |
GET /v1/patients/{id}/patterns/{finding_id}/evidence |
every supporting resource, paged |
GET /v1/patients/{id}/series?code=… |
one measurement as one value per day, with coverage, gaps and source changes |
POST /v1/patients/{id}/patterns/compare |
one measurement in two periods you choose |
GET /v1/patterns/methods |
the method registry: every method with its version, maturity, inputs, minimums, assumptions, threshold source, false-positive risks, limitations and validation; no patient data |
Reading a finding
summary_text: one plain sentence, safe to show or quote.statistically_supported:trueonly when the finding passed its statistical test. The others are descriptions, not evidence. There is no strength grade in the output: report the counts and dates insummary_text.min_strengthstill filters on the internal grade.window,comparison_window: the periods analysed.evidence(up to 20, spread over the period) andevidence_total: the resources behind the finding, with version, date, value and author type.limitations: coded, with text. Show them with the finding.review: whether a clinician has reviewed the thresholds (falsefor now) and where they come from.method,engine_version,input_fingerprint: the same data, configuration and versions give the same result and the same id.methodalso carries the method'smaturity,patient_facingandnotify(see below).confidence: five separate axes, never one score (details below).disclosure: the text to show with the finding when its method is patient-facing;nullotherwise.
Method maturity
Every method has an entry in the registry (GET /v1/patterns/methods) and a maturity:
| Maturity | What it means | Who sets it |
|---|---|---|
experimental |
Runs and is returned to developers; not meant to be shown to the person | the default: a method that has not passed the validation gate, or whose ceiling in the registry is experimental |
internally_validated |
Passed the internal statistical validation on synthetic data: at most 5% of runs without any real pattern report a supported finding, for the method alone and for the whole run, both pooled (the upper 95% bound) and in every null scenario; raw p-values on data without a pattern not too small (the share below 0.05 not significantly above 7.5% in any null scenario); sensitivity at twice the threshold at least 10%; identical output on identical input, reproducible from its seed, regression goldens | earned from the numbers of the committed validation report of the current engine version and of the method's current code (a code fingerprint: a change without a new report falls back to experimental), and capped by the method's ceiling in the registry (maturity = the lower of the two) |
clinically_reviewed |
A named clinician reviewed the method and its thresholds | never set by code |
production_approved |
Clinical review plus product sign-off | never set by code |
method.patient_facing is true from internally_validated on; such findings carry disclosure = "Method set with AI help; not reviewed by a clinician." (until a clinical review). method.notify is true only for internally_validated methods marked eligible (associations, groupings, steps, weekday, time-of-day, episode and month-of-year patterns never are) that also pass the repeated-looks gate: the engine runs again whenever new data arrive, so over a year of weekly analyses under the display rule (below) at most 5% of simulated people without any real pattern may be notified by the method, and by all notifying methods together, and at most 10% may see anything shown (upper 95% bound over all simulated people, and the estimate for each kind of person). An app may then notify on shown, never on the change to supported, at most once a week per person. Which methods are internally_validated right now is in GET /v1/patterns/methods (each entry's maturity and validation). With the current report seven methods are internally_validated: five in production (the usual level, the regularity of episodes, the time of day of a symptom, blood pressure morning against evening, the months of the year) and two sandbox-only associations (two symptoms on the same days, a symptom after a low-step day); the others stay experimental, because they find too few planted changes at twice the threshold or on held-out people (see below). Two of them pass the repeated-looks gate and may notify: the usual level and the regularity of episodes. A stored finding computed with an earlier engine version or method version is experimental (not patient-facing) until the next run recomputes it. The associations around the start and the stop of a medication, the description of a few lab results, the comparison of two chosen periods and the grouping of recent changes have the ceiling experimental: they stay developer-only whatever the numbers. Internal validation on synthetic data is not clinical validation.
Validation on synthetic data
The engine ships with its own validation framework (app/patterns/validation, run with python -m app.patterns.validation). It builds simulated people with a known truth and runs the real engine on them, in the production configuration and with the sandbox-only associations:
- scenarios: no pattern at all; planted effects of known size (0.75 to 3 times each method's threshold), including a level step 60 days before the end, symptom starts gathered away from the person's usual recording hours, a symptom more frequent on Mondays, blood pressure lower in the evening, symptom episodes that lengthen or grow more intense over the window, a second symptom recorded more often on the days of the first, a symptom or blood pressure that changes after a medication is stopped, a symptom more frequent on the day after a low-step day and a yearly cycle in blood pressure over two years of data; every simulated person records two symptoms (headache and fatigue) with an intensity, and all but the manual-only ones wear a watch that also counts steps; missing data (completely at random, in bursts, logging that fades over the months); symptoms that come in episodes of 2, 3 or 5 days with entries instead of on independent days; blood pressure that is persistent from day to day (a daily level that moves slowly) and body weight close to a random walk; other entries made mostly in the morning while symptoms are recorded at any time (a recording habit); two years of blood pressure with a slow drift but no yearly cycle, or persistent from day to day; heavy-tailed noise with outliers; weekday-driven sleep and symptoms (an association that exists only through the weekday); far fewer entries at the weekend (a weekday pattern in logging, not in the symptom); entries with and without a local time; 60, 120 or 180 days of data; blood pressure daily, every two days or weekly, in the morning and on half of those days also in the evening; dense watch data against sparse manual entries; a held-out set (other persistence, other measuring rhythms, another weight model, other people) written before the methods were tuned and not looked at while tuning, which must pass the same gates (for the symptom methods: longer episodes, episodes over calendar days, a more frequent symptom, entries missing at random);
- metrics per method and for the whole run: false positive and false negative rates, sensitivity and specificity, precision and recall over the scenario mix, calibration (how the strength of a finding follows the planted effect), the calibration of the raw p-values on data without a pattern (in every null scenario), stability (the same input gives the same output, also in another order) and reproducibility (the same seed gives the same data and output);
- repeated looks: the null rates above are per snapshot (one analysis per simulated person). Simulated people without any pattern are also analysed every week over a year, as the refresh worker would after new data; this measures how many would ever see, and could be notified of, a false supported finding, and gates
method.notify; - report:
app/patterns/validation/report.json(read by the registry: a method's maturity comes from these numbers, never from a hand-set flag) andREPORT.md, which states the date, engine version, seeds and number of runs. Regression goldens (goldens.json) fail the gate when an output changes without a new method version.
The report says plainly what it is: an internal statistical validation on synthetic data, not a clinical validation. Simulated people are simpler than real ones, and the thresholds the sensitivity is measured against are engineering defaults that a clinician has not reviewed yet.
What the current report shows (9 November 2026, 31,440 simulated runs, after the independent review of Phase 2c): the trend and level-step tests are self-normalised and read their p-value at the strongest day-to-day memory the data cannot rule out, now from null tables simulated exactly as the tests run (the trend on ranks, the step over its own splits, for each series length from 20 to 1,000 values) and with the memory bound taken as the largest over several frequency bands, so a slow component under a faster one is no longer missed; the usual-level test now also widens its variance to that memory. Every null scenario is at or below 3.5% for the whole run, in both configurations: the scenarios used while tuning, the earlier held-out sets and round ho3 (both seen now), and a fresh held-out round ho4 run once, after the changes (the independent reviewer's dependence families: a periodic AR with a 30-day cycle, a threshold AR, volatility clustering, an aggregate of many AR(1) processes with blood pressure measured more often when it is high, a slow component under a fast one at 180 days and three years), where the whole run is at most 2.0%. Overall, one analysis without any pattern shows a supported finding in 1.5% of runs. The price is sensitivity: at twice the threshold the usual-level test finds 17.5% of planted changes (was 62.5%; 23% on the held-out round), the step 9%, the trend 2.5%, the medication-stop measurement 3.5%, so trend, step and stop measurement stay experimental. Seven methods pass every gate; two of them may notify.
What a person sees over time
Stored findings (GET /v1/patients/{id}/patterns/current) carry shown and shown_since, set by one display rule (display_rule in the response): a finding is shown only after it stayed statistically supported over consecutive evaluations spanning at least 14 days, and hidden only after it stayed unsupported for 28 days, or at once when it is no longer computed. The shown state is evaluated at most once per 7 days, on the first refresh in each 7-day period, so frequent refreshes do not give a false finding more chances. Show a stored finding to a person only when shown and method.patient_facing are both true. The patterns.updated webhook carries shown and hidden events (for every method) and the display rule; notify on shown only, and only when /current shows that finding with method.patient_facing and method.notify true. A new method version starts the display state again. Findings computed on request (GET /v1/patients/{id}/patterns, POST /v1/context, the MCP tool) are a single look: each carries shown from the stored finding with the same key and method version, and the context and the MCP tool keep only shown, patient-facing findings by default.
Findings of step_change, day_of_week, time_of_day and month_of_year carry shown_only_if_supported = true: they pick what they name among many tries, so show them only when statistically supported. Each next step carries patient_facing: show it to a person only when true. POST /v1/context and the MCP tool get_health_patterns give each pattern item its method (name, version, maturity, patient_facing) and disclosure, and by default leave out findings of methods that are not patient-facing (include_experimental_patterns / include_experimental for developer tools).
With the current report, simulated people without any pattern (six kinds, 300 each, including symptom episodes, daily blood pressure and a short history), analysed every week for a year under this rule: 6.1% would see something shown (upper 95% bound 7.3%; at most 8.7% for one kind) and 2.8% would be notified by a notifying method (upper bound 3.6%; at most 4.3% for one kind). The rule also delays real changes: a sustained resting heart rate step is shown within 90 days for 69% of people with it (none within 28 days), a doubled headache rate within 90 days for 23% (62% have it supported at some look). Two methods notify: the usual level and the regularity of episodes.
Confidence
Each finding has confidence with five axes that are read separately:
| Axis | Fields | What it says |
|---|---|---|
data_quality |
level (low, medium, high), coverage, regularity, sources, excluded, local_time_share |
how well the data cover the analysed period: share of days with data, share of weeks with data since the first one, how many sources wrote them, what was left out and why, and how much is on the person's own day |
statistical |
q, effect_vs_threshold |
the corrected q-value and the size of the change over the threshold for a meaningful change (1 or more = at least the threshold); no strength grade |
extraction |
level, share_manual, share_device, share_import_or_document, share_clinician |
how the values got into the record: typed by the person, measured by a device, imported or read from documents, entered by a clinician |
generalizability |
personal |
the finding is about this person's own data only |
research |
level, references |
none for now: no published research is linked |
The level rules are fixed and listed in confidence_rules of GET /v1/patterns/methods. For example, data_quality.level is low when coverage is below 0.15 or regularity below 0.5, and high only with coverage of at least 0.7, regularity of at least 0.8, at least 90% of the data on the person's local day and no change of source or unit. Findings stored before engine 0.6.0 have no confidence until their next run.
Next steps
When a test could not run because data are missing, its entry in not_computed carries a next_step, and the run lists them all in next_steps, fewest entries first:
{"variable": {"code": "29463-7", "display": "Body weight", "unit": "kg"}, "need": "days", "missing": 4,
"within_days": 21, "by": "2026-11-28", "entry": "variable", "method": "trend_theil_sen_mann_kendall", "type": "trend"}
need:daysdepends only on what the person records;events,episodesandnightsdepend on what happens, so they have no deadline (within_daysandbyarenull).missing: the fewest entries that would be enough;within_days/by: the soonest the test can run, counted from the end of the run (the window moves forward with the date, so old data can drop out).missing = 0means only time has to pass.entry:variable= days with a value of this measurement;any= days with any entry by the person (symptom rates count only days on which the person recorded something).- Tests that recording cannot unlock (no variation, a period that is already in the past) have no
next_step.
A next step says what to record, never what to do about health. GET /v1/patients/{id}/patterns/current returns the next_steps of the last background run, POST /v1/context adds the first three (of patient-facing methods, by default) to the patterns section text, and the MCP tool get_health_patterns returns them with the run.
Rules worth knowing
- Consent first. Under an OAuth grant the engine reads only what the grant allows; what it could not read is listed in
omitted, without content. - Ids. Patients appear with your project's pairwise id; finding ids are derived per project. When the record changes, a finding gets a new id and the old one answers 404.
- Time. When a reading's time carries an explicit offset (
2026-10-16T00:30:00+03:00), it counts on the person's own day; times in UTC (Z) or without an offset stay on the UTC day. Each finding says which intime_basis(record_offsets,partly_localorlocal_time_unknown). Local days are used on sandbox and production records. Time-of-day patterns (symptom starts, blood pressure in the morning against the evening) use only entries with an explicit offset: without one they are listed innot_computedwith the reasonlocal_time_unknown. Sleep duration (93832-4) counts on the day of waking: the end ofeffectivePeriod(from engine 0.6.0; before, the start). - Left out. Values written by AI, results marked entered-in-error and dates known only to the month are not used, and are counted.
- Limits. 30 pattern runs per minute per credential, on top of the usual 600 requests per minute.
Frequently asked questions
Does it use a language model?
No. Every number comes from fixed, versioned statistical methods. Any model, hosted or local, can read the results.
Why is a clear change in my data marked weak?
Because the evidence does not survive the correction for all the tests in the run, the series is short or noisy, or the change is below the threshold for that measurement. The finding still describes what the record shows.
Does it work on production records?
Yes, from 16 October 2026, but only under a patient's OAuth consent that includes the separate anpheros/patterns permission, which the consent screen shows on its own line. Request the scope next to your patient/… scopes; a grant without it, and any production API key, gets 403.
Related
- Health patterns developer guide: consent, the display rule, feedback, research and the safety header
- FHIR MCP server for AI agents
- LLM applications and healthcare data
- AI agents and medical data
- Healthcare API with patient consent
Ask your AI
Paste this into Claude, ChatGPT, Cursor or Claude Code. Your assistant reads this guide and adapts it to your code.
Read https://developers.anpheros.com/guides/health-patterns.md and help me apply this guide to my own project. Use the Anpheros sandbox (base URL https://platform.anpheros.com) with my API key from the ANPHEROS_KEY environment variable, never written in the code. Give me complete, runnable code, the response I should expect, and how to fix the errors in https://developers.anpheros.com/guides/troubleshooting.md if a call fails.Open in ClaudeOpen in ChatGPTThis guide as MarkdownBuild the whole integration with an AI coding tool
Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no cardYour first API call in 2 minutes →
