@healthcloudai/hc-sdk 3.15.1 → 3.17.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.
- package/dist/index.cjs +89 -0
- package/dist/index.d.cts +525 -2
- package/dist/index.d.ts +525 -2
- package/dist/index.js +89 -0
- package/docs/clients/PatientClient.md +4 -0
- package/docs/docs-manifest.json +15 -3
- package/docs/examples/index.md +4 -0
- package/docs/index.md +4 -0
- package/docs/models/ApplyPatientFlagsRequest.md +18 -0
- package/docs/models/FlagOperationError.md +18 -0
- package/docs/models/FlagOperationReceipt.md +20 -0
- package/docs/models/Insurance.md +2 -0
- package/docs/models/ReplaceInsuranceRequest.md +25 -0
- package/docs/models/ReplaceInsuranceResponse.md +20 -0
- package/docs/models/RetireInsuranceRequest.md +17 -0
- package/docs/models/RetireInsuranceResponse.md +19 -0
- package/docs/models/UnknownFlagOperation.md +18 -0
- package/docs/models/index.md +8 -0
- package/docs/operations/fieldagent.listPatients.md +2 -0
- package/docs/operations/patient.applyPatientFlagsOperation.md +152 -0
- package/docs/operations/patient.getInsurance.md +17 -15
- package/docs/operations/patient.getPatient.md +2 -0
- package/docs/operations/patient.getPatientFlagsOperation.md +150 -0
- package/docs/operations/patient.getPatientSidebarPatientSidebar.md +2 -0
- package/docs/operations/patient.replaceInsurance.md +124 -0
- package/docs/operations/patient.retireInsurance.md +129 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1236,6 +1236,36 @@ function CreateEncounterRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
|
+
// src/models/openapi-generated/patient/models/ApplyPatientFlagsRequest.ts
|
|
1240
|
+
function ApplyPatientFlagsRequestToJSON(json) {
|
|
1241
|
+
return ApplyPatientFlagsRequestToJSONTyped(json, false);
|
|
1242
|
+
}
|
|
1243
|
+
function ApplyPatientFlagsRequestToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1244
|
+
if (value == null) {
|
|
1245
|
+
return value;
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
"flags": value["flags"],
|
|
1249
|
+
"idempotency_key": value["idempotency_key"]
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// src/models/openapi-generated/patient/models/FlagOperationReceipt.ts
|
|
1254
|
+
function FlagOperationReceiptFromJSON(json) {
|
|
1255
|
+
return FlagOperationReceiptFromJSONTyped(json, false);
|
|
1256
|
+
}
|
|
1257
|
+
function FlagOperationReceiptFromJSONTyped(json, ignoreDiscriminator) {
|
|
1258
|
+
if (json == null) {
|
|
1259
|
+
return json;
|
|
1260
|
+
}
|
|
1261
|
+
return {
|
|
1262
|
+
"flags": json["flags"],
|
|
1263
|
+
"idempotency_key": json["idempotency_key"],
|
|
1264
|
+
"patient_id": json["patient_id"],
|
|
1265
|
+
"status": json["status"]
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1239
1269
|
// src/models/openapi-generated/patient/models/ProcedureStatus.ts
|
|
1240
1270
|
function ProcedureStatusToJSON(value) {
|
|
1241
1271
|
return value;
|
|
@@ -2689,6 +2719,45 @@ var PatientClient = class extends BaseServiceClient {
|
|
|
2689
2719
|
body: request
|
|
2690
2720
|
});
|
|
2691
2721
|
}
|
|
2722
|
+
flagOperationKey(key) {
|
|
2723
|
+
if (typeof key !== "string" || key.length !== 36 || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(key)) {
|
|
2724
|
+
throw new Error("A canonical UUID operation key is required");
|
|
2725
|
+
}
|
|
2726
|
+
return key;
|
|
2727
|
+
}
|
|
2728
|
+
flagOperationReceipt(value, key, approved) {
|
|
2729
|
+
const invalid = () => new Error("Invalid or mismatched flag operation receipt; reconcile the original key");
|
|
2730
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid();
|
|
2731
|
+
const receipt = value;
|
|
2732
|
+
if (Object.keys(receipt).sort().join(",") !== "flags,idempotency_key,patient_id,status" || receipt.idempotency_key !== key || receipt.status !== "applied" || typeof receipt.patient_id !== "string" || receipt.patient_id.trim() !== receipt.patient_id || !/^[A-Za-z0-9.-]{1,64}$/.test(receipt.patient_id) || !receipt.flags || typeof receipt.flags !== "object" || Array.isArray(receipt.flags)) throw invalid();
|
|
2733
|
+
const flags = receipt.flags;
|
|
2734
|
+
if (!Object.keys(flags).length || Object.entries(flags).some(([name, item]) => !name || name.length > 256 || typeof item !== "boolean") || approved && (Object.keys(flags).length !== Object.keys(approved).length || Object.entries(approved).some(([name, item]) => flags[name] !== item))) throw invalid();
|
|
2735
|
+
return FlagOperationReceiptFromJSON(value);
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* Commit the exact approved flag patch under a stable key. No automatic retries.
|
|
2739
|
+
* After a timeout or unknown outcome, look up the original key before proceeding.
|
|
2740
|
+
* The receipt contains the original patch, even if current flags have changed.
|
|
2741
|
+
*/
|
|
2742
|
+
async applyPatientFlagsOperation(request) {
|
|
2743
|
+
const key = this.flagOperationKey(request.idempotency_key);
|
|
2744
|
+
const flags = { ...request.flags };
|
|
2745
|
+
const result = await this.send("POST", "/patients/flags/operations", {
|
|
2746
|
+
body: ApplyPatientFlagsRequestToJSON({ idempotency_key: key, flags })
|
|
2747
|
+
});
|
|
2748
|
+
return this.flagOperationReceipt(result, key, flags);
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* Read only the authenticated patient's original keyed receipt.
|
|
2752
|
+
* A 404 remains an HTTP error; an in-flight write may still commit.
|
|
2753
|
+
*/
|
|
2754
|
+
async getPatientFlagsOperation(idempotencyKey) {
|
|
2755
|
+
const key = this.flagOperationKey(idempotencyKey);
|
|
2756
|
+
const result = await this.send("GET", "/patients/flags/operations/{idempotency_key}", {
|
|
2757
|
+
pathParams: { idempotency_key: key }
|
|
2758
|
+
});
|
|
2759
|
+
return this.flagOperationReceipt(result, key);
|
|
2760
|
+
}
|
|
2692
2761
|
/** GET /patients — self-service; returns the authenticated patient's own FHIR Patient record. */
|
|
2693
2762
|
getProfile() {
|
|
2694
2763
|
return this.send("GET", "/patients", {});
|
|
@@ -2783,6 +2852,26 @@ var PatientClient = class extends BaseServiceClient {
|
|
|
2783
2852
|
listPatientInsurances() {
|
|
2784
2853
|
return this.send("GET", "/patients/insurance", {});
|
|
2785
2854
|
}
|
|
2855
|
+
/** Confirm a change to saved insurance. A pending response is not completion.
|
|
2856
|
+
* Reuse request_id/body for retries; never retry through createInsurance().
|
|
2857
|
+
*/
|
|
2858
|
+
replaceInsurance(coverageId, request) {
|
|
2859
|
+
return this.send(
|
|
2860
|
+
"PUT",
|
|
2861
|
+
`/patients/insurance/${encodeURIComponent(coverageId)}`,
|
|
2862
|
+
{ body: request }
|
|
2863
|
+
);
|
|
2864
|
+
}
|
|
2865
|
+
/** Retire the exact saved coverage after confirmation. History is retained.
|
|
2866
|
+
* Reuse request_id for retries; pending is not completed removal.
|
|
2867
|
+
*/
|
|
2868
|
+
retireInsurance(coverageId, request) {
|
|
2869
|
+
return this.send(
|
|
2870
|
+
"POST",
|
|
2871
|
+
`/patients/insurance/${encodeURIComponent(coverageId)}/retire`,
|
|
2872
|
+
{ body: request }
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2786
2875
|
importHealthRecord(payload) {
|
|
2787
2876
|
return this.send("POST", "/patients/health-record/import", {
|
|
2788
2877
|
body: payload
|