@clinia/context-engine-js 0.5.0 → 0.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,7 +122,10 @@ export interface paths {
122
122
  put?: never;
123
123
  /**
124
124
  * Ingest FHIR R4
125
- * @description Submits a FHIR R4 Bundle or single resource for ingestion. Returns an `IngestExecutionEnvelope` immediately with status `pending` or `running`. Pass `?wait=<ms>` (max 30 000) to block until the execution reaches a terminal status. Multiple ingest calls for the same registry key accumulate sources; entity resolution re-runs after each call.
125
+ * @deprecated
126
+ * @description **Deprecated — use `POST /v1/patients/{patientId}/ingestions/fhir/r4` instead**, or `…/fhir/r5` for R5 payloads, which this endpoint parses as R4. The replacement returns an ingestion receipt you poll, accounts for resources it could not use, and does not block. This endpoint is unchanged and will be removed in a future release.
127
+ *
128
+ * Submits a FHIR R4 Bundle or single resource for ingestion. Returns an `IngestExecutionEnvelope` immediately with status `pending` or `running`. Pass `?wait=<ms>` (max 30 000) to block until the execution reaches a terminal status. Multiple ingest calls for the same registry key accumulate sources; entity resolution re-runs after each call.
126
129
  */
127
130
  post: operations["ingest-fhir"];
128
131
  delete?: never;
@@ -142,7 +145,10 @@ export interface paths {
142
145
  put?: never;
143
146
  /**
144
147
  * Ingest CDA
145
- * @description Submits a CDA/C-CDA XML document for ingestion. Body must be `text/plain`. Returns an `IngestExecutionEnvelope` immediately; use `?wait=<ms>` to block until terminal status.
148
+ * @deprecated
149
+ * @description **Deprecated — use `POST /v1/patients/{patientId}/ingestions/cda/r2` instead.** The replacement takes several documents in one call, returns an ingestion receipt you poll, and accounts for the sections it could not use. This endpoint is unchanged and will be removed in a future release.
150
+ *
151
+ * Submits a CDA/C-CDA XML document for ingestion. Body must be `text/plain`. Returns an `IngestExecutionEnvelope` immediately; use `?wait=<ms>` to block until terminal status.
146
152
  */
147
153
  post: operations["ingest-cda"];
148
154
  delete?: never;
@@ -162,7 +168,10 @@ export interface paths {
162
168
  put?: never;
163
169
  /**
164
170
  * Register unstructured document
165
- * @description Registers an unstructured document by name and MIME type. Used for documents that cannot be parsed as FHIR or CDA (e.g., PDFs). The document is tracked as an ingest source but does not contribute extracted clinical entities.
171
+ * @deprecated
172
+ * @description **Deprecated, and not replaced yet.** It registers a name and a MIME type and extracts nothing, so it contributes no clinical content; unstructured document ingest returns as a file upload once that work lands. This endpoint is unchanged and will be removed in a future release.
173
+ *
174
+ * Registers an unstructured document by name and MIME type. Used for documents that cannot be parsed as FHIR or CDA (e.g., PDFs). The document is tracked as an ingest source but does not contribute extracted clinical entities.
166
175
  */
167
176
  post: operations["ingest-document"];
168
177
  delete?: never;
@@ -182,7 +191,10 @@ export interface paths {
182
191
  put?: never;
183
192
  /**
184
193
  * Batch ingest
185
- * @description Submits FHIR bundles, CDA documents, and unstructured document registrations in a single request. Each source type is processed independently; the graph is rebuilt once after all sources are loaded.
194
+ * @deprecated
195
+ * @description **Deprecated, and not replaced.** Post to the per-format endpoints instead — `POST /v1/patients/{patientId}/ingestions/fhir/r4` (or `/r5`) and `.../ingestions/cda/r2`, each of which accepts several items in one call. Mixing formats in one request forces a single label onto the receipt, so it cannot record what actually arrived. This endpoint is unchanged and will be removed in a future release.
196
+ *
197
+ * Submits FHIR bundles, CDA documents, and unstructured document registrations in a single request. Each source type is processed independently; the graph is rebuilt once after all sources are loaded.
186
198
  */
187
199
  post: operations["ingest-batch"];
188
200
  delete?: never;
@@ -251,6 +263,108 @@ export interface paths {
251
263
  patch?: never;
252
264
  trace?: never;
253
265
  };
266
+ "/v1/patients/{patientId}/ingestions/fhir/r4": {
267
+ parameters: {
268
+ query?: never;
269
+ header?: never;
270
+ path?: never;
271
+ cookie?: never;
272
+ };
273
+ get?: never;
274
+ put?: never;
275
+ /**
276
+ * Ingest FHIR R4
277
+ * @description Submits a FHIR R4 Bundle or a single resource. The response is a receipt: extraction continues after it is returned, so poll the ingestion to follow it. The version is part of the path because a Bundle does not state which FHIR release it is written against.
278
+ */
279
+ post: operations["ingest-fhir-r4"];
280
+ delete?: never;
281
+ options?: never;
282
+ head?: never;
283
+ patch?: never;
284
+ trace?: never;
285
+ };
286
+ "/v1/patients/{patientId}/ingestions/fhir/r5": {
287
+ parameters: {
288
+ query?: never;
289
+ header?: never;
290
+ path?: never;
291
+ cookie?: never;
292
+ };
293
+ get?: never;
294
+ put?: never;
295
+ /**
296
+ * Ingest FHIR R5
297
+ * @description Submits a FHIR R5 Bundle or a single resource. The response is a receipt: ingestion continues after it is returned, so poll the ingestion to follow it. The version is part of the path because a Bundle does not state which FHIR release it is written against.
298
+ */
299
+ post: operations["ingest-fhir-r5"];
300
+ delete?: never;
301
+ options?: never;
302
+ head?: never;
303
+ patch?: never;
304
+ trace?: never;
305
+ };
306
+ "/v1/patients/{patientId}/ingestions/cda/r2": {
307
+ parameters: {
308
+ query?: never;
309
+ header?: never;
310
+ path?: never;
311
+ cookie?: never;
312
+ };
313
+ get?: never;
314
+ put?: never;
315
+ /**
316
+ * Ingest CDA R2
317
+ * @description Submits CDA R2 documents as XML. Post one document as the request body with `Content-Type: application/cda+xml`, or several as `multipart/form-data` with one `documents` part per document.
318
+ *
319
+ * The response is a receipt: ingestion continues after it is returned, so poll the ingestion to follow it. `intake` comes back index-aligned with the documents you sent, so it stays clear which document held what — and if any document cannot be parsed the whole request is rejected and nothing is stored.
320
+ */
321
+ post: operations["ingest-cda-r2"];
322
+ delete?: never;
323
+ options?: never;
324
+ head?: never;
325
+ patch?: never;
326
+ trace?: never;
327
+ };
328
+ "/v1/patients/{patientId}/ingestions": {
329
+ parameters: {
330
+ query?: never;
331
+ header?: never;
332
+ path?: never;
333
+ cookie?: never;
334
+ };
335
+ /**
336
+ * List ingestions
337
+ * @description This patient's submissions, newest arrival last. `status` is derived per submission from the work it started, so filtering on it is also how to ask what is outstanding: `?status=pending,processing` returns everything still to settle, and its `meta.total` is the count — zero means this patient's data has settled.
338
+ */
339
+ get: operations["list-ingestions"];
340
+ put?: never;
341
+ post?: never;
342
+ delete?: never;
343
+ options?: never;
344
+ head?: never;
345
+ patch?: never;
346
+ trace?: never;
347
+ };
348
+ "/v1/patients/{patientId}/ingestions/{ingestionId}": {
349
+ parameters: {
350
+ query?: never;
351
+ header?: never;
352
+ path?: never;
353
+ cookie?: never;
354
+ };
355
+ /**
356
+ * Get an ingestion
357
+ * @description One submission and where its work stands. `status` is derived from the work the submission started, so this is the handle to poll after submitting — it stays valid for the life of that work.
358
+ */
359
+ get: operations["get-ingestion"];
360
+ put?: never;
361
+ post?: never;
362
+ delete?: never;
363
+ options?: never;
364
+ head?: never;
365
+ patch?: never;
366
+ trace?: never;
367
+ };
254
368
  "/v1/patients/{patientId}/sessions": {
255
369
  parameters: {
256
370
  query?: never;
@@ -399,6 +513,106 @@ export interface paths {
399
513
  patch?: never;
400
514
  trace?: never;
401
515
  };
516
+ "/v1/patients/{patientId}/graph/nodes/{type}/items/{nodeId}": {
517
+ parameters: {
518
+ query?: never;
519
+ header?: never;
520
+ path?: never;
521
+ cookie?: never;
522
+ };
523
+ /**
524
+ * Get node
525
+ * @description Returns a single node from the patient context graph by id
526
+ */
527
+ get: operations["get-node"];
528
+ put?: never;
529
+ post?: never;
530
+ delete?: never;
531
+ options?: never;
532
+ head?: never;
533
+ patch?: never;
534
+ trace?: never;
535
+ };
536
+ "/v1/patients/{patientId}/graph/nodes/{type}/items": {
537
+ parameters: {
538
+ query?: never;
539
+ header?: never;
540
+ path?: never;
541
+ cookie?: never;
542
+ };
543
+ /**
544
+ * List nodes
545
+ * @description Returns a paginated list of nodes of one type from the patient context graph
546
+ */
547
+ get: operations["list-nodes"];
548
+ put?: never;
549
+ post?: never;
550
+ delete?: never;
551
+ options?: never;
552
+ head?: never;
553
+ patch?: never;
554
+ trace?: never;
555
+ };
556
+ "/v1/patients/{patientId}/graph/nodes/{type}/query": {
557
+ parameters: {
558
+ query?: never;
559
+ header?: never;
560
+ path?: never;
561
+ cookie?: never;
562
+ };
563
+ get?: never;
564
+ put?: never;
565
+ /**
566
+ * Query nodes
567
+ * @description Returns a paginated, filtered, and sorted page of nodes of one type from the patient context graph — the structured counterpart to `list-nodes`, for conditions that don't fit query-string params. Only `fact` is supported today; broader per-type querying is future work.
568
+ */
569
+ post: operations["query-nodes"];
570
+ delete?: never;
571
+ options?: never;
572
+ head?: never;
573
+ patch?: never;
574
+ trace?: never;
575
+ };
576
+ "/v1/patients/{patientId}/graph/edges/{type}/items/{edgeId}": {
577
+ parameters: {
578
+ query?: never;
579
+ header?: never;
580
+ path?: never;
581
+ cookie?: never;
582
+ };
583
+ /**
584
+ * Get edge
585
+ * @description Returns a single edge from the patient context graph by id
586
+ */
587
+ get: operations["get-edge"];
588
+ put?: never;
589
+ post?: never;
590
+ delete?: never;
591
+ options?: never;
592
+ head?: never;
593
+ patch?: never;
594
+ trace?: never;
595
+ };
596
+ "/v1/patients/{patientId}/graph/edges/{type}/items": {
597
+ parameters: {
598
+ query?: never;
599
+ header?: never;
600
+ path?: never;
601
+ cookie?: never;
602
+ };
603
+ /**
604
+ * List edges
605
+ * @description Returns a paginated list of edges of one type from the patient context graph
606
+ */
607
+ get: operations["list-edges"];
608
+ put?: never;
609
+ post?: never;
610
+ delete?: never;
611
+ options?: never;
612
+ head?: never;
613
+ patch?: never;
614
+ trace?: never;
615
+ };
402
616
  }
403
617
  export type webhooks = Record<string, never>;
404
618
  export interface components {
@@ -519,7 +733,7 @@ export interface components {
519
733
  display: string;
520
734
  /** @description Complete provenance trace for this fact. */
521
735
  provenance: {
522
- /** @description Resolution layer that produced this fact (e.g., deterministic-code, nlp-normalization, llm-adjudication, novel-entity). */
736
+ /** @description Id of the stop rule that settled this fact's most recent merge decision (e.g., deterministic-code-exact, nlp-normalization-match, llm-adjudication), or novel-entity if no pair was ever compared. */
523
737
  resolvedBy: string;
524
738
  /** @description Resolution confidence score between 0 and 1. */
525
739
  confidence: number;
@@ -595,7 +809,7 @@ export interface components {
595
809
  type: string;
596
810
  /** @description Number of source records that were merged into this entity. */
597
811
  sourceCount: number;
598
- /** @description Resolution strategy that produced the merge. */
812
+ /** @description Id of the stop rule that settled the merge, or novel-entity if none was compared. */
599
813
  resolvedBy: string;
600
814
  /** @description Merge confidence score between 0 and 1. */
601
815
  confidence: number;
@@ -806,6 +1020,110 @@ export interface components {
806
1020
  detail?: string;
807
1021
  } | null;
808
1022
  };
1023
+ /** @description One submission, whatever the item count — the receipt for a single request, and the only handle to keep. A receipt whose `staged` counts are all zero created no work, and `intake` says which of the two reasons it was: entries reading `ignored` mean nothing in the payload could be used, anything else means the content was already stored by an earlier submission — in which case `status` covers the work holding it, and can be `failed`. */
1024
+ Ingestion: {
1025
+ /** @description Stable unique identifier for this submission. */
1026
+ ingestionId: string;
1027
+ source: components["schemas"]["IngestionSource"];
1028
+ /** @description Media type as received. */
1029
+ mimeType: string;
1030
+ /** @description ISO 8601 timestamp when the submission was accepted. */
1031
+ receivedAt: string;
1032
+ status: components["schemas"]["IngestionStatus"];
1033
+ staged: components["schemas"]["IngestionStaged"];
1034
+ intake?: components["schemas"]["IngestionIntake"];
1035
+ /** @description ISO 8601 timestamp when all of this submission's work settled. Null until then. */
1036
+ completedAt: string | null;
1037
+ /** @description Why this submission did not land. Null unless `status` is `failed` or `partial`. */
1038
+ failure: {
1039
+ /** @description Machine-readable classification. */
1040
+ code: string;
1041
+ /** @description Human-readable detail. */
1042
+ message: string;
1043
+ } | null;
1044
+ };
1045
+ /**
1046
+ * @description Version-qualified entry family. `batch/legacy` and `document/legacy` are historical only — no current route writes them.
1047
+ * @enum {string}
1048
+ */
1049
+ IngestionSource: "fhir/r4" | "fhir/r5" | "cda/r2" | "session/v1" | "batch/legacy" | "document/legacy";
1050
+ /**
1051
+ * @description Where this submission stands, across all its work.
1052
+ * @enum {string}
1053
+ */
1054
+ IngestionStatus: "pending" | "processing" | "succeeded" | "partial" | "failed";
1055
+ /** @description What this submission staged, per entity kind. Fixed at accept and never recomputed. */
1056
+ IngestionStaged: {
1057
+ /** @description Clinical facts staged. */
1058
+ facts: number;
1059
+ /** @description Clinical events staged. */
1060
+ events: number;
1061
+ /** @description Prose passages staged. */
1062
+ narratives: number;
1063
+ };
1064
+ /** @description What the submission held. Absent when it was not recorded. */
1065
+ IngestionIntake: {
1066
+ /**
1067
+ * @description The sub-unit of this item: resources in a bundle, sections in a document, messages in a transcript.
1068
+ * @enum {string}
1069
+ */
1070
+ unit: "resource" | "section" | "message";
1071
+ /** @description Items of `unit` this one carried. */
1072
+ received: number;
1073
+ /** @description Grouped by kind and outcome. */
1074
+ entries: {
1075
+ /**
1076
+ * @description A FHIR `resourceType`, a CDA section code — your own token, echoed back.
1077
+ * @example ServiceRequest
1078
+ */
1079
+ kind: string;
1080
+ /**
1081
+ * @description Section title, where the kind alone does not read as one.
1082
+ * @example Results
1083
+ */
1084
+ label?: string;
1085
+ /** @description How many items of this kind and outcome. */
1086
+ count: number;
1087
+ outcome: components["schemas"]["IngestionItemOutcome"];
1088
+ reason?: components["schemas"]["IngestionIgnoreReason"];
1089
+ }[];
1090
+ }[];
1091
+ /**
1092
+ * @description structured: clinical detail was read from it. text_only: kept, but as prose — no structured detail was read. ignored: not used at all.
1093
+ * @enum {string}
1094
+ */
1095
+ IngestionItemOutcome: "structured" | "text_only" | "ignored";
1096
+ /**
1097
+ * @description Present only when `outcome` is `ignored`.
1098
+ * @enum {string}
1099
+ */
1100
+ IngestionIgnoreReason: "unsupported" | "unusable" | "empty";
1101
+ /** @description A FHIR Bundle or a single FHIR resource. */
1102
+ IngestFhirBody: {
1103
+ /**
1104
+ * @description The FHIR resource type — `Bundle` for a collection, otherwise the resource's.
1105
+ * @example Bundle
1106
+ */
1107
+ resourceType: string;
1108
+ /** @description A Bundle's entries. Absent when the body is a single resource. */
1109
+ entry?: unknown[];
1110
+ } & {
1111
+ [key: string]: unknown;
1112
+ };
1113
+ /** @description A page of submissions for this patient. */
1114
+ IngestionList: {
1115
+ /** @description The requested page of items. */
1116
+ data: components["schemas"]["Ingestion"][];
1117
+ /** @description Pagination metadata for the returned page. */
1118
+ meta: {
1119
+ /** @description Total number of items across all pages. */
1120
+ total: number;
1121
+ /** @description Zero-indexed page returned in `data`. */
1122
+ page: number;
1123
+ /** @description Page size used for this response. */
1124
+ perPage: number;
1125
+ };
1126
+ };
809
1127
  /** @description A session opened or confirmed by the upsert-session endpoint. */
810
1128
  Session: {
811
1129
  /** @description Unique identifier for this session. */
@@ -900,57 +1218,235 @@ export interface components {
900
1218
  /** @description Rendered content of the VFS file in the requested format (narrative Markdown, compact Markdown, or structured JSON string). */
901
1219
  content: string;
902
1220
  };
903
- };
904
- responses: never;
905
- parameters: never;
906
- requestBodies: never;
907
- headers: never;
908
- pathItems: never;
909
- }
910
- export type $defs = Record<string, never>;
911
- export interface operations {
912
- "get-service-info": {
913
- parameters: {
914
- query?: never;
915
- header?: never;
916
- path?: never;
917
- cookie?: never;
918
- };
919
- requestBody?: never;
920
- responses: {
921
- /** @description Service name and build identity */
922
- 200: {
923
- headers: {
924
- [name: string]: unknown;
925
- };
926
- content: {
927
- "application/json": components["schemas"]["ServiceInfo"];
928
- };
1221
+ /** @description A node in the patient context graph. */
1222
+ Node: {
1223
+ /** @enum {string} */
1224
+ type: "extracted_fact";
1225
+ /** @description Unique identifier for this node. */
1226
+ id: string;
1227
+ /** @description ISO 8601 timestamp when this node was first created. */
1228
+ createdAt: string;
1229
+ /** @description ISO 8601 timestamp when this node was last updated. */
1230
+ updatedAt: string;
1231
+ /** @description Type-specific attributes of an `extracted_fact` node. */
1232
+ payload: {
1233
+ [key: string]: unknown;
929
1234
  };
930
- };
931
- };
932
- "list-patients": {
933
- parameters: {
934
- query?: never;
935
- header?: never;
936
- path?: never;
937
- cookie?: never;
938
- };
939
- requestBody?: never;
940
- responses: {
941
- /** @description List all registered patients */
942
- 200: {
943
- headers: {
944
- [name: string]: unknown;
945
- };
946
- content: {
947
- "application/json": components["schemas"]["PatientList"];
948
- };
1235
+ } | {
1236
+ /** @enum {string} */
1237
+ type: "fact";
1238
+ /** @description Unique identifier for this node. */
1239
+ id: string;
1240
+ /** @description ISO 8601 timestamp when this node was first created. */
1241
+ createdAt: string;
1242
+ /** @description ISO 8601 timestamp when this node was last updated. */
1243
+ updatedAt: string;
1244
+ /** @description Type-specific attributes of a `fact` node. */
1245
+ payload: {
1246
+ [key: string]: unknown;
949
1247
  };
950
- };
951
- };
952
- "get-patient": {
953
- parameters: {
1248
+ } | {
1249
+ /** @enum {string} */
1250
+ type: "extracted_narrative";
1251
+ /** @description Unique identifier for this node. */
1252
+ id: string;
1253
+ /** @description ISO 8601 timestamp when this node was first created. */
1254
+ createdAt: string;
1255
+ /** @description ISO 8601 timestamp when this node was last updated. */
1256
+ updatedAt: string;
1257
+ /** @description Type-specific attributes of an `extracted_narrative` node. */
1258
+ payload: {
1259
+ [key: string]: unknown;
1260
+ };
1261
+ } | {
1262
+ /** @enum {string} */
1263
+ type: "narrative_passage";
1264
+ /** @description Unique identifier for this node. */
1265
+ id: string;
1266
+ /** @description ISO 8601 timestamp when this node was first created. */
1267
+ createdAt: string;
1268
+ /** @description ISO 8601 timestamp when this node was last updated. */
1269
+ updatedAt: string;
1270
+ /** @description Type-specific attributes of a `narrative_passage` node. */
1271
+ payload: {
1272
+ [key: string]: unknown;
1273
+ };
1274
+ } | {
1275
+ /** @enum {string} */
1276
+ type: "narrative";
1277
+ /** @description Unique identifier for this node. */
1278
+ id: string;
1279
+ /** @description ISO 8601 timestamp when this node was first created. */
1280
+ createdAt: string;
1281
+ /** @description ISO 8601 timestamp when this node was last updated. */
1282
+ updatedAt: string;
1283
+ /** @description Type-specific attributes of a `narrative` node. */
1284
+ payload: {
1285
+ [key: string]: unknown;
1286
+ };
1287
+ } | {
1288
+ /** @enum {string} */
1289
+ type: "learned_memory";
1290
+ /** @description Unique identifier for this node. */
1291
+ id: string;
1292
+ /** @description ISO 8601 timestamp when this node was first created. */
1293
+ createdAt: string;
1294
+ /** @description ISO 8601 timestamp when this node was last updated. */
1295
+ updatedAt: string;
1296
+ /** @description Type-specific attributes of a `learned_memory` node. */
1297
+ payload: {
1298
+ [key: string]: unknown;
1299
+ };
1300
+ } | {
1301
+ /** @enum {string} */
1302
+ type: "extracted_clinical_event";
1303
+ /** @description Unique identifier for this node. */
1304
+ id: string;
1305
+ /** @description ISO 8601 timestamp when this node was first created. */
1306
+ createdAt: string;
1307
+ /** @description ISO 8601 timestamp when this node was last updated. */
1308
+ updatedAt: string;
1309
+ /** @description Type-specific attributes of an `extracted_clinical_event` node. */
1310
+ payload: {
1311
+ [key: string]: unknown;
1312
+ };
1313
+ };
1314
+ /** @description A page of nodes of one type from the patient context graph. */
1315
+ NodeList: {
1316
+ /** @description The requested page of items. */
1317
+ data: components["schemas"]["Node"][];
1318
+ /** @description Pagination metadata for the returned page. */
1319
+ meta: {
1320
+ /** @description Total number of items across all pages. */
1321
+ total: number;
1322
+ /** @description Zero-indexed page returned in `data`. */
1323
+ page: number;
1324
+ /** @description Page size used for this response. */
1325
+ perPage: number;
1326
+ };
1327
+ };
1328
+ /** @description An edge in the patient context graph. */
1329
+ Edge: {
1330
+ /** @enum {string} */
1331
+ type: "resolution_decision";
1332
+ /** @description Unique identifier for this edge. */
1333
+ id: string;
1334
+ /** @description ISO 8601 timestamp when this edge was first created. */
1335
+ createdAt: string;
1336
+ /** @description ISO 8601 timestamp when this edge was last updated. */
1337
+ updatedAt: string;
1338
+ from: components["schemas"]["NodeRef"];
1339
+ to: components["schemas"]["NodeRef"] & unknown;
1340
+ /** @description Type-specific attributes of a `resolution_decision` edge. */
1341
+ payload: {
1342
+ [key: string]: unknown;
1343
+ };
1344
+ } | {
1345
+ /** @enum {string} */
1346
+ type: "resolves_to";
1347
+ /** @description Unique identifier for this edge. */
1348
+ id: string;
1349
+ /** @description ISO 8601 timestamp when this edge was first created. */
1350
+ createdAt: string;
1351
+ /** @description ISO 8601 timestamp when this edge was last updated. */
1352
+ updatedAt: string;
1353
+ from: components["schemas"]["NodeRef"];
1354
+ to: components["schemas"]["NodeRef"] & unknown;
1355
+ /** @description Type-specific attributes of a `resolves_to` edge. */
1356
+ payload: {
1357
+ [key: string]: unknown;
1358
+ };
1359
+ } | {
1360
+ /** @enum {string} */
1361
+ type: "chunked_into";
1362
+ /** @description Unique identifier for this edge. */
1363
+ id: string;
1364
+ /** @description ISO 8601 timestamp when this edge was first created. */
1365
+ createdAt: string;
1366
+ /** @description ISO 8601 timestamp when this edge was last updated. */
1367
+ updatedAt: string;
1368
+ from: components["schemas"]["NodeRef"];
1369
+ to: components["schemas"]["NodeRef"] & unknown;
1370
+ /** @description Type-specific attributes of a `chunked_into` edge. */
1371
+ payload: {
1372
+ [key: string]: unknown;
1373
+ };
1374
+ };
1375
+ /** @description The node this edge originates from. */
1376
+ NodeRef: {
1377
+ /** @description Id of the referenced node. */
1378
+ id: string;
1379
+ /**
1380
+ * @description Node type of the referenced node.
1381
+ * @enum {string}
1382
+ */
1383
+ type: "extracted_fact" | "fact" | "extracted_narrative" | "narrative_passage" | "narrative" | "learned_memory" | "extracted_clinical_event";
1384
+ };
1385
+ /** @description A page of edges of one type from the patient context graph. */
1386
+ EdgeList: {
1387
+ /** @description The requested page of items. */
1388
+ data: components["schemas"]["Edge"][];
1389
+ /** @description Pagination metadata for the returned page. */
1390
+ meta: {
1391
+ /** @description Total number of items across all pages. */
1392
+ total: number;
1393
+ /** @description Zero-indexed page returned in `data`. */
1394
+ page: number;
1395
+ /** @description Page size used for this response. */
1396
+ perPage: number;
1397
+ };
1398
+ };
1399
+ };
1400
+ responses: never;
1401
+ parameters: never;
1402
+ requestBodies: never;
1403
+ headers: never;
1404
+ pathItems: never;
1405
+ }
1406
+ export type $defs = Record<string, never>;
1407
+ export interface operations {
1408
+ "get-service-info": {
1409
+ parameters: {
1410
+ query?: never;
1411
+ header?: never;
1412
+ path?: never;
1413
+ cookie?: never;
1414
+ };
1415
+ requestBody?: never;
1416
+ responses: {
1417
+ /** @description Service name and build identity */
1418
+ 200: {
1419
+ headers: {
1420
+ [name: string]: unknown;
1421
+ };
1422
+ content: {
1423
+ "application/json": components["schemas"]["ServiceInfo"];
1424
+ };
1425
+ };
1426
+ };
1427
+ };
1428
+ "list-patients": {
1429
+ parameters: {
1430
+ query?: never;
1431
+ header?: never;
1432
+ path?: never;
1433
+ cookie?: never;
1434
+ };
1435
+ requestBody?: never;
1436
+ responses: {
1437
+ /** @description List all registered patients */
1438
+ 200: {
1439
+ headers: {
1440
+ [name: string]: unknown;
1441
+ };
1442
+ content: {
1443
+ "application/json": components["schemas"]["PatientList"];
1444
+ };
1445
+ };
1446
+ };
1447
+ };
1448
+ "get-patient": {
1449
+ parameters: {
954
1450
  query?: never;
955
1451
  header?: never;
956
1452
  path: {
@@ -1354,6 +1850,242 @@ export interface operations {
1354
1850
  };
1355
1851
  };
1356
1852
  };
1853
+ "ingest-fhir-r4": {
1854
+ parameters: {
1855
+ query?: never;
1856
+ header?: never;
1857
+ path: {
1858
+ /** @description ID of the patient */
1859
+ patientId: string;
1860
+ };
1861
+ cookie?: never;
1862
+ };
1863
+ /** @description FHIR R4 Bundle or single resource to ingest. */
1864
+ requestBody: {
1865
+ content: {
1866
+ "application/json": components["schemas"]["IngestFhirBody"];
1867
+ };
1868
+ };
1869
+ responses: {
1870
+ /** @description Submission accepted */
1871
+ 202: {
1872
+ headers: {
1873
+ [name: string]: unknown;
1874
+ };
1875
+ content: {
1876
+ "application/json": components["schemas"]["Ingestion"];
1877
+ };
1878
+ };
1879
+ /** @description Body is not a FHIR resource */
1880
+ 400: {
1881
+ headers: {
1882
+ [name: string]: unknown;
1883
+ };
1884
+ content: {
1885
+ "application/json": components["schemas"]["ApiError"];
1886
+ };
1887
+ };
1888
+ /** @description Patient not found */
1889
+ 404: {
1890
+ headers: {
1891
+ [name: string]: unknown;
1892
+ };
1893
+ content: {
1894
+ "application/json": components["schemas"]["ApiError"];
1895
+ };
1896
+ };
1897
+ /** @description Resource could not be processed */
1898
+ 422: {
1899
+ headers: {
1900
+ [name: string]: unknown;
1901
+ };
1902
+ content: {
1903
+ "application/json": components["schemas"]["ApiError"];
1904
+ };
1905
+ };
1906
+ };
1907
+ };
1908
+ "ingest-fhir-r5": {
1909
+ parameters: {
1910
+ query?: never;
1911
+ header?: never;
1912
+ path: {
1913
+ /** @description ID of the patient */
1914
+ patientId: string;
1915
+ };
1916
+ cookie?: never;
1917
+ };
1918
+ /** @description FHIR R5 Bundle or single resource to ingest. */
1919
+ requestBody: {
1920
+ content: {
1921
+ "application/json": components["schemas"]["IngestFhirBody"];
1922
+ };
1923
+ };
1924
+ responses: {
1925
+ /** @description Submission accepted */
1926
+ 202: {
1927
+ headers: {
1928
+ [name: string]: unknown;
1929
+ };
1930
+ content: {
1931
+ "application/json": components["schemas"]["Ingestion"];
1932
+ };
1933
+ };
1934
+ /** @description Body is not a FHIR resource */
1935
+ 400: {
1936
+ headers: {
1937
+ [name: string]: unknown;
1938
+ };
1939
+ content: {
1940
+ "application/json": components["schemas"]["ApiError"];
1941
+ };
1942
+ };
1943
+ /** @description Patient not found */
1944
+ 404: {
1945
+ headers: {
1946
+ [name: string]: unknown;
1947
+ };
1948
+ content: {
1949
+ "application/json": components["schemas"]["ApiError"];
1950
+ };
1951
+ };
1952
+ /** @description Resource could not be processed */
1953
+ 422: {
1954
+ headers: {
1955
+ [name: string]: unknown;
1956
+ };
1957
+ content: {
1958
+ "application/json": components["schemas"]["ApiError"];
1959
+ };
1960
+ };
1961
+ };
1962
+ };
1963
+ "ingest-cda-r2": {
1964
+ parameters: {
1965
+ query?: never;
1966
+ header?: never;
1967
+ path: {
1968
+ /** @description ID of the patient */
1969
+ patientId: string;
1970
+ };
1971
+ cookie?: never;
1972
+ };
1973
+ /** @description One CDA document, or several as multipart parts. */
1974
+ requestBody: {
1975
+ content: {
1976
+ "application/cda+xml": string;
1977
+ "multipart/form-data": {
1978
+ documents?: string[];
1979
+ };
1980
+ };
1981
+ };
1982
+ responses: {
1983
+ /** @description Submission accepted */
1984
+ 202: {
1985
+ headers: {
1986
+ [name: string]: unknown;
1987
+ };
1988
+ content: {
1989
+ "application/json": components["schemas"]["Ingestion"];
1990
+ };
1991
+ };
1992
+ /** @description A document is missing or is not a CDA document */
1993
+ 400: {
1994
+ headers: {
1995
+ [name: string]: unknown;
1996
+ };
1997
+ content: {
1998
+ "application/json": components["schemas"]["ApiError"];
1999
+ };
2000
+ };
2001
+ /** @description Patient not found */
2002
+ 404: {
2003
+ headers: {
2004
+ [name: string]: unknown;
2005
+ };
2006
+ content: {
2007
+ "application/json": components["schemas"]["ApiError"];
2008
+ };
2009
+ };
2010
+ /** @description Document could not be processed */
2011
+ 422: {
2012
+ headers: {
2013
+ [name: string]: unknown;
2014
+ };
2015
+ content: {
2016
+ "application/json": components["schemas"]["ApiError"];
2017
+ };
2018
+ };
2019
+ };
2020
+ };
2021
+ "list-ingestions": {
2022
+ parameters: {
2023
+ query?: {
2024
+ /** @description Zero-indexed page of submissions to return. Defaults to 0. */
2025
+ page?: number | null;
2026
+ /** @description Number of submissions per page. Defaults to 100; maximum is 1000. */
2027
+ perPage?: number;
2028
+ /** @description Field to sort by. One of: receivedAt. Defaults to `receivedAt`. */
2029
+ sort?: "receivedAt";
2030
+ /** @description Sort direction. Defaults to `desc`. */
2031
+ order?: "asc" | "desc";
2032
+ /** @description Only return submissions in these states. Repeat the parameter or separate with commas. */
2033
+ status?: (components["schemas"]["IngestionStatus"] & unknown)[];
2034
+ };
2035
+ header?: never;
2036
+ path: {
2037
+ /** @description ID of the patient */
2038
+ patientId: string;
2039
+ };
2040
+ cookie?: never;
2041
+ };
2042
+ requestBody?: never;
2043
+ responses: {
2044
+ /** @description A page of submissions */
2045
+ 200: {
2046
+ headers: {
2047
+ [name: string]: unknown;
2048
+ };
2049
+ content: {
2050
+ "application/json": components["schemas"]["IngestionList"];
2051
+ };
2052
+ };
2053
+ };
2054
+ };
2055
+ "get-ingestion": {
2056
+ parameters: {
2057
+ query?: never;
2058
+ header?: never;
2059
+ path: {
2060
+ /** @description ID of the patient */
2061
+ patientId: string;
2062
+ /** @description Id of the submission, as returned when it was accepted. */
2063
+ ingestionId: string;
2064
+ };
2065
+ cookie?: never;
2066
+ };
2067
+ requestBody?: never;
2068
+ responses: {
2069
+ /** @description The submission */
2070
+ 200: {
2071
+ headers: {
2072
+ [name: string]: unknown;
2073
+ };
2074
+ content: {
2075
+ "application/json": components["schemas"]["Ingestion"];
2076
+ };
2077
+ };
2078
+ /** @description Ingestion not found */
2079
+ 404: {
2080
+ headers: {
2081
+ [name: string]: unknown;
2082
+ };
2083
+ content: {
2084
+ "application/json": components["schemas"]["ApiError"];
2085
+ };
2086
+ };
2087
+ };
2088
+ };
1357
2089
  "create-session": {
1358
2090
  parameters: {
1359
2091
  query?: never;
@@ -1703,4 +2435,275 @@ export interface operations {
1703
2435
  };
1704
2436
  };
1705
2437
  };
2438
+ "get-node": {
2439
+ parameters: {
2440
+ query?: never;
2441
+ header?: never;
2442
+ path: {
2443
+ /** @description ID of the patient */
2444
+ patientId: string;
2445
+ /** @description Type of node to operate on. */
2446
+ type: "extracted_fact" | "fact" | "extracted_narrative" | "narrative_passage" | "narrative" | "learned_memory" | "extracted_clinical_event";
2447
+ /** @description Id of the node to retrieve. */
2448
+ nodeId: string;
2449
+ };
2450
+ cookie?: never;
2451
+ };
2452
+ requestBody?: never;
2453
+ responses: {
2454
+ /** @description The node. */
2455
+ 200: {
2456
+ headers: {
2457
+ [name: string]: unknown;
2458
+ };
2459
+ content: {
2460
+ "application/json": components["schemas"]["Node"];
2461
+ };
2462
+ };
2463
+ /** @description `nodeId` is not a node of the given `type`. */
2464
+ 400: {
2465
+ headers: {
2466
+ [name: string]: unknown;
2467
+ };
2468
+ content: {
2469
+ "application/json": components["schemas"]["ApiError"];
2470
+ };
2471
+ };
2472
+ /** @description No node with this id exists for the patient. */
2473
+ 404: {
2474
+ headers: {
2475
+ [name: string]: unknown;
2476
+ };
2477
+ content: {
2478
+ "application/json": components["schemas"]["ApiError"];
2479
+ };
2480
+ };
2481
+ };
2482
+ };
2483
+ "list-nodes": {
2484
+ parameters: {
2485
+ query?: {
2486
+ /** @description Zero-indexed page of nodes to return. Defaults to 0. */
2487
+ page?: number | null;
2488
+ /** @description Number of nodes per page. Defaults to 100; maximum is 1000. */
2489
+ perPage?: number;
2490
+ };
2491
+ header?: never;
2492
+ path: {
2493
+ /** @description ID of the patient */
2494
+ patientId: string;
2495
+ /** @description Type of node to operate on. */
2496
+ type: "extracted_fact" | "fact" | "extracted_narrative" | "narrative_passage" | "narrative" | "learned_memory" | "extracted_clinical_event";
2497
+ };
2498
+ cookie?: never;
2499
+ };
2500
+ requestBody?: never;
2501
+ responses: {
2502
+ /** @description A page of nodes. */
2503
+ 200: {
2504
+ headers: {
2505
+ [name: string]: unknown;
2506
+ };
2507
+ content: {
2508
+ "application/json": components["schemas"]["NodeList"];
2509
+ };
2510
+ };
2511
+ /** @description Patient not found. */
2512
+ 404: {
2513
+ headers: {
2514
+ [name: string]: unknown;
2515
+ };
2516
+ content: {
2517
+ "application/json": components["schemas"]["ApiError"];
2518
+ };
2519
+ };
2520
+ };
2521
+ };
2522
+ "query-nodes": {
2523
+ parameters: {
2524
+ query?: never;
2525
+ header?: never;
2526
+ path: {
2527
+ /** @description ID of the patient */
2528
+ patientId: string;
2529
+ /** @description Type of node to operate on. */
2530
+ type: "extracted_fact" | "fact" | "extracted_narrative" | "narrative_passage" | "narrative" | "learned_memory" | "extracted_clinical_event";
2531
+ };
2532
+ cookie?: never;
2533
+ };
2534
+ requestBody: {
2535
+ content: {
2536
+ "application/json": {
2537
+ /**
2538
+ * @description Zero-indexed page of facts to return. Defaults to 0.
2539
+ * @default 0
2540
+ */
2541
+ page?: number | null;
2542
+ /**
2543
+ * @description Number of facts per page. Defaults to 100; maximum is 1000.
2544
+ * @default 100
2545
+ */
2546
+ perPage?: number;
2547
+ /**
2548
+ * @description Field to sort by. One of: effectiveStart. Defaults to `effectiveStart`.
2549
+ * @default effectiveStart
2550
+ * @enum {string}
2551
+ */
2552
+ sort?: "effectiveStart";
2553
+ /**
2554
+ * @description Sort direction. Defaults to `desc`.
2555
+ * @default desc
2556
+ * @enum {string}
2557
+ */
2558
+ order?: "asc" | "desc";
2559
+ /** @description Conditions to filter on, ANDed together. Omitted or empty matches every fact. */
2560
+ filter?: {
2561
+ /** @description Restrict to this fact id. */
2562
+ id?: {
2563
+ /** @description Matches exactly this value. */
2564
+ eq: string;
2565
+ } | {
2566
+ /** @description Matches any of these values. At most 500. */
2567
+ any: string[];
2568
+ };
2569
+ /** @description Restrict to this fact type. */
2570
+ type?: {
2571
+ /**
2572
+ * @description Matches exactly this value.
2573
+ * @enum {string}
2574
+ */
2575
+ eq: "condition" | "medication" | "allergy" | "family_history" | "social_history" | "immunization" | "device" | "demographic" | "insurance" | "directive";
2576
+ } | {
2577
+ /** @description Matches any of these values. At most 500. */
2578
+ any: ("condition" | "medication" | "allergy" | "family_history" | "social_history" | "immunization" | "device" | "demographic" | "insurance" | "directive")[];
2579
+ };
2580
+ };
2581
+ };
2582
+ };
2583
+ };
2584
+ responses: {
2585
+ /** @description A page of nodes. */
2586
+ 200: {
2587
+ headers: {
2588
+ [name: string]: unknown;
2589
+ };
2590
+ content: {
2591
+ "application/json": components["schemas"]["NodeList"];
2592
+ };
2593
+ };
2594
+ /** @description `body` does not match the given `type`'s filter/sort schema. */
2595
+ 400: {
2596
+ headers: {
2597
+ [name: string]: unknown;
2598
+ };
2599
+ content: {
2600
+ "application/json": components["schemas"]["ApiError"];
2601
+ };
2602
+ };
2603
+ /** @description Patient not found. */
2604
+ 404: {
2605
+ headers: {
2606
+ [name: string]: unknown;
2607
+ };
2608
+ content: {
2609
+ "application/json": components["schemas"]["ApiError"];
2610
+ };
2611
+ };
2612
+ /** @description Querying nodes of the given `type` is not yet supported. */
2613
+ 501: {
2614
+ headers: {
2615
+ [name: string]: unknown;
2616
+ };
2617
+ content: {
2618
+ "application/json": components["schemas"]["ApiError"];
2619
+ };
2620
+ };
2621
+ };
2622
+ };
2623
+ "get-edge": {
2624
+ parameters: {
2625
+ query?: never;
2626
+ header?: never;
2627
+ path: {
2628
+ /** @description ID of the patient */
2629
+ patientId: string;
2630
+ /** @description Type of edge to operate on. */
2631
+ type: "resolution_decision" | "resolves_to" | "chunked_into";
2632
+ /** @description Id of the edge to retrieve. */
2633
+ edgeId: string;
2634
+ };
2635
+ cookie?: never;
2636
+ };
2637
+ requestBody?: never;
2638
+ responses: {
2639
+ /** @description The edge. */
2640
+ 200: {
2641
+ headers: {
2642
+ [name: string]: unknown;
2643
+ };
2644
+ content: {
2645
+ "application/json": components["schemas"]["Edge"];
2646
+ };
2647
+ };
2648
+ /** @description `edgeId` is not an edge of the given `type`. */
2649
+ 400: {
2650
+ headers: {
2651
+ [name: string]: unknown;
2652
+ };
2653
+ content: {
2654
+ "application/json": components["schemas"]["ApiError"];
2655
+ };
2656
+ };
2657
+ /** @description No edge with this id exists for the patient. */
2658
+ 404: {
2659
+ headers: {
2660
+ [name: string]: unknown;
2661
+ };
2662
+ content: {
2663
+ "application/json": components["schemas"]["ApiError"];
2664
+ };
2665
+ };
2666
+ };
2667
+ };
2668
+ "list-edges": {
2669
+ parameters: {
2670
+ query?: {
2671
+ /** @description Zero-indexed page of edges to return. Defaults to 0. */
2672
+ page?: number | null;
2673
+ /** @description Number of edges per page. Defaults to 100; maximum is 1000. */
2674
+ perPage?: number;
2675
+ /** @description Restrict results to edges touching the given node id(s) (same `{type}_{id}` format). One id returns every edge touching that node, in either direction. Two ids (repeat the param, e.g. `?touching=a&touching=b`) return only the edge(s) connecting exactly that pair. */
2676
+ touching?: string | string[];
2677
+ };
2678
+ header?: never;
2679
+ path: {
2680
+ /** @description ID of the patient */
2681
+ patientId: string;
2682
+ /** @description Type of edge to operate on. */
2683
+ type: "resolution_decision" | "resolves_to" | "chunked_into";
2684
+ };
2685
+ cookie?: never;
2686
+ };
2687
+ requestBody?: never;
2688
+ responses: {
2689
+ /** @description A page of edges. */
2690
+ 200: {
2691
+ headers: {
2692
+ [name: string]: unknown;
2693
+ };
2694
+ content: {
2695
+ "application/json": components["schemas"]["EdgeList"];
2696
+ };
2697
+ };
2698
+ /** @description Patient not found. */
2699
+ 404: {
2700
+ headers: {
2701
+ [name: string]: unknown;
2702
+ };
2703
+ content: {
2704
+ "application/json": components["schemas"]["ApiError"];
2705
+ };
2706
+ };
2707
+ };
2708
+ };
1706
2709
  }