hl7-tstd 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.txt +202 -0
- package/README.md +108 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +457 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025 1nandagopal
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# hl7-tstd
|
|
2
|
+
|
|
3
|
+
A simple package to create, parse & transform HL7 message.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import HL7 from 'hl7-tstd';
|
|
7
|
+
|
|
8
|
+
const hl7 = new HL7(raw);
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
_cjs support under development._
|
|
12
|
+
|
|
13
|
+
## API References
|
|
14
|
+
|
|
15
|
+
<details id="get">
|
|
16
|
+
<summary><code>get</code></summary>
|
|
17
|
+
|
|
18
|
+
_Documentation under progress._
|
|
19
|
+
|
|
20
|
+
</details>
|
|
21
|
+
|
|
22
|
+
<details id="set">
|
|
23
|
+
<summary><code>set</code></summary>
|
|
24
|
+
|
|
25
|
+
_Documentation under progress._
|
|
26
|
+
|
|
27
|
+
</details>
|
|
28
|
+
|
|
29
|
+
<details id="getSegment">
|
|
30
|
+
<summary><code>getSegment</code></summary>
|
|
31
|
+
|
|
32
|
+
_Documentation under progress._
|
|
33
|
+
|
|
34
|
+
</details>
|
|
35
|
+
|
|
36
|
+
<details id="getSegments">
|
|
37
|
+
<summary><code>getSegments</code></summary>
|
|
38
|
+
|
|
39
|
+
_Documentation under progress._
|
|
40
|
+
|
|
41
|
+
</details>
|
|
42
|
+
|
|
43
|
+
<details id="getSegmentsAfter">
|
|
44
|
+
<summary><code>getSegmentsAfter</code></summary>
|
|
45
|
+
|
|
46
|
+
_Documentation under progress._
|
|
47
|
+
|
|
48
|
+
</details>
|
|
49
|
+
|
|
50
|
+
<details id="createSegment">
|
|
51
|
+
<summary><code>createSegment</code></summary>
|
|
52
|
+
|
|
53
|
+
_Documentation under progress._
|
|
54
|
+
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<details id="createSegmentAfter">
|
|
58
|
+
<summary><code>createSegmentAfter</code></summary>
|
|
59
|
+
|
|
60
|
+
_Documentation under progress._
|
|
61
|
+
|
|
62
|
+
</details>
|
|
63
|
+
|
|
64
|
+
<details id="createSegmentBefore">
|
|
65
|
+
<summary><code>createSegmentBefore</code></summary>
|
|
66
|
+
|
|
67
|
+
_Documentation under progress._
|
|
68
|
+
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
<details id="deleteSegment">
|
|
72
|
+
<summary><code>deleteSegment</code></summary>
|
|
73
|
+
|
|
74
|
+
_Documentation under progress._
|
|
75
|
+
|
|
76
|
+
</details>
|
|
77
|
+
|
|
78
|
+
<details id="deleteSegments">
|
|
79
|
+
<summary><code>deleteSegments</code></summary>
|
|
80
|
+
|
|
81
|
+
_Documentation under progress._
|
|
82
|
+
|
|
83
|
+
</details>
|
|
84
|
+
|
|
85
|
+
<details id="moveSegmentAfter">
|
|
86
|
+
<summary><code>moveSegmentAfter</code></summary>
|
|
87
|
+
|
|
88
|
+
_Documentation under progress._
|
|
89
|
+
|
|
90
|
+
</details>
|
|
91
|
+
|
|
92
|
+
<details id="moveSegmentBefore">
|
|
93
|
+
<summary><code>moveSegmentBefore</code></summary>
|
|
94
|
+
|
|
95
|
+
_Documentation under progress._
|
|
96
|
+
|
|
97
|
+
</details>
|
|
98
|
+
|
|
99
|
+
<details id="reindexSegments">
|
|
100
|
+
<summary><code>reindexSegments</code></summary>
|
|
101
|
+
|
|
102
|
+
_Documentation under progress._
|
|
103
|
+
|
|
104
|
+
</details>
|
|
105
|
+
|
|
106
|
+
### Attribution
|
|
107
|
+
|
|
108
|
+
This project includes code inspired from [hl7-standard](https://github.com/ironbridgecorp/hl7-standard), licensed under the Apache License 2.0.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type TSegmentType = 'DG1' | 'EVN' | 'GT1' | 'IN1' | 'MSH' | 'NK1' | 'NTE' | 'OBR' | 'OBX' | 'ORC' | 'PID' | 'PR1' | 'PV1' | 'PV2' | (string & {});
|
|
2
|
+
type TSegmentData = Record<string, Array<Record<string, Array<string>>>>;
|
|
3
|
+
type TParseOptions = {
|
|
4
|
+
fieldDelim: string;
|
|
5
|
+
repeatingDelim: string;
|
|
6
|
+
componentDelim: string;
|
|
7
|
+
subCompDelim: string;
|
|
8
|
+
eolDelim: '\r?\n|\r' | '\r\n' | '\n' | '\r';
|
|
9
|
+
buildEolChar: '\r\n' | '\n' | '\r';
|
|
10
|
+
};
|
|
11
|
+
declare class Segment {
|
|
12
|
+
readonly type: TSegmentType;
|
|
13
|
+
data: TSegmentData | null;
|
|
14
|
+
private parseOptions;
|
|
15
|
+
constructor(type: TSegmentType, data?: TSegmentData | null, parseOptions?: Omit<TParseOptions, 'eolDelim' | 'buildEolChar'>);
|
|
16
|
+
get(field: string, repeatingIndex?: number, subComponentIndex?: number): string | null;
|
|
17
|
+
set(field: string, value: string, repeatingIndex?: number, subComponentIndex?: number): void;
|
|
18
|
+
}
|
|
19
|
+
declare class HL7 {
|
|
20
|
+
raw: string;
|
|
21
|
+
parseOptions: TParseOptions;
|
|
22
|
+
private head;
|
|
23
|
+
private tail;
|
|
24
|
+
constructor(hl7Msg: string, parseOptions?: Partial<TParseOptions>);
|
|
25
|
+
transform(): void;
|
|
26
|
+
build(): string;
|
|
27
|
+
getSegment(type: TSegmentType): Segment | null;
|
|
28
|
+
getSegments(type?: TSegmentType): Segment[];
|
|
29
|
+
getSegmentsAfter(startSegment: Segment, type: TSegmentType, stopSegmentType: TSegmentType[], consecutive?: boolean): Segment[];
|
|
30
|
+
createSegment(type: TSegmentType): Segment;
|
|
31
|
+
createSegmentAfter(type: TSegmentType, targetSegment: Segment): Segment;
|
|
32
|
+
createSegmentBefore(type: string, targetSegment: Segment): Segment;
|
|
33
|
+
deleteSegment(segment: Segment): void;
|
|
34
|
+
deleteSegments(segments: Segment[]): void;
|
|
35
|
+
moveSegmentAfter(segment: Segment, targetSegment: Segment): void;
|
|
36
|
+
moveSegmentBefore(segment: Segment, targetSegment: Segment): void;
|
|
37
|
+
reindexSegments(resetRules: {
|
|
38
|
+
[k in Exclude<TSegmentType, 'MSH'>]?: TSegmentType[];
|
|
39
|
+
}, field?: string): void;
|
|
40
|
+
private getNode;
|
|
41
|
+
private appendSegmentNode;
|
|
42
|
+
private prependSegmentNode;
|
|
43
|
+
}
|
|
44
|
+
export type { Segment };
|
|
45
|
+
export default HL7;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GACb,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,KAAK,aAAa,GAAG;IACnB,UAAU,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,EAAE,OAAO;IAQ7D,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO;IAQxD,aAAa,CAAC,OAAO,EAAE,OAAO;IAO9B,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE;IAqBlC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;IA0BzD,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO;IA0B1D,eAAe,CACb,UAAU,EAAE;SAAG,CAAC,IAAI,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE;KAAE,EACpE,KAAK,SAAQ;IAgCf,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,kBAAkB;CAsB3B;AAED,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,eAAe,GAAG,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
class Node {
|
|
2
|
+
constructor(data, next = null, prev = null) {
|
|
3
|
+
this.data = data;
|
|
4
|
+
this.next = next;
|
|
5
|
+
this.prev = prev;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class Segment {
|
|
9
|
+
constructor(type, data = null, parseOptions) {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
this.type = type;
|
|
12
|
+
this.data = data;
|
|
13
|
+
this.parseOptions = {
|
|
14
|
+
fieldDelim: (_a = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.fieldDelim) !== null && _a !== void 0 ? _a : '|',
|
|
15
|
+
repeatingDelim: (_b = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.repeatingDelim) !== null && _b !== void 0 ? _b : '~',
|
|
16
|
+
componentDelim: (_c = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.componentDelim) !== null && _c !== void 0 ? _c : '^',
|
|
17
|
+
subCompDelim: (_d = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.subCompDelim) !== null && _d !== void 0 ? _d : '&',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
get(field, repeatingIndex = 0, subComponentIndex = 0) {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
22
|
+
if (!this.data)
|
|
23
|
+
return null;
|
|
24
|
+
if (!field || !/^[A-Z\d]{3}(\.\d+){0,2}$/.test(field))
|
|
25
|
+
throw new Error(`Invalid field: '${field}'`);
|
|
26
|
+
if (typeof repeatingIndex !== 'number' && repeatingIndex < -1)
|
|
27
|
+
throw new Error(`Invalid Repeating index: '${repeatingIndex}' (type:${typeof repeatingIndex})`);
|
|
28
|
+
if (typeof subComponentIndex !== 'number' && subComponentIndex < -1)
|
|
29
|
+
throw new Error(`Invalid Subcomponent index: '${subComponentIndex}' (type:${typeof subComponentIndex})`);
|
|
30
|
+
const [type, fieldIdx, compIdx] = field.split('.');
|
|
31
|
+
if (type !== this.type)
|
|
32
|
+
throw new Error(`Invalid field: '${field}'`);
|
|
33
|
+
if (compIdx && repeatingIndex < 0)
|
|
34
|
+
throw new Error(`Invalid Repeating index: '${repeatingIndex}' (type:${typeof repeatingIndex})\nCannot get All repeating fields when getting component ${field}`);
|
|
35
|
+
const { fieldDelim, repeatingDelim, componentDelim, subCompDelim } = this.parseOptions;
|
|
36
|
+
if (fieldIdx && compIdx) {
|
|
37
|
+
if (subComponentIndex === -1) {
|
|
38
|
+
const component = (_b = (_a = this.data[`${type}.${fieldIdx}`]) === null || _a === void 0 ? void 0 : _a[repeatingIndex]) === null || _b === void 0 ? void 0 : _b[`${type}.${fieldIdx}.${compIdx}`];
|
|
39
|
+
if (!component)
|
|
40
|
+
return null;
|
|
41
|
+
return (_c = component.join(subCompDelim)) !== null && _c !== void 0 ? _c : null;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return ((_g = (_f = (_e = (_d = this.data[`${type}.${fieldIdx}`]) === null || _d === void 0 ? void 0 : _d[repeatingIndex]) === null || _e === void 0 ? void 0 : _e[`${type}.${fieldIdx}.${compIdx}`]) === null || _f === void 0 ? void 0 : _f[subComponentIndex]) !== null && _g !== void 0 ? _g : null);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else if (fieldIdx) {
|
|
48
|
+
if (repeatingIndex === -1) {
|
|
49
|
+
const field = this.data[`${type}.${fieldIdx}`];
|
|
50
|
+
const repeatingFieldsArr = [];
|
|
51
|
+
if (!field)
|
|
52
|
+
return null;
|
|
53
|
+
for (const repeatingField of field) {
|
|
54
|
+
const componentsArr = [];
|
|
55
|
+
for (const compKey in repeatingField) {
|
|
56
|
+
componentsArr.push(repeatingField[compKey].join(subCompDelim));
|
|
57
|
+
}
|
|
58
|
+
repeatingFieldsArr.push(componentsArr.join(componentDelim));
|
|
59
|
+
}
|
|
60
|
+
return repeatingFieldsArr.join(repeatingDelim);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const component = (_h = this.data[`${type}.${fieldIdx}`]) === null || _h === void 0 ? void 0 : _h[repeatingIndex];
|
|
64
|
+
if (!component)
|
|
65
|
+
return null;
|
|
66
|
+
const componentsArr = [];
|
|
67
|
+
for (const compKey in component) {
|
|
68
|
+
componentsArr.push((_j = component[compKey]) === null || _j === void 0 ? void 0 : _j.join(subCompDelim));
|
|
69
|
+
}
|
|
70
|
+
return componentsArr.join(componentDelim);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
if (!this.data)
|
|
75
|
+
return null;
|
|
76
|
+
const fieldsArr = [this.type];
|
|
77
|
+
for (const fieldKey in this.data) {
|
|
78
|
+
const repeatingCompsArr = [];
|
|
79
|
+
for (const repeatingField of this.data[fieldKey]) {
|
|
80
|
+
const compsArr = [];
|
|
81
|
+
for (const compKey in repeatingField) {
|
|
82
|
+
compsArr.push((_k = repeatingField[compKey]) === null || _k === void 0 ? void 0 : _k.join(subCompDelim));
|
|
83
|
+
}
|
|
84
|
+
repeatingCompsArr.push(compsArr.join(componentDelim));
|
|
85
|
+
}
|
|
86
|
+
fieldsArr.push(repeatingCompsArr.join(repeatingDelim));
|
|
87
|
+
}
|
|
88
|
+
return fieldsArr.join(fieldDelim);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
set(field, value, repeatingIndex = 0, subComponentIndex = 0) {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
93
|
+
if (!field || !/^[A-Z\d]{3}(\.\d+){1,2}$/.test(field))
|
|
94
|
+
throw new Error(`Invalid field: '${field}'`);
|
|
95
|
+
if (typeof value !== 'string')
|
|
96
|
+
throw new Error(`Invalid value: '${value}' (type:${typeof value})`);
|
|
97
|
+
if (typeof repeatingIndex !== 'number' && repeatingIndex < 0)
|
|
98
|
+
throw new Error(`Invalid Repeating index: '${repeatingIndex}' (type:${typeof repeatingIndex})`);
|
|
99
|
+
if (typeof subComponentIndex !== 'number' && subComponentIndex < 0)
|
|
100
|
+
throw new Error(`Invalid Subcomponent index: '${subComponentIndex}' (type:${typeof subComponentIndex})`);
|
|
101
|
+
const [type, fieldIdx, compIdx] = field.split('.');
|
|
102
|
+
if (!type || type !== this.type)
|
|
103
|
+
throw new Error(`Invalid type: '${type}'. Cannot set ${type} in ${this.type} Segment`);
|
|
104
|
+
if (!fieldIdx)
|
|
105
|
+
throw new Error('Invalid field'); // TODO ----------------
|
|
106
|
+
if (!this.data)
|
|
107
|
+
this.data = {};
|
|
108
|
+
for (let i = type === 'MSH' ? 2 : 1; i <= parseInt(fieldIdx, 10); i++) {
|
|
109
|
+
if (((_b = (_a = this.data[`${type}.${i}`]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[`${type}.${i}.${1}`]) == null)
|
|
110
|
+
this.data[`${type}.${i}`] = [{ [`${type}.${i}.${1}`]: [''] }];
|
|
111
|
+
}
|
|
112
|
+
if (repeatingIndex === -1) {
|
|
113
|
+
this.data[`${type}.${fieldIdx}`] = [{ [`${type}.${fieldIdx}.${1}`]: [''] }];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
for (let i = 0; i <= repeatingIndex; i++) {
|
|
117
|
+
if (((_d = (_c = this.data[`${type}.${fieldIdx}`]) === null || _c === void 0 ? void 0 : _c[i]) === null || _d === void 0 ? void 0 : _d[`${type}.${fieldIdx}.${1}`]) == null)
|
|
118
|
+
this.data[`${type}.${fieldIdx}`][i] = {
|
|
119
|
+
[`${type}.${fieldIdx}.${1}`]: [''],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (compIdx) {
|
|
124
|
+
for (let i = 1; i <= parseInt(compIdx, 10); i++) {
|
|
125
|
+
if (((_f = (_e = this.data[`${type}.${fieldIdx}`]) === null || _e === void 0 ? void 0 : _e[repeatingIndex]) === null || _f === void 0 ? void 0 : _f[`${type}.${fieldIdx}.${i}`]) == null)
|
|
126
|
+
this.data[`${type}.${fieldIdx}`][repeatingIndex][`${type}.${fieldIdx}.${i}`] = [''];
|
|
127
|
+
}
|
|
128
|
+
for (let i = 0; i <= subComponentIndex; i++) {
|
|
129
|
+
if (((_j = (_h = (_g = this.data[`${type}.${fieldIdx}`]) === null || _g === void 0 ? void 0 : _g[repeatingIndex]) === null || _h === void 0 ? void 0 : _h[`${type}.${fieldIdx}.${compIdx}`]) === null || _j === void 0 ? void 0 : _j[i]) == null)
|
|
130
|
+
this.data[`${type}.${fieldIdx}`][repeatingIndex][`${type}.${fieldIdx}.${compIdx}`][i] =
|
|
131
|
+
'';
|
|
132
|
+
}
|
|
133
|
+
this.data[`${type}.${fieldIdx}`][repeatingIndex][`${type}.${fieldIdx}.${compIdx}`][subComponentIndex] = value;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.data[`${type}.${fieldIdx}`][repeatingIndex] = {
|
|
137
|
+
[`${type}.${fieldIdx}.${1}`]: [value],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
class HL7 {
|
|
143
|
+
constructor(hl7Msg, parseOptions) {
|
|
144
|
+
var _a, _b, _c, _d, _e, _f;
|
|
145
|
+
this.head = null;
|
|
146
|
+
this.tail = null;
|
|
147
|
+
this.raw = typeof hl7Msg === 'string' ? hl7Msg : '';
|
|
148
|
+
this.parseOptions = {
|
|
149
|
+
fieldDelim: (_a = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.fieldDelim) !== null && _a !== void 0 ? _a : '|',
|
|
150
|
+
repeatingDelim: (_b = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.repeatingDelim) !== null && _b !== void 0 ? _b : '~',
|
|
151
|
+
componentDelim: (_c = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.componentDelim) !== null && _c !== void 0 ? _c : '^',
|
|
152
|
+
subCompDelim: (_d = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.subCompDelim) !== null && _d !== void 0 ? _d : '&',
|
|
153
|
+
eolDelim: (_e = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.eolDelim) !== null && _e !== void 0 ? _e : '\r?\n|\r',
|
|
154
|
+
buildEolChar: (_f = parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.buildEolChar) !== null && _f !== void 0 ? _f : '\r\n',
|
|
155
|
+
};
|
|
156
|
+
this.transform();
|
|
157
|
+
}
|
|
158
|
+
transform() {
|
|
159
|
+
if (!this.raw.startsWith('MSH')) {
|
|
160
|
+
throw new Error('Expected raw msg to be HL7 message. Message does not start with MSH');
|
|
161
|
+
}
|
|
162
|
+
const segmentsStr = this.raw
|
|
163
|
+
.split(RegExp(this.parseOptions.eolDelim))
|
|
164
|
+
.filter((segmentStr) => /^[A-Z\d]{3}\|/.test(segmentStr));
|
|
165
|
+
const { fieldDelim, repeatingDelim, componentDelim, subCompDelim } = this.parseOptions;
|
|
166
|
+
for (const segmentStr of segmentsStr) {
|
|
167
|
+
const type = segmentStr.substring(0, 3);
|
|
168
|
+
const segment = new Segment(type, null, this.parseOptions);
|
|
169
|
+
const fields = segmentStr.split(fieldDelim);
|
|
170
|
+
segment.data = {};
|
|
171
|
+
for (let i = 1; i < fields.length; i++) {
|
|
172
|
+
const fieldIdx = type === 'MSH' ? i + 1 : i;
|
|
173
|
+
const repeatings = fields[i].split(repeatingDelim);
|
|
174
|
+
segment.data[`${type}.${fieldIdx}`] = [];
|
|
175
|
+
for (let j = 0; j < repeatings.length; j++) {
|
|
176
|
+
const components = repeatings[j].split(componentDelim);
|
|
177
|
+
segment.data[`${type}.${fieldIdx}`][j] = {};
|
|
178
|
+
for (let k = 0; k < components.length; k++) {
|
|
179
|
+
const subComps = components[k].split(subCompDelim);
|
|
180
|
+
segment.data[`${type}.${fieldIdx}`][j][`${type}.${fieldIdx}.${k + 1}`] = [];
|
|
181
|
+
for (let l = 0; l < subComps.length; l++) {
|
|
182
|
+
segment.data[`${type}.${fieldIdx}`][j][`${type}.${fieldIdx}.${k + 1}`][l] =
|
|
183
|
+
subComps[l];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (type === 'MSH') {
|
|
189
|
+
segment.data['MSH.2'] = [
|
|
190
|
+
{
|
|
191
|
+
'MSH.2.1': [`${componentDelim}${repeatingDelim}\\${subCompDelim}`],
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
this.appendSegmentNode(segment);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
build() {
|
|
199
|
+
var _a;
|
|
200
|
+
const segments = this.getSegments();
|
|
201
|
+
const { fieldDelim, repeatingDelim, componentDelim, subCompDelim, buildEolChar } = this.parseOptions;
|
|
202
|
+
const segmentsStrArr = [];
|
|
203
|
+
for (const segment of segments) {
|
|
204
|
+
const fieldsArr = [segment.type];
|
|
205
|
+
for (const fieldKey in segment.data) {
|
|
206
|
+
const repeatingCompsArr = [];
|
|
207
|
+
for (const component of segment.data[fieldKey]) {
|
|
208
|
+
const compsArr = [];
|
|
209
|
+
for (const subCompsKey in component) {
|
|
210
|
+
compsArr.push((_a = component[subCompsKey]) === null || _a === void 0 ? void 0 : _a.join(subCompDelim));
|
|
211
|
+
}
|
|
212
|
+
repeatingCompsArr.push(compsArr.join(componentDelim));
|
|
213
|
+
}
|
|
214
|
+
fieldsArr.push(repeatingCompsArr.join(repeatingDelim));
|
|
215
|
+
}
|
|
216
|
+
segmentsStrArr.push(fieldsArr.join(fieldDelim));
|
|
217
|
+
}
|
|
218
|
+
return segmentsStrArr.join(buildEolChar);
|
|
219
|
+
}
|
|
220
|
+
getSegment(type) {
|
|
221
|
+
if (!/^[A-Z\d]{3}$/.test(type))
|
|
222
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
223
|
+
let curr = this.head;
|
|
224
|
+
while (curr) {
|
|
225
|
+
if (curr.data.type === type) {
|
|
226
|
+
return curr.data;
|
|
227
|
+
}
|
|
228
|
+
curr = curr.next;
|
|
229
|
+
}
|
|
230
|
+
return curr;
|
|
231
|
+
}
|
|
232
|
+
getSegments(type) {
|
|
233
|
+
if (type && !/^[A-Z\d]{3}$/.test(type))
|
|
234
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
235
|
+
const segments = [];
|
|
236
|
+
let curr = this.head;
|
|
237
|
+
while (curr) {
|
|
238
|
+
if (type) {
|
|
239
|
+
if (type === curr.data.type) {
|
|
240
|
+
segments.push(curr.data);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
segments.push(curr.data);
|
|
245
|
+
}
|
|
246
|
+
curr = curr.next;
|
|
247
|
+
}
|
|
248
|
+
return segments;
|
|
249
|
+
}
|
|
250
|
+
getSegmentsAfter(startSegment, type, stopSegmentType, consecutive = false) {
|
|
251
|
+
if (!startSegment || !(startSegment instanceof Segment))
|
|
252
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(startSegment)}`);
|
|
253
|
+
if (!/^[A-Z\d]{3}$/.test(type))
|
|
254
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
255
|
+
if (typeof consecutive !== 'boolean')
|
|
256
|
+
throw new Error(`Invalid Consecutive flag: '${consecutive}'`);
|
|
257
|
+
const startNode = this.getNode(startSegment);
|
|
258
|
+
if (!startNode)
|
|
259
|
+
throw new Error(`Failed to locate Start Segment: '${startSegment.type}`);
|
|
260
|
+
const res = [];
|
|
261
|
+
let curr = startNode.next;
|
|
262
|
+
while (curr) {
|
|
263
|
+
if (stopSegmentType.includes(curr.data.type))
|
|
264
|
+
break;
|
|
265
|
+
if (curr.data.type === type)
|
|
266
|
+
res.push(curr.data);
|
|
267
|
+
else if (consecutive && res.length)
|
|
268
|
+
break;
|
|
269
|
+
curr = curr.next;
|
|
270
|
+
}
|
|
271
|
+
return res;
|
|
272
|
+
}
|
|
273
|
+
createSegment(type) {
|
|
274
|
+
if (!/^[A-Z\d]{3}$/.test(type))
|
|
275
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
276
|
+
return this.appendSegmentNode(new Segment(type, null, this.parseOptions));
|
|
277
|
+
}
|
|
278
|
+
createSegmentAfter(type, targetSegment) {
|
|
279
|
+
if (!/^[A-Z\d]{3}$/.test(type))
|
|
280
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
281
|
+
if (!targetSegment || !(targetSegment instanceof Segment))
|
|
282
|
+
throw new Error(`Invalid Target Segment : ${JSON.stringify(targetSegment)}`);
|
|
283
|
+
return this.appendSegmentNode(new Segment(type, null, this.parseOptions), targetSegment);
|
|
284
|
+
}
|
|
285
|
+
createSegmentBefore(type, targetSegment) {
|
|
286
|
+
if (!/^[A-Z\d]{3}$/.test(type))
|
|
287
|
+
throw new Error(`Invalid Segment type: '${type}'`);
|
|
288
|
+
if (!targetSegment || !(targetSegment instanceof Segment))
|
|
289
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(targetSegment)}`);
|
|
290
|
+
return this.prependSegmentNode(new Segment(type, null, this.parseOptions), targetSegment);
|
|
291
|
+
}
|
|
292
|
+
deleteSegment(segment) {
|
|
293
|
+
if (!segment || !(segment instanceof Segment))
|
|
294
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(segment)}`);
|
|
295
|
+
this.deleteSegments([segment]);
|
|
296
|
+
}
|
|
297
|
+
deleteSegments(segments) {
|
|
298
|
+
var _a, _b;
|
|
299
|
+
for (const segment of segments) {
|
|
300
|
+
if (!segment || !(segment instanceof Segment))
|
|
301
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(segment)}`);
|
|
302
|
+
const node = this.getNode(segment);
|
|
303
|
+
if (!node) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
if ((_a = node.prev) === null || _a === void 0 ? void 0 : _a.next)
|
|
307
|
+
node.prev.next = node.next;
|
|
308
|
+
if ((_b = node.next) === null || _b === void 0 ? void 0 : _b.prev)
|
|
309
|
+
node.next.prev = node.prev;
|
|
310
|
+
if (this.head === node)
|
|
311
|
+
this.head = this.head.next;
|
|
312
|
+
if (this.tail === node)
|
|
313
|
+
this.tail = this.tail.prev;
|
|
314
|
+
node.next = null;
|
|
315
|
+
node.prev = null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
moveSegmentAfter(segment, targetSegment) {
|
|
319
|
+
var _a, _b, _c;
|
|
320
|
+
if (!segment || !(segment instanceof Segment))
|
|
321
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(segment)}`);
|
|
322
|
+
if (!targetSegment || !(targetSegment instanceof Segment))
|
|
323
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(targetSegment)}`);
|
|
324
|
+
const node = this.getNode(segment);
|
|
325
|
+
if (!node)
|
|
326
|
+
throw new Error(`Failed to locate Segment: '${segment.type}'`);
|
|
327
|
+
const targetNode = this.getNode(targetSegment);
|
|
328
|
+
if (!targetNode)
|
|
329
|
+
throw new Error(`Failed to locate Target Segment: '${targetSegment.type}'`);
|
|
330
|
+
if ((_a = node.prev) === null || _a === void 0 ? void 0 : _a.next)
|
|
331
|
+
node.prev.next = node.next;
|
|
332
|
+
if ((_b = node.next) === null || _b === void 0 ? void 0 : _b.prev)
|
|
333
|
+
node.next.prev = node.prev;
|
|
334
|
+
node.next = targetNode.next;
|
|
335
|
+
node.prev = targetNode;
|
|
336
|
+
targetNode.next = node;
|
|
337
|
+
if ((_c = node.next) === null || _c === void 0 ? void 0 : _c.prev)
|
|
338
|
+
node.next.prev = node;
|
|
339
|
+
if (targetNode === this.tail)
|
|
340
|
+
this.tail = this.tail.next;
|
|
341
|
+
}
|
|
342
|
+
moveSegmentBefore(segment, targetSegment) {
|
|
343
|
+
var _a, _b, _c;
|
|
344
|
+
if (!segment || !(segment instanceof Segment))
|
|
345
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(segment)}`);
|
|
346
|
+
if (!targetSegment || !(targetSegment instanceof Segment))
|
|
347
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(targetSegment)}`);
|
|
348
|
+
const node = this.getNode(segment);
|
|
349
|
+
if (!node)
|
|
350
|
+
throw new Error(`Failed to locate Segment: '${segment.type}'`);
|
|
351
|
+
const targetNode = this.getNode(targetSegment);
|
|
352
|
+
if (!targetNode)
|
|
353
|
+
throw new Error(`Failed to locate Target Segment: '${targetSegment.type}'`);
|
|
354
|
+
if ((_a = node.prev) === null || _a === void 0 ? void 0 : _a.next)
|
|
355
|
+
node.prev.next = node.next;
|
|
356
|
+
if ((_b = node.next) === null || _b === void 0 ? void 0 : _b.prev)
|
|
357
|
+
node.next.prev = node.prev;
|
|
358
|
+
node.next = targetNode;
|
|
359
|
+
node.prev = targetNode.prev;
|
|
360
|
+
targetNode.prev = node;
|
|
361
|
+
if ((_c = node.prev) === null || _c === void 0 ? void 0 : _c.next)
|
|
362
|
+
node.prev.next = node;
|
|
363
|
+
if (targetNode === this.head)
|
|
364
|
+
this.head = this.head.prev;
|
|
365
|
+
}
|
|
366
|
+
reindexSegments(resetRules, field = '1.1') {
|
|
367
|
+
var _a;
|
|
368
|
+
if (!resetRules || typeof resetRules !== 'object')
|
|
369
|
+
throw new Error('Invalid Parameter: resetRules');
|
|
370
|
+
if (field && !/^(\d)+(\.\d+)*$/.test(field))
|
|
371
|
+
throw new Error(`Invalid Parameter: field '${field}'`);
|
|
372
|
+
let curr = this.head;
|
|
373
|
+
const indexMap = {};
|
|
374
|
+
for (const key in resetRules) {
|
|
375
|
+
indexMap[key] = 1;
|
|
376
|
+
}
|
|
377
|
+
while (curr) {
|
|
378
|
+
const segment = curr.data;
|
|
379
|
+
if (segment.type in resetRules) {
|
|
380
|
+
segment.set(`${segment.type}.${field}`, String(indexMap[segment.type]++));
|
|
381
|
+
}
|
|
382
|
+
for (const key in resetRules) {
|
|
383
|
+
if ((_a = resetRules[key]) === null || _a === void 0 ? void 0 : _a.includes(segment.type)) {
|
|
384
|
+
indexMap[key] = 1;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
curr = curr.next;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
getNode(segment) {
|
|
391
|
+
if (!segment || !(segment instanceof Segment)) {
|
|
392
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(segment)}`);
|
|
393
|
+
}
|
|
394
|
+
let curr = this.head;
|
|
395
|
+
while (curr) {
|
|
396
|
+
if (curr.data === segment) {
|
|
397
|
+
return curr;
|
|
398
|
+
}
|
|
399
|
+
curr = curr.next;
|
|
400
|
+
}
|
|
401
|
+
return curr;
|
|
402
|
+
}
|
|
403
|
+
appendSegmentNode(newSegment, targetSegment) {
|
|
404
|
+
var _a;
|
|
405
|
+
if (!newSegment || !(newSegment instanceof Segment))
|
|
406
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(newSegment)}`);
|
|
407
|
+
if (targetSegment && !(targetSegment instanceof Segment))
|
|
408
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(targetSegment)}`);
|
|
409
|
+
const newNode = new Node(newSegment);
|
|
410
|
+
if (targetSegment) {
|
|
411
|
+
const targetNode = this.getNode(targetSegment);
|
|
412
|
+
if (!targetNode)
|
|
413
|
+
throw new Error(`Failed to locate Target Segment: '${targetSegment.type}'`);
|
|
414
|
+
newNode.next = targetNode.next;
|
|
415
|
+
newNode.prev = targetNode;
|
|
416
|
+
targetNode.next = newNode;
|
|
417
|
+
if ((_a = newNode.next) === null || _a === void 0 ? void 0 : _a.prev)
|
|
418
|
+
newNode.next.prev = newNode;
|
|
419
|
+
if (targetNode === this.tail)
|
|
420
|
+
this.tail = newNode;
|
|
421
|
+
}
|
|
422
|
+
else if (!this.head) {
|
|
423
|
+
this.head = newNode;
|
|
424
|
+
this.tail = newNode;
|
|
425
|
+
}
|
|
426
|
+
else if (this.tail) {
|
|
427
|
+
newNode.prev = this.tail;
|
|
428
|
+
this.tail.next = newNode;
|
|
429
|
+
this.tail = newNode;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
throw new Error(`Failed to append Segment: ${newSegment.type}`);
|
|
433
|
+
}
|
|
434
|
+
return newSegment;
|
|
435
|
+
}
|
|
436
|
+
prependSegmentNode(newSegment, targetSegment) {
|
|
437
|
+
var _a;
|
|
438
|
+
if (!newSegment || !(newSegment instanceof Segment))
|
|
439
|
+
throw new Error(`Invalid Segment: ${JSON.stringify(newSegment)}`);
|
|
440
|
+
if (!targetSegment || !(targetSegment instanceof Segment))
|
|
441
|
+
throw new Error(`Invalid Target Segment: ${JSON.stringify(targetSegment)}`);
|
|
442
|
+
const targetNode = this.getNode(targetSegment);
|
|
443
|
+
if (!targetNode)
|
|
444
|
+
throw new Error(`Failed to locate Target Segment: '${targetSegment.type}'`);
|
|
445
|
+
const newNode = new Node(newSegment);
|
|
446
|
+
newNode.next = targetNode;
|
|
447
|
+
newNode.prev = targetNode.prev;
|
|
448
|
+
targetNode.prev = newNode;
|
|
449
|
+
if ((_a = newNode.prev) === null || _a === void 0 ? void 0 : _a.next)
|
|
450
|
+
newNode.prev.next = newNode;
|
|
451
|
+
if (targetNode === this.head)
|
|
452
|
+
this.head = this.head.prev;
|
|
453
|
+
return newSegment;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
export default HL7;
|
|
457
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4BA,MAAM,IAAI;IACR,YACkB,IAAO,EAChB,OAAuB,IAAI,EAC3B,OAAuB,IAAI;QAFlB,SAAI,GAAJ,IAAI,CAAG;QAChB,SAAI,GAAJ,IAAI,CAAuB;QAC3B,SAAI,GAAJ,IAAI,CAAuB;IACjC,CAAC;CACL;AAED,MAAM,OAAO;IAGX,YACkB,IAAkB,EAC3B,OAA4B,IAAI,EACvC,YAA+D;;QAF/C,SAAI,GAAJ,IAAI,CAAc;QAC3B,SAAI,GAAJ,IAAI,CAA4B;QAGvC,IAAI,CAAC,YAAY,GAAG;YAClB,UAAU,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,mCAAI,GAAG;YAC3C,cAAc,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,mCAAI,GAAG;YACnD,cAAc,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,mCAAI,GAAG;YACnD,YAAY,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,mCAAI,GAAG;SAChD,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,iBAAyB,CAAC,EAAE,oBAA4B,CAAC;;QAC1E,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAE5B,IAAI,CAAC,KAAK,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,GAAG,CAAC,CAAC;QAE/C,IAAI,OAAO,cAAc,KAAK,QAA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CAAC;QAC1B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC;QAE1B,IAAI,MAAA,OAAO,CAAC,IAAI,0CAAE,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpD,IAAI,UAAU,KAAK,IAAI,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAEzD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAGD,eAAe,GAAG,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hl7-tstd",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A simple package to create, parse & transform HL7 message.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=16.0.0"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rimraf dist && npx tsc"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"hl7",
|
|
19
|
+
"parse",
|
|
20
|
+
"create",
|
|
21
|
+
"transform",
|
|
22
|
+
"format"
|
|
23
|
+
],
|
|
24
|
+
"author": "1nandagopal",
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"homepage": "https://github.com/1nandagopal/hl7-tstd#readme",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/1nandagopal/hl7-tstd.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/1nandagopal/hl7-tstd/issues"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@biomejs/biome": "2.2.2",
|
|
36
|
+
"rimraf": "^6.0.1",
|
|
37
|
+
"typescript": "^5.9.2"
|
|
38
|
+
}
|
|
39
|
+
}
|