Clinia
Concepts

Relationship Inference

How Patient Memory constructs a typed graph of clinical relationships between deduplicated entities, and what nodes and edges that graph contains.

What it is

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. The entity types map directly to the VFS path categories:

Node typeVFS pathRepresents
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

Nodes carry all field values from their contributing sources, resolved conflicts, and the full provenance trace. See Provenance and Auditability.

Edges

Edges are directed and typed. They come from two inference mechanisms.

Knowledge-base edges are emitted when the clinical knowledge base identifies a known relationship between two entities already in the graph:

Edge typeSource nodeTarget nodeWhat it encodes
prescribed_formedicationconditionMedication is indicated for the condition
monitorslabconditionLab test tracks disease activity or treatment response
complication_ofconditionconditionCondition is a known complication of another
manifestation_ofconditionconditionCondition is a clinical manifestation of another
progression_ofconditionconditionCondition is a later stage or progression of another
risk_factor_forconditionconditionCondition increases risk of another
commonly_comorbidconditionconditionConditions frequently co-occur; represented as A→B and B→A edges
same_disease_axisconditionconditionConditions 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 typeSource nodeTarget nodeWhat it encodes
occurred_duringconditionencounterCondition 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.

Note: symptom_of edges, which link symptom conditions to their parent conditions, are added during Stage 3 post-processing, not during relationship inference. They appear in the reconciliation report under post-processing actions rather than as inferred relationships.

Explicit vs. inferred edges

Edges come from two sources and 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 relationship resolver using the clinical knowledge base. The resolver only adds an inferred edge when no explicit edge of the same type already exists between a pair. This prevents the knowledge base from contradicting structured data that came from a clinician.

Both types are recorded in the entity's relationship list with a source field ("explicit" or "inferred") so the distinction is always visible.

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.json at any condition path includes the full list of typed relationship edges for that node, both explicit and inferred.
  • The reconciliation report (GET /patients/{patientId}/reconciliation) lists every inferred edge added during the inference pass. See Review the Reconciliation Summary.

On this page