@outburn/fume-mapping-provider 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 +21 -0
- package/README.md +397 -0
- package/dist/FumeMappingProvider.d.ts +112 -0
- package/dist/FumeMappingProvider.d.ts.map +1 -0
- package/dist/FumeMappingProvider.js +245 -0
- package/dist/FumeMappingProvider.js.map +1 -0
- package/dist/converters.d.ts +32 -0
- package/dist/converters.d.ts.map +1 -0
- package/dist/converters.js +201 -0
- package/dist/converters.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/providers.d.ts +61 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +475 -0
- package/dist/providers.js.map +1 -0
- package/dist/types.d.ts +191 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AliasProvider = exports.PackageMappingProvider = exports.UserMappingProvider = void 0;
|
|
37
|
+
const converters_1 = require("./converters");
|
|
38
|
+
/**
|
|
39
|
+
* Validate that a StructureMap is a FUME mapping
|
|
40
|
+
* Must have the correct useContext and fume expression extension
|
|
41
|
+
*/
|
|
42
|
+
function isFumeMapping(structureMap) {
|
|
43
|
+
// Check for fume expression in rule extensions
|
|
44
|
+
/* istanbul ignore if */
|
|
45
|
+
if (!structureMap.group || structureMap.group.length === 0) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
for (const group of structureMap.group) {
|
|
49
|
+
/* istanbul ignore if */
|
|
50
|
+
if (!group.rule || group.rule.length === 0) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
for (const rule of group.rule) {
|
|
54
|
+
if (!rule.extension || rule.extension.length === 0) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const hasFumeExtension = rule.extension.some(
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
(ext) => ext.url === 'http://fhir.fume.health/StructureDefinition/mapping-expression' &&
|
|
60
|
+
ext.valueExpression?.expression);
|
|
61
|
+
if (hasFumeExtension) {
|
|
62
|
+
// Check for appropriate useContext (optional but recommended)
|
|
63
|
+
/* istanbul ignore if */
|
|
64
|
+
if (structureMap.useContext && structureMap.useContext.length > 0) {
|
|
65
|
+
const hasFumeContext = structureMap.useContext.some(ctx => ctx.valueCodeableConcept?.coding?.some(coding => coding.system?.includes('fume') || coding.code === 'fume'));
|
|
66
|
+
return hasFumeContext;
|
|
67
|
+
}
|
|
68
|
+
// If no useContext, accept based on extension alone
|
|
69
|
+
/* istanbul ignore next */
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Provider for user mappings (file + server)
|
|
78
|
+
* Handles collision resolution: file overrides server
|
|
79
|
+
*/
|
|
80
|
+
class UserMappingProvider {
|
|
81
|
+
constructor(mappingsFolder,
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
fhirClient, logger, fileExtension) {
|
|
84
|
+
this.mappingsFolder = mappingsFolder;
|
|
85
|
+
this.fhirClient = fhirClient;
|
|
86
|
+
this.logger = logger;
|
|
87
|
+
this.fileExtension = fileExtension || '.fume';
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Load all user mappings from file and server
|
|
91
|
+
* File mappings override server mappings on key collision (with warning)
|
|
92
|
+
*/
|
|
93
|
+
async loadMappings() {
|
|
94
|
+
const mappings = new Map();
|
|
95
|
+
// Load from server first
|
|
96
|
+
if (this.fhirClient) {
|
|
97
|
+
const serverMappings = await this.loadServerMappings();
|
|
98
|
+
for (const [key, mapping] of serverMappings) {
|
|
99
|
+
mappings.set(key, mapping);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Load from file (overrides server)
|
|
103
|
+
if (this.mappingsFolder) {
|
|
104
|
+
const fileMappings = await this.loadFileMappings();
|
|
105
|
+
for (const [key, mapping] of fileMappings) {
|
|
106
|
+
if (mappings.has(key)) {
|
|
107
|
+
this.logger?.warn?.(`File mapping '${key}' overrides server mapping with same key`);
|
|
108
|
+
}
|
|
109
|
+
mappings.set(key, mapping);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return mappings;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Refresh a specific user mapping by key
|
|
116
|
+
* Checks both file and server (file takes precedence)
|
|
117
|
+
*/
|
|
118
|
+
async refreshMapping(key) {
|
|
119
|
+
// Check file first
|
|
120
|
+
if (this.mappingsFolder) {
|
|
121
|
+
const fileMapping = await this.loadFileMapping(key);
|
|
122
|
+
if (fileMapping) {
|
|
123
|
+
return fileMapping;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Check server
|
|
127
|
+
if (this.fhirClient) {
|
|
128
|
+
const serverMapping = await this.loadServerMapping(key);
|
|
129
|
+
if (serverMapping) {
|
|
130
|
+
return serverMapping;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/* istanbul ignore next */
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
async loadFileMappings() {
|
|
137
|
+
const mappings = new Map();
|
|
138
|
+
/* istanbul ignore if */
|
|
139
|
+
if (!this.mappingsFolder) {
|
|
140
|
+
return mappings;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
144
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
145
|
+
const files = await fs.readdir(this.mappingsFolder);
|
|
146
|
+
const mappingFiles = files.filter(f => f.endsWith(this.fileExtension));
|
|
147
|
+
for (const file of mappingFiles) {
|
|
148
|
+
try {
|
|
149
|
+
const filePath = path.join(this.mappingsFolder, file);
|
|
150
|
+
const expression = await fs.readFile(filePath, 'utf-8');
|
|
151
|
+
const key = path.basename(file, this.fileExtension);
|
|
152
|
+
mappings.set(key, {
|
|
153
|
+
key,
|
|
154
|
+
expression,
|
|
155
|
+
source: 'file',
|
|
156
|
+
filename: file
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
/* istanbul ignore next */
|
|
161
|
+
this.logger?.error?.(`Failed to load mapping from file ${file}:`, error);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
/* istanbul ignore next */
|
|
167
|
+
this.logger?.error?.(`Failed to read mappings folder ${this.mappingsFolder}:`, error);
|
|
168
|
+
}
|
|
169
|
+
return mappings;
|
|
170
|
+
}
|
|
171
|
+
async loadFileMapping(key) {
|
|
172
|
+
/* istanbul ignore if */
|
|
173
|
+
if (!this.mappingsFolder) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
178
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
179
|
+
const filename = `${key}${this.fileExtension}`;
|
|
180
|
+
const filePath = path.join(this.mappingsFolder, filename);
|
|
181
|
+
const expression = await fs.readFile(filePath, 'utf-8');
|
|
182
|
+
return {
|
|
183
|
+
key,
|
|
184
|
+
expression,
|
|
185
|
+
source: 'file',
|
|
186
|
+
filename
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
catch (_error) {
|
|
190
|
+
/* istanbul ignore next */
|
|
191
|
+
// File not found
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async loadServerMappings() {
|
|
196
|
+
const mappings = new Map();
|
|
197
|
+
/* istanbul ignore if */
|
|
198
|
+
if (!this.fhirClient) {
|
|
199
|
+
return mappings;
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
const serverUrl = this.fhirClient.getBaseUrl();
|
|
203
|
+
this.logger?.debug?.(`Loading mappings from FHIR server ${serverUrl}`);
|
|
204
|
+
// Search for all StructureMap resources using fetchAll for automatic pagination
|
|
205
|
+
const resources = await this.fhirClient.search('StructureMap', {}, { fetchAll: true, noCache: true });
|
|
206
|
+
if (resources && Array.isArray(resources)) {
|
|
207
|
+
for (const structureMap of resources) {
|
|
208
|
+
// Only process FUME mappings
|
|
209
|
+
const isFume = isFumeMapping(structureMap);
|
|
210
|
+
/* istanbul ignore if */
|
|
211
|
+
if (!isFume) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
215
|
+
if (expression) {
|
|
216
|
+
mappings.set(structureMap.id, {
|
|
217
|
+
key: structureMap.id,
|
|
218
|
+
expression,
|
|
219
|
+
source: 'server',
|
|
220
|
+
sourceServer: serverUrl,
|
|
221
|
+
name: structureMap.name,
|
|
222
|
+
url: structureMap.url
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
/* istanbul ignore next */
|
|
230
|
+
const serverUrl = this.fhirClient.getBaseUrl();
|
|
231
|
+
/* istanbul ignore next */
|
|
232
|
+
this.logger?.error?.(`Failed to load mappings from server ${serverUrl}:`, error);
|
|
233
|
+
}
|
|
234
|
+
return mappings;
|
|
235
|
+
}
|
|
236
|
+
async loadServerMapping(key) {
|
|
237
|
+
/* istanbul ignore if */
|
|
238
|
+
if (!this.fhirClient) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const serverUrl = this.fhirClient.getBaseUrl();
|
|
243
|
+
const structureMap = await this.fhirClient.read('StructureMap', key, { noCache: true });
|
|
244
|
+
if (structureMap && isFumeMapping(structureMap)) {
|
|
245
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
246
|
+
if (expression) {
|
|
247
|
+
return {
|
|
248
|
+
key: structureMap.id,
|
|
249
|
+
expression,
|
|
250
|
+
source: 'server',
|
|
251
|
+
sourceServer: serverUrl,
|
|
252
|
+
name: structureMap.name,
|
|
253
|
+
url: structureMap.url
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (_error) {
|
|
259
|
+
/* istanbul ignore next */
|
|
260
|
+
// Resource not found
|
|
261
|
+
}
|
|
262
|
+
/* istanbul ignore next */
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
exports.UserMappingProvider = UserMappingProvider;
|
|
267
|
+
/**
|
|
268
|
+
* Provider for package mappings
|
|
269
|
+
* No collision handling needed - packages are immutable
|
|
270
|
+
*/
|
|
271
|
+
class PackageMappingProvider {
|
|
272
|
+
constructor(
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
274
|
+
packageExplorer, logger) {
|
|
275
|
+
this.packageExplorer = packageExplorer;
|
|
276
|
+
this.logger = logger;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Load all package mappings
|
|
280
|
+
* Returns array since package mappings don't need key-based lookup
|
|
281
|
+
*/
|
|
282
|
+
async loadMappings(options) {
|
|
283
|
+
const mappings = [];
|
|
284
|
+
try {
|
|
285
|
+
this.logger?.debug?.('Loading StructureMap resources from package context');
|
|
286
|
+
// Build filter
|
|
287
|
+
const filter = { resourceType: 'StructureMap' };
|
|
288
|
+
if (options?.packageContext) {
|
|
289
|
+
filter.package = options.packageContext;
|
|
290
|
+
}
|
|
291
|
+
// Load all StructureMap resources from the package context
|
|
292
|
+
const structureMaps = await this.packageExplorer.lookup(filter);
|
|
293
|
+
for (const structureMap of structureMaps) {
|
|
294
|
+
// Only process FUME mappings
|
|
295
|
+
if (!isFumeMapping(structureMap)) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
299
|
+
if (expression && structureMap.__packageId && structureMap.__packageVersion) {
|
|
300
|
+
mappings.push({
|
|
301
|
+
id: structureMap.id,
|
|
302
|
+
expression,
|
|
303
|
+
packageId: structureMap.__packageId,
|
|
304
|
+
packageVersion: structureMap.__packageVersion,
|
|
305
|
+
filename: structureMap.__filename,
|
|
306
|
+
name: structureMap.name,
|
|
307
|
+
url: structureMap.url
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
/* istanbul ignore next */
|
|
314
|
+
this.logger?.error?.('Failed to load mappings from packages:', error);
|
|
315
|
+
}
|
|
316
|
+
return mappings;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Get a package mapping by identifier (tries url, id, name in order)
|
|
320
|
+
* Returns first successful resolution
|
|
321
|
+
*/
|
|
322
|
+
async getMapping(identifier, options) {
|
|
323
|
+
// Build base filter
|
|
324
|
+
const baseFilter = { resourceType: 'StructureMap' };
|
|
325
|
+
if (options?.packageContext) {
|
|
326
|
+
baseFilter.package = options.packageContext;
|
|
327
|
+
}
|
|
328
|
+
// Try URL first (most specific)
|
|
329
|
+
try {
|
|
330
|
+
const filter = { ...baseFilter, url: identifier };
|
|
331
|
+
const structureMap = await this.packageExplorer.resolve(filter);
|
|
332
|
+
if (structureMap && isFumeMapping(structureMap)) {
|
|
333
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
334
|
+
if (expression && structureMap.__packageId && structureMap.__packageVersion) {
|
|
335
|
+
return {
|
|
336
|
+
id: structureMap.id,
|
|
337
|
+
expression,
|
|
338
|
+
packageId: structureMap.__packageId,
|
|
339
|
+
packageVersion: structureMap.__packageVersion,
|
|
340
|
+
filename: structureMap.__filename,
|
|
341
|
+
name: structureMap.name,
|
|
342
|
+
url: structureMap.url
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch (_error) {
|
|
348
|
+
/* istanbul ignore next */
|
|
349
|
+
// Not found or duplicate, try next
|
|
350
|
+
}
|
|
351
|
+
// Try ID
|
|
352
|
+
try {
|
|
353
|
+
const filter = { ...baseFilter, id: identifier };
|
|
354
|
+
const structureMap = await this.packageExplorer.resolve(filter);
|
|
355
|
+
if (structureMap && isFumeMapping(structureMap)) {
|
|
356
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
357
|
+
if (expression && structureMap.__packageId && structureMap.__packageVersion) {
|
|
358
|
+
return {
|
|
359
|
+
id: structureMap.id,
|
|
360
|
+
expression,
|
|
361
|
+
packageId: structureMap.__packageId,
|
|
362
|
+
packageVersion: structureMap.__packageVersion,
|
|
363
|
+
filename: structureMap.__filename,
|
|
364
|
+
name: structureMap.name,
|
|
365
|
+
url: structureMap.url
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
catch (_error) {
|
|
371
|
+
/* istanbul ignore next */
|
|
372
|
+
// Not found or duplicate, try next
|
|
373
|
+
}
|
|
374
|
+
// Try name (least specific)
|
|
375
|
+
try {
|
|
376
|
+
const filter = { ...baseFilter, name: identifier };
|
|
377
|
+
const structureMaps = await this.packageExplorer.lookup(filter);
|
|
378
|
+
if (structureMaps && structureMaps.length > 0) {
|
|
379
|
+
const structureMap = structureMaps[0];
|
|
380
|
+
if (isFumeMapping(structureMap)) {
|
|
381
|
+
const expression = (0, converters_1.structureMapToExpression)(structureMap);
|
|
382
|
+
if (expression && structureMap.__packageId && structureMap.__packageVersion) {
|
|
383
|
+
return {
|
|
384
|
+
id: structureMap.id,
|
|
385
|
+
expression,
|
|
386
|
+
packageId: structureMap.__packageId,
|
|
387
|
+
packageVersion: structureMap.__packageVersion,
|
|
388
|
+
filename: structureMap.__filename,
|
|
389
|
+
name: structureMap.name,
|
|
390
|
+
url: structureMap.url
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
catch (_error) {
|
|
397
|
+
/* istanbul ignore next */
|
|
398
|
+
// Not found
|
|
399
|
+
}
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
exports.PackageMappingProvider = PackageMappingProvider;
|
|
404
|
+
/**
|
|
405
|
+
* Validate that a ConceptMap is a FUME alias resource
|
|
406
|
+
* Must have the correct useContext
|
|
407
|
+
*/
|
|
408
|
+
function isFumeAliasResource(conceptMap) {
|
|
409
|
+
if (!conceptMap.useContext || conceptMap.useContext.length === 0) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
return conceptMap.useContext.some(ctx => ctx.code?.system === 'http://snomed.info/sct' &&
|
|
413
|
+
ctx.code?.code === '706594005' &&
|
|
414
|
+
ctx.valueCodeableConcept?.coding?.some(coding => coding.system === 'http://codes.fume.health' && coding.code === 'fume'));
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Provider for aliases (server only)
|
|
418
|
+
* Handles loading and transforming FUME alias ConceptMap resources
|
|
419
|
+
*/
|
|
420
|
+
class AliasProvider {
|
|
421
|
+
constructor(
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
423
|
+
fhirClient, logger) {
|
|
424
|
+
this.fhirClient = fhirClient;
|
|
425
|
+
this.logger = logger;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Load aliases from FHIR server
|
|
429
|
+
* @returns AliasObject with all aliases, or empty object if none found
|
|
430
|
+
*/
|
|
431
|
+
async loadAliases() {
|
|
432
|
+
/* istanbul ignore if */
|
|
433
|
+
if (!this.fhirClient) {
|
|
434
|
+
return {};
|
|
435
|
+
}
|
|
436
|
+
try {
|
|
437
|
+
const serverUrl = this.fhirClient.getBaseUrl();
|
|
438
|
+
this.logger?.debug?.(`Loading aliases from FHIR server ${serverUrl}`);
|
|
439
|
+
// Search for ConceptMap with name=FumeAliases and context parameter
|
|
440
|
+
const searchParams = {
|
|
441
|
+
name: 'FumeAliases',
|
|
442
|
+
context: 'http://codes.fume.health|fume'
|
|
443
|
+
};
|
|
444
|
+
const resources = await this.fhirClient.search('ConceptMap', searchParams, { fetchAll: true, noCache: true });
|
|
445
|
+
if (!resources || !Array.isArray(resources) || resources.length === 0) {
|
|
446
|
+
this.logger?.debug?.('No alias ConceptMap found on server');
|
|
447
|
+
return {};
|
|
448
|
+
}
|
|
449
|
+
// Filter client-side in case server ignores context parameter
|
|
450
|
+
const aliasResources = resources.filter((cm) => isFumeAliasResource(cm));
|
|
451
|
+
if (aliasResources.length === 0) {
|
|
452
|
+
this.logger?.debug?.('No alias ConceptMap with correct useContext found');
|
|
453
|
+
return {};
|
|
454
|
+
}
|
|
455
|
+
if (aliasResources.length > 1) {
|
|
456
|
+
this.logger?.error?.(`Found ${aliasResources.length} alias ConceptMaps - expected exactly 1. Skipping alias loading.`);
|
|
457
|
+
return {};
|
|
458
|
+
}
|
|
459
|
+
const conceptMap = aliasResources[0];
|
|
460
|
+
const aliases = (0, converters_1.conceptMapToAliasObject)(conceptMap, this.logger);
|
|
461
|
+
this.logger?.info?.(`Loaded ${Object.keys(aliases).length} alias(es) from server`);
|
|
462
|
+
return aliases;
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
/* istanbul ignore next */
|
|
466
|
+
const serverUrl = this.fhirClient.getBaseUrl();
|
|
467
|
+
/* istanbul ignore next */
|
|
468
|
+
this.logger?.error?.(`Failed to load aliases from server ${serverUrl}:`, error);
|
|
469
|
+
/* istanbul ignore next */
|
|
470
|
+
return {};
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
exports.AliasProvider = AliasProvider;
|
|
475
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAAiF;AAEjF;;;GAGG;AACH,SAAS,aAAa,CAAC,YAA0B;IAC/C,+CAA+C;IAC/C,wBAAwB;IACx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C,CAAC;YAEjE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,wBAAwB,CAAC,CAAC;YACnF,OAAO,OAAO,CAAC;QAEjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0BAA0B;YAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC/C,0BAA0B;YAC1B,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,sCAAsC,SAAS,GAAG,EAAE,KAAK,CAAC,CAAC;YAChF,0BAA0B;YAC1B,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA9DD,sCA8DC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { FhirClient } from '@outburn/fhir-client';
|
|
2
|
+
import type { FhirPackageIdentifier, Logger, Resource } from '@outburn/types';
|
|
3
|
+
import { FhirPackageExplorer } from 'fhir-package-explorer';
|
|
4
|
+
/**
|
|
5
|
+
* Extended Resource type with FPE enrichment properties
|
|
6
|
+
*/
|
|
7
|
+
export interface EnrichedResource extends Resource {
|
|
8
|
+
/** Package ID enriched by fhir-package-explorer */
|
|
9
|
+
__packageId?: string;
|
|
10
|
+
/** Package version enriched by fhir-package-explorer */
|
|
11
|
+
__packageVersion?: string;
|
|
12
|
+
/** Filename enriched by fhir-package-explorer */
|
|
13
|
+
__filename?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* User mapping metadata (from file or server)
|
|
17
|
+
*/
|
|
18
|
+
export interface UserMappingMetadata {
|
|
19
|
+
/** Unique key (ID) for the mapping */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Source: 'file' or 'server' */
|
|
22
|
+
source: 'file' | 'server';
|
|
23
|
+
/** Filename (for file sources) */
|
|
24
|
+
filename?: string;
|
|
25
|
+
/** Source FHIR server URL (for server sources) */
|
|
26
|
+
sourceServer?: string;
|
|
27
|
+
/** StructureMap resource name (if applicable) */
|
|
28
|
+
name?: string;
|
|
29
|
+
/** StructureMap canonical URL (if applicable) */
|
|
30
|
+
url?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A complete user mapping with expression and metadata
|
|
34
|
+
*/
|
|
35
|
+
export interface UserMapping extends UserMappingMetadata {
|
|
36
|
+
/** The FUME expression */
|
|
37
|
+
expression: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Package mapping metadata
|
|
41
|
+
*/
|
|
42
|
+
export interface PackageMappingMetadata {
|
|
43
|
+
/** Resource ID */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Package ID */
|
|
46
|
+
packageId: string;
|
|
47
|
+
/** Package version */
|
|
48
|
+
packageVersion: string;
|
|
49
|
+
/** Filename in package */
|
|
50
|
+
filename: string;
|
|
51
|
+
/** StructureMap resource name (if applicable) */
|
|
52
|
+
name?: string;
|
|
53
|
+
/** StructureMap canonical URL (if applicable) */
|
|
54
|
+
url?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A complete package mapping with expression and metadata
|
|
58
|
+
*/
|
|
59
|
+
export interface PackageMapping extends PackageMappingMetadata {
|
|
60
|
+
/** The FUME expression */
|
|
61
|
+
expression: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* FHIR StructureMap resource (simplified)
|
|
65
|
+
* Extended with FPE enrichment properties
|
|
66
|
+
*/
|
|
67
|
+
export interface StructureMap extends EnrichedResource {
|
|
68
|
+
resourceType: 'StructureMap';
|
|
69
|
+
id: string;
|
|
70
|
+
url?: string;
|
|
71
|
+
identifier?: Array<{
|
|
72
|
+
use?: string;
|
|
73
|
+
type?: {
|
|
74
|
+
text?: string;
|
|
75
|
+
};
|
|
76
|
+
system?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
}>;
|
|
79
|
+
name?: string;
|
|
80
|
+
title?: string;
|
|
81
|
+
status?: string;
|
|
82
|
+
date?: string;
|
|
83
|
+
useContext?: Array<{
|
|
84
|
+
code?: {
|
|
85
|
+
system?: string;
|
|
86
|
+
code?: string;
|
|
87
|
+
display?: string;
|
|
88
|
+
};
|
|
89
|
+
valueCodeableConcept?: {
|
|
90
|
+
coding?: Array<{
|
|
91
|
+
system?: string;
|
|
92
|
+
code?: string;
|
|
93
|
+
display?: string;
|
|
94
|
+
}>;
|
|
95
|
+
text?: string;
|
|
96
|
+
};
|
|
97
|
+
}>;
|
|
98
|
+
group?: Array<{
|
|
99
|
+
name?: string;
|
|
100
|
+
typeMode?: string;
|
|
101
|
+
input?: Array<{
|
|
102
|
+
name?: string;
|
|
103
|
+
mode?: string;
|
|
104
|
+
}>;
|
|
105
|
+
rule?: Array<{
|
|
106
|
+
extension?: Array<{
|
|
107
|
+
url?: string;
|
|
108
|
+
valueExpression?: {
|
|
109
|
+
language?: string;
|
|
110
|
+
expression?: string;
|
|
111
|
+
};
|
|
112
|
+
}>;
|
|
113
|
+
name?: string;
|
|
114
|
+
source?: Array<{
|
|
115
|
+
context?: string;
|
|
116
|
+
}>;
|
|
117
|
+
}>;
|
|
118
|
+
}>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Configuration options for FumeMappingProvider
|
|
122
|
+
*/
|
|
123
|
+
export interface FumeMappingProviderConfig {
|
|
124
|
+
/** Path to folder containing mapping files */
|
|
125
|
+
mappingsFolder?: string;
|
|
126
|
+
/** File extension for mapping files (default: '.fume') */
|
|
127
|
+
fileExtension?: string;
|
|
128
|
+
/** Injected FHIR package explorer instance */
|
|
129
|
+
packageExplorer?: FhirPackageExplorer;
|
|
130
|
+
/** Injected FHIR client instance */
|
|
131
|
+
fhirClient?: FhirClient;
|
|
132
|
+
/** Optional logger instance for structured logging */
|
|
133
|
+
logger?: Logger;
|
|
134
|
+
/** Canonical base URL for generated FHIR resources (default: 'http://example.com') */
|
|
135
|
+
canonicalBaseUrl?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Options for getting package mappings
|
|
139
|
+
*/
|
|
140
|
+
export interface GetPackageMappingOptions {
|
|
141
|
+
/** Filter by package context - supports string or FhirPackageIdentifier */
|
|
142
|
+
packageContext?: string | FhirPackageIdentifier;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Alias object - key-value mappings
|
|
146
|
+
*/
|
|
147
|
+
export interface AliasObject {
|
|
148
|
+
[key: string]: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* FHIR ConceptMap resource (simplified)
|
|
152
|
+
*/
|
|
153
|
+
export interface ConceptMap extends Resource {
|
|
154
|
+
resourceType: 'ConceptMap';
|
|
155
|
+
id?: string;
|
|
156
|
+
url?: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
status?: string;
|
|
159
|
+
publisher?: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
date?: string;
|
|
162
|
+
useContext?: Array<{
|
|
163
|
+
code?: {
|
|
164
|
+
system?: string;
|
|
165
|
+
code?: string;
|
|
166
|
+
display?: string;
|
|
167
|
+
};
|
|
168
|
+
valueCodeableConcept?: {
|
|
169
|
+
coding?: Array<{
|
|
170
|
+
system?: string;
|
|
171
|
+
code?: string;
|
|
172
|
+
display?: string;
|
|
173
|
+
}>;
|
|
174
|
+
text?: string;
|
|
175
|
+
};
|
|
176
|
+
}>;
|
|
177
|
+
group?: Array<{
|
|
178
|
+
source?: string;
|
|
179
|
+
target?: string;
|
|
180
|
+
element?: Array<{
|
|
181
|
+
code?: string;
|
|
182
|
+
display?: string;
|
|
183
|
+
target?: Array<{
|
|
184
|
+
code?: string;
|
|
185
|
+
display?: string;
|
|
186
|
+
equivalence?: string;
|
|
187
|
+
}>;
|
|
188
|
+
}>;
|
|
189
|
+
}>;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=types.d.ts.map
|