@aehrc/ecl-core 1.6.2 → 1.7.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/README.md +181 -8
- package/dist/derive/compress-expression.d.ts +55 -0
- package/dist/derive/compress-expression.d.ts.map +1 -0
- package/dist/derive/cover-optimiser.d.ts +20 -0
- package/dist/derive/cover-optimiser.d.ts.map +1 -0
- package/dist/derive/critique.d.ts +25 -0
- package/dist/derive/critique.d.ts.map +1 -0
- package/dist/derive/derive-ecl.d.ts +262 -0
- package/dist/derive/derive-ecl.d.ts.map +1 -0
- package/dist/derive/greedy-grouping.d.ts +15 -0
- package/dist/derive/greedy-grouping.d.ts.map +1 -0
- package/dist/derive/hierarchy-clauses.d.ts +35 -0
- package/dist/derive/hierarchy-clauses.d.ts.map +1 -0
- package/dist/derive/refinements.d.ts +39 -0
- package/dist/derive/refinements.d.ts.map +1 -0
- package/dist/derive/set-queries.d.ts +53 -0
- package/dist/derive/set-queries.d.ts.map +1 -0
- package/dist/derive/taxonomy-graph.d.ts +38 -0
- package/dist/derive/taxonomy-graph.d.ts.map +1 -0
- package/dist/formatter/comments.d.ts +15 -0
- package/dist/formatter/comments.d.ts.map +1 -1
- package/dist/formatter/formatter.d.ts.map +1 -1
- package/dist/formatter/rules.d.ts +2 -0
- package/dist/formatter/rules.d.ts.map +1 -1
- package/dist/index.cjs +3280 -965
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3274 -966
- package/dist/refactoring/index.d.ts +2 -1
- package/dist/refactoring/index.d.ts.map +1 -1
- package/dist/refactoring/simplify-expression.d.ts +50 -0
- package/dist/refactoring/simplify-expression.d.ts.map +1 -1
- package/dist/terminology/fhir-service.d.ts +23 -1
- package/dist/terminology/fhir-service.d.ts.map +1 -1
- package/dist/terminology/types.d.ts +58 -0
- package/dist/terminology/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -23,5 +23,6 @@ export declare function getRefactoringActions(documentUri: string, documentText:
|
|
|
23
23
|
/** Marker for code actions that need async resolution (FHIR lookups) */
|
|
24
24
|
export declare const REFACTORING_RESOLVE_KIND = "ecl.refactoring.resolve";
|
|
25
25
|
export { resolveAddDisplayTerms } from './add-display-terms';
|
|
26
|
-
export { resolveUnifiedSimplify } from './simplify-expression';
|
|
26
|
+
export { resolveUnifiedSimplify, simplifyExpression } from './simplify-expression';
|
|
27
|
+
export type { SimplifyResult, SimplifyStep, SimplifyTechnique } from './simplify-expression';
|
|
27
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refactoring/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,eAAe,EAAE,SAAS,CAAC;IAC3B,+BAA+B;IAC/B,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB;AAsKD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,EAAE,CAgEnH;AAED,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refactoring/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,eAAe,EAAE,SAAS,CAAC;IAC3B,+BAA+B;IAC/B,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB;AAsKD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,EAAE,CAgEnH;AAED,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,12 +1,62 @@
|
|
|
1
1
|
import { CoreCodeAction } from '../types';
|
|
2
2
|
import { RefactoringContext } from './index';
|
|
3
3
|
import { ITerminologyService } from '../terminology/types';
|
|
4
|
+
/** Which technique produced a simplification step. */
|
|
5
|
+
export type SimplifyTechnique = 'removeDuplicates' | 'rankOperators' | 'factorFocus' | 'mergeFocus' | 'subsumption';
|
|
6
|
+
/** One transformation applied to an AND/OR compound during simplification. */
|
|
7
|
+
export interface SimplifyStep {
|
|
8
|
+
technique: SimplifyTechnique;
|
|
9
|
+
/** The compound operator of the node the technique was applied to. */
|
|
10
|
+
compoundOperator: 'AND' | 'OR';
|
|
11
|
+
/** The node's operands before the step. */
|
|
12
|
+
operands: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Operands dropped because another operand makes them redundant. Empty for
|
|
15
|
+
* `factorFocus` / `mergeFocus`, which combine every operand into one.
|
|
16
|
+
*/
|
|
17
|
+
removed: string[];
|
|
18
|
+
/** The node's text after the step. */
|
|
19
|
+
result: string;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
22
|
* Returns a "Simplify" code action when the expression contains any
|
|
6
23
|
* AND/OR compound with 2+ operands at any nesting level.
|
|
7
24
|
* Uses the resolve pattern since FHIR subsumption is async.
|
|
8
25
|
*/
|
|
9
26
|
export declare function getUnifiedSimplifyAction(ctx: RefactoringContext): CoreCodeAction | null;
|
|
27
|
+
/** Result of {@link simplifyExpression}. */
|
|
28
|
+
export interface SimplifyResult {
|
|
29
|
+
/** The simplified expression, or the input unchanged when nothing applied. */
|
|
30
|
+
expression: string;
|
|
31
|
+
/** True when at least one step applied (`expression` then differs from the input). */
|
|
32
|
+
changed: boolean;
|
|
33
|
+
/** The steps applied, innermost compounds first, in the order they fired. */
|
|
34
|
+
steps: SimplifyStep[];
|
|
35
|
+
/**
|
|
36
|
+
* Whether technique 4 (subsumption through the terminology server) ran:
|
|
37
|
+
* - `'not-run'`: no terminology service was given, so only the syntactic techniques ran
|
|
38
|
+
* - `'not-applicable'`: a service was given, but no AND/OR compound with 2+ operands was
|
|
39
|
+
* left for it to check (a single concept, MINUS only, or the syntactic steps collapsed it)
|
|
40
|
+
* - `'complete'`: it ran and every evaluation succeeded
|
|
41
|
+
* - `'partial'`: some evaluations failed; those operand pairs were left as they were
|
|
42
|
+
*/
|
|
43
|
+
subsumption: 'not-run' | 'not-applicable' | 'complete' | 'partial';
|
|
44
|
+
/**
|
|
45
|
+
* Syntax error messages when the input does not parse. The input is then
|
|
46
|
+
* returned unchanged with no steps, as the editor code action refuses it too.
|
|
47
|
+
*/
|
|
48
|
+
errors: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Simplify an ECL expression without changing the set of concepts it selects,
|
|
52
|
+
* and report how. This is the engine behind the editor's "Simplify" code
|
|
53
|
+
* action, as a plain function for callers outside the editor.
|
|
54
|
+
*
|
|
55
|
+
* Techniques 1-3 (duplicates, same-concept operator ranking, factoring or
|
|
56
|
+
* merging a shared focus) are syntactic. Technique 4 (dropping an operand
|
|
57
|
+
* subsumed by another) needs `terminologyService`, and is skipped without one.
|
|
58
|
+
*/
|
|
59
|
+
export declare function simplifyExpression(ecl: string, terminologyService?: ITerminologyService | null): Promise<SimplifyResult>;
|
|
10
60
|
/**
|
|
11
61
|
* Resolves the unified "Simplify" code action by running the full
|
|
12
62
|
* bottom-up engine with all techniques including FHIR subsumption.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplify-expression.d.ts","sourceRoot":"","sources":["../../src/refactoring/simplify-expression.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"simplify-expression.d.ts","sourceRoot":"","sources":["../../src/refactoring/simplify-expression.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA4YhE,sDAAsD;AACtD,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,eAAe,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,CAAC;AAEpH,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,sEAAsE;IACtE,gBAAgB,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AA6MD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,kBAAkB,GAAG,cAAc,GAAG,IAAI,CAwBvF;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB;;;;;;;OAOG;IACH,WAAW,EAAE,SAAS,GAAG,gBAAgB,GAAG,UAAU,GAAG,SAAS,CAAC;IACnE;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,kBAAkB,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAC9C,OAAO,CAAC,cAAc,CAAC,CAoBzB;AA2BD;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,cAAc,EAC1B,kBAAkB,EAAE,mBAAmB,GACtC,OAAO,CAAC,cAAc,CAAC,CAYzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITerminologyService, ConceptInfo, SearchResponse, EvaluationResponse, HistoricalAssociation } from './types';
|
|
1
|
+
import { ITerminologyService, ConceptInfo, SearchResponse, EvaluationResponse, ExpandComposeOptions, DefiningRelationship, ValueSetCompose, HistoricalAssociation } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* How {@link FhirTerminologyService.evaluateEcl} carries the ECL to the terminology server.
|
|
4
4
|
*
|
|
@@ -171,6 +171,28 @@ export declare class FhirTerminologyService implements ITerminologyService {
|
|
|
171
171
|
* JSON body, so it needs no escaping at all.
|
|
172
172
|
*/
|
|
173
173
|
private evaluateViaPostExpand;
|
|
174
|
+
/**
|
|
175
|
+
* `$lookup` with `property=*`: SNOMED CT servers list each role group as a
|
|
176
|
+
* `609096000` property whose sub-properties are `attribute = value` pairs, and
|
|
177
|
+
* ungrouped attributes as properties coded by the attribute id.
|
|
178
|
+
*
|
|
179
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
180
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
181
|
+
*/
|
|
182
|
+
getDefiningRelationships(conceptId: string): Promise<DefiningRelationship[] | null>;
|
|
183
|
+
/** The relationships in a `$lookup` response's `property` parameters; role groups are numbered from 1. */
|
|
184
|
+
private static relationshipsOf;
|
|
185
|
+
/** A relationship value in ECL form: a concept id, or a concrete `#500`, `"text"` or `true`. */
|
|
186
|
+
private static eclValue;
|
|
187
|
+
/**
|
|
188
|
+
* `POST ValueSet/$expand` with an inline `compose` mixing ECL filters and enumerated
|
|
189
|
+
* concepts. The difference between an expression and a list of 100,000 codes is one
|
|
190
|
+
* request of about 2 MB that Ontoserver answers in seconds (measured for issue #147).
|
|
191
|
+
*
|
|
192
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
193
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
194
|
+
*/
|
|
195
|
+
expandCompose(compose: ValueSetCompose, options?: ExpandComposeOptions): Promise<EvaluationResponse>;
|
|
174
196
|
/**
|
|
175
197
|
* True when an implicit-URL failure indicates the implicit ValueSet *form* is unsupported
|
|
176
198
|
* rather than the expression being invalid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fhir-service.d.ts","sourceRoot":"","sources":["../../src/terminology/fhir-service.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,EAEd,kBAAkB,EAClB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"fhir-service.d.ts","sourceRoot":"","sources":["../../src/terminology/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,6 +16,8 @@ export interface SearchResponse {
|
|
|
16
16
|
export interface EvaluationConcept {
|
|
17
17
|
code: string;
|
|
18
18
|
display: string;
|
|
19
|
+
/** Direct IS-A parents, when asked for with `ExpandComposeOptions.parents` and the server returns them. */
|
|
20
|
+
parents?: string[];
|
|
19
21
|
}
|
|
20
22
|
export interface EvaluationResponse {
|
|
21
23
|
total: number;
|
|
@@ -75,5 +77,61 @@ export interface ITerminologyService {
|
|
|
75
77
|
evaluateEcl(expression: string, limit?: number): Promise<EvaluationResponse>;
|
|
76
78
|
/** Historical associations for an inactive concept, if the source supports them. */
|
|
77
79
|
getHistoricalAssociations?(conceptId: string): Promise<HistoricalAssociation[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Expand a set built from ECL expressions and enumerated concepts, computed by
|
|
82
|
+
* the source rather than by downloading each part: the union of `include`
|
|
83
|
+
* minus the union of `exclude`. Lets callers compare an expression with a
|
|
84
|
+
* concept list of any size (FHIR: `POST ValueSet/$expand` with an inline
|
|
85
|
+
* `compose`). Optional; features that need it say so when it is missing.
|
|
86
|
+
*
|
|
87
|
+
* `total` is exact. Inactive concepts are left out unless `activeOnly` is false.
|
|
88
|
+
* Enumerated codes the source does not know are dropped silently.
|
|
89
|
+
* @throws `TerminologyTransportError` / `TerminologyHttpError` on failure.
|
|
90
|
+
*/
|
|
91
|
+
expandCompose?(compose: ValueSetCompose, options?: ExpandComposeOptions): Promise<EvaluationResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* A concept's defining relationships other than IS-A, each with its role group
|
|
94
|
+
* (0 for ungrouped). Optional; used to propose attribute refinements.
|
|
95
|
+
*
|
|
96
|
+
* @returns an empty list for a primitive concept with no attributes; `null`
|
|
97
|
+
* when the server says the concept is unknown.
|
|
98
|
+
* @throws `TerminologyTransportError` / `TerminologyHttpError` on failure.
|
|
99
|
+
*/
|
|
100
|
+
getDefiningRelationships?(conceptId: string): Promise<DefiningRelationship[] | null>;
|
|
101
|
+
}
|
|
102
|
+
/** One `attribute = value` relationship of a concept. */
|
|
103
|
+
export interface DefiningRelationship {
|
|
104
|
+
type: string;
|
|
105
|
+
/** A concept id, or a concrete value in ECL form: `#500`, `#1.5`, `"text"`, `true`. */
|
|
106
|
+
value: string;
|
|
107
|
+
/** Role group number; 0 for an ungrouped attribute. */
|
|
108
|
+
group: number;
|
|
109
|
+
}
|
|
110
|
+
/** One part of a {@link ValueSetCompose}: an ECL expression or an enumerated list of concept ids. */
|
|
111
|
+
export type ValueSetClause = {
|
|
112
|
+
ecl: string;
|
|
113
|
+
} | {
|
|
114
|
+
concepts: string[];
|
|
115
|
+
};
|
|
116
|
+
/** A set expressed as `(include₁ ∪ include₂ …) − (exclude₁ ∪ exclude₂ …)`. */
|
|
117
|
+
export interface ValueSetCompose {
|
|
118
|
+
include: ValueSetClause[];
|
|
119
|
+
exclude?: ValueSetClause[];
|
|
120
|
+
}
|
|
121
|
+
export interface ExpandComposeOptions {
|
|
122
|
+
/** Maximum concepts to return (0 for the total only). Default 0. */
|
|
123
|
+
count?: number;
|
|
124
|
+
/** Index of the first concept to return, for paging. Default 0. */
|
|
125
|
+
offset?: number;
|
|
126
|
+
/** Leave out inactive concepts. Default true. */
|
|
127
|
+
activeOnly?: boolean;
|
|
128
|
+
/** Request timeout in milliseconds; large enumerations need more than an ECL lookup. */
|
|
129
|
+
timeoutMs?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Also return each concept's direct parents (`EvaluationConcept.parents`).
|
|
132
|
+
* Default false. A server that does not support it returns concepts without
|
|
133
|
+
* `parents`.
|
|
134
|
+
*/
|
|
135
|
+
parents?: boolean;
|
|
78
136
|
}
|
|
79
137
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/terminology/types.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,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