Relationship Inference
How the Clinia Context Engine constructs a typed graph of clinical relationships between deduplicated entities, and what nodes and edges that graph contains.
Relationship Inference
After entity resolution deduplicates clinical records across sources, the patient graph is a set of isolated nodes: conditions, medications, labs, and so on. Those nodes do not yet know about each other. Relationship inference adds the edges that connect them.
The result is a directed, typed graph where each edge encodes a specific clinical meaning. This structure is what allows the VFS to assemble condition stories that include medications, monitoring labs, and complications without querying across separate tables.
Nodes
Each node in the graph corresponds to one resolved clinical entity. Most entity types map directly to the VFS path categories; the last two are edge endpoints only, so they appear in a fact's relationship list without having a path of their own:
| Node type | VFS path | Represents |
|---|---|---|
condition | /conditions/active/, /conditions/resolved/ | Diagnoses, problems, and clinical findings |
medication | /medications/current/, /medications/discontinued/ | Drugs, dosages, and administration records |
lab | /labs/ | Laboratory observations and results |
allergy | /allergies/ | Allergy and intolerance records |
encounter | /encounters/{year}/ | Clinical visits, organized by year |
family_history | /family_history/ | Conditions recorded as family history |
insurance | /insurance/ | Coverage and payer information |
directive | /directives/ | Advance directives and consent records |
memory | — not a VFS entry | What a session recorded |
narrative | — not a VFS entry | Free-text content of an ingested document |
Nodes carry all field values from their contributing sources, resolved conflicts, and the full provenance trace. See Provenance and Auditability.
memory and narrative are explained under the edges they carry, below.
Edges
Edges are directed and typed. Several mechanisms produce them, and each edge records which one it came from.
Knowledge-base edges are emitted when the clinical knowledge base identifies a known relationship between two entities already in the graph:
| Edge type | Source node | Target node | What it encodes |
|---|---|---|---|
prescribed_for | medication | condition | Medication is indicated for the condition |
monitors | lab | condition | Lab test tracks disease activity or treatment response |
has_complication | condition | condition | Condition has another as a known complication |
manifestation_of | condition | condition | Condition is a clinical manifestation of another |
progression_of | condition | condition | Condition is a later stage or progression of another |
risk_factor_for | condition | condition | Condition increases risk of another |
commonly_comorbid | condition | condition | Conditions frequently co-occur; represented as A→B and B→A edges |
same_disease_axis | condition | condition | Conditions share the same disease spectrum or axis |
Each knowledge-base edge carries a confidence score derived from the strength level in the knowledge base: strong indications produce confidence ~0.90, moderate ~0.75, weak ~0.60.
Temporal inference edges are emitted when timing patterns suggest a linkage that is not in the knowledge base:
| Edge type | Source node | Target node | What it encodes |
|---|---|---|---|
occurred_during | condition | encounter | Condition onset or recorded date correlates with an encounter |
occurred_during uses graded confidence based on how closely the condition onset aligns with the encounter window (0.80 for onset within the encounter period, down to 0.60 for onset within 30 days). It is skipped when an explicit has_reason or occurred_during edge already exists from the source data.
Memory edges are emitted when memories are generated for a session and a clinically-anchored memory (symptom or adherence) is matched against the patient's facts. See Memory.
| Edge type | Source node | Target node | What it encodes |
|---|---|---|---|
corroborates | memory | fact | Conversational statement agrees with the structured record |
enriches | memory | fact | Conversational statement adds context without contradicting |
conflicts | memory | fact | Conversational statement contradicts the structured record |
Memory edges never modify the target fact. A conflicts edge surfaces the disagreement without touching the fact's value, status, or confidence. concern and preference memories produce no edges.
Narrative edges use the same three types, but come from a different place: they are emitted during ingestion, when a fact is adjudicated against the free-text narrative content of the documents the patient's record already contains. Where a memory edge speaks for something said in a session, a narrative edge speaks for something written in a note.
| Edge type | Source node | Target node | What it encodes |
|---|---|---|---|
corroborates | narrative | fact | The note states what the structured record holds |
enriches | narrative | fact | The note adds context the structured record does not carry |
conflicts | narrative | fact | The note contradicts the structured record |
A narrative edge carries the evidence for its verdict: the verbatim quote, the passage the quote came from, and the strength of the reading. Like memory edges, it never modifies the target fact — a conflicts edge records the disagreement and leaves the fact's value, status, and confidence alone.
Explicit vs. inferred edges
Whether an edge was stated or inferred matters more than which mechanism inferred it, and the two are handled differently.
Explicit edges are lifted directly from the source data. FHIR reasonReference links and CDA entryRelationship elements are preserved as-is. They are never overridden by inference.
Inferred edges are added by the mechanisms described above — the knowledge base, temporal patterns, memory generation, and narrative verification. For the two that connect facts to each other, the relationship resolver only adds an inferred edge when no explicit edge of the same type already exists between the pair, so the knowledge base cannot contradict structured data that came from a clinician. Memory and narrative edges raise no such conflict: they run between a fact and an endpoint that source data never links to, in edge types no source record states.
Every edge records in the entity's relationship list which mechanism produced it, so the distinction is always visible. The possible values of source are:
explicit_reference- Lifted directly from the source data, never inferredknowledge_base- Inferred from a known relationship in the clinical knowledge basetemporal_inference- Inferred from how the two entities line up in timellm_inferred- Inferred by a model, as memory edges arenarrative_verification- Inferred by adjudicating a fact against narrative content
Where the graph is visible
The relationship graph surfaces in three places:
- Condition stories (
_story.md) are assembled by traversing the graph from a condition node outward to its linked medications, labs, and complications. See Condition Stories. _raw.jsonat any condition path includes the full list of typed relationship edges for that node, both explicit and inferred.- The reconciliation report (
GET /v1/patients/{patientId}/reconciliation) lists every inferred edge added during the inference pass. See Review the Reconciliation Summary.
Entity Resolution
How the Clinia Context Engine deduplicates clinical entities across multiple sources using a 4-layer escalating pipeline.
Provenance and Auditability
How the Clinia Context Engine records where every clinical fact came from, what conflicts existed between sources, and how each conflict was resolved.