# From Theory to Practice

URL: https://docs.clinia.com/docs/get-started/from-the-names-to-the-data-model

> Which graph types, VFS paths and REST operations sit behind Recorded Memory and Learned Memory.

Recorded Memory and Learned Memory are high-level concepts that describe the content of a patient graph, but they are not concrete API objects you interact with when using the Context Engine. The API returns facts, narratives, memories and the edges between them.

<img
  src="/patient-graph.webp"
  alt="The patient graph: the nodes Recorded Memory and Learned Memory produce, and the edges between them"
  width={2000}
  height={902}
  className="dark:hidden"
/>
<img
  src="/patient-graph-dark.webp"
  alt="The patient graph: the nodes Recorded Memory and Learned Memory produce, and the edges between them"
  width={2000}
  height={902}
  className="hidden dark:block"
/>

Four families of REST operations touch these objects.

| Family    | Operations                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | What it returns                                                      |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| Graph     | [`list-nodes`](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), [`get-node`](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items-nodeId), [`list-edges`](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items), [`get-edge`](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items-edgeId) and one query operation per node and edge type, shown as [Query nodes](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query) and [Query edges](https://docs.clinia.com/api/rest/post-patients-patientId-graph-edges-type-query) (technical preview) | The nodes and edges themselves                                       |
| VFS       | [`browse-vfs`](https://docs.clinia.com/api/rest/get-patients-patientId-vfs) and [`read-vfs`](https://docs.clinia.com/api/rest/get-patients-patientId-read)                                                                                                                                                                                                                                                                                                                                                                                                                                  | Folders and files rendered from the graph                            |
| Sessions  | [`get-session`](https://docs.clinia.com/api/rest/get-patients-patientId-sessions-sessionId) and [`list-session-memories`](https://docs.clinia.com/api/rest/get-patients-patientId-sessions-sessionId-memories)                                                                                                                                                                                                                                                                                                                                                                              | A session's metadata and its memories                                |
| Ingestion | [`ingest-fhir-r4`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-fhir-r4), [`ingest-fhir-r5`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-fhir-r5), [`ingest-cda-r2`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-cda-r2), [`ingest-sessions`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-sessions), [`list-ingestions`](https://docs.clinia.com/api/rest/get-patients-patientId-ingestions) and [`get-ingestion`](https://docs.clinia.com/api/rest/get-patients-patientId-ingestions-ingestionId)                                                                                       | Receipts that track a submission and none of the objects it produces |

## Recorded Memory objects [#recorded-memory-objects]

Six node types make up Recorded Memory.

| Object                     | What it is                                                                                      | VFS paths                                                                                                                                                              | REST operations                                                                                                                                                                                                                                         |
| -------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `extracted_fact`           | The state of a patient, as one source stated it                                                 | None                                                                                                                                                                   | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-extracted-fact-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query)                                                                         |
| `extracted_clinical_event` | A point-in-time event such as an encounter, an observation, a procedure or an administered dose | `/timeline/`                                                                                                                                                           | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-extracted-clinical-event-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query)                                                               |
| `extracted_narrative`      | The free-form text of a document                                                                | `/sources/`                                                                                                                                                            | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-extracted-narrative-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query)                                                                    |
| `narrative_passage`        | A sentence or paragraph of an extracted narrative                                               | None                                                                                                                                                                   | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-narrative-passage-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query)                                                                      |
| `fact`                     | The canonical state of a patient axis, merged from the extracted facts that describe it         | The entity folders: `/conditions/`, `/medications/`, `/labs/`, `/allergies/`, `/encounters/`, `/directives/`, `/insurance/`, `/family_history/` and `/social_history/` | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-fact-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query), and [`read-vfs`](https://docs.clinia.com/api/rest/get-patients-patientId-read) with `structured` format |
| `narrative`                | A summary of narrative passages                                                                 | `/conditions/{status}/{id}/_narratives/`                                                                                                                               | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-narrative-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query)                                                                              |

Four edge types record how the nodes were formed and what relates to them.

