Personal health recordA personal health record your agents can read and keep current
One person's lab results, readings, targets, hypotheses, medication and vaccine doses, with "off target", "overdue" and "incomplete" worked out on every read.
- Graph ID
- health
- Sample data
- Noa Brandt, an invented person with two years of results · 266 nodes, 551 edges
- Schema
- 16 node types · 39 edge types
- Stored queries
- 47 reads · 52 writes
- Updated
[What it is]
Build a living personal health record, and the agent workflows around it. It keeps lab results, device readings, targets, hypotheses, what you take and the vaccine doses you were given linked to the documents they came from. Whether a result is off target, a retest is overdue or a vaccine series is incomplete is worked out from the current data each time you ask. Agents read your reports and tell you what is due, on branches you review before anything reaches the record.
How it works in Omnigraph: schema language, stored queries, access policies and branches and merges. To have it run for you, see Omnigraph Cloud (private preview).
[Personal health record ontology]
Drag types to rearrange · pinch or ⌘-scroll to zoom
All 16 types as a list
Person3 in sample
Someone the record is about, or a clinician who appears in it.
slug · name · role · born_on
Organization4 in sample
A laboratory, clinic, hospital or pharmacy that produced a document or gave a dose.
slug · name · kind
Visit5 in sample
An appointment, planned or past. Completing it can record the graph commit the clinician saw.
slug · title · kind · scheduled_at · status · reason · summary · baseline_commit
VisitOf → Person · VisitWith → Person
HealthRecord12 in sample
A document the record learned from: a lab report, a clinic letter, a vaccination card, a wearable export.
slug · title · kind · document_date · received_at · extraction · file · notes
RecordFor → Person · RecordFrom → Organization · RecordOfVisit → Visit
Measurable26 in sample
Something that can be measured about a person: a lab analyte, a vital sign, a body composition figure, a daily sleep or activity figure, a symptom score.
slug · name · kind · category · canonical_unit · aliases · description
Measurement122 in sample
One value of one measurable for one person: a lab result as reported, a reading, or a summary over a period.
slug · measured_at · period_start · statistic · value · comparator · value_text · unit · canonical_value · reference_low · reference_high · flag · status · fasting · device · source_name · source_line
MeasurementOf → Measurable · MeasurementFor → Person · MeasurementIn → HealthRecord · MeasurementSupersedes → Measurement
ExternalCode20 in sample
A code from a standard system for a measurable, a condition or a vaccine: LOINC, ICD-10, CVX.
slug · system · code · display
CodeForMeasurable → Measurable · CodeForCondition → Condition · CodeForImmunization → Immunization
Target5 in sample
The range a person wants a marker to stay in, with who set it and why. Off target is worked out against the latest result.
slug · low · high · unit · set_on · set_by · rationale · status
TargetFor → Measurable · TargetOf → Person
Hypothesis5 in sample
A possible explanation someone holds, with the results that support and contradict it.
slug · title · thesis · status · review_status · raised_on
HypothesisFor → Person · HypothesisAbout → Measurable · SupportedBy → Measurement · ContradictedBy → Measurement
Condition17 in sample
A disease, a diagnosis or a kind of reaction, as a concept. A person's own case of it is a ConditionOccurrence.
slug · name · category
ConditionOccurrence5 in sample
One person's case of a condition, or one reaction they had, with how certain it is.
slug · status · certainty · onset_on · resolved_on · severity · notes
OccurrenceOf → Condition · OccurrenceFor → Person · ReactionToIntervention → Intervention · ReactionToImmunization → Immunization
Intervention5 in sample
Something a person takes or does for their health: a medication, a supplement, a change of diet, exercise or sleep. The markers it is meant to move and the hypothesis behind it hang on this node; the dose is on its episodes.
slug · name · kind · status · started_at · stopped_at · reason
InterventionFor → Person · Targets → Measurable · MotivatedBy → Hypothesis · Treats → ConditionOccurrence
InterventionEpisode7 in sample
One period of an intervention at one dose and frequency. The current dose is the latest episode's; a change of dose is a new episode, so the intervention keeps its markers and its history.
slug · dose · frequency · started_at · reason
EpisodeOf → Intervention
Immunization19 in sample
One vaccine dose given to a person, or one that was due and not given. Which diseases it counts towards, and as which dose of each series, is on its ProtectsAgainst links.
slug · vaccine · product · manufacturer · lot_number · expires_on · administered_on · date_precision · site · route · status · status_reason · origin
ImmunizationFor → Person · ProtectsAgainst → Condition · AdministeredAt → Organization · ImmunizationIn → HealthRecord
Recommendation8 in sample
Something due by a date: a retest, a screening, a vaccine dose or a follow-up, with the authority that set it. Whether it has been met is worked out from the result or the dose linked as fulfilling it.
slug · title · kind · authority · earliest_at · due_at · latest_at · repeats_every_days · dose_number · series_doses · status · reason
RecommendationFor → Person · RecommendsMeasuring → Measurable · RecommendsVaccineAgainst → Condition · FulfilledByMeasurement → Measurement · FulfilledByImmunization → Immunization
Notification3 in sample
A prompt put in front of the person, with whether it was sent and acknowledged. Its slug says what it is about, so the same prompt cannot be raised twice.
slug · title · body · kind · status · raised_at · sent_at · channel · acknowledged_at
NotificationFor → Person · AboutRecommendation → Recommendation · AboutMeasurement → Measurement
[Personal health record: questions it answers]
Each one is a stored query in the cookbook, written once and run by name from the CLI, the SDKs or an agent.
off_target
Which results are outside my own targets?
Latest results outside the person's own active target for that marker.
Show the query +Hide the query −
query off_target() @description("Latest results outside the person's own active target for that marker.") {
match {
$t: Target { status: "active" }
$t targetOf $p
$t targetFor $x
$m measurementFor $p
$m measurementOf $x
$m.status != "entered_in_error"
not { $c measurementSupersedes{1,8} $m $c.status != "entered_in_error" }
not { $n measurementOf $x $n measurementFor $p $n.status != "entered_in_error"
not { $d measurementSupersedes{1,8} $n $d.status != "entered_in_error" }
$n.measured_at > $m.measured_at }
($m.comparator is null and ($m.canonical_value > $t.high or $m.canonical_value < $t.low))
or (($m.comparator = "lt" or $m.comparator = "le") and $m.canonical_value <= $t.low)
or (($m.comparator = "gt" or $m.comparator = "ge") and $m.canonical_value >= $t.high)
}
return { $p.slug as person, $x.slug as marker, $m.comparator, $m.canonical_value as value, $t.low, $t.high, $t.unit, $m.measured_at, $t.slug as target }
order { $p.slug asc, $x.slug asc }
limit 500
}intervention_effect
Did this change move the marker it was meant to move?
Every current result of the markers one intervention targets, marked as before or after it started.
Show the query +Hide the query −
query intervention_effect($intervention: String) @description("Every current result of the markers one intervention targets, marked as before or after it started.") {
match {
$v: Intervention { slug: $intervention }
$v interventionFor $p
$v targets $x
$m measurementOf $x
$m measurementFor $p
$m.status != "entered_in_error"
not { $c measurementSupersedes{1,8} $m $c.status != "entered_in_error" }
}
return { $x.slug as marker, $m.measured_at, $m.canonical_value as value, $x.canonical_unit as unit, $m.measured_at >= $v.started_at as after_start }
order { $x.slug asc, $m.measured_at asc }
limit 2000
}incomplete_series
Which vaccine series did I never finish?
Diseases whose latest given dose is not the last of its series.
Show the query +Hide the query −
query incomplete_series() @description("Diseases whose latest given dose is not the last of its series.") {
match {
$i: Immunization
$i immunizationFor $p
$i.status = "completed"
$i $w:protectsAgainst $d
$w.dose_number < $w.series_doses
not { $j immunizationFor $p $j.status = "completed" $j $v:protectsAgainst $d
$v.dose_number > $w.dose_number }
}
return { $p.slug as person, $d.slug as disease, $w.dose_number as doses_given, $w.series_doses, $i.vaccine, $i.administered_on as last_dose_on }
order { $d.slug asc }
limit 500
}overdue_recommendations
What is overdue?
Recommendations still due whose date has passed.
Show the query +Hide the query −
query overdue_recommendations() @description("Recommendations still due whose date has passed.") {
match {
$r: Recommendation { status: "open" }
$r.due_at < now()
not { $r fulfilledByMeasurement $fm $fm.status != "entered_in_error" }
not { $r fulfilledByImmunization $fi $fi.status = "completed" }
$r recommendationFor $p
}
return { $p.slug as person, $r.slug, $r.title, $r.kind, $r.authority, $r.due_at }
order { $r.due_at asc }
limit 500
}contested_hypotheses
Which of my hypotheses does a result contradict?
Hypotheses still open or held as supported that a current result contradicts.
Show the query +Hide the query −
query contested_hypotheses() @description("Hypotheses still open or held as supported that a current result contradicts.") {
match {
$h: Hypothesis
$h.status = "open" or $h.status = "supported"
$h contradictedBy $m
$m.status != "entered_in_error"
not { $c measurementSupersedes{1,8} $m $c.status != "entered_in_error" }
$m measurementOf $x
}
return { $h.slug, $h.title, $h.status, $m.slug as result, $x.slug as marker, $m.value, $m.unit, $m.measured_at }
order { $h.slug asc, $m.measured_at asc }
limit 500
}[99 stored queries]
Reads answer questions; writes are the typed mutations agents and people use to change the graph, each one commit.
queries/mutations.gq52 queries+
- add_personwriteAdd a person: the subject of a record (role subject) or a clinician.
- add_organizationwriteAdd a laboratory, clinic, hospital or pharmacy.
- add_markerwriteAdd a marker with the unit its targets and canonical values use.
- add_marker_codewriteRecord a standard code, such as a LOINC code, for a marker.
- file_recordwriteFile a document for a person, with the file itself, before anything is read from it. Refused if the slug already exists.
- link_record_sourcewriteSay which laboratory or clinic issued a document.
- link_record_visitwriteSay which visit a document came out of.
- mark_extractedwriteMark a raw document as read: its values are in the record and await a person's check.
- mark_reviewedwriteMark a document's extracted values as checked against the file. A person's step.
- record_resultwriteRecord one result read from a document, as the document printed it. Refused if the slug already exists, so reading a report twice cannot change a value.
- record_readingwriteRecord a reading or a period summary from a device or app, with no document behind it.
- correct_resultwriteRecord a source's correction of an earlier result. The earlier result stays on record and stops counting as current.
- void_resultwriteMark a result as entered in error, such as one filed under the wrong person. It stays on record and stops counting: a result it had corrected becomes current again, and a recommendation it had met is due again.
- set_canonical_valuewriteAdd the value in the marker's canonical unit to a result that was reported in another unit.
- set_targetwriteSet the range a person wants a marker to stay in, in the marker's canonical unit, with who set it.
- retire_targetwriteStop judging results against a target.
- raise_hypothesiswriteRaise a possible explanation about one marker, open until a person or clinician decides.
- link_supportwriteLink a result as supporting a hypothesis.
- link_contradictionwriteLink a result as contradicting a hypothesis.
- review_hypothesiswriteRecord that a person has read an agent's proposed hypothesis. A person's step.
- decide_hypothesiswriteSet a hypothesis to supported, rejected or superseded. A person's or clinician's verdict.
- start_interventionwriteRecord something a person starts taking or doing, with its first dose period and the marker it is meant to move.
- add_intervention_markerwriteAdd another marker an intervention is meant to move.
- link_intervention_hypothesiswriteSay which hypothesis an intervention acts on.
- link_intervention_conditionwriteSay which of the person's conditions an intervention is for.
- stop_interventionwriteStop an active or paused intervention.
- change_dosewriteRecord a change of dose or frequency as a new dose period of the same intervention, which keeps its markers and its history.
- add_conditionwriteAdd a disease, diagnosis or kind of reaction as a concept.
- record_conditionwriteRecord a person's case of a condition, with how certain it is.
- record_dose_reactionwriteRecord a reaction that followed a vaccine dose.
- record_intervention_reactionwriteRecord a reaction attributed to something the person takes or does.
- resolve_conditionwriteMark a person's condition or reaction as resolved.
- record_dosewriteRecord one vaccine dose that was given, with the first disease it counts towards and its dose number in that series.
- add_dose_diseasewriteAdd another disease a combined vaccine dose counts towards, with its own dose number.
- record_dose_not_givenwriteRecord a dose that was due and not given, with the reason.
- link_dose_recordwriteLink a dose to the document that shows it.
- link_dose_placewriteSay where a dose was given.
- add_dose_codewriteRecord the vaccine type of a dose as a code, such as a CVX code.
- void_dosewriteMark a dose as entered in error. It stays on record and stops counting: a recommendation it had met is due again.
- recommend_retestwriteRecord that a marker should be measured again by a date, with who says so.
- recommend_dosewriteRecord that a vaccine dose is due by a date, with the authority that set it.
- recommend_otherwriteRecord a screening or a follow-up due by a date.
- fulfil_with_resultwriteLink the result that met a recommendation. The recommendation stops being due while that result stands, and is due again if the result is later marked as entered in error.
- fulfil_with_dosewriteLink the dose that met a dose recommendation. The recommendation stops being due while that dose stands.
- close_recommendationwriteClose an open recommendation as declined, superseded, or done where no result or dose in the record shows it. A person's step.
- schedule_visitwriteAdd a planned visit with the clinician to be seen.
- complete_visitwriteMark a visit as done, with what came of it and the graph commit the clinician saw.
- raise_notificationwriteRaise a prompt about one recommendation for a person. Refused if the slug already exists, whatever its status.
- raise_result_notificationwriteRaise a prompt about one result, such as one off target or flagged critical. Refused if the slug already exists, whatever its status.
- mark_sentwriteRecord that a pending prompt was sent, and on which channel.
- acknowledge_notificationwriteRecord that the person has seen a prompt. A person's step.
- dismiss_notificationwriteDismiss a prompt as not needed. It stays on record, so it is not raised again.
queries/record.gq47 queries+
- latest_resultsThe latest current result of each marker, per person.
- out_of_rangeLatest results outside the range their own source printed.
- off_targetLatest results outside the person's own active target for that marker.
- targetsEach active target beside the latest result it is judged against.
- marker_historyEvery current result of one marker, oldest first.
- record_resultsThe results read from one document, with the line each was read from.
- records_awaiting_reviewDocuments an agent read values from that no person has checked against the file yet, and documents nothing was read from.
- unconverted_resultsCurrent results in a unit other than their marker's canonical unit, with no canonical value: they cannot be judged against a target.
- corrected_resultsResults a source corrected, each beside the value it replaced. A correction entered in error is left out.
- preliminary_resultsResults the source marked preliminary that no final result has replaced.
- detection_limit_resultsLatest results reported at a detection limit, such as "<0.3". They are judged against a range or a target only where the limit settles it.
- markersEvery marker with its kind, category and canonical unit.
- marker_codesThe standard codes recorded for each marker.
- search_markersMarkers matching words in their name or description.
- unmeasured_markersMarkers with no current result for anyone.
- open_recommendationsEverything still due, soonest first: open, and not met by a valid result or a given dose.
- overdue_recommendationsRecommendations still due whose date has passed.
- targets_without_retestActive targets whose marker has no recommendation still due to measure it again.
- overdue_not_notifiedOverdue recommendations nobody has been told about: no notification about them exists. A dismissed one counts as told.
- met_by_resultRecommendations a valid result has met, each with the result.
- met_by_doseDose recommendations a given dose has met, each with the dose.
- immunization_historyEvery dose on record, oldest first, with what the entry rests on.
- doses_by_diseaseFor each disease, how many doses were given and the highest dose number reached in its series.
- incomplete_seriesDiseases whose latest given dose is not the last of its series.
- undocumented_dosesDoses no document shows: entered from recall, or with no record linked.
- doses_not_givenDoses that were due and not given, with the reason.
- doses_by_lotEvery dose given from one lot, for a recall notice. Doses not given or entered in error are left out.
- disease_dosesThe doses that count towards one disease, in order.
- reactionsReactions on record, each with the dose or the intervention it is attributed to.
- dose_reactionsReactions that followed a vaccine dose.
- intervention_reactionsReactions attributed to something the person takes or does.
- hypothesesEvery hypothesis with its standing and whether a person has reviewed it.
- hypothesis_supportThe current results linked as supporting one hypothesis.
- hypothesis_contradictionThe current results linked as contradicting one hypothesis.
- contested_hypothesesHypotheses still open or held as supported that a current result contradicts.
- hypotheses_without_evidenceOpen hypotheses with no current result linked for or against them.
- hypotheses_awaiting_reviewHypotheses an agent proposed that no person has reviewed.
- active_interventionsWhat the person takes or does now, at its current dose, with the marker each is meant to move.
- intervention_effectEvery current result of the markers one intervention targets, marked as before or after it started.
- interventions_without_followupActive interventions whose target marker has not been measured since they started.
- dose_historyEvery dose period of every intervention, oldest first: a change of dose or frequency starts a new one.
- active_conditionsA person's suspected and active conditions, with how certain each is.
- visitsEvery visit, newest first, with the commit a completed one baselined.
- upcoming_visitsPlanned visits that have not happened yet, soonest first.
- visit_recordsThe documents that came out of one visit.
- notificationOne notification by its slug: read it before raising the same prompt again.
- unacknowledged_notificationsPrompts raised or sent that the person has not acknowledged or dismissed.
[Run it with your agent]
Paste this into a coding agent. It installs Omnigraph if it has to, creates the graph from this cookbook, loads the sample data and runs the queries above.
- Claude Code
- Codex
- Antigravity
Read https://www.omnigraph.dev/
[More use cases]
[Personal]
Second brain
One person's people, projects, notes, tasks, habits and reading, with where each piece came from.
13 node types · 43 edge types · 128 queries
[Company]
Company brain
A company's people, projects, claims, decisions and commitments, each tied to the exact words it rests on, shared by its people and agents.
8 node types · 18 edge types · 69 queries
[Engineering]
Development graph
Issues, epics, specs, decisions, pull requests, releases and incidents as one graph, with the Git host still the record for code.
22 node types · 92 edge types · 80 queries