fhir-persistence 0.6.0 → 0.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/CHANGELOG.md +40 -0
- package/README.md +1 -1
- package/dist/cjs/index.cjs +719 -0
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/cjs/index.d.ts +214 -0
- package/dist/esm/index.d.ts +214 -0
- package/dist/esm/index.mjs +712 -0
- package/dist/esm/index.mjs.map +4 -4
- package/dist/index.d.ts +214 -0
- package/dist/lib/conformance/concept-hierarchy-repo.d.ts +38 -0
- package/dist/lib/conformance/concept-hierarchy-repo.d.ts.map +1 -0
- package/dist/lib/conformance/element-index-repo.d.ts +40 -0
- package/dist/lib/conformance/element-index-repo.d.ts.map +1 -0
- package/dist/lib/conformance/expansion-cache-repo.d.ts +32 -0
- package/dist/lib/conformance/expansion-cache-repo.d.ts.map +1 -0
- package/dist/lib/conformance/ig-import-orchestrator.d.ts +69 -0
- package/dist/lib/conformance/ig-import-orchestrator.d.ts.map +1 -0
- package/dist/lib/conformance/ig-resource-map-repo.d.ts +41 -0
- package/dist/lib/conformance/ig-resource-map-repo.d.ts.map +1 -0
- package/dist/lib/conformance/index.d.ts +29 -0
- package/dist/lib/conformance/index.d.ts.map +1 -0
- package/dist/lib/conformance/sd-index-repo.d.ts +35 -0
- package/dist/lib/conformance/sd-index-repo.d.ts.map +1 -0
- package/dist/lib/conformance/search-param-index-repo.d.ts +33 -0
- package/dist/lib/conformance/search-param-index-repo.d.ts.map +1 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.d.ts
CHANGED
|
@@ -331,6 +331,14 @@ declare interface BundleLink {
|
|
|
331
331
|
url: string;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
export declare interface CachedExpansion {
|
|
335
|
+
valuesetUrl: string;
|
|
336
|
+
version: string;
|
|
337
|
+
expandedAt: string;
|
|
338
|
+
codeCount: number;
|
|
339
|
+
expansionJson: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
334
342
|
/**
|
|
335
343
|
* StructureDefinition Registry
|
|
336
344
|
*
|
|
@@ -425,6 +433,34 @@ export declare interface ColumnSchema {
|
|
|
425
433
|
*/
|
|
426
434
|
export declare function compareSchemas(oldSets: ResourceTableSet[], newSets: ResourceTableSet[]): SchemaDelta[];
|
|
427
435
|
|
|
436
|
+
export declare interface ConceptHierarchyEntry {
|
|
437
|
+
id: string;
|
|
438
|
+
codeSystemUrl: string;
|
|
439
|
+
codeSystemVersion?: string;
|
|
440
|
+
code: string;
|
|
441
|
+
display?: string;
|
|
442
|
+
parentCode?: string;
|
|
443
|
+
level: number;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare class ConceptHierarchyRepo {
|
|
447
|
+
private readonly adapter;
|
|
448
|
+
private readonly dialect;
|
|
449
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
450
|
+
ensureTable(): Promise<void>;
|
|
451
|
+
/** Batch insert hierarchical concept entries. */
|
|
452
|
+
batchInsert(entries: ConceptHierarchyEntry[]): Promise<number>;
|
|
453
|
+
/** Get all concepts for a CodeSystem (tree order by level). */
|
|
454
|
+
getTree(codeSystemUrl: string): Promise<ConceptHierarchyEntry[]>;
|
|
455
|
+
/** Get direct children of a concept. */
|
|
456
|
+
getChildren(codeSystemUrl: string, parentCode: string): Promise<ConceptHierarchyEntry[]>;
|
|
457
|
+
/** Lookup a single concept by code. */
|
|
458
|
+
lookup(codeSystemUrl: string, code: string): Promise<ConceptHierarchyEntry | undefined>;
|
|
459
|
+
/** Remove all concepts for a CodeSystem. */
|
|
460
|
+
removeByCodeSystem(codeSystemUrl: string): Promise<void>;
|
|
461
|
+
private mapRow;
|
|
462
|
+
}
|
|
463
|
+
|
|
428
464
|
/**
|
|
429
465
|
* Definition of a PostgreSQL table constraint.
|
|
430
466
|
*/
|
|
@@ -538,6 +574,36 @@ export declare const DELETED_SCHEMA_VERSION = -1;
|
|
|
538
574
|
|
|
539
575
|
export declare type DeltaKind = 'ADD_TABLE' | 'DROP_TABLE' | 'ADD_COLUMN' | 'DROP_COLUMN' | 'ALTER_COLUMN' | 'ADD_INDEX' | 'DROP_INDEX' | 'REINDEX';
|
|
540
576
|
|
|
577
|
+
export declare interface ElementIndexEntry {
|
|
578
|
+
id: string;
|
|
579
|
+
structureId: string;
|
|
580
|
+
path: string;
|
|
581
|
+
min?: number;
|
|
582
|
+
max?: string;
|
|
583
|
+
typeCodes?: string[];
|
|
584
|
+
isSlice?: boolean;
|
|
585
|
+
sliceName?: string;
|
|
586
|
+
isExtension?: boolean;
|
|
587
|
+
bindingValueSet?: string;
|
|
588
|
+
mustSupport?: boolean;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export declare class ElementIndexRepo {
|
|
592
|
+
private readonly adapter;
|
|
593
|
+
private readonly dialect;
|
|
594
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
595
|
+
ensureTable(): Promise<void>;
|
|
596
|
+
/** Batch insert element index entries for a StructureDefinition. */
|
|
597
|
+
batchInsert(structureId: string, elements: Omit<ElementIndexEntry, 'structureId'>[]): Promise<number>;
|
|
598
|
+
/** Get all elements for a StructureDefinition. */
|
|
599
|
+
getByStructureId(structureId: string): Promise<ElementIndexEntry[]>;
|
|
600
|
+
/** Search elements by path pattern (LIKE). */
|
|
601
|
+
searchByPath(pathPattern: string): Promise<ElementIndexEntry[]>;
|
|
602
|
+
/** Remove all element indexes for a StructureDefinition. */
|
|
603
|
+
removeByStructureId(structureId: string): Promise<void>;
|
|
604
|
+
private mapRow;
|
|
605
|
+
}
|
|
606
|
+
|
|
541
607
|
/**
|
|
542
608
|
* Eviction policy for the cache.
|
|
543
609
|
*
|
|
@@ -560,6 +626,21 @@ export declare function executeSearch(adapter: StorageAdapter, request: SearchRe
|
|
|
560
626
|
dialect?: SqlDialect;
|
|
561
627
|
}): Promise<SearchResult_2>;
|
|
562
628
|
|
|
629
|
+
export declare class ExpansionCacheRepo {
|
|
630
|
+
private readonly adapter;
|
|
631
|
+
private readonly dialect;
|
|
632
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
633
|
+
ensureTable(): Promise<void>;
|
|
634
|
+
/** Write or update an expansion cache entry. */
|
|
635
|
+
upsert(url: string, version: string, expansionJson: string, codeCount: number): Promise<void>;
|
|
636
|
+
/** Get a cached expansion by URL and version. */
|
|
637
|
+
get(url: string, version: string): Promise<CachedExpansion | undefined>;
|
|
638
|
+
/** Invalidate a specific expansion cache entry. */
|
|
639
|
+
invalidate(url: string, version: string): Promise<void>;
|
|
640
|
+
/** Clear all expansion caches. */
|
|
641
|
+
clear(): Promise<void>;
|
|
642
|
+
}
|
|
643
|
+
|
|
563
644
|
/**
|
|
564
645
|
* A reference extracted from a FHIR resource.
|
|
565
646
|
*/
|
|
@@ -607,6 +688,14 @@ export declare function extractPropertyPath(expression: string, resourceType: st
|
|
|
607
688
|
*/
|
|
608
689
|
export declare function extractReferencesV2(resource: FhirResource, impls: SearchParameterImpl[]): ReferenceRowV2[];
|
|
609
690
|
|
|
691
|
+
/** A minimal FHIR Bundle shape for IG import. */
|
|
692
|
+
declare interface FhirBundle {
|
|
693
|
+
resourceType: 'Bundle';
|
|
694
|
+
entry?: Array<{
|
|
695
|
+
resource?: Record<string, unknown>;
|
|
696
|
+
}>;
|
|
697
|
+
}
|
|
698
|
+
|
|
610
699
|
/**
|
|
611
700
|
* Bridges a fhir-definition DefinitionRegistry into our DefinitionProvider.
|
|
612
701
|
*
|
|
@@ -1055,6 +1144,57 @@ export declare interface HistoryTableSchema {
|
|
|
1055
1144
|
indexes: IndexSchema[];
|
|
1056
1145
|
}
|
|
1057
1146
|
|
|
1147
|
+
export declare interface IGImportOptions {
|
|
1148
|
+
/** Extract element index rows from a StructureDefinition (from fhir-runtime). */
|
|
1149
|
+
extractElementIndex?: (sd: Record<string, unknown>) => Omit<ElementIndexEntry, 'structureId'>[];
|
|
1150
|
+
/** Extract SD dependencies (from fhir-runtime). */
|
|
1151
|
+
extractDependencies?: (sd: Record<string, unknown>) => string[];
|
|
1152
|
+
/** Flatten concept hierarchy from a CodeSystem (from fhir-runtime). */
|
|
1153
|
+
flattenConcepts?: (cs: Record<string, unknown>) => ConceptHierarchyEntry[];
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
export declare class IGImportOrchestrator {
|
|
1157
|
+
private readonly resourceMapRepo;
|
|
1158
|
+
private readonly sdIndexRepo;
|
|
1159
|
+
private readonly elementIndexRepo;
|
|
1160
|
+
private readonly expansionCacheRepo;
|
|
1161
|
+
private readonly conceptRepo;
|
|
1162
|
+
private readonly spIndexRepo;
|
|
1163
|
+
private readonly opts;
|
|
1164
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect, options?: IGImportOptions);
|
|
1165
|
+
/** Ensure all conformance tables exist. */
|
|
1166
|
+
ensureAllTables(): Promise<void>;
|
|
1167
|
+
/** Execute a complete IG import from a FHIR Bundle. */
|
|
1168
|
+
importIG(igId: string, bundle: FhirBundle): Promise<IGImportResult>;
|
|
1169
|
+
/** Get individual repos for direct access. */
|
|
1170
|
+
get repos(): {
|
|
1171
|
+
resourceMap: IGResourceMapRepo;
|
|
1172
|
+
sdIndex: SDIndexRepo;
|
|
1173
|
+
elementIndex: ElementIndexRepo;
|
|
1174
|
+
expansionCache: ExpansionCacheRepo;
|
|
1175
|
+
conceptHierarchy: ConceptHierarchyRepo;
|
|
1176
|
+
searchParamIndex: SearchParamIndexRepo;
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
export declare interface IGImportResult {
|
|
1181
|
+
igId: string;
|
|
1182
|
+
resourceCount: number;
|
|
1183
|
+
sdIndexCount: number;
|
|
1184
|
+
elementIndexCount: number;
|
|
1185
|
+
conceptCount: number;
|
|
1186
|
+
spIndexCount: number;
|
|
1187
|
+
errors: string[];
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export declare interface IGIndex {
|
|
1191
|
+
profiles: IGResourceMapEntry[];
|
|
1192
|
+
extensions: IGResourceMapEntry[];
|
|
1193
|
+
valueSets: IGResourceMapEntry[];
|
|
1194
|
+
codeSystems: IGResourceMapEntry[];
|
|
1195
|
+
searchParameters: IGResourceMapEntry[];
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1058
1198
|
declare type IGInitAction = 'new' | 'upgrade' | 'consistent';
|
|
1059
1199
|
|
|
1060
1200
|
declare interface IGInitResult {
|
|
@@ -1100,6 +1240,30 @@ export declare class IGPersistenceManager {
|
|
|
1100
1240
|
initialize(input: IGPackageInput): Promise<IGInitResult>;
|
|
1101
1241
|
}
|
|
1102
1242
|
|
|
1243
|
+
export declare interface IGResourceMapEntry {
|
|
1244
|
+
igId: string;
|
|
1245
|
+
resourceType: string;
|
|
1246
|
+
resourceId: string;
|
|
1247
|
+
resourceUrl?: string;
|
|
1248
|
+
resourceName?: string;
|
|
1249
|
+
baseType?: string;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
export declare class IGResourceMapRepo {
|
|
1253
|
+
private readonly adapter;
|
|
1254
|
+
private readonly dialect;
|
|
1255
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
1256
|
+
ensureTable(): Promise<void>;
|
|
1257
|
+
/** Batch insert resource map entries for an IG. */
|
|
1258
|
+
batchInsert(igId: string, entries: Omit<IGResourceMapEntry, 'igId'>[]): Promise<number>;
|
|
1259
|
+
/** Get grouped IG index. */
|
|
1260
|
+
getIGIndex(igId: string): Promise<IGIndex>;
|
|
1261
|
+
/** Get resources of a specific type within an IG. */
|
|
1262
|
+
getByType(igId: string, resourceType: string): Promise<IGResourceMapEntry[]>;
|
|
1263
|
+
/** Remove all resource mappings for an IG. */
|
|
1264
|
+
removeIG(igId: string): Promise<void>;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1103
1267
|
/**
|
|
1104
1268
|
* A parsed `_include` or `_revinclude` target.
|
|
1105
1269
|
*
|
|
@@ -2288,6 +2452,32 @@ declare interface SchemaVersionRecord {
|
|
|
2288
2452
|
appliedAt: string;
|
|
2289
2453
|
}
|
|
2290
2454
|
|
|
2455
|
+
export declare interface SDIndexEntry {
|
|
2456
|
+
id: string;
|
|
2457
|
+
url?: string;
|
|
2458
|
+
version?: string;
|
|
2459
|
+
type?: string;
|
|
2460
|
+
kind?: string;
|
|
2461
|
+
baseDefinition?: string;
|
|
2462
|
+
derivation?: string;
|
|
2463
|
+
snapshotHash?: string;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
export declare class SDIndexRepo {
|
|
2467
|
+
private readonly adapter;
|
|
2468
|
+
private readonly dialect;
|
|
2469
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
2470
|
+
ensureTable(): Promise<void>;
|
|
2471
|
+
upsert(entry: SDIndexEntry): Promise<void>;
|
|
2472
|
+
batchUpsert(entries: SDIndexEntry[]): Promise<number>;
|
|
2473
|
+
getById(id: string): Promise<SDIndexEntry | undefined>;
|
|
2474
|
+
getByUrl(url: string): Promise<SDIndexEntry[]>;
|
|
2475
|
+
getByType(type: string): Promise<SDIndexEntry[]>;
|
|
2476
|
+
getByBaseDefinition(baseUrl: string): Promise<SDIndexEntry[]>;
|
|
2477
|
+
remove(id: string): Promise<void>;
|
|
2478
|
+
private mapRow;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2291
2481
|
/**
|
|
2292
2482
|
* All valid search prefixes.
|
|
2293
2483
|
*/
|
|
@@ -2563,6 +2753,30 @@ export declare interface SearchParameterResource {
|
|
|
2563
2753
|
target?: string[];
|
|
2564
2754
|
}
|
|
2565
2755
|
|
|
2756
|
+
export declare interface SearchParamIndexEntry {
|
|
2757
|
+
id: string;
|
|
2758
|
+
igId: string;
|
|
2759
|
+
url?: string;
|
|
2760
|
+
code: string;
|
|
2761
|
+
type: string;
|
|
2762
|
+
base: string[];
|
|
2763
|
+
expression?: string;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
export declare class SearchParamIndexRepo {
|
|
2767
|
+
private readonly adapter;
|
|
2768
|
+
private readonly dialect;
|
|
2769
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
2770
|
+
ensureTable(): Promise<void>;
|
|
2771
|
+
upsert(entry: SearchParamIndexEntry): Promise<void>;
|
|
2772
|
+
batchUpsert(entries: SearchParamIndexEntry[]): Promise<number>;
|
|
2773
|
+
getByIG(igId: string): Promise<SearchParamIndexEntry[]>;
|
|
2774
|
+
getByCode(code: string): Promise<SearchParamIndexEntry[]>;
|
|
2775
|
+
remove(id: string): Promise<void>;
|
|
2776
|
+
removeByIG(igId: string): Promise<void>;
|
|
2777
|
+
private mapRow;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2566
2780
|
/**
|
|
2567
2781
|
* Metadata for a search parameter, preserved for SchemaDiff.
|
|
2568
2782
|
*/
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -331,6 +331,14 @@ declare interface BundleLink {
|
|
|
331
331
|
url: string;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
export declare interface CachedExpansion {
|
|
335
|
+
valuesetUrl: string;
|
|
336
|
+
version: string;
|
|
337
|
+
expandedAt: string;
|
|
338
|
+
codeCount: number;
|
|
339
|
+
expansionJson: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
334
342
|
/**
|
|
335
343
|
* StructureDefinition Registry
|
|
336
344
|
*
|
|
@@ -425,6 +433,34 @@ export declare interface ColumnSchema {
|
|
|
425
433
|
*/
|
|
426
434
|
export declare function compareSchemas(oldSets: ResourceTableSet[], newSets: ResourceTableSet[]): SchemaDelta[];
|
|
427
435
|
|
|
436
|
+
export declare interface ConceptHierarchyEntry {
|
|
437
|
+
id: string;
|
|
438
|
+
codeSystemUrl: string;
|
|
439
|
+
codeSystemVersion?: string;
|
|
440
|
+
code: string;
|
|
441
|
+
display?: string;
|
|
442
|
+
parentCode?: string;
|
|
443
|
+
level: number;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare class ConceptHierarchyRepo {
|
|
447
|
+
private readonly adapter;
|
|
448
|
+
private readonly dialect;
|
|
449
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
450
|
+
ensureTable(): Promise<void>;
|
|
451
|
+
/** Batch insert hierarchical concept entries. */
|
|
452
|
+
batchInsert(entries: ConceptHierarchyEntry[]): Promise<number>;
|
|
453
|
+
/** Get all concepts for a CodeSystem (tree order by level). */
|
|
454
|
+
getTree(codeSystemUrl: string): Promise<ConceptHierarchyEntry[]>;
|
|
455
|
+
/** Get direct children of a concept. */
|
|
456
|
+
getChildren(codeSystemUrl: string, parentCode: string): Promise<ConceptHierarchyEntry[]>;
|
|
457
|
+
/** Lookup a single concept by code. */
|
|
458
|
+
lookup(codeSystemUrl: string, code: string): Promise<ConceptHierarchyEntry | undefined>;
|
|
459
|
+
/** Remove all concepts for a CodeSystem. */
|
|
460
|
+
removeByCodeSystem(codeSystemUrl: string): Promise<void>;
|
|
461
|
+
private mapRow;
|
|
462
|
+
}
|
|
463
|
+
|
|
428
464
|
/**
|
|
429
465
|
* Definition of a PostgreSQL table constraint.
|
|
430
466
|
*/
|
|
@@ -538,6 +574,36 @@ export declare const DELETED_SCHEMA_VERSION = -1;
|
|
|
538
574
|
|
|
539
575
|
export declare type DeltaKind = 'ADD_TABLE' | 'DROP_TABLE' | 'ADD_COLUMN' | 'DROP_COLUMN' | 'ALTER_COLUMN' | 'ADD_INDEX' | 'DROP_INDEX' | 'REINDEX';
|
|
540
576
|
|
|
577
|
+
export declare interface ElementIndexEntry {
|
|
578
|
+
id: string;
|
|
579
|
+
structureId: string;
|
|
580
|
+
path: string;
|
|
581
|
+
min?: number;
|
|
582
|
+
max?: string;
|
|
583
|
+
typeCodes?: string[];
|
|
584
|
+
isSlice?: boolean;
|
|
585
|
+
sliceName?: string;
|
|
586
|
+
isExtension?: boolean;
|
|
587
|
+
bindingValueSet?: string;
|
|
588
|
+
mustSupport?: boolean;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export declare class ElementIndexRepo {
|
|
592
|
+
private readonly adapter;
|
|
593
|
+
private readonly dialect;
|
|
594
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
595
|
+
ensureTable(): Promise<void>;
|
|
596
|
+
/** Batch insert element index entries for a StructureDefinition. */
|
|
597
|
+
batchInsert(structureId: string, elements: Omit<ElementIndexEntry, 'structureId'>[]): Promise<number>;
|
|
598
|
+
/** Get all elements for a StructureDefinition. */
|
|
599
|
+
getByStructureId(structureId: string): Promise<ElementIndexEntry[]>;
|
|
600
|
+
/** Search elements by path pattern (LIKE). */
|
|
601
|
+
searchByPath(pathPattern: string): Promise<ElementIndexEntry[]>;
|
|
602
|
+
/** Remove all element indexes for a StructureDefinition. */
|
|
603
|
+
removeByStructureId(structureId: string): Promise<void>;
|
|
604
|
+
private mapRow;
|
|
605
|
+
}
|
|
606
|
+
|
|
541
607
|
/**
|
|
542
608
|
* Eviction policy for the cache.
|
|
543
609
|
*
|
|
@@ -560,6 +626,21 @@ export declare function executeSearch(adapter: StorageAdapter, request: SearchRe
|
|
|
560
626
|
dialect?: SqlDialect;
|
|
561
627
|
}): Promise<SearchResult_2>;
|
|
562
628
|
|
|
629
|
+
export declare class ExpansionCacheRepo {
|
|
630
|
+
private readonly adapter;
|
|
631
|
+
private readonly dialect;
|
|
632
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
633
|
+
ensureTable(): Promise<void>;
|
|
634
|
+
/** Write or update an expansion cache entry. */
|
|
635
|
+
upsert(url: string, version: string, expansionJson: string, codeCount: number): Promise<void>;
|
|
636
|
+
/** Get a cached expansion by URL and version. */
|
|
637
|
+
get(url: string, version: string): Promise<CachedExpansion | undefined>;
|
|
638
|
+
/** Invalidate a specific expansion cache entry. */
|
|
639
|
+
invalidate(url: string, version: string): Promise<void>;
|
|
640
|
+
/** Clear all expansion caches. */
|
|
641
|
+
clear(): Promise<void>;
|
|
642
|
+
}
|
|
643
|
+
|
|
563
644
|
/**
|
|
564
645
|
* A reference extracted from a FHIR resource.
|
|
565
646
|
*/
|
|
@@ -607,6 +688,14 @@ export declare function extractPropertyPath(expression: string, resourceType: st
|
|
|
607
688
|
*/
|
|
608
689
|
export declare function extractReferencesV2(resource: FhirResource, impls: SearchParameterImpl[]): ReferenceRowV2[];
|
|
609
690
|
|
|
691
|
+
/** A minimal FHIR Bundle shape for IG import. */
|
|
692
|
+
declare interface FhirBundle {
|
|
693
|
+
resourceType: 'Bundle';
|
|
694
|
+
entry?: Array<{
|
|
695
|
+
resource?: Record<string, unknown>;
|
|
696
|
+
}>;
|
|
697
|
+
}
|
|
698
|
+
|
|
610
699
|
/**
|
|
611
700
|
* Bridges a fhir-definition DefinitionRegistry into our DefinitionProvider.
|
|
612
701
|
*
|
|
@@ -1055,6 +1144,57 @@ export declare interface HistoryTableSchema {
|
|
|
1055
1144
|
indexes: IndexSchema[];
|
|
1056
1145
|
}
|
|
1057
1146
|
|
|
1147
|
+
export declare interface IGImportOptions {
|
|
1148
|
+
/** Extract element index rows from a StructureDefinition (from fhir-runtime). */
|
|
1149
|
+
extractElementIndex?: (sd: Record<string, unknown>) => Omit<ElementIndexEntry, 'structureId'>[];
|
|
1150
|
+
/** Extract SD dependencies (from fhir-runtime). */
|
|
1151
|
+
extractDependencies?: (sd: Record<string, unknown>) => string[];
|
|
1152
|
+
/** Flatten concept hierarchy from a CodeSystem (from fhir-runtime). */
|
|
1153
|
+
flattenConcepts?: (cs: Record<string, unknown>) => ConceptHierarchyEntry[];
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
export declare class IGImportOrchestrator {
|
|
1157
|
+
private readonly resourceMapRepo;
|
|
1158
|
+
private readonly sdIndexRepo;
|
|
1159
|
+
private readonly elementIndexRepo;
|
|
1160
|
+
private readonly expansionCacheRepo;
|
|
1161
|
+
private readonly conceptRepo;
|
|
1162
|
+
private readonly spIndexRepo;
|
|
1163
|
+
private readonly opts;
|
|
1164
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect, options?: IGImportOptions);
|
|
1165
|
+
/** Ensure all conformance tables exist. */
|
|
1166
|
+
ensureAllTables(): Promise<void>;
|
|
1167
|
+
/** Execute a complete IG import from a FHIR Bundle. */
|
|
1168
|
+
importIG(igId: string, bundle: FhirBundle): Promise<IGImportResult>;
|
|
1169
|
+
/** Get individual repos for direct access. */
|
|
1170
|
+
get repos(): {
|
|
1171
|
+
resourceMap: IGResourceMapRepo;
|
|
1172
|
+
sdIndex: SDIndexRepo;
|
|
1173
|
+
elementIndex: ElementIndexRepo;
|
|
1174
|
+
expansionCache: ExpansionCacheRepo;
|
|
1175
|
+
conceptHierarchy: ConceptHierarchyRepo;
|
|
1176
|
+
searchParamIndex: SearchParamIndexRepo;
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
export declare interface IGImportResult {
|
|
1181
|
+
igId: string;
|
|
1182
|
+
resourceCount: number;
|
|
1183
|
+
sdIndexCount: number;
|
|
1184
|
+
elementIndexCount: number;
|
|
1185
|
+
conceptCount: number;
|
|
1186
|
+
spIndexCount: number;
|
|
1187
|
+
errors: string[];
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export declare interface IGIndex {
|
|
1191
|
+
profiles: IGResourceMapEntry[];
|
|
1192
|
+
extensions: IGResourceMapEntry[];
|
|
1193
|
+
valueSets: IGResourceMapEntry[];
|
|
1194
|
+
codeSystems: IGResourceMapEntry[];
|
|
1195
|
+
searchParameters: IGResourceMapEntry[];
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1058
1198
|
declare type IGInitAction = 'new' | 'upgrade' | 'consistent';
|
|
1059
1199
|
|
|
1060
1200
|
declare interface IGInitResult {
|
|
@@ -1100,6 +1240,30 @@ export declare class IGPersistenceManager {
|
|
|
1100
1240
|
initialize(input: IGPackageInput): Promise<IGInitResult>;
|
|
1101
1241
|
}
|
|
1102
1242
|
|
|
1243
|
+
export declare interface IGResourceMapEntry {
|
|
1244
|
+
igId: string;
|
|
1245
|
+
resourceType: string;
|
|
1246
|
+
resourceId: string;
|
|
1247
|
+
resourceUrl?: string;
|
|
1248
|
+
resourceName?: string;
|
|
1249
|
+
baseType?: string;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
export declare class IGResourceMapRepo {
|
|
1253
|
+
private readonly adapter;
|
|
1254
|
+
private readonly dialect;
|
|
1255
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
1256
|
+
ensureTable(): Promise<void>;
|
|
1257
|
+
/** Batch insert resource map entries for an IG. */
|
|
1258
|
+
batchInsert(igId: string, entries: Omit<IGResourceMapEntry, 'igId'>[]): Promise<number>;
|
|
1259
|
+
/** Get grouped IG index. */
|
|
1260
|
+
getIGIndex(igId: string): Promise<IGIndex>;
|
|
1261
|
+
/** Get resources of a specific type within an IG. */
|
|
1262
|
+
getByType(igId: string, resourceType: string): Promise<IGResourceMapEntry[]>;
|
|
1263
|
+
/** Remove all resource mappings for an IG. */
|
|
1264
|
+
removeIG(igId: string): Promise<void>;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1103
1267
|
/**
|
|
1104
1268
|
* A parsed `_include` or `_revinclude` target.
|
|
1105
1269
|
*
|
|
@@ -2288,6 +2452,32 @@ declare interface SchemaVersionRecord {
|
|
|
2288
2452
|
appliedAt: string;
|
|
2289
2453
|
}
|
|
2290
2454
|
|
|
2455
|
+
export declare interface SDIndexEntry {
|
|
2456
|
+
id: string;
|
|
2457
|
+
url?: string;
|
|
2458
|
+
version?: string;
|
|
2459
|
+
type?: string;
|
|
2460
|
+
kind?: string;
|
|
2461
|
+
baseDefinition?: string;
|
|
2462
|
+
derivation?: string;
|
|
2463
|
+
snapshotHash?: string;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
export declare class SDIndexRepo {
|
|
2467
|
+
private readonly adapter;
|
|
2468
|
+
private readonly dialect;
|
|
2469
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
2470
|
+
ensureTable(): Promise<void>;
|
|
2471
|
+
upsert(entry: SDIndexEntry): Promise<void>;
|
|
2472
|
+
batchUpsert(entries: SDIndexEntry[]): Promise<number>;
|
|
2473
|
+
getById(id: string): Promise<SDIndexEntry | undefined>;
|
|
2474
|
+
getByUrl(url: string): Promise<SDIndexEntry[]>;
|
|
2475
|
+
getByType(type: string): Promise<SDIndexEntry[]>;
|
|
2476
|
+
getByBaseDefinition(baseUrl: string): Promise<SDIndexEntry[]>;
|
|
2477
|
+
remove(id: string): Promise<void>;
|
|
2478
|
+
private mapRow;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2291
2481
|
/**
|
|
2292
2482
|
* All valid search prefixes.
|
|
2293
2483
|
*/
|
|
@@ -2563,6 +2753,30 @@ export declare interface SearchParameterResource {
|
|
|
2563
2753
|
target?: string[];
|
|
2564
2754
|
}
|
|
2565
2755
|
|
|
2756
|
+
export declare interface SearchParamIndexEntry {
|
|
2757
|
+
id: string;
|
|
2758
|
+
igId: string;
|
|
2759
|
+
url?: string;
|
|
2760
|
+
code: string;
|
|
2761
|
+
type: string;
|
|
2762
|
+
base: string[];
|
|
2763
|
+
expression?: string;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
export declare class SearchParamIndexRepo {
|
|
2767
|
+
private readonly adapter;
|
|
2768
|
+
private readonly dialect;
|
|
2769
|
+
constructor(adapter: StorageAdapter, dialect?: DDLDialect);
|
|
2770
|
+
ensureTable(): Promise<void>;
|
|
2771
|
+
upsert(entry: SearchParamIndexEntry): Promise<void>;
|
|
2772
|
+
batchUpsert(entries: SearchParamIndexEntry[]): Promise<number>;
|
|
2773
|
+
getByIG(igId: string): Promise<SearchParamIndexEntry[]>;
|
|
2774
|
+
getByCode(code: string): Promise<SearchParamIndexEntry[]>;
|
|
2775
|
+
remove(id: string): Promise<void>;
|
|
2776
|
+
removeByIG(igId: string): Promise<void>;
|
|
2777
|
+
private mapRow;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2566
2780
|
/**
|
|
2567
2781
|
* Metadata for a search parameter, preserved for SchemaDiff.
|
|
2568
2782
|
*/
|