@healthcloudai/hc-sdk 3.21.0 → 3.23.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.
Files changed (36) hide show
  1. package/dist/index.cjs +212 -1
  2. package/dist/index.d.cts +821 -2
  3. package/dist/index.d.ts +821 -2
  4. package/dist/index.js +212 -1
  5. package/docs/clients/PatientClient.md +3 -0
  6. package/docs/clients/QuestClient.md +1 -1
  7. package/docs/docs-manifest.json +17 -3
  8. package/docs/examples/index.md +4 -1
  9. package/docs/index.md +4 -1
  10. package/docs/models/CatalogItemKind.md +15 -0
  11. package/docs/models/CatalogVendor.md +15 -0
  12. package/docs/models/CollectionModality.md +15 -0
  13. package/docs/models/EncounterClinicalState.md +31 -0
  14. package/docs/models/EncounterEffect.md +18 -0
  15. package/docs/models/EncounterOperationError.md +18 -0
  16. package/docs/models/EncounterOperationResponse.md +22 -0
  17. package/docs/models/EncounterSections.md +22 -0
  18. package/docs/models/GetTestOrderResponse.md +1 -0
  19. package/docs/models/ObservedEncounterResponse.md +26 -0
  20. package/docs/models/OrderItem.md +4 -0
  21. package/docs/models/PlaceTestOrderResponse.md +1 -0
  22. package/docs/models/QuestRetrieveCompendiumResponse.md +5 -0
  23. package/docs/models/SubmitEncounterOperationRequest.md +18 -0
  24. package/docs/models/TestOrder.md +1 -0
  25. package/docs/models/UnknownEncounterOperation.md +18 -0
  26. package/docs/models/index.md +11 -0
  27. package/docs/operations/connectors.questRetrieveCompendium.md +17 -2
  28. package/docs/operations/patient.getPatientEncounterClinicalState.md +170 -0
  29. package/docs/operations/patient.getPatientEncounterOperation.md +151 -0
  30. package/docs/operations/patient.getTestOrder.md +1 -0
  31. package/docs/operations/patient.listOrderItems.md +12 -4
  32. package/docs/operations/patient.listTestOrders.md +1 -0
  33. package/docs/operations/patient.placeTestOrder.md +2 -0
  34. package/docs/operations/patient.submitPatientEncounterOperation.md +161 -0
  35. package/docs/operations/patient.submitPatientIntakeOperation.md +1 -1
  36. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1010,6 +1010,105 @@ var MCPClient = class extends BaseServiceClient {
1010
1010
  }
1011
1011
  };
1012
1012
 
