@glion/transform-profile-groups 0.0.0-stage → 0.21.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) 2023 Rethink Health
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 CHANGED
@@ -1,3 +1,167 @@
1
- # Temporary Holding Version
1
+ # @glion/transform-profile-groups
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Unified plugin that nests HL7v2 segments in the segment groups their event schema defines.
4
+
5
+ ## What it does
6
+
7
+ The parser produces a flat list of segments. This plugin nests them in `Group` nodes the way the HL7v2 standard defines the event's message structure: in an `ORU_R01`, each order's `OBR` and its results go in an `ORDER_OBSERVATION`, inside a `PATIENT_RESULT`. It reads the event schema MSH-12 and MSH-9 name and moves the existing segment nodes; it does not copy or change them.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @glion/transform-profile-groups
13
+ ```
14
+
15
+ ## Use
16
+
17
+ ```ts
18
+ import { parseHL7v2 } from "@glion/parser";
19
+ import { hl7v2TransformProfileGroups } from "@glion/transform-profile-groups";
20
+ import { unified } from "unified";
21
+ import { VFile } from "vfile";
22
+
23
+ const tree = parseHL7v2(
24
+ [
25
+ "MSH|^~\\&|LAB|FAC|EMR|RFAC|20241201120000||ORU^R01^ORU_R01|MSG1|P|2.5",
26
+ "PID|1||12345^^^MRN||Doe^John",
27
+ "PV1|1|I",
28
+ "ORC|RE|ORD1",
29
+ "OBR|1|ORD1||CBC",
30
+ "OBX|1|NM|WBC||5.0",
31
+ "OBX|2|NM|RBC||4.1",
32
+ ].join("\r")
33
+ );
34
+
35
+ await unified().use(hl7v2TransformProfileGroups).run(tree, new VFile());
36
+ ```
37
+
38
+ The root now holds:
39
+
40
+ ```
41
+ MSH
42
+ PATIENT_RESULT
43
+ PATIENT
44
+ PID
45
+ VISIT
46
+ PV1
47
+ ORDER_OBSERVATION
48
+ ORC
49
+ OBR
50
+ OBSERVATION
51
+ OBX
52
+ OBSERVATION
53
+ OBX
54
+ ```
55
+
56
+ Paths from `@glion/util-query` address the groups:
57
+
58
+ ```ts
59
+ import { selectAll, value } from "@glion/util-query";
60
+
61
+ selectAll(tree, "PATIENT_RESULT-ORDER_OBSERVATION"); // each order
62
+ value(tree, "PATIENT_RESULT-ORDER_OBSERVATION[1]-OBX[2]-5")?.value; // => "4.1"
63
+ ```
64
+
65
+ ## Options
66
+
67
+ | Option | Type | Default | Description |
68
+ | ---------------- | ------------------------------------------------------ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | `definition` | `EventSchema \| (context) => EventSchema \| undefined` | the schema MSH-9 names | The event schema to group by, or a function of `{ tree, file }` that returns one, sync or async. `undefined` falls back to the schema MSH-9 names. |
70
+ | `allowZSegments` | `boolean` | `true` | Whether a Z-segment the event schema does not name fits at any position, as HL7v2 allows (v2.5.1 §2.11). When `false`, such a segment leaves the tree flat. |
71
+
72
+ An event schema of your own groups a message the bundled schemas do not define, such as one with a site's Z-segment:
73
+
74
+ ```ts
75
+ import type { EventSchema } from "@glion/profiles";
76
+
77
+ const definition: EventSchema = {
78
+ id: "ZAD_Z01",
79
+ elements: [
80
+ { type: "segment", name: "MSH", optional: false, repeating: false },
81
+ { type: "segment", name: "PID", optional: false, repeating: false },
82
+ {
83
+ type: "group",
84
+ name: "VISIT",
85
+ optional: false,
86
+ repeating: false,
87
+ elements: [
88
+ { type: "segment", name: "PV1", optional: false, repeating: false },
89
+ { type: "segment", name: "ZPV", optional: true, repeating: false },
90
+ ],
91
+ },
92
+ ],
93
+ };
94
+
95
+ await unified()
96
+ .use(hl7v2TransformProfileGroups, { definition })
97
+ .run(tree, new VFile());
98
+ // MSH, PID, VISIT(PV1, ZPV)
99
+ ```
100
+
101
+ ## API
102
+
103
+ ### `unified().use(hl7v2TransformProfileGroups[, options])`
104
+
105
+ Replaces the root's segments with nested `Group` nodes holding the same segment nodes, in the same order.
106
+
107
+ ```ts
108
+ import type { Root } from "@glion/ast";
109
+ import type { EventSchema } from "@glion/profiles";
110
+ import type { Plugin } from "unified";
111
+ import type { VFile } from "vfile";
112
+
113
+ interface TransformProfileGroupsContext {
114
+ tree: Root;
115
+ file: VFile;
116
+ }
117
+
118
+ interface TransformProfileGroupsOptions {
119
+ definition?:
120
+ | EventSchema
121
+ | ((
122
+ context: TransformProfileGroupsContext
123
+ ) => EventSchema | undefined | Promise<EventSchema | undefined>);
124
+ allowZSegments?: boolean;
125
+ }
126
+
127
+ declare const hl7v2TransformProfileGroups: Plugin<
128
+ [TransformProfileGroupsOptions?],
129
+ Root,
130
+ Root
131
+ >;
132
+ export default hl7v2TransformProfileGroups;
133
+ ```
134
+
135
+ ###### Requires
136
+
137
+ Without `options.definition`: a message whose MSH-12 and MSH-9 name a bundled event schema. MSH-9.3 names the schema; when it is empty, MSH-9.1 and MSH-9.2 name the event, and the version's event map gives its schema.
138
+
139
+ ###### Returns
140
+
141
+ Async transformer. Mutates the tree in place and returns it.
142
+
143
+ ###### Throws
144
+
145
+ When the event schema is invalid: it has no elements, a segment or group has no name, a group has no elements, a choice has no alternatives, or a choice alternative can match no segment. When a bundled event schema fails to load.
146
+
147
+ ## Behavior
148
+
149
+ - Each `Group` has `type: "group"`, the group's `name` from the standard, such as `ORDER_OBSERVATION`, and a `position` from the start of its first segment to the end of its last.
150
+ - Each occurrence of a repeating group is its own `Group` node: two results give two `OBSERVATION` nodes.
151
+ - A choice, the standard's `< OBR | RXO >`, adds no node: the chosen segment sits in the enclosing group.
152
+ - A group occurrence that holds no segment is left out.
153
+ - Where the schema admits more than one grouping, the plugin enters an optional element rather than skip it, repeats an element rather than leave it, and takes the earlier alternative of a choice. A segment therefore continues the group it is in before it starts a new enclosing one: in an `ORU_R01`, an `ORC` after an `OBX` starts a new `ORDER_OBSERVATION` in the current `PATIENT_RESULT`.
154
+ - A Z-segment, a segment ID that starts with `Z`, that the schema does not name goes right after the segment before it, in that segment's group: in an `ORU_R01`, a `ZPI` after the `PID` sits in `PATIENT`, and a `ZDS` after the `OBR` in `ORDER_OBSERVATION`. Consecutive Z-segments stay together, in order, and a Z-segment before every segment the schema names stays at the top level. A Z-segment the schema names is placed where the schema puts it. With `allowZSegments: false`, a Z-segment the schema does not name leaves the tree flat.
155
+ - A tree that already holds a group, from a first run or from another plugin, is left as it is, and `definition` is not called for it.
156
+ - The tree is also left unchanged when there is no event schema, or when the segments do not fit the schema: a segment out of order, a required segment missing, or a segment the schema does not define that is not a Z-segment. `@glion/lint-profile-segment-order` reports those messages.
157
+ - Running it twice changes nothing.
158
+
159
+ Grouping changes neither serialization nor segment paths: `toHl7v2` writes the same text, and `value(tree, "PID-3.1")` and `value(tree, "OBX[2]-5")` resolve the same nodes. Profile annotation and lint plugins read segments at any depth, so they run before or after it.
160
+
161
+ ## Part of Glion
162
+
163
+ `@glion/transform-profile-groups` is part of **[Glion]**, the application framework for HL7v2.
164
+ See the [Glion README] for the full package catalog and architecture.
165
+
166
+ [Glion]: https://github.com/rethinkhealth/glion#readme
167
+ [Glion README]: https://github.com/rethinkhealth/glion#readme
@@ -0,0 +1,53 @@
1
+ import type { Root } from "@glion/ast";
2
+ import type { EventSchema } from "@glion/profiles";
3
+ import type { Plugin } from "unified";
4
+ import type { VFile } from "vfile";
5
+ /** The message a `definition` function chooses an event schema for. */
6
+ export interface TransformProfileGroupsContext {
7
+ tree: Root;
8
+ file: VFile;
9
+ }
10
+ /** Options for {@link hl7v2TransformProfileGroups}. */
11
+ export interface TransformProfileGroupsOptions {
12
+ /**
13
+ * The event schema to group by, or a function that returns the one to use
14
+ * for a message. Default: the schema MSH-9 names.
15
+ *
16
+ * When the function returns `undefined`, the plugin uses the schema MSH-9
17
+ * names. Return the same object for every message that uses a schema: a
18
+ * new object is compiled on its first run.
19
+ */
20
+ definition?: EventSchema | ((context: TransformProfileGroupsContext) => EventSchema | undefined | Promise<EventSchema | undefined>);
21
+ /**
22
+ * Whether a Z-segment (a segment ID that starts with `Z`) that the event
23
+ * schema does not name fits at any position. HL7v2 allows local Z-segments
24
+ * in any message and segment group (v2.5.1 §2.11). When `false`, such a
25
+ * segment leaves the tree flat. Default: `true`.
26
+ */
27
+ allowZSegments?: boolean;
28
+ }
29
+ /**
30
+ * Unified plugin that nests a message's segments in the segment groups its
31
+ * event schema defines, such as `PATIENT_RESULT` and `ORDER_OBSERVATION`.
32
+ *
33
+ * Groups by `options.definition`, or else by the schema MSH-12 and MSH-9
34
+ * name. Replaces the root's children with `Group` nodes holding the same
35
+ * segment nodes, in the same order. A group's position spans its first to its
36
+ * last segment. A Z-segment the schema does not name goes right after the
37
+ * segment before it, in that segment's group, unless `options.allowZSegments`
38
+ * is `false`.
39
+ *
40
+ * Runs only on a tree that holds segments and no group: a tree that already
41
+ * holds a group, from this plugin or another, is left as it is, and
42
+ * `options.definition` is not called for it. Also leaves the tree
43
+ * unchanged when there is no event schema or when the segments do not fit
44
+ * it. Idempotent.
45
+ *
46
+ * @throws {Error} When the event schema is invalid (see `runner`), or a
47
+ * bundled event schema fails to load.
48
+ */
49
+ export declare const hl7v2TransformProfileGroups: Plugin<[
50
+ TransformProfileGroupsOptions?
51
+ ], Root, Root>;
52
+ export default hl7v2TransformProfileGroups;
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,IAAI,EAAW,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAIjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,uEAAuE;AACvE,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;CACb;AAED,uDAAuD;AACvD,MAAM,WAAW,6BAA6B;IAC5C;;;;;;;OAOG;IACH,UAAU,CAAC,EACP,WAAW,GACX,CAAC,CACC,OAAO,EAAE,6BAA6B,KACnC,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC;IACrE;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAgDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C;IAAC,6BAA6B,CAAC;CAAC,EAChC,IAAI,EACJ,IAAI,CA6CL,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,94 @@
1
+ import { profiles, runner } from "@glion/profiles";
2
+ import { value } from "@glion/util-query";
3
+ import { EXIT, SKIP, visit } from "@glion/util-visit";
4
+ //#region src/index.ts
5
+ /**
6
+ * The bundled event schema MSH-12 and MSH-9 name: MSH-9.3, or MSH-9.1 and
7
+ * MSH-9.2, which the events store resolves through the version's event map.
8
+ * `undefined` when MSH-12 is empty or the version bundles no such schema.
9
+ */
10
+ const bundledEventSchema = async (tree) => {
11
+ const version = value(tree, "MSH-12.1")?.value;
12
+ if (!version) return;
13
+ const id = value(tree, "MSH-9.3")?.value || `${value(tree, "MSH-9.1")?.value ?? ""}_${value(tree, "MSH-9.2")?.value ?? ""}`;
14
+ return await profiles.events.load(version, id);
15
+ };
16
+ /**
17
+ * The tree node of one match: the segment it indexes, or a `Group` of its
18
+ * children's nodes, positioned from the start of its first segment to the
19
+ * end of its last.
20
+ */
21
+ const nodeOf = (match, segments) => {
22
+ if (typeof match === "number") {
23
+ const segment = segments[match];
24
+ if (!segment) throw new Error(`@glion/transform-profile-groups: a match indexes segment ${match} of ${segments.length}; this is a bug, please report it`);
25
+ return segment;
26
+ }
27
+ const children = match.children.map((child) => nodeOf(child, segments));
28
+ const group = {
29
+ children,
30
+ name: match.name,
31
+ type: "group"
32
+ };
33
+ const start = children[0]?.position?.start;
34
+ const end = children.at(-1)?.position?.end;
35
+ if (start && end) group.position = {
36
+ end,
37
+ start
38
+ };
39
+ return group;
40
+ };
41
+ /**
42
+ * Unified plugin that nests a message's segments in the segment groups its
43
+ * event schema defines, such as `PATIENT_RESULT` and `ORDER_OBSERVATION`.
44
+ *
45
+ * Groups by `options.definition`, or else by the schema MSH-12 and MSH-9
46
+ * name. Replaces the root's children with `Group` nodes holding the same
47
+ * segment nodes, in the same order. A group's position spans its first to its
48
+ * last segment. A Z-segment the schema does not name goes right after the
49
+ * segment before it, in that segment's group, unless `options.allowZSegments`
50
+ * is `false`.
51
+ *
52
+ * Runs only on a tree that holds segments and no group: a tree that already
53
+ * holds a group, from this plugin or another, is left as it is, and
54
+ * `options.definition` is not called for it. Also leaves the tree
55
+ * unchanged when there is no event schema or when the segments do not fit
56
+ * it. Idempotent.
57
+ *
58
+ * @throws {Error} When the event schema is invalid (see `runner`), or a
59
+ * bundled event schema fails to load.
60
+ */
61
+ const hl7v2TransformProfileGroups = (options) => async (tree, file) => {
62
+ let grouped = false;
63
+ const segments = [];
64
+ visit(tree, (node) => {
65
+ if (node.type === "group") {
66
+ grouped = true;
67
+ return EXIT;
68
+ }
69
+ if (node.type === "segment") {
70
+ segments.push(node);
71
+ return SKIP;
72
+ }
73
+ });
74
+ if (grouped || segments.length === 0) return tree;
75
+ const definition = options?.definition;
76
+ const schema = (typeof definition === "function" ? await definition({
77
+ file,
78
+ tree
79
+ }) : definition) ?? await bundledEventSchema(tree);
80
+ if (!schema) return tree;
81
+ const result = runner(schema, segments.map((segment) => segment.name), { allowZSegments: options?.allowZSegments });
82
+ switch (result.type) {
83
+ case "matched":
84
+ tree.children = result.groups.map((match) => nodeOf(match, segments));
85
+ break;
86
+ case "mismatched":
87
+ case "incomplete": break;
88
+ }
89
+ return tree;
90
+ };
91
+ //#endregion
92
+ export { hl7v2TransformProfileGroups as default, hl7v2TransformProfileGroups };
93
+
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Group, Root, Segment } from \"@glion/ast\";\nimport type { EventSchema, SegmentMatch } from \"@glion/profiles\";\nimport { profiles, runner } from \"@glion/profiles\";\nimport { value } from \"@glion/util-query\";\nimport { EXIT, SKIP, visit } from \"@glion/util-visit\";\nimport type { Plugin } from \"unified\";\nimport type { VFile } from \"vfile\";\n\n/** The message a `definition` function chooses an event schema for. */\nexport interface TransformProfileGroupsContext {\n tree: Root;\n file: VFile;\n}\n\n/** Options for {@link hl7v2TransformProfileGroups}. */\nexport interface TransformProfileGroupsOptions {\n /**\n * The event schema to group by, or a function that returns the one to use\n * for a message. Default: the schema MSH-9 names.\n *\n * When the function returns `undefined`, the plugin uses the schema MSH-9\n * names. Return the same object for every message that uses a schema: a\n * new object is compiled on its first run.\n */\n definition?:\n | EventSchema\n | ((\n context: TransformProfileGroupsContext\n ) => EventSchema | undefined | Promise<EventSchema | undefined>);\n /**\n * Whether a Z-segment (a segment ID that starts with `Z`) that the event\n * schema does not name fits at any position. HL7v2 allows local Z-segments\n * in any message and segment group (v2.5.1 §2.11). When `false`, such a\n * segment leaves the tree flat. Default: `true`.\n */\n allowZSegments?: boolean;\n}\n\n/**\n * The bundled event schema MSH-12 and MSH-9 name: MSH-9.3, or MSH-9.1 and\n * MSH-9.2, which the events store resolves through the version's event map.\n * `undefined` when MSH-12 is empty or the version bundles no such schema.\n */\nconst bundledEventSchema = async (\n tree: Root\n): Promise<EventSchema | undefined> => {\n const version = value(tree, \"MSH-12.1\")?.value;\n if (!version) {\n return;\n }\n const id =\n value(tree, \"MSH-9.3\")?.value ||\n `${value(tree, \"MSH-9.1\")?.value ?? \"\"}_${value(tree, \"MSH-9.2\")?.value ?? \"\"}`;\n return await profiles.events.load(version, id);\n};\n\n/**\n * The tree node of one match: the segment it indexes, or a `Group` of its\n * children's nodes, positioned from the start of its first segment to the\n * end of its last.\n */\nconst nodeOf = (\n match: SegmentMatch,\n segments: readonly Segment[]\n): Group | Segment => {\n if (typeof match === \"number\") {\n const segment = segments[match];\n if (!segment) {\n throw new Error(\n `@glion/transform-profile-groups: a match indexes segment ${match} of ${segments.length}; this is a bug, please report it`\n );\n }\n return segment;\n }\n const children = match.children.map((child) => nodeOf(child, segments));\n const group: Group = { children, name: match.name, type: \"group\" };\n const start = children[0]?.position?.start;\n const end = children.at(-1)?.position?.end;\n if (start && end) {\n group.position = { end, start };\n }\n return group;\n};\n\n/**\n * Unified plugin that nests a message's segments in the segment groups its\n * event schema defines, such as `PATIENT_RESULT` and `ORDER_OBSERVATION`.\n *\n * Groups by `options.definition`, or else by the schema MSH-12 and MSH-9\n * name. Replaces the root's children with `Group` nodes holding the same\n * segment nodes, in the same order. A group's position spans its first to its\n * last segment. A Z-segment the schema does not name goes right after the\n * segment before it, in that segment's group, unless `options.allowZSegments`\n * is `false`.\n *\n * Runs only on a tree that holds segments and no group: a tree that already\n * holds a group, from this plugin or another, is left as it is, and\n * `options.definition` is not called for it. Also leaves the tree\n * unchanged when there is no event schema or when the segments do not fit\n * it. Idempotent.\n *\n * @throws {Error} When the event schema is invalid (see `runner`), or a\n * bundled event schema fails to load.\n */\nexport const hl7v2TransformProfileGroups: Plugin<\n [TransformProfileGroupsOptions?],\n Root,\n Root\n> = (options) => async (tree, file) => {\n // A group means the tree is grouped already, by this plugin or another.\n let grouped = false;\n const segments: Segment[] = [];\n visit(tree, (node) => {\n if (node.type === \"group\") {\n grouped = true;\n return EXIT;\n }\n if (node.type === \"segment\") {\n segments.push(node);\n return SKIP;\n }\n });\n if (grouped || segments.length === 0) {\n return tree;\n }\n\n const definition = options?.definition;\n const chosen =\n typeof definition === \"function\"\n ? await definition({ file, tree })\n : definition;\n const schema = chosen ?? (await bundledEventSchema(tree));\n if (!schema) {\n return tree;\n }\n\n const result = runner(\n schema,\n segments.map((segment) => segment.name),\n { allowZSegments: options?.allowZSegments }\n );\n switch (result.type) {\n case \"matched\": {\n tree.children = result.groups.map((match) => nodeOf(match, segments));\n break;\n }\n case \"mismatched\":\n case \"incomplete\": {\n break;\n }\n }\n return tree;\n};\n\nexport default hl7v2TransformProfileGroups;\n"],"mappings":";;;;;;;;;AA2CA,MAAM,qBAAqB,OACzB,SACqC;CACrC,MAAM,UAAU,MAAM,MAAM,WAAW,EAAE;AACzC,KAAI,CAAC,QACH;CAEF,MAAM,KACJ,MAAM,MAAM,UAAU,EAAE,SACxB,GAAG,MAAM,MAAM,UAAU,EAAE,SAAS,GAAG,GAAG,MAAM,MAAM,UAAU,EAAE,SAAS;AAC7E,QAAO,MAAM,SAAS,OAAO,KAAK,SAAS,GAAG;;;;;;;AAQhD,MAAM,UACJ,OACA,aACoB;AACpB,KAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,UAAU,SAAS;AACzB,MAAI,CAAC,QACH,OAAM,IAAI,MACR,4DAA4D,MAAM,MAAM,SAAS,OAAO,mCACzF;AAEH,SAAO;;CAET,MAAM,WAAW,MAAM,SAAS,KAAK,UAAU,OAAO,OAAO,SAAS,CAAC;CACvE,MAAM,QAAe;EAAE;EAAU,MAAM,MAAM;EAAM,MAAM;EAAS;CAClE,MAAM,QAAQ,SAAS,IAAI,UAAU;CACrC,MAAM,MAAM,SAAS,GAAG,GAAG,EAAE,UAAU;AACvC,KAAI,SAAS,IACX,OAAM,WAAW;EAAE;EAAK;EAAO;AAEjC,QAAO;;;;;;;;;;;;;;;;;;;;;;AAuBT,MAAa,+BAIR,YAAY,OAAO,MAAM,SAAS;CAErC,IAAI,UAAU;CACd,MAAM,WAAsB,EAAE;AAC9B,OAAM,OAAO,SAAS;AACpB,MAAI,KAAK,SAAS,SAAS;AACzB,aAAU;AACV,UAAO;;AAET,MAAI,KAAK,SAAS,WAAW;AAC3B,YAAS,KAAK,KAAK;AACnB,UAAO;;GAET;AACF,KAAI,WAAW,SAAS,WAAW,EACjC,QAAO;CAGT,MAAM,aAAa,SAAS;CAK5B,MAAM,UAHJ,OAAO,eAAe,aAClB,MAAM,WAAW;EAAE;EAAM;EAAM,CAAC,GAChC,eACoB,MAAM,mBAAmB,KAAK;AACxD,KAAI,CAAC,OACH,QAAO;CAGT,MAAM,SAAS,OACb,QACA,SAAS,KAAK,YAAY,QAAQ,KAAK,EACvC,EAAE,gBAAgB,SAAS,gBAAgB,CAC5C;AACD,SAAQ,OAAO,MAAf;EACE,KAAK;AACH,QAAK,WAAW,OAAO,OAAO,KAAK,UAAU,OAAO,OAAO,SAAS,CAAC;AACrE;EAEF,KAAK;EACL,KAAK,aACH;;AAGJ,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@glion/transform-profile-groups",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.21.0",
4
+ "description": "Unified plugin to group HL7v2 segments into the segment groups their event schema defines",
5
+ "keywords": [
6
+ "group",
7
+ "health",
8
+ "healthcare",
9
+ "hl7",
10
+ "hl7v2",
11
+ "nodejs",
12
+ "plugin",
13
+ "profile",
14
+ "transform",
15
+ "typescript",
16
+ "unified"
17
+ ],
18
+ "homepage": "https://glion.dev",
19
+ "license": "MIT",
20
+ "author": {
21
+ "name": "Melek Somai",
22
+ "email": "melek@rethinkhealth.io"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/rethinkhealth/glion.git",
27
+ "directory": "packages/transform-profile-groups"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "type": "module",
33
+ "types": "./dist/index.d.ts",
34
+ "exports": {
35
+ ".": "./dist/index.js"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "dependencies": {
41
+ "unified": "11.0.5",
42
+ "vfile": "6.0.3",
43
+ "@glion/ast": "0.21.0",
44
+ "@glion/profiles": "0.21.0",
45
+ "@glion/util-visit": "0.21.0",
46
+ "@glion/util-query": "0.21.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "25.6.0",
50
+ "@vitest/coverage-v8": "4.1.11",
51
+ "publint": "0.3.18",
52
+ "tsdown": "0.21.10",
53
+ "typescript": "6.0.3",
54
+ "vitest": "4.1.11",
55
+ "@glion/check-readme": "0.18.0",
56
+ "@glion/annotate-profile-context": "0.21.0",
57
+ "@glion/annotate-profile-fields": "0.21.0",
58
+ "@glion/parser": "0.21.0",
59
+ "@glion/testing": "0.18.0",
60
+ "@glion/tsconfig": "0.18.0",
61
+ "@glion/to-hl7v2": "0.21.0"
62
+ },
63
+ "engines": {
64
+ "node": ">=22"
65
+ },
66
+ "scripts": {
67
+ "build": "tsdown && tsc --emitDeclarationOnly",
68
+ "check-types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
69
+ "check:readme": "glion-check-readme",
70
+ "test": "vitest run",
71
+ "test:coverage": "vitest run --coverage",
72
+ "test:watch": "vitest",
73
+ "publint": "publint --strict"
74
+ }
6
75
  }