fluent-cerner-js 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 geekmdtravis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # fluent-cerner-js
2
+
3
+ A fluent `MPAGE_EVENT` string generation library.
4
+
5
+ | Environment | CI | Publish |
6
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
7
+ | Production | ![Main Build](https://github.com/geekmdtravis/fluent-cerner-js/actions/workflows/main.yml/badge.svg?branch=main) | ![Main Publish](https://github.com/geekmdtravis/fluent-cerner-js/actions/workflows/publish.yml/badge.svg?branch=main) |
8
+ | Development | ![Development Build](https://github.com/geekmdtravis/fluent-cerner-js/actions/workflows/main.yml/badge.svg?branch=development) | Not Applicable |
9
+
10
+ ## Resources
11
+
12
+ - [MPage Developer Guide - MPAGE_EVENT Orders](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT-ORDERS)
13
+
14
+ ### Anatomy of an `MPAGE_EVENT` String
15
+
16
+ An `MPAGE_EVENT` string takes the form:
17
+
18
+ ```
19
+ personId|encounterId|orderList|customizeFlags|tabList|defaultDisplay|silentSignFlag
20
+ ```
21
+
22
+ Where `orderList` is a series of braces-contained, pipe-delimited strings that takes the form:
23
+
24
+ ```
25
+ {orderAction|orderId|synonymId|orderOrigination|orderSentenceId|nomenclatureId|signTimeInteractionFlag}
26
+ ```
27
+
28
+ Where `tabList` is a single brace-contained, pip-delimited string that takes the form:
29
+
30
+ ```
31
+ {tab|tabDisplayFlags}
32
+ ```
33
+
34
+ ### Definitions
35
+
36
+ - `personId`: The `person_id` of the patient whose Modal Order Entry Window (MOEW) is to be displayed.
37
+ - `encounterId`: The `encntr_id` of the patient whose MOEW is to be displayed.
38
+ - `orderList`: The list of order actions and properties that define the data that is to be loaded into the MOEW.
39
+ - A set that must be enclosed by curly brackets `{` and `}`.
40
+ - If you want only to launch into the MOEW and not to add any new orders or perform any other order actions, an empty orderAction / orderProperties set of `{ORDER|0|0|0|0|0}` can be used.
41
+ - `orderAction`: The type of action to be performed on an order.
42
+ - Must follow the `{"ORDER"|synonymId|orderOrigination|orderSentenceId|nomenclatureId|signTimeInteractionFlag}` signature.
43
+ - `"ORDER"` The prototype for placing a new order.
44
+ - Must follow the `{<ORDER_ACTION_TYPE>|orderId}` signature.
45
+ - `"ACTIVATE"` - The prototype for activating an existing future order.
46
+ - `"CANCEL DC"` The prototype for canceling / discontinuing an existing order.
47
+ - `"CANCEL REORD"` The prototype for canceling and reordering an existing order.
48
+ - `"CLEAR"` The prototype for clearing the future actions of an existing order.
49
+ - `"CONVERT_INPAT"` The prototype for converting a historical or prescription order into an inpatient order.
50
+ - `"CONVERT_RX"` The prototype for converting an existing non-prescription order to a prescription order.
51
+ - `"MODIFY"` The prototype for modifying an existing order.
52
+ - `"RENEW"` The prototype for renewing an existing non-prescription order.
53
+ - `"RENEW_RX"` The prototype for renewing an existing prescription order.
54
+ - `"REPEAT"` The prototype for copying an existing order.
55
+ - `"RESUME"` The prototype for resuming an existing suspended order.
56
+ - `"SUSPEND"` The prototype for suspending an existing order.
57
+ - Child Paramters:
58
+ - `orderId`: The `order_id` associated with an existing order.
59
+ - `synonymId`: The `synonym_id` to be associated with the new order.
60
+ - `orderOrigination`: The type of order to be associated with the new order. A value of represents a normal order.
61
+ - `1`: Prescription order.
62
+ - `5`: satellite order
63
+ - `orderSenteceId`: The optional `order_sentence_id` to be associated with the new order.
64
+ - `nomenclatureId`: The optional `nomenclature_id` to be associated with the new order.
65
+ - `signTimeInterationFlag`: A Boolean flag to determine if interaction checking should only be performed at sign-time or not.
66
+ - `customizeFlags`: A set of flags that can be used to define the style of the MOEW.
67
+ - `0`: default, no PowerPlans.
68
+ - `24`: enable PowerPlans.
69
+ - `tabList`: The customization data for the different tab(s) of the MOEW.
70
+ - A set that must be enclosed by the `{` and `}` braces.
71
+ - Parameters within the sets are pipe-delimited.
72
+ - Child Parameters
73
+ - `tab`: The tab that is to be modified.
74
+ - `2`: customizations to the Order List profile.
75
+ - `3`: customizations to the Medication List profile.
76
+ - `tabDisplayFlags`: A set of flags that can be used to define the style of the tab being altered by 'tab'.
77
+ - `127` For full PowerOrders functionality.
78
+ - `defaultDisplay`: The view to display by default when launching into the MOEW.
79
+ - `8`: default to the order search.
80
+ - `16`: default to the order profile.
81
+ - `32`: default to the orders for signature.
82
+ - `silentSignFlag` (optional): A Boolean flag used to determine if the MOEW should sign orders silently. When this flag is set, and the required details on each new order are pre-populated, it causes the orders to be signed automatically without displaying the MOEW. Orders are signed automatically when existing orders are not already on the scratchpad and no other orderActions are present.
83
+
84
+ ### Example
85
+
86
+ One would read the following:
87
+
88
+ ```
89
+ 6204|3623|{REPEAT|123456}{REPEAT|654321}{REPEAT|987654}|24|{2|127}|16
90
+ ```
91
+
92
+ As:
93
+
94
+ - For patient `6204`,
95
+ - In encounter `3623`,
96
+ - We will copy the following list orders by their `orderId`:
97
+ - 123456
98
+ - 654321
99
+ - 987654
100
+ - With **PowerPlans** enabled,
101
+ - Customizing the **Order List Profile** with **PowerOrder** functionality
102
+ - Defaulting to the **Order Profile** view.
103
+
104
+ ## API In Action [Under Construction]
105
+
106
+ Add order's one at a time (or via a loop):
107
+
108
+ ```js
109
+ const fcjs = require('fluent-cerner-js');
110
+ const MPageOrder = fcjs.MPageOrder;
111
+ const MPageOrderEvent = fcjs.MPageOrderEvent;
112
+
113
+ // Make a new order from an existing order which serves as a template for copy.
114
+ const order1 = new MPageOrder();
115
+ order1.willCopyExistingOrder(12345);
116
+
117
+ // Make a new order from scratch, declare that it's a prescription order.
118
+ const order2 = new MPageOrder();
119
+ order2.willMakeNewOrder(1343, { isRxOrder: true });
120
+
121
+ // Make a new order from scratch, declare that it's a non-prescription order,
122
+ // reference an order sentence id and a nomenclature id in addition to requesting
123
+ // skip interaction checks until sign.
124
+ const opts = {
125
+ orderSentenceId: 3,
126
+ nomenclatureId: 14,
127
+ skipInteractionCheckUntilSign: true,
128
+ };
129
+ const order3 = new MPageOrder();
130
+ order3.willMakeNewOrder(3428, opts);
131
+
132
+ // Prepare the MPage event for person 1231251 on encounter 812388.
133
+ const event = new MPageOrderEvent();
134
+ event
135
+ .forPerson(1231251)
136
+ .forEncounter(812388)
137
+ .addOrders([order1, order2, order3])
138
+ .enablePowerPlans()
139
+ .customizeOrderListProfile()
140
+ .enablePowerOrders()
141
+ .launchOrderProfile();
142
+
143
+ // Send the MPage event to the server.
144
+ event.send();
145
+ ```
146
+
147
+ You can also invoke the "toString()" override method to confirm your order string is correct.
148
+
149
+ ```js
150
+ console.log(`MPage Event String:\n${mpageEvent}\n`);
151
+ ```
152
+
153
+ Result:
154
+
155
+ ```sh
156
+ 1231251|812388|{REPEAT|12345}{ORDER|1343|1|0|0|0}{ORDER|3428|0|3|14|1}|24|{2|127}|16|0
157
+ ```
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Options for a new order
3
+ * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from
4
+ * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.
5
+ * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually
6
+ * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.
7
+ * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with
8
+ * the new order. Field will be set to 0 if undefined.
9
+ * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the
10
+ * new order. Field will be set to 0 if undefined.
11
+ * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction
12
+ * checking. A value of true skips checking for interactions until orders are signed, false
13
+ * will not. Field will be set to false if left undefined; this resolves to 0 when built.
14
+ */
15
+ export declare type NewOrderOpts = {
16
+ isRxOrder?: boolean;
17
+ isSatelliteOrder?: boolean;
18
+ orderSentenceId?: number;
19
+ nomenclatureId?: number;
20
+ skipInteractionCheckUntilSign?: boolean;
21
+ };
22
+ export declare class MPageOrder {
23
+ private _orderAction;
24
+ getOrderAction: () => string;
25
+ private _orderId;
26
+ getOrderId: () => number;
27
+ private _synonymId;
28
+ getSynonymId: () => number;
29
+ private _orderOrigination;
30
+ getOrderOrigination: () => number;
31
+ private _orderSentenceId;
32
+ getOrderSentenceId: () => number;
33
+ private _nomenclatureId;
34
+ getNomenclatureId: () => number;
35
+ private _signTimeInteraction;
36
+ getSignTimeInteraction: () => number;
37
+ /**
38
+ * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.
39
+ *
40
+ * @since 0.1.0
41
+ * @category MPage Events - Orders
42
+ * @param {number} orderId The order id value for the order to activate.
43
+ * @returns {this} Returns itself to continue chaining method calls.
44
+ */
45
+ willActivate(orderId: number): this;
46
+ /**
47
+ * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.
48
+ *
49
+ * @since 0.1.0
50
+ * @param {number} orderId The order id value for the order to activate.
51
+ * @returns {this} Returns itself to continue chaining method calls.
52
+ */
53
+ willCancelDiscontinue(orderId: number): this;
54
+ /**
55
+ * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.
56
+ *
57
+ * @since 0.1.0
58
+ * @param {number} orderId The order id value for the order to activate.
59
+ * @returns {this} Returns itself to continue chaining method calls.
60
+ */
61
+ willCancelReorder(orderId: number): this;
62
+ /**
63
+ * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.
64
+ *
65
+ * @since 0.1.0
66
+ * @param {number} orderId The order id value for the order to activate.
67
+ * @returns {this} Returns itself to continue chaining method calls.
68
+ */
69
+ willClear(orderId: number): this;
70
+ /**
71
+ * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.
72
+ *
73
+ * @since 0.1.0
74
+ * @param {number} orderId The order id value for the order to activate.
75
+ * @returns {this} Returns itself to continue chaining method calls.
76
+ */
77
+ willConvertInpatient(orderId: number): this;
78
+ /**
79
+ * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.
80
+ *
81
+ * @since 0.1.0
82
+ * @param {number} orderId The order id value for the order to activate.
83
+ * @returns {this} Returns itself to continue chaining method calls.
84
+ */
85
+ willConvertToPrescriptionOrder(orderId: number): this;
86
+ /**
87
+ * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.
88
+ *
89
+ * @since 0.1.0
90
+ * @param {number} orderId The order id value for the order to activate.
91
+ * @returns {this} Returns itself to continue chaining method calls.
92
+ */
93
+ willModify(orderId: number): this;
94
+ /**
95
+ * Creates a new MPage Order with order action 'ORDER'.
96
+ *
97
+ * @since 0.1.0
98
+ * @category MPage Events - Orders
99
+ * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.
100
+ * @param {NewOrderOpts} options required when making a new order
101
+ * @returns {this} Returns itself to continue chaining method calls.
102
+ * default to a normal order type.
103
+ * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting
104
+ * both creates underfined behavior with respect the order origination field.
105
+ * @example
106
+ * m.willMakeNewOrder(34, true, 13, 42, true).toString() => "{'ORDER'|34|5|1342|1}"
107
+ */
108
+ willMakeNewOrder(synonymId: number, opts?: NewOrderOpts): this;
109
+ /**
110
+ * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.
111
+ *
112
+ * @since 0.1.0
113
+ * @param {number} orderId The order id value for the order to activate.
114
+ * @returns {this} Returns itself to continue chaining method calls.
115
+ */
116
+ willRenewNonPrescription(orderId: number): this;
117
+ /**
118
+ * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.
119
+ *
120
+ * @since 0.1.0
121
+ * @param {number} orderId The order id value for the order to activate.
122
+ * @returns {this} Returns itself to continue chaining method calls.
123
+ */
124
+ willRenewPrescription(orderId: number): this;
125
+ /**
126
+ * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.
127
+ *
128
+ * @since 0.1.0
129
+ * @param {number} orderId The order id value for the order to activate.
130
+ * @returns {this} Returns itself to continue chaining method calls.
131
+ */
132
+ willCopyExistingOrder(orderId: number): this;
133
+ /**
134
+ * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.
135
+ *
136
+ * @since 0.1.0
137
+ * @param {number} orderId The order id value for the order to activate.
138
+ * @returns {this} Returns itself to continue chaining method calls.
139
+ */
140
+ willResumeSuspendedOrder(orderId: number): this;
141
+ /**
142
+ * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.
143
+ *
144
+ * @since 0.1.0
145
+ * @param {number} orderId The order id value for the order to activate.
146
+ * @returns {this} Returns itself to continue chaining method calls.
147
+ */
148
+ willSuspend(orderId: number): this;
149
+ /**
150
+ * Overrides the toString() method for representing the objects internal state as a string.
151
+ *
152
+ * @since 0.1.0
153
+ * @returns {string} string representation of MPageOrder's internal state
154
+ */
155
+ toString(): string;
156
+ }
@@ -0,0 +1,35 @@
1
+ import { MPageOrder } from '.';
2
+ declare class MPageOrderEvent {
3
+ private _orders;
4
+ getOrders: () => MPageOrder[];
5
+ private _tabList;
6
+ getTabList: () => {
7
+ tab: number;
8
+ tabDisplayFlag: number;
9
+ };
10
+ private _personId;
11
+ getPersonId: () => number;
12
+ private _encounterId;
13
+ getEncounterId: () => number;
14
+ private _powerPlanFlag;
15
+ getPowerPlanFlag: () => number;
16
+ private _defaultDisplay;
17
+ getDefaultDisplay: () => number;
18
+ private _silentSignFlag;
19
+ getSilentSignFlag: () => number;
20
+ constructor();
21
+ forPerson(id: number): this;
22
+ forEncounter(id: number): this;
23
+ addOrders(orders: Array<MPageOrder> | MPageOrder): this;
24
+ enablePowerPlans(): this;
25
+ customizeOrderListProfile(): this;
26
+ customizeMedicationListProfile(): this;
27
+ enablePowerOrders(): this;
28
+ launchOrderSearch(): this;
29
+ launchOrderProfile(): this;
30
+ launchOrdersForSignature(): this;
31
+ signSilently(): this;
32
+ send(): void;
33
+ toString(): string;
34
+ }
35
+ export { MPageOrderEvent };