| Object                | Runs between                                                               | What it records                                                                                                             | VFS paths                                                                                                                                                  | REST operations                                                                                                                                                                      |
| --------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `resolves_to`         | An extracted fact and its fact, and a narrative passage and its narrative  | Which canonical node an extracted node was merged into                                                                      | None                                                                                                                                                       | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items), including [`query-resolves-to-edges`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-edges-type-query)         |
| `resolution_decision` | Two nodes of the same type that the engine compared                        | The verdict (merge or reject), the rule that fired and the evidence                                                         | None                                                                                                                                                       | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items), including [`query-resolution-decision-edges`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-edges-type-query) |
| `chunked_into`        | An extracted narrative and its narrative passages                          | How a text was split into passages                                                                                          | None                                                                                                                                                       | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items), including [`query-chunked-into-edges`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-edges-type-query)        |
| `relationship`        | A fact and a fact, a narrative and a fact, and a learned memory and a fact | A typed link, either a clinical link between facts or `corroborates`, `enriches` or `conflicts` for a narrative or a memory | A condition's `_story.md` and `_narratives/`, and the typed edges returned by [`read-vfs`](https://docs.clinia.com/api/rest/get-patients-patientId-read) with `structured` format | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-edges-type-items), including [`query-relationship-edges`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-edges-type-query)        |

<Callout title="The audit surfaces start with the graph operations">
  No VFS path shows a resolution edge, so tracing a fact back to its sources or reading why two
  nodes merged is done with the graph operations. [Audit the Patient
  Graph](https://docs.clinia.com/docs/trust-and-governance/audit-the-graph) walks through both.
</Callout>

## Learned Memory objects [#learned-memory-objects]

Three objects make up Learned Memory. Only the memory is a node in the patient graph.

| Object           | What it is                                                                                                                 | VFS paths                                                                                            | REST operations                                                                                                                                                                                                                                                                                                                          |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Session          | One conversation with a patient, created by its first write                                                                | None                                                                                                 | [`get-session`](https://docs.clinia.com/api/rest/get-patients-patientId-sessions-sessionId) and [`ingest-sessions`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-sessions) (technical preview), while [`create-session`](https://docs.clinia.com/api/rest/post-patients-patientId-sessions) and [`upsert-session`](https://docs.clinia.com/api/rest/put-patients-patientId-sessions-sessionId) are deprecated |
| Message          | One turn of a session                                                                                                      | None                                                                                                 | No operation returns messages, while [`append-messages`](https://docs.clinia.com/api/rest/post-patients-patientId-sessions-sessionId-messages) is deprecated in favour of [`ingest-sessions`](https://docs.clinia.com/api/rest/post-patients-patientId-ingestions-sessions)                                                                                                            |
| `learned_memory` | A statement kept from a session, of type `symptom`, `adherence`, `concern` or `preference`, stored as a short text passage | `/memory/{type}.md`, plus the Patient-Reported section of a condition story and of a medication file | [Graph operations](https://docs.clinia.com/api/rest/get-patients-patientId-graph-nodes-type-items), including [`query-learned-memory-nodes`](https://docs.clinia.com/api/rest/post-patients-patientId-graph-nodes-type-query), and [`list-session-memories`](https://docs.clinia.com/api/rest/get-patients-patientId-sessions-sessionId-memories)                                                             |

A memory links back to a fact through the `relationship` edge described in [Recorded Memory objects](#recorded-memory-objects). The link follows four rules.

- Only `symptom` memories, which link to conditions, and `adherence` memories, which link to medications, are linked to facts. `concern` and `preference` memories stay unlinked.
- A memory links only to the facts it names or clearly describes, such as "my blood thinner" when one blood thinner is on file. A memory that names nothing, such as "No. She took it back.", stays unlinked.
- The link is typed `corroborates`, `enriches` or `conflicts`, depending on whether the memory agrees with the fact, adds context to it or contradicts it.
- The link leaves the fact as it was. Memories are never merged or updated.
