@awell-health/awell-extensions 2.0.136 → 2.0.138

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/dist/extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.d.ts +41 -0
  2. package/dist/extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.js +93 -0
  3. package/dist/extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.js.map +1 -0
  4. package/dist/extensions/elation/actions/findFutureAppointment/config/dataPoints.d.ts +14 -0
  5. package/dist/extensions/elation/actions/findFutureAppointment/config/dataPoints.js +18 -0
  6. package/dist/extensions/elation/actions/findFutureAppointment/config/dataPoints.js.map +1 -0
  7. package/dist/extensions/elation/actions/findFutureAppointment/config/fields.d.ts +28 -0
  8. package/dist/extensions/elation/actions/findFutureAppointment/config/fields.js +26 -0
  9. package/dist/extensions/elation/actions/findFutureAppointment/config/fields.js.map +1 -0
  10. package/dist/extensions/elation/actions/findFutureAppointment/config/index.d.ts +2 -0
  11. package/dist/extensions/elation/actions/findFutureAppointment/config/index.js +9 -0
  12. package/dist/extensions/elation/actions/findFutureAppointment/config/index.js.map +1 -0
  13. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.d.ts +4 -0
  14. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +126 -0
  15. package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -0
  16. package/dist/extensions/elation/actions/findFutureAppointment/index.d.ts +1 -0
  17. package/dist/extensions/elation/actions/findFutureAppointment/index.js +6 -0
  18. package/dist/extensions/elation/actions/findFutureAppointment/index.js.map +1 -0
  19. package/dist/extensions/elation/actions/index.d.ts +66 -0
  20. package/dist/extensions/elation/actions/index.js +2 -0
  21. package/dist/extensions/elation/actions/index.js.map +1 -1
  22. package/dist/extensions/medplum/actions/createCalculationObservation/createCalculationObservation.js +63 -42
  23. package/dist/extensions/medplum/actions/createCalculationObservation/createCalculationObservation.js.map +1 -1
  24. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/__testdata__/index.d.ts +1 -0
  25. package/dist/{src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse → extensions/medplum/actions/submitQuestionnaireResponse/__testdata__}/index.js +1 -1
  26. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/__testdata__/index.js.map +1 -0
  27. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/__testdata__/submitQuestionnaireResponse.mocks.d.ts +38 -0
  28. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/__testdata__/submitQuestionnaireResponse.mocks.js +62 -0
  29. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/__testdata__/submitQuestionnaireResponse.mocks.js.map +1 -0
  30. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/submitQuestionnaireResponse.js +29 -47
  31. package/dist/extensions/medplum/actions/submitQuestionnaireResponse/submitQuestionnaireResponse.js.map +1 -1
  32. package/dist/extensions/medplum/settings.d.ts +0 -20
  33. package/dist/extensions/medplum/settings.js +0 -16
  34. package/dist/extensions/medplum/settings.js.map +1 -1
  35. package/dist/src/lib/awell/getAllFormsInCurrentStep/getAllFormsInCurrentStep.js +4 -2
  36. package/dist/src/lib/awell/getAllFormsInCurrentStep/getAllFormsInCurrentStep.js.map +1 -1
  37. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/__testdata__/getLastCalculationActivityInCurrentStep.mock.d.ts +49 -0
  38. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/__testdata__/getLastCalculationActivityInCurrentStep.mock.js +61 -0
  39. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/__testdata__/getLastCalculationActivityInCurrentStep.mock.js.map +1 -0
  40. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/__testdata__/index.d.ts +1 -0
  41. package/dist/src/lib/{fhir/transformers → awell/getLastCalculationActivityInCurrentStep}/__testdata__/index.js +1 -2
  42. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/__testdata__/index.js.map +1 -0
  43. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/getLastCalculationActivityInCurrentStep.d.ts +8 -0
  44. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/getLastCalculationActivityInCurrentStep.js +58 -0
  45. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/getLastCalculationActivityInCurrentStep.js.map +1 -0
  46. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/index.d.ts +1 -0
  47. package/dist/src/lib/{fhir/transformers → awell/getLastCalculationActivityInCurrentStep}/index.js +1 -2
  48. package/dist/src/lib/awell/getLastCalculationActivityInCurrentStep/index.js.map +1 -0
  49. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formDefinitionResponse.d.ts +170 -8
  50. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formDefinitionResponse.js +1 -0
  51. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formDefinitionResponse.js.map +1 -1
  52. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formResponseResponse.d.ts +47 -4
  53. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formResponseResponse.js +1 -0
  54. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/formResponseResponse.js.map +1 -1
  55. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/pathwayActivitiesResponse.d.ts +33 -7
  56. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/pathwayActivitiesResponse.js +27 -44
  57. package/dist/src/lib/awell/getLatestFormInCurrentStep/__testdata__/pathwayActivitiesResponse.js.map +1 -1
  58. package/dist/src/lib/awell/getLatestFormInCurrentStep/getLatestFormInCurrentStep.js +28 -16
  59. package/dist/src/lib/awell/getLatestFormInCurrentStep/getLatestFormInCurrentStep.js.map +1 -1
  60. package/dist/src/lib/awell/index.d.ts +2 -0
  61. package/dist/src/lib/awell/index.js +2 -0
  62. package/dist/src/lib/awell/index.js.map +1 -1
  63. package/dist/src/lib/types/DeepPartial.d.ts +3 -0
  64. package/dist/src/lib/types/DeepPartial.js +3 -0
  65. package/dist/src/lib/types/DeepPartial.js.map +1 -0
  66. package/dist/src/lib/types/index.d.ts +1 -0
  67. package/dist/src/lib/{fhir/transformers/AwellFormToFhirQuestionnaire → types}/index.js +1 -1
  68. package/dist/src/lib/types/index.js.map +1 -0
  69. package/package.json +1 -1
  70. package/dist/src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse/AwellFormResponseToFhirQuestionnaireResponseItems.d.ts +0 -6
  71. package/dist/src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse/AwellFormResponseToFhirQuestionnaireResponseItems.js +0 -105
  72. package/dist/src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse/AwellFormResponseToFhirQuestionnaireResponseItems.js.map +0 -1
  73. package/dist/src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse/index.d.ts +0 -1
  74. package/dist/src/lib/fhir/transformers/AwellFormResponseToFhirQuestionnaireResponse/index.js.map +0 -1
  75. package/dist/src/lib/fhir/transformers/AwellFormToFhirQuestionnaire/AwellFormToFhirQuestionnaire.d.ts +0 -3
  76. package/dist/src/lib/fhir/transformers/AwellFormToFhirQuestionnaire/AwellFormToFhirQuestionnaire.js +0 -121
  77. package/dist/src/lib/fhir/transformers/AwellFormToFhirQuestionnaire/AwellFormToFhirQuestionnaire.js.map +0 -1
  78. package/dist/src/lib/fhir/transformers/AwellFormToFhirQuestionnaire/index.d.ts +0 -1
  79. package/dist/src/lib/fhir/transformers/AwellFormToFhirQuestionnaire/index.js.map +0 -1
  80. package/dist/src/lib/fhir/transformers/__testdata__/formDefinition.data.d.ts +0 -2
  81. package/dist/src/lib/fhir/transformers/__testdata__/formDefinition.data.js +0 -264
  82. package/dist/src/lib/fhir/transformers/__testdata__/formDefinition.data.js.map +0 -1
  83. package/dist/src/lib/fhir/transformers/__testdata__/formResponse.data.d.ts +0 -2
  84. package/dist/src/lib/fhir/transformers/__testdata__/formResponse.data.js +0 -68
  85. package/dist/src/lib/fhir/transformers/__testdata__/formResponse.data.js.map +0 -1
  86. package/dist/src/lib/fhir/transformers/__testdata__/index.d.ts +0 -2
  87. package/dist/src/lib/fhir/transformers/__testdata__/index.js.map +0 -1
  88. package/dist/src/lib/fhir/transformers/index.d.ts +0 -2
  89. package/dist/src/lib/fhir/transformers/index.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ export declare const appointmentsMock: {
2
+ id: number;
3
+ scheduled_date: string;
4
+ duration: number;
5
+ billing_details: null;
6
+ payment: null;
7
+ time_slot_type: string;
8
+ time_slot_status: null;
9
+ reason: string;
10
+ mode: string;
11
+ description: string;
12
+ status: {
13
+ status: string;
14
+ room: null;
15
+ status_date: string;
16
+ status_detail: null;
17
+ };
18
+ patient: number;
19
+ patient_forms: {
20
+ patient_can_receive_forms: boolean;
21
+ anonymous_url: string;
22
+ overrides: never[];
23
+ short_code: null;
24
+ statuses: {
25
+ id: number;
26
+ name: string;
27
+ status: string;
28
+ }[];
29
+ hours_prior: number;
30
+ };
31
+ physician: number;
32
+ practice: number;
33
+ instructions: string;
34
+ recurring_event_schedule: null;
35
+ metadata: null;
36
+ created_date: string;
37
+ last_modified_date: string;
38
+ deleted_date: null;
39
+ service_location: null;
40
+ telehealth_details: string;
41
+ }[];
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appointmentsMock = void 0;
4
+ const date_fns_1 = require("date-fns");
5
+ exports.appointmentsMock = [
6
+ {
7
+ id: 123,
8
+ scheduled_date: (0, date_fns_1.addDays)(new Date(), 1).toISOString(),
9
+ duration: 60,
10
+ billing_details: null,
11
+ payment: null,
12
+ time_slot_type: 'appointment',
13
+ time_slot_status: null,
14
+ reason: 'PCP: Est. Patient Office',
15
+ mode: 'VIDEO',
16
+ description: '',
17
+ status: {
18
+ status: 'Scheduled',
19
+ room: null,
20
+ status_date: '2023-07-12T20:44:22Z',
21
+ status_detail: null,
22
+ },
23
+ patient: 12345,
24
+ patient_forms: {
25
+ patient_can_receive_forms: true,
26
+ anonymous_url: 'https://sandbox.elationemr.com/appointments/141701667029082/patient-forms/?key=642301d3930ac1e4d052ff65c093c5f1da1697e6b861a18f43a042b5afca50a1',
27
+ overrides: [],
28
+ short_code: null,
29
+ statuses: [
30
+ {
31
+ id: 316,
32
+ name: 'COVID-19 Screening Form',
33
+ status: 'incomplete',
34
+ },
35
+ ],
36
+ hours_prior: 0,
37
+ },
38
+ physician: 141114870071298,
39
+ practice: 141114865745924,
40
+ instructions: '',
41
+ recurring_event_schedule: null,
42
+ metadata: null,
43
+ created_date: '2023-07-12T20:44:22Z',
44
+ last_modified_date: '2023-07-12T20:44:22Z',
45
+ deleted_date: null,
46
+ service_location: null,
47
+ telehealth_details: '',
48
+ },
49
+ {
50
+ id: 456,
51
+ scheduled_date: (0, date_fns_1.addDays)(new Date(), 2).toISOString(),
52
+ duration: 60,
53
+ billing_details: null,
54
+ payment: null,
55
+ time_slot_type: 'appointment',
56
+ time_slot_status: null,
57
+ reason: 'PCP: Est. Patient Office',
58
+ mode: 'VIDEO',
59
+ description: '',
60
+ status: {
61
+ status: 'Scheduled',
62
+ room: null,
63
+ status_date: '2023-07-12T20:44:22Z',
64
+ status_detail: null,
65
+ },
66
+ patient: 12345,
67
+ patient_forms: {
68
+ patient_can_receive_forms: true,
69
+ anonymous_url: 'https://sandbox.elationemr.com/appointments/141701667029082/patient-forms/?key=642301d3930ac1e4d052ff65c093c5f1da1697e6b861a18f43a042b5afca50a1',
70
+ overrides: [],
71
+ short_code: null,
72
+ statuses: [
73
+ {
74
+ id: 316,
75
+ name: 'COVID-19 Screening Form',
76
+ status: 'incomplete',
77
+ },
78
+ ],
79
+ hours_prior: 0,
80
+ },
81
+ physician: 141114870071298,
82
+ practice: 141114865745924,
83
+ instructions: '',
84
+ recurring_event_schedule: null,
85
+ metadata: null,
86
+ created_date: '2023-07-12T20:44:22Z',
87
+ last_modified_date: '2023-07-12T20:44:22Z',
88
+ deleted_date: null,
89
+ service_location: null,
90
+ telehealth_details: '',
91
+ },
92
+ ];
93
+ //# sourceMappingURL=GetAppointments.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetAppointments.mock.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findFutureAppointment/__testdata__/GetAppointments.mock.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;IACD;QACE,EAAE,EAAE,GAAG;QACP,cAAc,EAAE,IAAA,kBAAO,EAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;QACpD,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,0BAA0B;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,EAAE;QACf,MAAM,EAAE;YACN,MAAM,EAAE,WAAW;YACnB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,sBAAsB;YACnC,aAAa,EAAE,IAAI;SACpB;QACD,OAAO,EAAE,KAAK;QACd,aAAa,EAAE;YACb,yBAAyB,EAAE,IAAI;YAC/B,aAAa,EACX,iJAAiJ;YACnJ,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE,YAAY;iBACrB;aACF;YACD,WAAW,EAAE,CAAC;SACf;QACD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,EAAE;QAChB,wBAAwB,EAAE,IAAI;QAC9B,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,sBAAsB;QACpC,kBAAkB,EAAE,sBAAsB;QAC1C,YAAY,EAAE,IAAI;QAClB,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,EAAE;KACvB;CACF,CAAA"}
@@ -0,0 +1,14 @@
1
+ export declare const dataPoints: {
2
+ appointment: {
3
+ key: string;
4
+ valueType: "json";
5
+ };
6
+ appointmentExists: {
7
+ key: string;
8
+ valueType: "boolean";
9
+ };
10
+ explanation: {
11
+ key: string;
12
+ valueType: "string";
13
+ };
14
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataPoints = void 0;
4
+ exports.dataPoints = {
5
+ appointment: {
6
+ key: 'appointment',
7
+ valueType: 'json',
8
+ },
9
+ appointmentExists: {
10
+ key: 'appointmentExists',
11
+ valueType: 'boolean',
12
+ },
13
+ explanation: {
14
+ key: 'explanation',
15
+ valueType: 'string',
16
+ },
17
+ };
18
+ //# sourceMappingURL=dataPoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findFutureAppointment/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,MAAM;KAClB;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,SAAS;KACrB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { FieldType } from '@awell-health/extensions-core';
3
+ export declare const fields: {
4
+ patientId: {
5
+ id: string;
6
+ label: string;
7
+ type: FieldType.NUMERIC;
8
+ required: true;
9
+ description: string;
10
+ };
11
+ prompt: {
12
+ id: string;
13
+ label: string;
14
+ type: FieldType.TEXT;
15
+ required: true;
16
+ description: string;
17
+ };
18
+ };
19
+ export declare const FieldsValidationSchema: z.ZodObject<{
20
+ patientId: z.ZodNumber;
21
+ prompt: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ patientId: number;
24
+ prompt: string;
25
+ }, {
26
+ patientId: number;
27
+ prompt: string;
28
+ }>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
4
+ const zod_1 = require("zod");
5
+ const extensions_core_1 = require("@awell-health/extensions-core");
6
+ exports.fields = {
7
+ patientId: {
8
+ id: 'patientId',
9
+ label: 'Elation patient ID',
10
+ type: extensions_core_1.FieldType.NUMERIC,
11
+ required: true,
12
+ description: '',
13
+ },
14
+ prompt: {
15
+ id: 'prompt',
16
+ label: 'Describe what appointment you would like to find',
17
+ type: extensions_core_1.FieldType.TEXT,
18
+ required: true,
19
+ description: '',
20
+ },
21
+ };
22
+ exports.FieldsValidationSchema = zod_1.z.object({
23
+ patientId: extensions_core_1.NumericIdSchema,
24
+ prompt: zod_1.z.string().min(1),
25
+ });
26
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findFutureAppointment/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AAEzB,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,kDAAkD;QACzD,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,iCAAe;IAC1B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACwB,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { dataPoints } from './dataPoints';
2
+ export { fields, FieldsValidationSchema } from './fields';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsValidationSchema = exports.fields = exports.dataPoints = void 0;
4
+ var dataPoints_1 = require("./dataPoints");
5
+ Object.defineProperty(exports, "dataPoints", { enumerable: true, get: function () { return dataPoints_1.dataPoints; } });
6
+ var fields_1 = require("./fields");
7
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
8
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/findFutureAppointment/config/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../../settings';
3
+ import { fields, dataPoints } from './config';
4
+ export declare const findFutureAppointment: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findFutureAppointment = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const client_1 = require("../../client");
6
+ const config_1 = require("./config");
7
+ const output_parsers_1 = require("@langchain/core/output_parsers");
8
+ const zod_1 = require("zod");
9
+ const openai_1 = require("@langchain/openai");
10
+ const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
11
+ const lodash_1 = require("lodash");
12
+ exports.findFutureAppointment = {
13
+ key: 'findFutureAppointment',
14
+ category: extensions_core_1.Category.EHR_INTEGRATIONS,
15
+ title: '🪄 Find future appointment',
16
+ description: 'Find a future appointment in Elation.',
17
+ fields: config_1.fields,
18
+ previewable: false,
19
+ dataPoints: config_1.dataPoints,
20
+ onEvent: async ({ payload, onComplete, onError }) => {
21
+ const { prompt, patientId } = config_1.FieldsValidationSchema.parse(payload.fields);
22
+ const api = (0, client_1.makeAPIClient)(payload.settings);
23
+ const openAiApiKey = payload.settings.openAiApiKey;
24
+ if (openAiApiKey === undefined || openAiApiKey === '') {
25
+ await onError({
26
+ events: [
27
+ {
28
+ date: new Date().toISOString(),
29
+ text: { en: 'OpenAI API key is required for this action.' },
30
+ error: {
31
+ category: 'SERVER_ERROR',
32
+ message: 'OpenAI API key is required for this action.',
33
+ },
34
+ },
35
+ ],
36
+ });
37
+ return;
38
+ }
39
+ const appointments = await api.findAppointments({
40
+ patient: patientId,
41
+ from_date: new Date().toISOString(),
42
+ });
43
+ const scheduledOrConfirmedAppointments = appointments.filter((appointment) => appointment.status.status === 'Scheduled' ||
44
+ appointment.status.status === 'Confirmed');
45
+ if (scheduledOrConfirmedAppointments.length === 0) {
46
+ await onComplete({
47
+ data_points: {
48
+ appointmentExists: 'false',
49
+ },
50
+ });
51
+ return;
52
+ }
53
+ const promptAppointments = scheduledOrConfirmedAppointments
54
+ .map((appointment) => {
55
+ const relevantInfo = {
56
+ id: appointment.id,
57
+ reason: appointment.reason,
58
+ duration: appointment.duration,
59
+ scheduled_date: appointment.scheduled_date,
60
+ };
61
+ return JSON.stringify(relevantInfo);
62
+ })
63
+ .join('\n\n');
64
+ const ChatModelGPT4o = new openai_1.ChatOpenAI({
65
+ modelName: 'gpt-4o-2024-08-06',
66
+ openAIApiKey: openAiApiKey,
67
+ temperature: 0,
68
+ maxRetries: 3,
69
+ timeout: 10000,
70
+ });
71
+ const systemPrompt = `You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists. If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome. If multiple appointments exist that match the instructions, you should return the first one. In any case, there can only be one appointment returned.
72
+
73
+ Important instructions:
74
+ - The appointment "reason" is the appointment type.
75
+ - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
76
+ - Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
77
+
78
+ ----------
79
+ Input array:
80
+ ${promptAppointments}
81
+ ----------
82
+ Instruction:
83
+ ${prompt}
84
+ ----------
85
+
86
+ Output a JSON object with two keys:
87
+ 1. appointmentId: The id of the appointment that matches the instructions, if one exists. If no appointment exists that obviously matches, you should return null.
88
+ 2. explanation: A readable explanation of how the appointment was found and why. Or, if no appointment exists that matches the instructions, an explanation of why.`;
89
+ const AppointmentIdSchema = zod_1.z.coerce
90
+ .number()
91
+ .nullable()
92
+ .describe('A single appointment');
93
+ const parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
94
+ appointmentId: AppointmentIdSchema,
95
+ explanation: zod_1.z
96
+ .string()
97
+ .describe('A readable explanation of how the appointment was found and why'),
98
+ }));
99
+ let result;
100
+ try {
101
+ const chain = ChatModelGPT4o.pipe(parser);
102
+ result = await chain.invoke(systemPrompt);
103
+ }
104
+ catch (invokeError) {
105
+ console.error('Error invoking ChatModelGPT4o for findFutureAppointment:', invokeError);
106
+ throw new Error('Failed to find future appointment.');
107
+ }
108
+ const matchedAppointmentId = AppointmentIdSchema.parse(result.appointmentId);
109
+ const foundAppointment = scheduledOrConfirmedAppointments.find((appointment) => appointment.id === Number(matchedAppointmentId));
110
+ await onComplete({
111
+ data_points: {
112
+ appointment: !(0, lodash_1.isNil)(matchedAppointmentId)
113
+ ? JSON.stringify(foundAppointment)
114
+ : undefined,
115
+ explanation: result.explanation,
116
+ appointmentExists: !(0, lodash_1.isNil)(matchedAppointmentId) ? 'true' : 'false',
117
+ },
118
+ events: [
119
+ (0, addEventLog_1.addActivityEventLog)({
120
+ message: `Number of future scheduled or confirmed appointments for patient ${patientId}: ${scheduledOrConfirmedAppointments.length}\nFound appointment: ${(0, lodash_1.isNil)(foundAppointment) ? 'none' : foundAppointment === null || foundAppointment === void 0 ? void 0 : foundAppointment.id}\nExplanation: ${result.explanation}`,
121
+ }),
122
+ ],
123
+ });
124
+ },
125
+ };
126
+ //# sourceMappingURL=findFutureAppointment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findFutureAppointment.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/findFutureAppointment.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,yCAA4C;AAC5C,qCAAqE;AACrE,mEAAuE;AACvE,6BAAuB;AACvB,8CAA8C;AAC9C,uEAA2E;AAC3E,mCAA8B;AAEjB,QAAA,qBAAqB,GAI9B;IACF,GAAG,EAAE,uBAAuB;IAC5B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAiB,EAAE;QACjE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC1E,MAAM,GAAG,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAE3C,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAA;QAElD,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,EAAE,EAAE,CAAC;YACtD,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,6CAA6C,EAAE;wBAC3D,KAAK,EAAE;4BACL,QAAQ,EAAE,cAAc;4BACxB,OAAO,EAAE,6CAA6C;yBACvD;qBACF;iBACF;aACF,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,gBAAgB,CAAC;YAC9C,OAAO,EAA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CAAC,CAAC,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,EAAE,kBAAkB,MAAM,CAAC,WAAW,EAAE;iBACxP,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export { findFutureAppointment } from './findFutureAppointment';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findFutureAppointment = void 0;
4
+ var findFutureAppointment_1 = require("./findFutureAppointment");
5
+ Object.defineProperty(exports, "findFutureAppointment", { enumerable: true, get: function () { return findFutureAppointment_1.findFutureAppointment; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/elation/actions/findFutureAppointment/index.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA"}
@@ -2551,4 +2551,70 @@ export declare const actions: {
2551
2551
  description: string;
2552
2552
  };
2553
2553
  }, "patientId" | "practice" | "letterId" | "consultantName" | "diagnosisCodes" | "diagnosisLabels">;
2554
+ findFutureAppointment: import("@awell-health/extensions-core").Action<{
2555
+ patientId: {
2556
+ id: string;
2557
+ label: string;
2558
+ type: import("@awell-health/extensions-core").FieldType.NUMERIC;
2559
+ required: true;
2560
+ description: string;
2561
+ };
2562
+ prompt: {
2563
+ id: string;
2564
+ label: string;
2565
+ type: import("@awell-health/extensions-core").FieldType.TEXT;
2566
+ required: true;
2567
+ description: string;
2568
+ };
2569
+ }, {
2570
+ base_url: {
2571
+ key: string;
2572
+ label: string;
2573
+ obfuscated: false;
2574
+ description: string;
2575
+ required: true;
2576
+ };
2577
+ auth_url: {
2578
+ key: string;
2579
+ label: string;
2580
+ obfuscated: false;
2581
+ description: string;
2582
+ required: true;
2583
+ };
2584
+ client_id: {
2585
+ key: string;
2586
+ label: string;
2587
+ obfuscated: false;
2588
+ description: string;
2589
+ required: true;
2590
+ };
2591
+ client_secret: {
2592
+ key: string;
2593
+ label: string;
2594
+ obfuscated: true;
2595
+ description: string;
2596
+ required: true;
2597
+ };
2598
+ username: {
2599
+ key: string;
2600
+ label: string;
2601
+ obfuscated: false;
2602
+ description: string;
2603
+ required: false;
2604
+ };
2605
+ password: {
2606
+ key: string;
2607
+ label: string;
2608
+ obfuscated: true;
2609
+ description: string;
2610
+ required: false;
2611
+ };
2612
+ openAiApiKey: {
2613
+ key: string;
2614
+ label: string;
2615
+ obfuscated: true;
2616
+ required: false;
2617
+ description: string;
2618
+ };
2619
+ }, "appointment" | "explanation" | "appointmentExists">;
2554
2620
  };
@@ -27,6 +27,7 @@ const createCareGap_1 = require("./createCareGap");
27
27
  const closeCareGap_1 = require("./closeCareGap");
28
28
  const updatePatientTags_1 = require("./updatePatientTags");
29
29
  const getReferralOrder_1 = require("./getReferralOrder");
30
+ const findFutureAppointment_1 = require("./findFutureAppointment");
30
31
  exports.actions = {
31
32
  getPatient: getPatient_1.getPatient,
32
33
  createPatient: createPatient_1.createPatient,
@@ -54,5 +55,6 @@ exports.actions = {
54
55
  closeCareGap: closeCareGap_1.closeCareGap,
55
56
  updatePatientTags: updatePatientTags_1.updatePatientTags,
56
57
  getReferralOrder: getReferralOrder_1.getReferralOrder,
58
+ findFutureAppointment: findFutureAppointment_1.findFutureAppointment,
57
59
  };
58
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,+CAA2C;AAC3C,yDAAqD;AACrD,mDAA+C;AAC/C,6DAAyD;AACzD,6DAAyD;AACzD,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;AAC7C,6CAAyC;AACzC,qDAAiD;AACjD,+DAA2D;AAC3D,wDAAoD;AACpD,wDAAoD;AACpD,uEAAmE;AACnE,qDAAiD;AACjD,2CAAuC;AACvC,+DAA2D;AAC3D,mDAA+C;AAC/C,iDAA6C;AAC7C,2DAAuD;AACvD,yDAAqD;AAExC,QAAA,OAAO,GAAG;IACrB,UAAU,EAAV,uBAAU;IACV,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,cAAc,EAAd,+BAAc;IACd,gBAAgB,EAAhB,mCAAgB;IAChB,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,2BAAY;IACZ,aAAa,EAAb,6BAAa;IACb,kBAAkB,EAAlB,uCAAkB;IAClB,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,SAAS,EAAT,qBAAS;IACT,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,mBAAmB,EAAnB,yCAAmB;IACnB,SAAS,EAAT,qBAAS;IACT,mBAAmB,EAAnB,yCAAmB;IACnB,aAAa,EAAb,6BAAa;IACb,YAAY,EAAZ,2BAAY;IACZ,iBAAiB,EAAjB,qCAAiB;IACjB,gBAAgB,EAAhB,mCAAgB;CACjB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/elation/actions/index.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,mDAA+C;AAC/C,mDAA+C;AAC/C,2DAAuD;AACvD,qDAAiD;AACjD,+CAA2C;AAC3C,yDAAqD;AACrD,mDAA+C;AAC/C,6DAAyD;AACzD,6DAAyD;AACzD,uDAAmD;AACnD,6DAAyD;AACzD,iDAA6C;AAC7C,6CAAyC;AACzC,qDAAiD;AACjD,+DAA2D;AAC3D,wDAAoD;AACpD,wDAAoD;AACpD,uEAAmE;AACnE,qDAAiD;AACjD,2CAAuC;AACvC,+DAA2D;AAC3D,mDAA+C;AAC/C,iDAA6C;AAC7C,2DAAuD;AACvD,yDAAqD;AACrD,mEAA+D;AAElD,QAAA,OAAO,GAAG;IACrB,UAAU,EAAV,uBAAU;IACV,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,iBAAiB,EAAjB,qCAAiB;IACjB,cAAc,EAAd,+BAAc;IACd,gBAAgB,EAAhB,mCAAgB;IAChB,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,2BAAY;IACZ,aAAa,EAAb,6BAAa;IACb,kBAAkB,EAAlB,uCAAkB;IAClB,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,kBAAkB,EAAlB,uCAAkB;IAClB,eAAe,EAAf,iCAAe;IACf,SAAS,EAAT,qBAAS;IACT,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,UAAU,EAAV,uBAAU;IACV,cAAc,EAAd,+BAAc;IACd,mBAAmB,EAAnB,yCAAmB;IACnB,SAAS,EAAT,qBAAS;IACT,mBAAmB,EAAnB,yCAAmB;IACnB,aAAa,EAAb,6BAAa;IACb,YAAY,EAAZ,2BAAY;IACZ,iBAAiB,EAAjB,qCAAiB;IACjB,gBAAgB,EAAhB,mCAAgB;IAChB,qBAAqB,EAArB,6CAAqB;CACtB,CAAA"}