1013
+ // src/models/openapi-generated/patient/models/EncounterClinicalState.ts
1014
+ function EncounterClinicalStateFromJSON(json) {
1015
+ return EncounterClinicalStateFromJSONTyped(json, false);
1016
+ }
1017
+ function EncounterClinicalStateFromJSONTyped(json, ignoreDiscriminator) {
1018
+ if (json == null) {
1019
+ return json;
1020
+ }
1021
+ return {
1022
+ "clinical_outcome": json["clinical_outcome"] == null ? void 0 : json["clinical_outcome"],
1023
+ "ehr": json["ehr"] == null ? void 0 : json["ehr"],
1024
+ "ehr_notes": json["ehr_notes"] == null ? void 0 : json["ehr_notes"],
1025
+ "encounter_id": json["encounter_id"] === void 0 ? void 0 : json["encounter_id"] === null ? null : json["encounter_id"],
1026
+ "fhir_encounter": json["fhir_encounter"] == null ? void 0 : json["fhir_encounter"],
1027
+ "idempotency_key": json["idempotency_key"],
1028
+ "insurance": json["insurance"] == null ? void 0 : json["insurance"],
1029
+ "journal_status": json["journal_status"],
1030
+ "notes_fhir": json["notes_fhir"] == null ? void 0 : json["notes_fhir"],
1031
+ "patient_id": json["patient_id"],
1032
+ "reason": json["reason"],
1033
+ "request_hash": json["request_hash"],
1034
+ "resource_version": json["resource_version"] === void 0 ? void 0 : json["resource_version"] === null ? null : json["resource_version"],
1035
+ "response_code": json["response_code"] === void 0 ? void 0 : json["response_code"] === null ? null : json["response_code"],
1036
+ "retry_allowed": json["retry_allowed"] == null ? void 0 : json["retry_allowed"]
1037
+ };
1038
+ }
1039
+
1040
+ // src/models/openapi-generated/patient/models/EncounterEffect.ts
1041
+ function EncounterEffectFromJSON(json) {
1042
+ return EncounterEffectFromJSONTyped(json, false);
1043
+ }
1044
+ function EncounterEffectFromJSONTyped(json, ignoreDiscriminator) {
1045
+ if (json == null) {
1046
+ return json;
1047
+ }
1048
+ return {
1049
+ "error_present": json["error_present"],
1050
+ "status": json["status"]
1051
+ };
1052
+ }
1053
+
1054
+ // src/models/openapi-generated/patient/models/EncounterSections.ts
1055
+ function EncounterSectionsFromJSON(json) {
1056
+ return EncounterSectionsFromJSONTyped(json, false);
1057
+ }
1058
+ function EncounterSectionsFromJSONTyped(json, ignoreDiscriminator) {
1059
+ if (json == null) {
1060
+ return json;
1061
+ }
1062
+ return {
1063
+ "assessment": json["assessment"] === void 0 ? void 0 : json["assessment"] === null ? null : EncounterEffectFromJSON(json["assessment"]),
1064
+ "hpi": json["hpi"] === void 0 ? void 0 : json["hpi"] === null ? null : EncounterEffectFromJSON(json["hpi"]),
1065
+ "overall": EncounterEffectFromJSON(json["overall"]),
1066
+ "plan": json["plan"] === void 0 ? void 0 : json["plan"] === null ? null : EncounterEffectFromJSON(json["plan"]),
1067
+ "reason_for_visit": json["reason_for_visit"] === void 0 ? void 0 : json["reason_for_visit"] === null ? null : EncounterEffectFromJSON(json["reason_for_visit"]),
1068
+ "ros": json["ros"] === void 0 ? void 0 : json["ros"] === null ? null : EncounterEffectFromJSON(json["ros"])
1069
+ };
1070
+ }
1071
+
1072
+ // src/models/openapi-generated/patient/models/ObservedEncounterResponse.ts
1073
+ function ObservedEncounterResponseFromJSON(json) {
1074
+ return ObservedEncounterResponseFromJSONTyped(json, false);
1075
+ }
1076
+ function ObservedEncounterResponseFromJSONTyped(json, ignoreDiscriminator) {
1077
+ if (json == null) {
1078
+ return json;
1079
+ }
1080
+ return {
1081
+ "athena_encounter": json["athena_encounter"] === void 0 ? void 0 : json["athena_encounter"] === null ? null : EncounterEffectFromJSON(json["athena_encounter"]),
1082
+ "athena_insurance": json["athena_insurance"] === void 0 ? void 0 : json["athena_insurance"] === null ? null : EncounterEffectFromJSON(json["athena_insurance"]),
1083
+ "clinical_outcome": json["clinical_outcome"] == null ? void 0 : json["clinical_outcome"],
1084
+ "created": json["created"] === void 0 ? void 0 : json["created"] === null ? null : json["created"],
1085
+ "encounter_id": json["encounter_id"] === void 0 ? void 0 : json["encounter_id"] === null ? null : json["encounter_id"],
1086
+ "error_present": json["error_present"],
1087
+ "notes_athena_sections": json["notes_athena_sections"] === void 0 ? void 0 : json["notes_athena_sections"] === null ? null : EncounterSectionsFromJSON(json["notes_athena_sections"]),
1088
+ "notes_fhir": json["notes_fhir"] === void 0 ? void 0 : json["notes_fhir"] === null ? null : EncounterEffectFromJSON(json["notes_fhir"]),
1089
+ "openloop_encounter": json["openloop_encounter"] === void 0 ? void 0 : json["openloop_encounter"] === null ? null : EncounterEffectFromJSON(json["openloop_encounter"]),
1090
+ "steadymd_encounter": json["steadymd_encounter"] === void 0 ? void 0 : json["steadymd_encounter"] === null ? null : EncounterEffectFromJSON(json["steadymd_encounter"])
1091
+ };
1092
+ }
1093
+
1094
+ // src/models/openapi-generated/patient/models/EncounterOperationResponse.ts
1095
+ function EncounterOperationResponseFromJSON(json) {
1096
+ return EncounterOperationResponseFromJSONTyped(json, false);
1097
+ }
1098
+ function EncounterOperationResponseFromJSONTyped(json, ignoreDiscriminator) {
1099
+ if (json == null) {
1100
+ return json;
1101
+ }
1102
+ return {
1103
+ "idempotency_key": json["idempotency_key"],
1104
+ "patient_id": json["patient_id"],
1105
+ "request_hash": json["request_hash"],
1106
+ "response_body": json["response_body"] === void 0 ? void 0 : json["response_body"] === null ? null : ObservedEncounterResponseFromJSON(json["response_body"]),
1107
+ "response_code": json["response_code"] === void 0 ? void 0 : json["response_code"] === null ? null : json["response_code"],
1108
+ "status": json["status"]
1109
+ };
1110
+ }
1111
+
1013
1112
  // src/models/openapi-generated/patient/models/ObservedIntakeResponse.ts
