@rethinkhealth/hl7v2-parser 0.2.3 → 0.2.4
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/README.md +14 -8
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +325 -534
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts +6 -13
- package/dist/parser.d.ts.map +1 -1
- package/dist/preprocessor.d.ts +26 -0
- package/dist/preprocessor.d.ts.map +1 -0
- package/dist/processor.d.ts +3 -5
- package/dist/processor.d.ts.map +1 -1
- package/dist/tokenizer.d.ts +18 -0
- package/dist/tokenizer.d.ts.map +1 -0
- package/dist/types.d.ts +29 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +6 -5
- package/dist/constants.d.ts +0 -11
- package/dist/constants.d.ts.map +0 -1
- package/dist/pipeline/core/message.d.ts +0 -16
- package/dist/pipeline/core/message.d.ts.map +0 -1
- package/dist/pipeline/core/parsers/component.d.ts +0 -13
- package/dist/pipeline/core/parsers/component.d.ts.map +0 -1
- package/dist/pipeline/core/parsers/field.d.ts +0 -13
- package/dist/pipeline/core/parsers/field.d.ts.map +0 -1
- package/dist/pipeline/core/parsers/segment-msh.d.ts +0 -14
- package/dist/pipeline/core/parsers/segment-msh.d.ts.map +0 -1
- package/dist/pipeline/core/parsers/segment.d.ts +0 -13
- package/dist/pipeline/core/parsers/segment.d.ts.map +0 -1
- package/dist/pipeline/core/parsers/subcomponent.d.ts +0 -10
- package/dist/pipeline/core/parsers/subcomponent.d.ts.map +0 -1
- package/dist/pipeline/core/registry.d.ts +0 -30
- package/dist/pipeline/core/registry.d.ts.map +0 -1
- package/dist/pipeline/index.d.ts +0 -10
- package/dist/pipeline/index.d.ts.map +0 -1
- package/dist/pipeline/interfaces.d.ts +0 -109
- package/dist/pipeline/interfaces.d.ts.map +0 -1
- package/dist/pipeline/utils/index.d.ts +0 -18
- package/dist/pipeline/utils/index.d.ts.map +0 -1
- package/dist/pipeline/validation/basic-validation.d.ts +0 -17
- package/dist/pipeline/validation/basic-validation.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,14 @@ This utility is a low level project. It’s used in [@rethinkhealth/hl7v2](../hl
|
|
|
8
8
|
|
|
9
9
|
If you want to handle syntax trees manually, use this. For an easier time processing content, use the [@rethinkhealth/hl7v2](../hl7v2/) ecosystem instead.
|
|
10
10
|
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Speed-first**: pull-based tokenizer, single pass, minimal object allocations.
|
|
14
|
+
- **Spec-aware**: auto-detects delimiters from MSH-1 and MSH-2.
|
|
15
|
+
- **AST design**: outputs a unist-compatible tree for use in the HL7v2 unified ecosystem.
|
|
16
|
+
- **Composable**: works directly as a unified parser plugin or as a standalone function.
|
|
17
|
+
- **Streaming-friendly**: pull-based design is ready for streaming use cases.
|
|
18
|
+
|
|
11
19
|
## Install
|
|
12
20
|
|
|
13
21
|
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). In Node.js (version 16+), install with npm:
|
|
@@ -21,18 +29,16 @@ npm install @rethinkhealth/hl7v2-parser
|
|
|
21
29
|
### Basic Usage
|
|
22
30
|
|
|
23
31
|
```typescript
|
|
32
|
+
import { unified } from 'unified';
|
|
24
33
|
import { hl7v2Parser } from '@rethinkhealth/hl7v2-parser';
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
const message = `MSH|^~\\&|SENDING_APP|SENDING_FAC|RECEIVING_APP|RECEIVING_FAC|20110613061611||ADT^A04|12345|P|2.3
|
|
28
|
-
PID|1||123456||SMITH^JOHN^J||19800101|M|||123 MAIN ST^^ANYTOWN^ST^12345
|
|
29
|
-
PV1|1|I|ICU^101^1|||DOCTOR123^SMITH^JOHN^MD`;
|
|
35
|
+
const message = `MSH|^~\\&|SENDING_APP|SENDING_FAC|...`;
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
const tree = unified()
|
|
38
|
+
.use(hl7v2Parser)
|
|
39
|
+
.parse(message);
|
|
34
40
|
|
|
35
|
-
console.log(
|
|
41
|
+
console.log(tree);
|
|
36
42
|
```
|
|
37
43
|
|
|
38
44
|
## Contributing
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export { default as hl7v2Parser } from './
|
|
1
|
+
export { default as hl7v2Parser } from './parser';
|
|
2
|
+
export * from './preprocessor';
|
|
3
|
+
export { parseHL7v2FromIterator } from './processor';
|
|
4
|
+
export * from './tokenizer';
|
|
2
5
|
export * from './types';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|