@oystehr/sdk 4.2.4 → 4.2.6
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/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/cjs/resources/classes/erx.cjs +24 -0
- package/dist/cjs/resources/classes/erx.cjs.map +1 -1
- package/dist/cjs/resources/classes/erx.d.ts +31 -1
- package/dist/cjs/resources/classes/fhir-ext.cjs +9 -2
- package/dist/cjs/resources/classes/fhir-ext.cjs.map +1 -1
- package/dist/cjs/resources/classes/fhir-ext.d.ts +1 -0
- package/dist/cjs/resources/types/ErxAddPatientPharmacyParams.d.ts +11 -0
- package/dist/cjs/resources/types/ErxGetMedicationParams.d.ts +5 -0
- package/dist/cjs/resources/types/ErxGetMedicationResponse.d.ts +39 -0
- package/dist/cjs/resources/types/ErxSearchPharmaciesParams.d.ts +11 -0
- package/dist/cjs/resources/types/ErxSearchPharmaciesResponse.d.ts +26 -0
- package/dist/cjs/resources/types/LabRoute.d.ts +1 -1
- package/dist/cjs/resources/types/ZambdaCreateParams.d.ts +1 -1
- package/dist/cjs/resources/types/ZambdaUpdateParams.d.ts +1 -1
- package/dist/cjs/resources/types/fhir.d.ts +2 -0
- package/dist/cjs/resources/types/index.d.ts +5 -0
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/resources/classes/erx.d.ts +31 -1
- package/dist/esm/resources/classes/erx.js +24 -0
- package/dist/esm/resources/classes/erx.js.map +1 -1
- package/dist/esm/resources/classes/fhir-ext.d.ts +1 -0
- package/dist/esm/resources/classes/fhir-ext.js +9 -2
- package/dist/esm/resources/classes/fhir-ext.js.map +1 -1
- package/dist/esm/resources/types/ErxAddPatientPharmacyParams.d.ts +11 -0
- package/dist/esm/resources/types/ErxGetMedicationParams.d.ts +5 -0
- package/dist/esm/resources/types/ErxGetMedicationResponse.d.ts +39 -0
- package/dist/esm/resources/types/ErxSearchPharmaciesParams.d.ts +11 -0
- package/dist/esm/resources/types/ErxSearchPharmaciesResponse.d.ts +26 -0
- package/dist/esm/resources/types/LabRoute.d.ts +1 -1
- package/dist/esm/resources/types/ZambdaCreateParams.d.ts +1 -1
- package/dist/esm/resources/types/ZambdaUpdateParams.d.ts +1 -1
- package/dist/esm/resources/types/fhir.d.ts +2 -0
- package/dist/esm/resources/types/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/resources/classes/erx.ts +62 -0
- package/src/resources/classes/fhir-ext.ts +23 -2
- package/src/resources/types/ErxAddPatientPharmacyParams.ts +13 -0
- package/src/resources/types/ErxGetMedicationParams.ts +7 -0
- package/src/resources/types/ErxGetMedicationResponse.ts +41 -0
- package/src/resources/types/ErxSearchPharmaciesParams.ts +13 -0
- package/src/resources/types/ErxSearchPharmaciesResponse.ts +28 -0
- package/src/resources/types/LabRoute.ts +1 -1
- package/src/resources/types/ZambdaCreateParams.ts +1 -1
- package/src/resources/types/ZambdaUpdateParams.ts +1 -1
- package/src/resources/types/fhir.ts +2 -0
- package/src/resources/types/index.ts +5 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErxCancelPrescriptionParams, ErxCheckAllergyInteractionsParams, ErxCheckAllergyInteractionsResponse, ErxCheckMedicationInteractionsParams, ErxCheckMedicationInteractionsResponse, ErxCheckPractitionerEnrollmentParams, ErxCheckPractitionerEnrollmentResponse, ErxCheckPrecheckInteractionsParams, ErxCheckPrecheckInteractionsResponse, ErxConnectPractitionerParams, ErxConnectPractitionerResponse, ErxEnrollPractitionerParams, ErxGetConfigurationResponse, ErxSearchAllergensParams, ErxSearchAllergensResponse, ErxSearchMedicationsParams, ErxSearchMedicationsResponse, ErxSyncPatientParams, ErxUnenrollPractitionerParams, OystehrClientRequest } from '../..';
|
|
1
|
+
import { ErxAddPatientPharmacyParams, ErxCancelPrescriptionParams, ErxCheckAllergyInteractionsParams, ErxCheckAllergyInteractionsResponse, ErxCheckMedicationInteractionsParams, ErxCheckMedicationInteractionsResponse, ErxCheckPractitionerEnrollmentParams, ErxCheckPractitionerEnrollmentResponse, ErxCheckPrecheckInteractionsParams, ErxCheckPrecheckInteractionsResponse, ErxConnectPractitionerParams, ErxConnectPractitionerResponse, ErxEnrollPractitionerParams, ErxGetConfigurationResponse, ErxGetMedicationParams, ErxGetMedicationResponse, ErxSearchAllergensParams, ErxSearchAllergensResponse, ErxSearchMedicationsParams, ErxSearchMedicationsResponse, ErxSearchPharmaciesParams, ErxSearchPharmaciesResponse, ErxSyncPatientParams, ErxUnenrollPractitionerParams, OystehrClientRequest } from '../..';
|
|
2
2
|
import { SDKResource } from '../../client/client';
|
|
3
3
|
import { OystehrConfig } from '../../config';
|
|
4
4
|
export declare class Erx extends SDKResource {
|
|
@@ -16,6 +16,18 @@ export declare class Erx extends SDKResource {
|
|
|
16
16
|
* Access Policy Resource: `eRx:Medication`
|
|
17
17
|
*/
|
|
18
18
|
searchMedications(params: ErxSearchMedicationsParams, request?: OystehrClientRequest): Promise<ErxSearchMedicationsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Get full medication details.
|
|
21
|
+
* Action: `eRx:GetMedication`
|
|
22
|
+
* Access Policy Resource: `eRx:Medication`
|
|
23
|
+
*/
|
|
24
|
+
getMedication(params: ErxGetMedicationParams, request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Get full medication details.
|
|
27
|
+
* Action: `eRx:GetMedication`
|
|
28
|
+
* Access Policy Resource: `eRx:Medication`
|
|
29
|
+
*/
|
|
30
|
+
getMedication(request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;
|
|
19
31
|
/**
|
|
20
32
|
* Get eRx configuration for project.
|
|
21
33
|
* Action: `eRx:GetConfiguration`
|
|
@@ -40,6 +52,12 @@ export declare class Erx extends SDKResource {
|
|
|
40
52
|
* Access Policy Resource: `eRx:Interaction`
|
|
41
53
|
*/
|
|
42
54
|
checkPrecheckInteractions(params: ErxCheckPrecheckInteractionsParams, request?: OystehrClientRequest): Promise<ErxCheckPrecheckInteractionsResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Adds pharmacy for a patient with the upstream eRx provider, setting it as primary if specified.
|
|
57
|
+
* Action: `eRx:AddPatientPharmacy`
|
|
58
|
+
* Access Policy Resource: `eRx:Patient`
|
|
59
|
+
*/
|
|
60
|
+
addPatientPharmacy(params: ErxAddPatientPharmacyParams, request?: OystehrClientRequest): Promise<void>;
|
|
43
61
|
/**
|
|
44
62
|
* Cancel prescription for patient.
|
|
45
63
|
* Action: `eRx:CancelPrescription`
|
|
@@ -52,6 +70,18 @@ export declare class Erx extends SDKResource {
|
|
|
52
70
|
* Access Policy Resource: `eRx:Patient`
|
|
53
71
|
*/
|
|
54
72
|
syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Search for pharmacies by a variety of criteria.
|
|
75
|
+
* Action: `eRx:SearchPharmacy`
|
|
76
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
77
|
+
*/
|
|
78
|
+
searchPharmacies(params: ErxSearchPharmaciesParams, request?: OystehrClientRequest): Promise<ErxSearchPharmaciesResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Search for pharmacies by a variety of criteria.
|
|
81
|
+
* Action: `eRx:SearchPharmacy`
|
|
82
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
83
|
+
*/
|
|
84
|
+
searchPharmacies(request?: OystehrClientRequest): Promise<ErxSearchPharmaciesResponse>;
|
|
55
85
|
/**
|
|
56
86
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
57
87
|
* Action: `eRx:Connect`
|
|
@@ -24,6 +24,14 @@ class Erx extends SDKResource {
|
|
|
24
24
|
searchMedications(params, request) {
|
|
25
25
|
return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Get full medication details.
|
|
29
|
+
* Action: `eRx:GetMedication`
|
|
30
|
+
* Access Policy Resource: `eRx:Medication`
|
|
31
|
+
*/
|
|
32
|
+
getMedication(params, request) {
|
|
33
|
+
return this.request('/medication/details', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
34
|
+
}
|
|
27
35
|
/**
|
|
28
36
|
* Get eRx configuration for project.
|
|
29
37
|
* Action: `eRx:GetConfiguration`
|
|
@@ -56,6 +64,14 @@ class Erx extends SDKResource {
|
|
|
56
64
|
checkPrecheckInteractions(params, request) {
|
|
57
65
|
return this.request('/patient/{patientId}/interactions/precheck/{drugId}', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
58
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Adds pharmacy for a patient with the upstream eRx provider, setting it as primary if specified.
|
|
69
|
+
* Action: `eRx:AddPatientPharmacy`
|
|
70
|
+
* Access Policy Resource: `eRx:Patient`
|
|
71
|
+
*/
|
|
72
|
+
addPatientPharmacy(params, request) {
|
|
73
|
+
return this.request('/patient/{patientId}/pharmacies', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
74
|
+
}
|
|
59
75
|
/**
|
|
60
76
|
* Cancel prescription for patient.
|
|
61
77
|
* Action: `eRx:CancelPrescription`
|
|
@@ -72,6 +88,14 @@ class Erx extends SDKResource {
|
|
|
72
88
|
syncPatient(params, request) {
|
|
73
89
|
return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
74
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Search for pharmacies by a variety of criteria.
|
|
93
|
+
* Action: `eRx:SearchPharmacy`
|
|
94
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
95
|
+
*/
|
|
96
|
+
searchPharmacies(params, request) {
|
|
97
|
+
return this.request('/pharmacy', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
98
|
+
}
|
|
75
99
|
/**
|
|
76
100
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
77
101
|
* Action: `eRx:Connect`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erx.js","sources":["../../../../src/resources/classes/erx.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n ErxCancelPrescriptionParams,\n ErxCheckAllergyInteractionsParams,\n ErxCheckAllergyInteractionsResponse,\n ErxCheckMedicationInteractionsParams,\n ErxCheckMedicationInteractionsResponse,\n ErxCheckPractitionerEnrollmentParams,\n ErxCheckPractitionerEnrollmentResponse,\n ErxCheckPrecheckInteractionsParams,\n ErxCheckPrecheckInteractionsResponse,\n ErxConnectPractitionerParams,\n ErxConnectPractitionerResponse,\n ErxEnrollPractitionerParams,\n ErxGetConfigurationResponse,\n ErxSearchAllergensParams,\n ErxSearchAllergensResponse,\n ErxSearchMedicationsParams,\n ErxSearchMedicationsResponse,\n ErxSyncPatientParams,\n ErxUnenrollPractitionerParams,\n OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Erx extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n #baseUrlThunk(): string {\n return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3';\n }\n /**\n * Search for allergens.\n * Action: `eRx:SearchAllergen`\n * Access Policy Resource: `eRx:Allergen`\n */\n searchAllergens(\n params: ErxSearchAllergensParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchAllergensResponse> {\n return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Search for medications.\n * Action: `eRx:SearchMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n searchMedications(\n params: ErxSearchMedicationsParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchMedicationsResponse> {\n return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get eRx configuration for project.\n * Action: `eRx:GetConfiguration`\n * Access Policy Resource: `eRx:Configuration`\n */\n getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {\n return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkAllergyInteractions(\n params: ErxCheckAllergyInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckAllergyInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/allergy',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkMedicationInteractions(\n params: ErxCheckMedicationInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckMedicationInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/medication',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkPrecheckInteractions(\n params: ErxCheckPrecheckInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPrecheckInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/precheck/{drugId}',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Cancel prescription for patient.\n * Action: `eRx:CancelPrescription`\n * Access Policy Resource: `eRx:Prescription`\n */\n cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void> {\n return this.request(\n '/patient/{patientId}/prescriptions/{medicationRequestId}',\n 'delete',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.\n * Action: `eRx:SyncPatient`\n * Access Policy Resource: `eRx:Patient`\n */\n syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params: ErxConnectPractitionerParams,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params?: ErxConnectPractitionerParams | OystehrClientRequest,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse> {\n return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Check eRx enrollment for a practitioner.\n * Action: `eRx:Read`\n * Access Policy Resource: `eRx:Enrollment`\n */\n checkPractitionerEnrollment(\n params: ErxCheckPractitionerEnrollmentParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPractitionerEnrollmentResponse> {\n return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Enroll a practitioner in the eRx service.\n * Action: `eRx:Create`\n * Access Policy Resource: `eRx:Enrollment`\n */\n enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Unenroll a practitioner from the eRx service.\n * Action: `eRx:Delete`\n * Access Policy Resource: `eRx:Enrollment`\n */\n unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);\n }\n}\n"],"names":[],"mappings":";;AAAA;AA2BM,MAAO,GAAI,SAAQ,WAAW,CAAA;AAClC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC;IACf;IACA,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,+BAA+B;IAC/E;AACA;;;;AAIG;IACH,eAAe,CACb,MAAgC,EAChC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF;AACA;;;;AAIG;IACH,iBAAiB,CACf,MAAkC,EAClC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3F;AACA;;;;AAIG;AACH,IAAA,gBAAgB,CAAC,OAA8B,EAAA;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/E;AACA;;;;AAIG;IACH,wBAAwB,CACtB,MAAyC,EACzC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CACjB,2CAA2C,EAC3C,KAAK,EACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC,MAAM,EAAE,OAAO,CAAC;IACpB;AACA;;;;AAIG;IAC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,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9G;AACA;;;;AAIG;IACH,kBAAkB,CAAC,MAAmC,EAAE,OAA8B,EAAA;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/G;AACA;;;;AAIG;IACH,oBAAoB,CAAC,MAAqC,EAAE,OAA8B,EAAA;QACxF,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IACjH;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"erx.js","sources":["../../../../src/resources/classes/erx.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n ErxAddPatientPharmacyParams,\n ErxCancelPrescriptionParams,\n ErxCheckAllergyInteractionsParams,\n ErxCheckAllergyInteractionsResponse,\n ErxCheckMedicationInteractionsParams,\n ErxCheckMedicationInteractionsResponse,\n ErxCheckPractitionerEnrollmentParams,\n ErxCheckPractitionerEnrollmentResponse,\n ErxCheckPrecheckInteractionsParams,\n ErxCheckPrecheckInteractionsResponse,\n ErxConnectPractitionerParams,\n ErxConnectPractitionerResponse,\n ErxEnrollPractitionerParams,\n ErxGetConfigurationResponse,\n ErxGetMedicationParams,\n ErxGetMedicationResponse,\n ErxSearchAllergensParams,\n ErxSearchAllergensResponse,\n ErxSearchMedicationsParams,\n ErxSearchMedicationsResponse,\n ErxSearchPharmaciesParams,\n ErxSearchPharmaciesResponse,\n ErxSyncPatientParams,\n ErxUnenrollPractitionerParams,\n OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Erx extends SDKResource {\n constructor(config: OystehrConfig) {\n super(config);\n }\n #baseUrlThunk(): string {\n return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3';\n }\n /**\n * Search for allergens.\n * Action: `eRx:SearchAllergen`\n * Access Policy Resource: `eRx:Allergen`\n */\n searchAllergens(\n params: ErxSearchAllergensParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchAllergensResponse> {\n return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Search for medications.\n * Action: `eRx:SearchMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n searchMedications(\n params: ErxSearchMedicationsParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchMedicationsResponse> {\n return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get full medication details.\n * Action: `eRx:GetMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n getMedication(params: ErxGetMedicationParams, request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;\n /**\n * Get full medication details.\n * Action: `eRx:GetMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n getMedication(request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;\n /**\n * Get full medication details.\n * Action: `eRx:GetMedication`\n * Access Policy Resource: `eRx:Medication`\n */\n getMedication(\n params?: ErxGetMedicationParams | OystehrClientRequest,\n request?: OystehrClientRequest\n ): Promise<ErxGetMedicationResponse> {\n return this.request('/medication/details', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Get eRx configuration for project.\n * Action: `eRx:GetConfiguration`\n * Access Policy Resource: `eRx:Configuration`\n */\n getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {\n return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n }\n /**\n * Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkAllergyInteractions(\n params: ErxCheckAllergyInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckAllergyInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/allergy',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkMedicationInteractions(\n params: ErxCheckMedicationInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckMedicationInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/medication',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Check for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.\n * Action: `eRx:Check`\n * Access Policy Resource: `eRx:Interaction`\n */\n checkPrecheckInteractions(\n params: ErxCheckPrecheckInteractionsParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPrecheckInteractionsResponse> {\n return this.request(\n '/patient/{patientId}/interactions/precheck/{drugId}',\n 'get',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Adds pharmacy for a patient with the upstream eRx provider, setting it as primary if specified.\n * Action: `eRx:AddPatientPharmacy`\n * Access Policy Resource: `eRx:Patient`\n */\n addPatientPharmacy(params: ErxAddPatientPharmacyParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/patient/{patientId}/pharmacies', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Cancel prescription for patient.\n * Action: `eRx:CancelPrescription`\n * Access Policy Resource: `eRx:Prescription`\n */\n cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void> {\n return this.request(\n '/patient/{patientId}/prescriptions/{medicationRequestId}',\n 'delete',\n this.#baseUrlThunk.bind(this)\n )(params, request);\n }\n /**\n * Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.\n * Action: `eRx:SyncPatient`\n * Access Policy Resource: `eRx:Patient`\n */\n syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Search for pharmacies by a variety of criteria.\n * Action: `eRx:SearchPharmacy`\n * Access Policy Resource: `eRx:Pharmacy`\n */\n searchPharmacies(\n params: ErxSearchPharmaciesParams,\n request?: OystehrClientRequest\n ): Promise<ErxSearchPharmaciesResponse>;\n /**\n * Search for pharmacies by a variety of criteria.\n * Action: `eRx:SearchPharmacy`\n * Access Policy Resource: `eRx:Pharmacy`\n */\n searchPharmacies(request?: OystehrClientRequest): Promise<ErxSearchPharmaciesResponse>;\n /**\n * Search for pharmacies by a variety of criteria.\n * Action: `eRx:SearchPharmacy`\n * Access Policy Resource: `eRx:Pharmacy`\n */\n searchPharmacies(\n params?: ErxSearchPharmaciesParams | OystehrClientRequest,\n request?: OystehrClientRequest\n ): Promise<ErxSearchPharmaciesResponse> {\n return this.request('/pharmacy', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params: ErxConnectPractitionerParams,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;\n /**\n * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n * Action: `eRx:Connect`\n * Access Policy Resource: `eRx:SSO`\n */\n connectPractitioner(\n params?: ErxConnectPractitionerParams | OystehrClientRequest,\n request?: OystehrClientRequest\n ): Promise<ErxConnectPractitionerResponse> {\n return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Check eRx enrollment for a practitioner.\n * Action: `eRx:Read`\n * Access Policy Resource: `eRx:Enrollment`\n */\n checkPractitionerEnrollment(\n params: ErxCheckPractitionerEnrollmentParams,\n request?: OystehrClientRequest\n ): Promise<ErxCheckPractitionerEnrollmentResponse> {\n return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Enroll a practitioner in the eRx service.\n * Action: `eRx:Create`\n * Access Policy Resource: `eRx:Enrollment`\n */\n enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request);\n }\n /**\n * Unenroll a practitioner from the eRx service.\n * Action: `eRx:Delete`\n * Access Policy Resource: `eRx:Enrollment`\n */\n unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);\n }\n}\n"],"names":[],"mappings":";;AAAA;AAgCM,MAAO,GAAI,SAAQ,WAAW,CAAA;AAClC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC;IACf;IACA,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,+BAA+B;IAC/E;AACA;;;;AAIG;IACH,eAAe,CACb,MAAgC,EAChC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF;AACA;;;;AAIG;IACH,iBAAiB,CACf,MAAkC,EAClC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAA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OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/G;AACA;;;;AAIG;IACH,oBAAoB,CAAC,MAAqC,EAAE,OAA8B,EAAA;QACxF,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAgC,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IACjH;AACD;;;;"}
|
|
@@ -32,6 +32,7 @@ declare function del<T extends FhirResource>(this: SDKResource, { resourceType,
|
|
|
32
32
|
export { del as delete };
|
|
33
33
|
export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id }: FhirHistorySearchParams<T>, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
|
|
34
34
|
export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id, versionId }: FhirHistoryGetParams<T>, request?: OystehrClientRequest): Promise<FhirFetcherResponse<T>>;
|
|
35
|
+
export declare function history<T extends FhirResource>(this: SDKResource, { resourceType, id, count, offset }: FhirHistorySearchParams<T>, request?: OystehrClientRequest): Promise<FhirFetcherResponse<Bundle<T>>>;
|
|
35
36
|
export declare const batch: <BundleContentType extends FhirResource>(this: SDKResource, input: BatchInput<BundleContentType>, request?: OystehrClientRequest) => Promise<FhirFetcherResponse<Bundle<BundleContentType>>>;
|
|
36
37
|
export declare const transaction: <BundleContentType extends FhirResource>(this: SDKResource, input: BatchInput<BundleContentType>, request?: OystehrClientRequest) => Promise<FhirFetcherResponse<Bundle<BundleContentType>>>;
|
|
37
38
|
export declare function formatAddress(address: AddressR4B | AddressR5, options?: {
|
|
@@ -68,8 +68,15 @@ async function patch({ resourceType, id, operations }, request) {
|
|
|
68
68
|
async function del({ resourceType, id }, request) {
|
|
69
69
|
return this.fhirRequest(`/${resourceType}/${id}`, 'DELETE')({}, request);
|
|
70
70
|
}
|
|
71
|
-
async function history({ resourceType, id, versionId }, request) {
|
|
72
|
-
|
|
71
|
+
async function history({ resourceType, id, versionId, count, offset, }, request) {
|
|
72
|
+
if (versionId) {
|
|
73
|
+
return this.fhirRequest(`/${resourceType}/${id}/_history/${versionId}`, 'GET')({}, request);
|
|
74
|
+
}
|
|
75
|
+
if (count) {
|
|
76
|
+
return this.fhirRequest(`/${resourceType}/${id}/_history?_total=accurate&_count=${count}
|
|
77
|
+
${offset ? `&_offset=${offset}` : ''}`, 'GET')({}, request);
|
|
78
|
+
}
|
|
79
|
+
return this.fhirRequest(`/${resourceType}/${id}/_history?_total=accurate`, 'GET')({}, request);
|
|
73
80
|
}
|
|
74
81
|
function batchInputRequestToBundleEntryItem(request) {
|
|
75
82
|
const { method, url } = request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fhir-ext.js","sources":["../../../../src/resources/classes/fhir-ext.ts"],"sourcesContent":["import { Address as AddressR4B, HumanName as HumanNameR4B } from 'fhir/r4b';\nimport { Address as AddressR5, HumanName as HumanNameR5 } from 'fhir/r5';\nimport {\n BatchInput,\n BatchInputRequest,\n Binary,\n Bundle,\n BundleEntry,\n FhirBundle,\n FhirCreateParams,\n FhirDeleteParams,\n FhirGetParams,\n FhirHistoryGetParams,\n FhirHistorySearchParams,\n FhirPatchParams,\n FhirResource,\n FhirSearchParams,\n FhirUpdateParams,\n} from '../..';\nimport { addParamsToSearch, FhirFetcherResponse, OystehrClientRequest, SDKResource } from '../../client/client';\n\n// Code adapted from https://github.com/sindresorhus/uint8array-extras\nconst MAX_BLOCK_SIZE = 65_535;\nfunction stringToBase64(input: string): string {\n const data: Uint8Array<ArrayBuffer> = new globalThis.TextEncoder().encode(input);\n let base64 = '';\n\n for (let index = 0; index < data.length; index += MAX_BLOCK_SIZE) {\n const chunk = data.subarray(index, index + MAX_BLOCK_SIZE);\n // Required as `btoa` and `atob` don't properly support Unicode: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n base64 += globalThis.btoa(String.fromCodePoint.apply(undefined, chunk as unknown as number[]));\n }\n return base64;\n}\n\n/**\n * Optional parameter that can be passed to the client methods. It allows\n * overriding the access token or project ID, and setting various headers,\n * such as 'Content-Type'. Also support enabling optimistic locking.\n */\nexport interface OystehrFHIRUpdateClientRequest extends OystehrClientRequest {\n /**\n * Enable optimistic locking for the request. If set to a version ID, the request will\n * include the 'If-Match' header with that value in the FHIR optimistic-locking format.\n * If the resource has been updated since the version provided, the request\n * will fail with a 412 Precondition Failed error.\n */\n optimisticLockingVersionId?: string;\n}\n\n/**\n * Performs a FHIR search and returns the results as a Bundle resource\n *\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\nexport async function search<T extends FhirResource>(\n this: SDKResource,\n params: FhirSearchParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>> {\n const { resourceType, params: searchParams } = params;\n let paramMap: Record<string, (string | number)[]> | undefined;\n if (searchParams) {\n paramMap = Object.entries(searchParams).reduce((acc, [_, param]) => {\n if (!acc[param.name]) {\n acc[param.name] = [];\n }\n acc[param.name].push(param.value);\n return acc;\n }, {} as Record<string, (string | number)[]>);\n }\n const requestBundle = await this.fhirRequest<FhirBundle<T>>(`/${resourceType}/_search`, 'POST')(paramMap, {\n ...request,\n contentType: 'application/x-www-form-urlencoded',\n });\n const bundle: Bundle<T> = {\n ...requestBundle,\n entry: requestBundle.entry as Array<BundleEntry<T>> | undefined,\n unbundle: function (this: { entry?: Array<BundleEntry<T>> | undefined }) {\n return this.entry?.map((entry) => entry.resource).filter((entry): entry is T => entry !== undefined) ?? [];\n },\n };\n return bundle;\n}\n\nexport async function create<T extends FhirResource>(\n this: SDKResource,\n params: FhirCreateParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { resourceType } = params;\n return this.fhirRequest(`/${resourceType}`, 'POST')(params as unknown as Record<string, unknown>, request);\n}\n\nexport async function get<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirGetParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest<T>(`/${resourceType}/${id}`, 'GET')({}, request);\n}\n\nexport async function update<T extends FhirResource>(\n this: SDKResource,\n params: FhirUpdateParams<T>,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { id, resourceType } = params;\n return this.fhirRequest(`/${resourceType}/${id}`, 'PUT')(params as unknown as Record<string, unknown>, {\n ...request,\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nexport async function patch<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, operations }: FhirPatchParams<T>,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'PATCH')(operations, {\n ...request,\n contentType: 'application/json-patch+json',\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nasync function del<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirDeleteParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'DELETE')({}, request);\n}\nexport { del as delete };\n\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirHistorySearchParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: FhirHistoryGetParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: { resourceType: string; id: string; versionId?: string },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>> | FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}/_history${versionId ? `/${versionId}` : ''}`, 'GET')({}, request);\n}\n\nfunction batchInputRequestToBundleEntryItem<T extends FhirResource>(\n request: BatchInputRequest<T>\n): BundleEntry<T | Binary<T>> {\n const { method, url } = request;\n const baseRequest = {\n request: {\n method,\n url,\n },\n };\n\n // Escape query string parameters in entry.request.url\n if (url.split('?').length > 1) {\n const [resource, query] = url.split('?');\n const params = query\n .split('&')\n .map((param) => {\n const [name, value] = param.split('=');\n return { name, value };\n })\n .reduce((acc, { name, value }) => {\n if (!name) {\n return acc;\n }\n if (!acc[name]) {\n acc[name] = [];\n }\n acc[name].push(value);\n return acc;\n }, {} as Record<string, string[]>);\n const search = new URLSearchParams();\n addParamsToSearch(params, search);\n baseRequest.request.url = `${resource}?${search.toString()}`;\n }\n\n // GET, DELETE, and HEAD require no further parameters\n if (['GET', 'DELETE', 'HEAD'].includes(method)) {\n return baseRequest as BundleEntry<T>;\n }\n\n // PUT updates require a full resource\n if (method === 'PUT') {\n const { resource } = request;\n return {\n request: {\n ...baseRequest.request,\n ifMatch: request.ifMatch,\n },\n resource: resource as T,\n } as BundleEntry<T>;\n }\n\n // PATCH can be Binary resource or JSON patch\n if (method === 'PATCH') {\n if ('resource' in request) {\n return {\n request: {\n ...baseRequest.request,\n ifMatch: request.ifMatch,\n },\n resource: request.resource,\n } as BundleEntry<Binary<T>>;\n }\n const data = stringToBase64(JSON.stringify(request.operations));\n return {\n ...baseRequest,\n resource: {\n resourceType: 'Binary',\n contentType: 'application/json-patch+json',\n data,\n },\n } as BundleEntry<Binary<T>>;\n }\n\n // POST creates require a full resource\n if (method === 'POST') {\n const { resource, fullUrl } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n fullUrl,\n } as BundleEntry<T>;\n }\n\n // // Add ifMatch for the entries that support it\n // if ('ifMatch' in request) {\n // baseRequest.request = {\n // ...baseRequest.request,\n // ifMatch: request.ifMatch,\n // };\n // }\n\n throw new Error('Unrecognized method');\n}\n\nfunction bundleRequest(type: 'batch' | 'transaction') {\n return async function <BundleContentType extends FhirResource>(\n this: SDKResource,\n input: BatchInput<BundleContentType>,\n request?: OystehrClientRequest\n ): Promise<FhirFetcherResponse<Bundle<BundleContentType>>> {\n return this.fhirRequest('/', 'POST')(\n {\n resourceType: 'Bundle',\n type,\n entry: input.requests.map(batchInputRequestToBundleEntryItem),\n },\n request\n );\n };\n}\n\nexport const batch = bundleRequest('batch');\nexport const transaction = bundleRequest('transaction');\n\nexport function formatAddress(\n address: AddressR4B | AddressR5,\n options?: { all?: boolean; use?: boolean; lineSeparator?: string }\n): string {\n const builder = [];\n\n if (address.line) {\n builder.push(...address.line);\n }\n\n if (address.city || address.state || address.postalCode) {\n const cityStateZip = [];\n if (address.city) {\n cityStateZip.push(address.city);\n }\n if (address.state) {\n cityStateZip.push(address.state);\n }\n if (address.postalCode) {\n cityStateZip.push(address.postalCode);\n }\n builder.push(cityStateZip.join(', '));\n }\n\n if (address.use && (options?.all || options?.use)) {\n builder.push('[' + address.use + ']');\n }\n\n return builder.join(options?.lineSeparator || ', ').trim();\n}\n\nexport function formatHumanName(\n name: HumanNameR4B | HumanNameR5,\n options?: {\n all?: boolean;\n prefix?: boolean;\n suffix?: boolean;\n use?: boolean;\n }\n): string {\n const builder = [];\n\n if (name.prefix && options?.prefix !== false) {\n builder.push(...name.prefix);\n }\n\n if (name.given) {\n builder.push(...name.given);\n }\n\n if (name.family) {\n builder.push(name.family);\n }\n\n if (name.suffix && options?.suffix !== false) {\n builder.push(...name.suffix);\n }\n\n if (name.use && (options?.all || options?.use)) {\n builder.push('[' + name.use + ']');\n }\n\n return builder.join(' ').trim();\n}\n"],"names":[],"mappings":";;AAqBA;AACA,MAAM,cAAc,GAAG,MAAM;AAC7B,SAAS,cAAc,CAAC,KAAa,EAAA;AACnC,IAAA,MAAM,IAAI,GAA4B,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,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,CAAC,KAAK,CAAC;IAC7B;AAEA,IAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,QAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC3B;IAEA,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,MAAM,KAAK,KAAK,EAAE;QAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B;AAEA,IAAA,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,CAAC,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACpC;IAEA,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;AACjC;;;;"}
|
|
1
|
+
{"version":3,"file":"fhir-ext.js","sources":["../../../../src/resources/classes/fhir-ext.ts"],"sourcesContent":["import { Address as AddressR4B, HumanName as HumanNameR4B } from 'fhir/r4b';\nimport { Address as AddressR5, HumanName as HumanNameR5 } from 'fhir/r5';\nimport {\n BatchInput,\n BatchInputRequest,\n Binary,\n Bundle,\n BundleEntry,\n FhirBundle,\n FhirCreateParams,\n FhirDeleteParams,\n FhirGetParams,\n FhirHistoryGetParams,\n FhirHistorySearchParams,\n FhirPatchParams,\n FhirResource,\n FhirSearchParams,\n FhirUpdateParams,\n} from '../..';\nimport { addParamsToSearch, FhirFetcherResponse, OystehrClientRequest, SDKResource } from '../../client/client';\n\n// Code adapted from https://github.com/sindresorhus/uint8array-extras\nconst MAX_BLOCK_SIZE = 65_535;\nfunction stringToBase64(input: string): string {\n const data: Uint8Array<ArrayBuffer> = new globalThis.TextEncoder().encode(input);\n let base64 = '';\n\n for (let index = 0; index < data.length; index += MAX_BLOCK_SIZE) {\n const chunk = data.subarray(index, index + MAX_BLOCK_SIZE);\n // Required as `btoa` and `atob` don't properly support Unicode: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n base64 += globalThis.btoa(String.fromCodePoint.apply(undefined, chunk as unknown as number[]));\n }\n return base64;\n}\n\n/**\n * Optional parameter that can be passed to the client methods. It allows\n * overriding the access token or project ID, and setting various headers,\n * such as 'Content-Type'. Also support enabling optimistic locking.\n */\nexport interface OystehrFHIRUpdateClientRequest extends OystehrClientRequest {\n /**\n * Enable optimistic locking for the request. If set to a version ID, the request will\n * include the 'If-Match' header with that value in the FHIR optimistic-locking format.\n * If the resource has been updated since the version provided, the request\n * will fail with a 412 Precondition Failed error.\n */\n optimisticLockingVersionId?: string;\n}\n\n/**\n * Performs a FHIR search and returns the results as a Bundle resource\n *\n * @param options FHIR resource type and FHIR search parameters\n * @param request optional OystehrClientRequest object\n * @returns FHIR Bundle resource\n */\nexport async function search<T extends FhirResource>(\n this: SDKResource,\n params: FhirSearchParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>> {\n const { resourceType, params: searchParams } = params;\n let paramMap: Record<string, (string | number)[]> | undefined;\n if (searchParams) {\n paramMap = Object.entries(searchParams).reduce((acc, [_, param]) => {\n if (!acc[param.name]) {\n acc[param.name] = [];\n }\n acc[param.name].push(param.value);\n return acc;\n }, {} as Record<string, (string | number)[]>);\n }\n const requestBundle = await this.fhirRequest<FhirBundle<T>>(`/${resourceType}/_search`, 'POST')(paramMap, {\n ...request,\n contentType: 'application/x-www-form-urlencoded',\n });\n const bundle: Bundle<T> = {\n ...requestBundle,\n entry: requestBundle.entry as Array<BundleEntry<T>> | undefined,\n unbundle: function (this: { entry?: Array<BundleEntry<T>> | undefined }) {\n return this.entry?.map((entry) => entry.resource).filter((entry): entry is T => entry !== undefined) ?? [];\n },\n };\n return bundle;\n}\n\nexport async function create<T extends FhirResource>(\n this: SDKResource,\n params: FhirCreateParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { resourceType } = params;\n return this.fhirRequest(`/${resourceType}`, 'POST')(params as unknown as Record<string, unknown>, request);\n}\n\nexport async function get<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirGetParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest<T>(`/${resourceType}/${id}`, 'GET')({}, request);\n}\n\nexport async function update<T extends FhirResource>(\n this: SDKResource,\n params: FhirUpdateParams<T>,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n const { id, resourceType } = params;\n return this.fhirRequest(`/${resourceType}/${id}`, 'PUT')(params as unknown as Record<string, unknown>, {\n ...request,\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nexport async function patch<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, operations }: FhirPatchParams<T>,\n request?: OystehrFHIRUpdateClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'PATCH')(operations, {\n ...request,\n contentType: 'application/json-patch+json',\n ifMatch: request?.optimisticLockingVersionId ? `W/\"${request.optimisticLockingVersionId}\"` : undefined,\n });\n}\n\nasync function del<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirDeleteParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>> {\n return this.fhirRequest(`/${resourceType}/${id}`, 'DELETE')({}, request);\n}\nexport { del as delete };\n\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id }: FhirHistorySearchParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, versionId }: FhirHistoryGetParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<T>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n { resourceType, id, count, offset }: FhirHistorySearchParams<T>,\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>>>;\nexport async function history<T extends FhirResource>(\n this: SDKResource,\n {\n resourceType,\n id,\n versionId,\n count,\n offset,\n }: { resourceType: string; id: string; versionId?: string; count?: number; offset?: number },\n request?: OystehrClientRequest\n): Promise<FhirFetcherResponse<Bundle<T>> | FhirFetcherResponse<T>> {\n if (versionId) {\n return this.fhirRequest(`/${resourceType}/${id}/_history/${versionId}`, 'GET')({}, request);\n }\n if (count) {\n return this.fhirRequest(\n `/${resourceType}/${id}/_history?_total=accurate&_count=${count}\n ${offset ? `&_offset=${offset}` : ''}`,\n 'GET'\n )({}, request);\n }\n return this.fhirRequest(`/${resourceType}/${id}/_history?_total=accurate`, 'GET')({}, request);\n}\n\nfunction batchInputRequestToBundleEntryItem<T extends FhirResource>(\n request: BatchInputRequest<T>\n): BundleEntry<T | Binary<T>> {\n const { method, url } = request;\n const baseRequest = {\n request: {\n method,\n url,\n },\n };\n\n // Escape query string parameters in entry.request.url\n if (url.split('?').length > 1) {\n const [resource, query] = url.split('?');\n const params = query\n .split('&')\n .map((param) => {\n const [name, value] = param.split('=');\n return { name, value };\n })\n .reduce((acc, { name, value }) => {\n if (!name) {\n return acc;\n }\n if (!acc[name]) {\n acc[name] = [];\n }\n acc[name].push(value);\n return acc;\n }, {} as Record<string, string[]>);\n const search = new URLSearchParams();\n addParamsToSearch(params, search);\n baseRequest.request.url = `${resource}?${search.toString()}`;\n }\n\n // GET, DELETE, and HEAD require no further parameters\n if (['GET', 'DELETE', 'HEAD'].includes(method)) {\n return baseRequest as BundleEntry<T>;\n }\n\n // PUT updates require a full resource\n if (method === 'PUT') {\n const { resource } = request;\n return {\n request: {\n ...baseRequest.request,\n ifMatch: request.ifMatch,\n },\n resource: resource as T,\n } as BundleEntry<T>;\n }\n\n // PATCH can be Binary resource or JSON patch\n if (method === 'PATCH') {\n if ('resource' in request) {\n return {\n request: {\n ...baseRequest.request,\n ifMatch: request.ifMatch,\n },\n resource: request.resource,\n } as BundleEntry<Binary<T>>;\n }\n const data = stringToBase64(JSON.stringify(request.operations));\n return {\n ...baseRequest,\n resource: {\n resourceType: 'Binary',\n contentType: 'application/json-patch+json',\n data,\n },\n } as BundleEntry<Binary<T>>;\n }\n\n // POST creates require a full resource\n if (method === 'POST') {\n const { resource, fullUrl } = request;\n return {\n ...baseRequest,\n resource: resource as T,\n fullUrl,\n } as BundleEntry<T>;\n }\n\n // // Add ifMatch for the entries that support it\n // if ('ifMatch' in request) {\n // baseRequest.request = {\n // ...baseRequest.request,\n // ifMatch: request.ifMatch,\n // };\n // }\n\n throw new Error('Unrecognized method');\n}\n\nfunction bundleRequest(type: 'batch' | 'transaction') {\n return async function <BundleContentType extends FhirResource>(\n this: SDKResource,\n input: BatchInput<BundleContentType>,\n request?: OystehrClientRequest\n ): Promise<FhirFetcherResponse<Bundle<BundleContentType>>> {\n return this.fhirRequest('/', 'POST')(\n {\n resourceType: 'Bundle',\n type,\n entry: input.requests.map(batchInputRequestToBundleEntryItem),\n },\n request\n );\n };\n}\n\nexport const batch = bundleRequest('batch');\nexport const transaction = bundleRequest('transaction');\n\nexport function formatAddress(\n address: AddressR4B | AddressR5,\n options?: { all?: boolean; use?: boolean; lineSeparator?: string }\n): string {\n const builder = [];\n\n if (address.line) {\n builder.push(...address.line);\n }\n\n if (address.city || address.state || address.postalCode) {\n const cityStateZip = [];\n if (address.city) {\n cityStateZip.push(address.city);\n }\n if (address.state) {\n cityStateZip.push(address.state);\n }\n if (address.postalCode) {\n cityStateZip.push(address.postalCode);\n }\n builder.push(cityStateZip.join(', '));\n }\n\n if (address.use && (options?.all || options?.use)) {\n builder.push('[' + address.use + ']');\n }\n\n return builder.join(options?.lineSeparator || ', ').trim();\n}\n\nexport function formatHumanName(\n name: HumanNameR4B | HumanNameR5,\n options?: {\n all?: boolean;\n prefix?: boolean;\n suffix?: boolean;\n use?: boolean;\n }\n): string {\n const builder = [];\n\n if (name.prefix && options?.prefix !== false) {\n builder.push(...name.prefix);\n }\n\n if (name.given) {\n builder.push(...name.given);\n }\n\n if (name.family) {\n builder.push(name.family);\n }\n\n if (name.suffix && options?.suffix !== false) {\n builder.push(...name.suffix);\n }\n\n if (name.use && (options?.all || options?.use)) {\n builder.push('[' + name.use + ']');\n }\n\n return builder.join(' ').trim();\n}\n"],"names":[],"mappings":";;AAqBA;AACA,MAAM,cAAc,GAAG,MAAM;AAC7B,SAAS,cAAc,CAAC,KAAa,EAAA;AACnC,IAAA,MAAM,IAAI,GAA4B,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;IAChF,IAAI,MAAM,GAAG,EAAE;AAEf,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,cAAc,EAAE;AAChE,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC;;AAE1D,QAAA,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,EAAE,KAA4B,CAAC,CAAC;IAChG;AACA,IAAA,OAAO,MAAM;AACf;AAiBA;;;;;;AAMG;AACI,eAAe,MAAM,CAE1B,MAA2B,EAC3B,OAA8B,EAAA;IAE9B,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM;AACrD,IAAA,IAAI,QAAyD;IAC7D,IAAI,YAAY,EAAE;AAChB,QAAA,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,KAAI;YACjE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;AACpB,gBAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB;AACA,YAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK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AAI,EAAE;AACjC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ErxAddPatientPharmacyParams {
|
|
2
|
+
/**
|
|
3
|
+
* ID of the pharmacy to add for the patient.
|
|
4
|
+
*/
|
|
5
|
+
pharmacyId: number;
|
|
6
|
+
/**
|
|
7
|
+
* Whether to set the added pharmacy as the patient's primary pharmacy.
|
|
8
|
+
*/
|
|
9
|
+
setAsPrimary?: boolean;
|
|
10
|
+
patientId: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Medication
|
|
3
|
+
*/
|
|
4
|
+
export interface ErxGetMedicationResponse {
|
|
5
|
+
/**
|
|
6
|
+
* The Medi-Span identifier for the medication.
|
|
7
|
+
*/
|
|
8
|
+
id: number;
|
|
9
|
+
/**
|
|
10
|
+
* RxNorm Concept Unique (RxCUI) identifier of medication.
|
|
11
|
+
*/
|
|
12
|
+
ndc?: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* RxNorm Concept Unique (RxCUI) identifier of medication.
|
|
15
|
+
*/
|
|
16
|
+
rxcui?: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Human readable name of medication.
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Alternative human readable name of medication.
|
|
23
|
+
*/
|
|
24
|
+
displayName?: string;
|
|
25
|
+
route?: string;
|
|
26
|
+
doseForm?: string;
|
|
27
|
+
strength?: string;
|
|
28
|
+
dispenseUnit?: string;
|
|
29
|
+
isBrandName: boolean;
|
|
30
|
+
genericName?: string | null;
|
|
31
|
+
isOtc: boolean;
|
|
32
|
+
classification?: string;
|
|
33
|
+
schedule?: number;
|
|
34
|
+
stateSchedules?: {
|
|
35
|
+
name: string;
|
|
36
|
+
schedule?: number;
|
|
37
|
+
}[];
|
|
38
|
+
isObsolete: boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Success
|
|
3
|
+
*/
|
|
4
|
+
export interface ErxSearchPharmaciesResponse {
|
|
5
|
+
data: {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
address1: string;
|
|
9
|
+
address2?: string;
|
|
10
|
+
city: string;
|
|
11
|
+
state: string;
|
|
12
|
+
zipCode: string;
|
|
13
|
+
phone: string;
|
|
14
|
+
fax?: string;
|
|
15
|
+
specialties: string[];
|
|
16
|
+
ncpdpId: string;
|
|
17
|
+
}[];
|
|
18
|
+
metadata: {
|
|
19
|
+
hasPrevious: boolean;
|
|
20
|
+
hasNext: boolean;
|
|
21
|
+
total: number;
|
|
22
|
+
currentPage: number;
|
|
23
|
+
totalPages: number;
|
|
24
|
+
pageSize: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -48,5 +48,5 @@ export interface LabRoute {
|
|
|
48
48
|
/**
|
|
49
49
|
* Date and time (in UTC) when the End User License Agreement was accepted. Required for certain labs. See [Create Route](https://docs.oystehr.com/oystehr/services/lab/onboarding-a-lab/#create-route) for more details.
|
|
50
50
|
*/
|
|
51
|
-
eulaAcceptanceDateTimeUtc?: string;
|
|
51
|
+
eulaAcceptanceDateTimeUtc?: string | null;
|
|
52
52
|
}
|
|
@@ -12,7 +12,7 @@ export interface ZambdaCreateParams {
|
|
|
12
12
|
/**
|
|
13
13
|
* The runtime to use for the Zambda Function.
|
|
14
14
|
*/
|
|
15
|
-
runtime: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | '
|
|
15
|
+
runtime: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | 'dotnet8' | 'ruby3.3';
|
|
16
16
|
/**
|
|
17
17
|
* The amount of memory in MB to allocate to the Zambda Function. If not specified, a system default (1024MB) will be used. Min: 128MB, Max: 10240MB.
|
|
18
18
|
*/
|
|
@@ -12,7 +12,7 @@ export interface ZambdaUpdateParams {
|
|
|
12
12
|
/**
|
|
13
13
|
* The runtime to use for the Zambda Function.
|
|
14
14
|
*/
|
|
15
|
-
runtime?: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | '
|
|
15
|
+
runtime?: 'nodejs20.x' | 'nodejs22.x' | 'python3.13' | 'python3.12' | 'java21' | 'dotnet8' | 'ruby3.3';
|
|
16
16
|
/**
|
|
17
17
|
* The amount of memory in MB to allocate to the Zambda Function. If not specified, a system default (1024MB) will be used. Min: 128MB, Max: 10240MB.
|
|
18
18
|
*/
|
|
@@ -39,6 +39,8 @@ export interface FhirDeleteParams<T extends FhirResource> {
|
|
|
39
39
|
export interface FhirHistorySearchParams<T extends FhirResource> {
|
|
40
40
|
resourceType: T['resourceType'];
|
|
41
41
|
id: string;
|
|
42
|
+
count?: number;
|
|
43
|
+
offset?: number;
|
|
42
44
|
}
|
|
43
45
|
export interface FhirHistoryGetParams<T extends FhirResource> {
|
|
44
46
|
resourceType: T['resourceType'];
|
|
@@ -175,6 +175,8 @@ export * from './ErxSearchAllergensParams';
|
|
|
175
175
|
export * from './ErxSearchAllergensResponse';
|
|
176
176
|
export * from './ErxSearchMedicationsParams';
|
|
177
177
|
export * from './ErxSearchMedicationsResponse';
|
|
178
|
+
export * from './ErxGetMedicationParams';
|
|
179
|
+
export * from './ErxGetMedicationResponse';
|
|
178
180
|
export * from './ErxGetConfigurationResponse';
|
|
179
181
|
export * from './ErxCheckAllergyInteractionsParams';
|
|
180
182
|
export * from './ErxCheckAllergyInteractionsResponse';
|
|
@@ -182,8 +184,11 @@ export * from './ErxCheckMedicationInteractionsParams';
|
|
|
182
184
|
export * from './ErxCheckMedicationInteractionsResponse';
|
|
183
185
|
export * from './ErxCheckPrecheckInteractionsParams';
|
|
184
186
|
export * from './ErxCheckPrecheckInteractionsResponse';
|
|
187
|
+
export * from './ErxAddPatientPharmacyParams';
|
|
185
188
|
export * from './ErxCancelPrescriptionParams';
|
|
186
189
|
export * from './ErxSyncPatientParams';
|
|
190
|
+
export * from './ErxSearchPharmaciesParams';
|
|
191
|
+
export * from './ErxSearchPharmaciesResponse';
|
|
187
192
|
export * from './ErxConnectPractitionerParams';
|
|
188
193
|
export * from './ErxConnectPractitionerResponse';
|
|
189
194
|
export * from './ErxCheckPractitionerEnrollmentParams';
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// AUTOGENERATED -- DO NOT EDIT
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
ErxAddPatientPharmacyParams,
|
|
4
5
|
ErxCancelPrescriptionParams,
|
|
5
6
|
ErxCheckAllergyInteractionsParams,
|
|
6
7
|
ErxCheckAllergyInteractionsResponse,
|
|
@@ -14,10 +15,14 @@ import {
|
|
|
14
15
|
ErxConnectPractitionerResponse,
|
|
15
16
|
ErxEnrollPractitionerParams,
|
|
16
17
|
ErxGetConfigurationResponse,
|
|
18
|
+
ErxGetMedicationParams,
|
|
19
|
+
ErxGetMedicationResponse,
|
|
17
20
|
ErxSearchAllergensParams,
|
|
18
21
|
ErxSearchAllergensResponse,
|
|
19
22
|
ErxSearchMedicationsParams,
|
|
20
23
|
ErxSearchMedicationsResponse,
|
|
24
|
+
ErxSearchPharmaciesParams,
|
|
25
|
+
ErxSearchPharmaciesResponse,
|
|
21
26
|
ErxSyncPatientParams,
|
|
22
27
|
ErxUnenrollPractitionerParams,
|
|
23
28
|
OystehrClientRequest,
|
|
@@ -54,6 +59,29 @@ export class Erx extends SDKResource {
|
|
|
54
59
|
): Promise<ErxSearchMedicationsResponse> {
|
|
55
60
|
return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
56
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Get full medication details.
|
|
64
|
+
* Action: `eRx:GetMedication`
|
|
65
|
+
* Access Policy Resource: `eRx:Medication`
|
|
66
|
+
*/
|
|
67
|
+
getMedication(params: ErxGetMedicationParams, request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Get full medication details.
|
|
70
|
+
* Action: `eRx:GetMedication`
|
|
71
|
+
* Access Policy Resource: `eRx:Medication`
|
|
72
|
+
*/
|
|
73
|
+
getMedication(request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Get full medication details.
|
|
76
|
+
* Action: `eRx:GetMedication`
|
|
77
|
+
* Access Policy Resource: `eRx:Medication`
|
|
78
|
+
*/
|
|
79
|
+
getMedication(
|
|
80
|
+
params?: ErxGetMedicationParams | OystehrClientRequest,
|
|
81
|
+
request?: OystehrClientRequest
|
|
82
|
+
): Promise<ErxGetMedicationResponse> {
|
|
83
|
+
return this.request('/medication/details', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
84
|
+
}
|
|
57
85
|
/**
|
|
58
86
|
* Get eRx configuration for project.
|
|
59
87
|
* Action: `eRx:GetConfiguration`
|
|
@@ -107,6 +135,14 @@ export class Erx extends SDKResource {
|
|
|
107
135
|
this.#baseUrlThunk.bind(this)
|
|
108
136
|
)(params, request);
|
|
109
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Adds pharmacy for a patient with the upstream eRx provider, setting it as primary if specified.
|
|
140
|
+
* Action: `eRx:AddPatientPharmacy`
|
|
141
|
+
* Access Policy Resource: `eRx:Patient`
|
|
142
|
+
*/
|
|
143
|
+
addPatientPharmacy(params: ErxAddPatientPharmacyParams, request?: OystehrClientRequest): Promise<void> {
|
|
144
|
+
return this.request('/patient/{patientId}/pharmacies', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
145
|
+
}
|
|
110
146
|
/**
|
|
111
147
|
* Cancel prescription for patient.
|
|
112
148
|
* Action: `eRx:CancelPrescription`
|
|
@@ -127,6 +163,32 @@ export class Erx extends SDKResource {
|
|
|
127
163
|
syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {
|
|
128
164
|
return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);
|
|
129
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Search for pharmacies by a variety of criteria.
|
|
168
|
+
* Action: `eRx:SearchPharmacy`
|
|
169
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
170
|
+
*/
|
|
171
|
+
searchPharmacies(
|
|
172
|
+
params: ErxSearchPharmaciesParams,
|
|
173
|
+
request?: OystehrClientRequest
|
|
174
|
+
): Promise<ErxSearchPharmaciesResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Search for pharmacies by a variety of criteria.
|
|
177
|
+
* Action: `eRx:SearchPharmacy`
|
|
178
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
179
|
+
*/
|
|
180
|
+
searchPharmacies(request?: OystehrClientRequest): Promise<ErxSearchPharmaciesResponse>;
|
|
181
|
+
/**
|
|
182
|
+
* Search for pharmacies by a variety of criteria.
|
|
183
|
+
* Action: `eRx:SearchPharmacy`
|
|
184
|
+
* Access Policy Resource: `eRx:Pharmacy`
|
|
185
|
+
*/
|
|
186
|
+
searchPharmacies(
|
|
187
|
+
params?: ErxSearchPharmaciesParams | OystehrClientRequest,
|
|
188
|
+
request?: OystehrClientRequest
|
|
189
|
+
): Promise<ErxSearchPharmaciesResponse> {
|
|
190
|
+
return this.request('/pharmacy', 'get', this.#baseUrlThunk.bind(this))(params, request);
|
|
191
|
+
}
|
|
130
192
|
/**
|
|
131
193
|
* Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.
|
|
132
194
|
* Action: `eRx:Connect`
|
|
@@ -147,10 +147,31 @@ export async function history<T extends FhirResource>(
|
|
|
147
147
|
): Promise<FhirFetcherResponse<T>>;
|
|
148
148
|
export async function history<T extends FhirResource>(
|
|
149
149
|
this: SDKResource,
|
|
150
|
-
{ resourceType, id,
|
|
150
|
+
{ resourceType, id, count, offset }: FhirHistorySearchParams<T>,
|
|
151
|
+
request?: OystehrClientRequest
|
|
152
|
+
): Promise<FhirFetcherResponse<Bundle<T>>>;
|
|
153
|
+
export async function history<T extends FhirResource>(
|
|
154
|
+
this: SDKResource,
|
|
155
|
+
{
|
|
156
|
+
resourceType,
|
|
157
|
+
id,
|
|
158
|
+
versionId,
|
|
159
|
+
count,
|
|
160
|
+
offset,
|
|
161
|
+
}: { resourceType: string; id: string; versionId?: string; count?: number; offset?: number },
|
|
151
162
|
request?: OystehrClientRequest
|
|
152
163
|
): Promise<FhirFetcherResponse<Bundle<T>> | FhirFetcherResponse<T>> {
|
|
153
|
-
|
|
164
|
+
if (versionId) {
|
|
165
|
+
return this.fhirRequest(`/${resourceType}/${id}/_history/${versionId}`, 'GET')({}, request);
|
|
166
|
+
}
|
|
167
|
+
if (count) {
|
|
168
|
+
return this.fhirRequest(
|
|
169
|
+
`/${resourceType}/${id}/_history?_total=accurate&_count=${count}
|
|
170
|
+
${offset ? `&_offset=${offset}` : ''}`,
|
|
171
|
+
'GET'
|
|
172
|
+
)({}, request);
|
|
173
|
+
}
|
|
174
|
+
return this.fhirRequest(`/${resourceType}/${id}/_history?_total=accurate`, 'GET')({}, request);
|
|
154
175
|
}
|
|
155
176
|
|
|
156
177
|
function batchInputRequestToBundleEntryItem<T extends FhirResource>(
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// AUTOGENERATED -- DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
export interface ErxAddPatientPharmacyParams {
|
|
4
|
+
/**
|
|
5
|
+
* ID of the pharmacy to add for the patient.
|
|
6
|
+
*/
|
|
7
|
+
pharmacyId: number;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to set the added pharmacy as the patient's primary pharmacy.
|
|
10
|
+
*/
|
|
11
|
+
setAsPrimary?: boolean;
|
|
12
|
+
patientId: string;
|
|
13
|
+
}
|