1014
1113
  function ObservedIntakeResponseFromJSON(json) {
1015
1114
  return ObservedIntakeResponseFromJSONTyped(json, false);
@@ -1089,6 +1188,70 @@ function intakeOperationResponse(value, key) {
1089
1188
  return IntakeOperationResponseFromJSON(value);
1090
1189
  }
1091
1190
 
1191
+ // src/clients/encounterOperations.ts
1192
+ var effects = ["athena_encounter", "athena_insurance", "openloop_encounter", "steadymd_encounter", "notes_fhir"];
1193
+ var sections2 = ["reason_for_visit", "hpi", "ros", "assessment", "plan"];
1194
+ var statuses = /* @__PURE__ */ new Set(["linked", "failed", "partial", "skipped_no_athena", "skipped_no_openloop", "skipped_no_steadymd", "skipped_no_notes", "skipped_no_content", "skipped_no_package_configured", "skipped_no_openai", "skipped_no_athena_integration", "skipped", "unknown"]);
1195
+ var record2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
1196
+ function encounterRequestSnapshot(request) {
1197
+ const invalid = () => new Error("Valid bounded exact encounter notes are required");
1198
+ if (!record2(request) || Object.keys(request).sort().join(",") !== "idempotency_key,notes") throw invalid();
1199
+ for (const name of Object.getOwnPropertyNames(request)) {
1200
+ const descriptor = Object.getOwnPropertyDescriptor(request, name);
1201
+ if (!descriptor.enumerable || !("value" in descriptor)) throw invalid();
1202
+ }
1203
+ if (Object.getOwnPropertySymbols(request).length) throw invalid();
1204
+ const key = intakeOperationKey(request.idempotency_key), notes = request.notes;
1205
+ if (typeof notes !== "string" || new TextEncoder().encode(notes).length > 65536) throw invalid();
1206
+ const blank = Array.from(notes).every((character) => !character.trim() || character.charCodeAt(0) >= 28 && character.charCodeAt(0) <= 31 || character.charCodeAt(0) === 133);
1207
+ if (blank) throw invalid();
1208
+ for (const character of notes) {
1209
+ const point = character.codePointAt(0);
1210
+ if (point >= 55296 && point <= 57343) throw invalid();
1211
+ }
1212
+ return { idempotency_key: key, notes };
1213
+ }
1214
+ function encounterOperationResponse(value, key) {
1215
+ const invalid = () => new Error("Invalid or mismatched encounter operation response; reconcile the original key");
1216
+ function closed(item, required, optional = []) {
1217
+ if (!record2(item) || required.some((name) => !Object.prototype.hasOwnProperty.call(item, name)) || Object.keys(item).some((name) => ![...required, ...optional].includes(name))) throw invalid();
1218
+ }
1219
+ function effect(item) {
1220
+ closed(item, ["status", "error_present"]);
1221
+ if (typeof item.status !== "string" || !statuses.has(item.status) || typeof item.error_present !== "boolean") throw invalid();
1222
+ }
1223
+ const identifier = (item) => typeof item === "string" && item.length <= 64 && /^[A-Za-z0-9.-]+$/.test(item) && item.trim() === item;
1224
+ closed(value, ["idempotency_key", "patient_id", "request_hash", "status"], ["response_code", "response_body"]);
1225
+ if (value.idempotency_key !== key || !identifier(value.patient_id) || typeof value.request_hash !== "string" || value.request_hash.length !== 64 || !/^[0-9a-f]{64}$/.test(value.request_hash) || typeof value.status !== "string" || !["reserved", "dispatching", "unknown", "recorded"].includes(value.status)) throw invalid();
1226
+ const code = value.response_code, body = value.response_body;
1227
+ if (value.status === "recorded") {
1228
+ if (typeof code !== "number" || !Number.isInteger(code) || code < 100 || code > 599) throw invalid();
1229
+ closed(body, ["clinical_outcome", "error_present"], [...effects, "encounter_id", "created", "notes_athena_sections"]);
1230
+ if (body.clinical_outcome !== "unknown" || typeof body.error_present !== "boolean" || body.encounter_id != null && !identifier(body.encounter_id) || body.created != null && typeof body.created !== "boolean") throw invalid();
1231
+ for (const name of effects) if (body[name] != null) effect(body[name]);
1232
+ if (body.notes_athena_sections != null) {
1233
+ closed(body.notes_athena_sections, ["overall"], sections2);
1234
+ effect(body.notes_athena_sections.overall);
1235
+ for (const name of sections2) if (body.notes_athena_sections[name] != null) effect(body.notes_athena_sections[name]);
1236
+ }
1237
+ } else if (code != null || body != null) throw invalid();
1238
+ return EncounterOperationResponseFromJSON(value);
1239
+ }
1240
+ function encounterClinicalState(value, key) {
1241
+ const invalid = () => new Error("Invalid or mismatched encounter clinical state; no retry authorized");
1242
+ const required = ["idempotency_key", "patient_id", "request_hash", "journal_status", "fhir_encounter", "notes_fhir", "ehr", "insurance", "ehr_notes", "clinical_outcome", "retry_allowed", "reason"];
1243
+ const identifier = (item) => typeof item === "string" && item.length <= 64 && /^[A-Za-z0-9.-]+$/.test(item) && item.trim() === item;
1244
+ if (!record2(value) || required.some((name) => !Object.prototype.hasOwnProperty.call(value, name)) || Object.keys(value).some((name) => ![...required, "response_code", "encounter_id", "resource_version"].includes(name)) || value.idempotency_key !== key || !identifier(value.patient_id) || typeof value.request_hash !== "string" || value.request_hash.length !== 64 || !/^[0-9a-f]{64}$/.test(value.request_hash) || typeof value.journal_status !== "string" || !["reserved", "dispatching", "unknown", "recorded"].includes(value.journal_status) || typeof value.fhir_encounter !== "string" || !["present", "unknown"].includes(value.fhir_encounter) || typeof value.notes_fhir !== "string" || !["matches", "unknown"].includes(value.notes_fhir) || ["ehr", "insurance", "ehr_notes", "clinical_outcome"].some((name) => value[name] !== "unknown") || value.retry_allowed !== false || typeof value.reason !== "string" || !["journal_unresolved", "no_recorded_encounter", "resource_unavailable", "resource_mismatch", "resource_unversioned", "resource_inactive", "notes_unverified", "notes_match"].includes(value.reason)) throw invalid();
1245
+ const code = value.response_code;
1246
+ if (value.journal_status === "recorded") {
1247
+ if (typeof code !== "number" || !Number.isInteger(code) || code < 100 || code > 599) throw invalid();
1248
+ } else if (code != null) throw invalid();
1249
+ if (value.fhir_encounter === "present") {
1250
+ if (value.journal_status !== "recorded" || !identifier(value.encounter_id) || !identifier(value.resource_version) || value.reason !== (value.notes_fhir === "matches" ? "notes_match" : "notes_unverified")) throw invalid();
1251
+ } else if (value.encounter_id != null || value.resource_version != null || value.notes_fhir !== "unknown" || ["notes_match", "notes_unverified"].includes(value.reason)) throw invalid();
1252
+ return EncounterClinicalStateFromJSON(value);
1253
+ }
1254
+
1092
1255
  // src/models/openapi-generated/patient/models/StediClaimsResponse.ts
1093
1256
  function StediClaimsResponseFromJSON(json) {
1094
1257
  return StediClaimsResponseFromJSONTyped(json, false);
@@ -2403,6 +2566,30 @@ function ListDeliveryOrdersResponseFromJSONTyped(json, ignoreDiscriminator) {
2403
2566
  };
2404
2567
  }
2405
2568
 
2569
+ // src/models/openapi-generated/patient/models/CatalogVendor.ts
2570
+ function CatalogVendorFromJSON(json) {
2571
+ return CatalogVendorFromJSONTyped(json, false);
2572
+ }
2573
+ function CatalogVendorFromJSONTyped(json, ignoreDiscriminator) {
2574
+ return json;
2575
+ }
2576
+
2577
+ // src/models/openapi-generated/patient/models/CatalogItemKind.ts
2578
+ function CatalogItemKindFromJSON(json) {
2579
+ return CatalogItemKindFromJSONTyped(json, false);
2580
+ }
2581
+ function CatalogItemKindFromJSONTyped(json, ignoreDiscriminator) {
2582
+ return json;
2583
+ }
2584
+
2585
+ // src/models/openapi-generated/patient/models/CollectionModality.ts
2586
+ function CollectionModalityFromJSON(json) {
2587
+ return CollectionModalityFromJSONTyped(json, false);
2588
+ }
2589
+ function CollectionModalityFromJSONTyped(json, ignoreDiscriminator) {
2590
+ return json;
2591
+ }
2592
+
2406
2593
  // src/models/openapi-generated/patient/models/OrderItem.ts
2407
2594
  function OrderItemFromJSON(json) {
2408
2595
  return OrderItemFromJSONTyped(json, false);
@@ -2412,9 +2599,13 @@ function OrderItemFromJSONTyped(json, ignoreDiscriminator) {
2412
2599
  return json;
2413
2600
  }
2414
2601
  return {
2602
+ "collection_modalities": json["collection_modalities"] == null ? void 0 : json["collection_modalities"].map(CollectionModalityFromJSON),
2603
+ "collection_modality": CollectionModalityFromJSON(json["collection_modality"]),
2415
2604
  "id": json["id"],
2416
2605
  "image": json["image"] === void 0 ? void 0 : json["image"] === null ? null : json["image"],
2417
- "name": json["name"]
2606
+ "kind": CatalogItemKindFromJSON(json["kind"]),
2607
+ "name": json["name"],
2608
+ "vendor": CatalogVendorFromJSON(json["vendor"])
2418
2609
  };
2419
2610
  }
2420
2611
 
@@ -2555,6 +2746,7 @@ function PlaceTestOrderResponseFromJSONTyped(json, ignoreDiscriminator) {
2555
2746
  "patient_fhir_id": json["patient_fhir_id"] === void 0 ? void 0 : json["patient_fhir_id"] === null ? null : json["patient_fhir_id"],
2556
2747
  "performer_name": json["performer_name"] === void 0 ? void 0 : json["performer_name"] === null ? null : json["performer_name"],
2557
2748
  "priority": json["priority"] == null ? void 0 : OrderPriorityFromJSON(json["priority"]),
2749
+ "quest_placer_order_number": json["quest_placer_order_number"] === void 0 ? void 0 : json["quest_placer_order_number"] === null ? null : json["quest_placer_order_number"],
2558
2750
  "reason": json["reason"] === void 0 ? void 0 : json["reason"] === null ? null : json["reason"],
2559
2751
  "requester_name": json["requester_name"] === void 0 ? void 0 : json["requester_name"] === null ? null : json["requester_name"],
2560
2752
  "requester_npi": json["requester_npi"] === void 0 ? void 0 : json["requester_npi"] === null ? null : json["requester_npi"],
@@ -2595,6 +2787,7 @@ function GetTestOrderResponseFromJSONTyped(json, ignoreDiscriminator) {
2595
2787
  "patient_fhir_id": json["patient_fhir_id"] === void 0 ? void 0 : json["patient_fhir_id"] === null ? null : json["patient_fhir_id"],
2596
2788
  "performer_name": json["performer_name"] === void 0 ? void 0 : json["performer_name"] === null ? null : json["performer_name"],
2597
2789
  "priority": json["priority"] == null ? void 0 : OrderPriorityFromJSON(json["priority"]),
2790
+ "quest_placer_order_number": json["quest_placer_order_number"] === void 0 ? void 0 : json["quest_placer_order_number"] === null ? null : json["quest_placer_order_number"],
2598
2791
  "reason": json["reason"] === void 0 ? void 0 : json["reason"] === null ? null : json["reason"],
2599
2792
  "requester_name": json["requester_name"] === void 0 ? void 0 : json["requester_name"] === null ? null : json["requester_name"],
2600
2793
  "requester_npi": json["requester_npi"] === void 0 ? void 0 : json["requester_npi"] === null ? null : json["requester_npi"],
@@ -2635,6 +2828,7 @@ function TestOrderFromJSONTyped(json, ignoreDiscriminator) {
2635
2828
  "patient_fhir_id": json["patient_fhir_id"] === void 0 ? void 0 : json["patient_fhir_id"] === null ? null : json["patient_fhir_id"],
2636
2829
  "performer_name": json["performer_name"] === void 0 ? void 0 : json["performer_name"] === null ? null : json["performer_name"],
2637
2830
  "priority": json["priority"] == null ? void 0 : OrderPriorityFromJSON(json["priority"]),
2831
+ "quest_placer_order_number": json["quest_placer_order_number"] === void 0 ? void 0 : json["quest_placer_order_number"] === null ? null : json["quest_placer_order_number"],
2638
2832
  "reason": json["reason"] === void 0 ? void 0 : json["reason"] === null ? null : json["reason"],
2639
2833
  "requester_name": json["requester_name"] === void 0 ? void 0 : json["requester_name"] === null ? null : json["requester_name"],
2640
2834
  "requester_npi": json["requester_npi"] === void 0 ? void 0 : json["requester_npi"] === null ? null : json["requester_npi"],
@@ -2973,6 +3167,23 @@ var PatientClient = class extends BaseServiceClient {
2973
3167
  const key = intakeOperationKey(idempotencyKey);
2974
3168
  return intakeOperationResponse(await this.send("GET", `/patients/intake/operations/${key}`), key);
2975
3169
  }
3170
+ /** Submit exact reviewed notes once. Recorded HTTP never settles clinical effects.
3171
+ * Pending/unknown remains unresolved; reconcile the original key, with no retry or fallback.
3172
+ */
3173
+ async submitPatientEncounterOperation(request) {
3174
+ const body = encounterRequestSnapshot(request);
3175
+ return encounterOperationResponse(await this.send("POST", "/patients/encounter/operations", { body }), body.idempotency_key);
3176
+ }
3177
+ /** Read only the original key. A 404 does not prove no clinical effects. */
3178
+ async getPatientEncounterOperation(idempotencyKey) {
3179
+ const key = intakeOperationKey(idempotencyKey);
3180
+ return encounterOperationResponse(await this.send("GET", `/patients/encounter/operations/${key}`), key);
3181
+ }
3182
+ /** Read only original-key FHIR facts. Never authorizes clinical completion or retry. */
3183
+ async getPatientEncounterClinicalState(idempotencyKey) {
3184
+ const key = intakeOperationKey(idempotencyKey);
3185
+ return encounterClinicalState(await this.send("GET", `/patients/encounter/operations/${key}/clinical-state`), key);
3186
+ }
2976
3187
  /** GET /patients/attributes - get the authenticated patient's arbitrary JSON attributes. */
2977
3188
  getAttributes() {
2978
3189
  return this.send("GET", "/patients/attributes", {});