UNPKG

fhir-snapshot-generator

Version:
92 lines 4.3 kB
/** * © Copyright Outburn Ltd. 2022-2025 All Rights Reserved * Project name: fhir-snapshot-generator */ import { FhirPackageExplorer, PackageIdentifier, FileIndexEntryWithPkg } from 'fhir-package-explorer'; import { ILogger, BaseFhirVersion, ElementDefinition, SnapshotCacheMode, SnapshotGeneratorConfig } from '../types'; export declare class FhirSnapshotGenerator { private fpe; private logger; private prethrow; private cachePath; private cacheMode; private fhirVersion; private fhirCorePackage; private resolvedBasePackages; private constructor(); /** * Creates a new instance of the FhirSnapshotGenerator class. * @param config - the configuration object for the FhirPackageExplorer * @returns - a promise that resolves to a new instance of the FhirSnapshotGenerator class */ static create(config: SnapshotGeneratorConfig): Promise<FhirSnapshotGenerator>; getLogger(): ILogger; getCachePath(): string; getCacheMode(): SnapshotCacheMode; getFhirVersion(): BaseFhirVersion; getFpe(): FhirPackageExplorer; /** * Get the core FHIR package for a specific FHIR package. * Will try to resolve the core package based on the direct dependencies of the source package or its fhirVersions array. * Defaults to the FHIR package of this instance's fhirVersion if no base package can be determined. * @param sourcePackage The source package identifier (e.g., { id: 'hl7.fhir.us.core', version: '6.1.0' }). * @returns The core FHIR package identifier (e.g., { id: 'hl7.fhir.r4.core', version: '4.0.1' }). */ private getCorePackage; /** * Get an original StructureDefinition from a specific package by filename. * After resolving the metadata using any other identifier (id, url, name), filename (combind with the package id and version) * is the most reliable way to get to a specific StructureDefinition, and is also used as the basis for the cache. */ private getStructureDefinitionByFileName; private getCacheFilePath; /** * Try to get an existing cached StructureDefinition snapshot. If not found, return undefined. */ private getSnapshotFromCache; private saveSnapshotToCache; /** * Fetch StructureDefinition metadata by any identifier (id, url, name) - FSH style. */ getMetadata(identifier: string, packageFilter?: PackageIdentifier): Promise<FileIndexEntryWithPkg>; /** * Generate a snapshot for a StructureDefinition. */ private generate; /** * Get snapshot by metadata. */ private getSnapshotByMeta; private getValueSetByFileName; private getValueSetMetadata; private getExpansionFromCache; private saveExpansionToCache; private flattenCodeSystemConcepts; private toSystemCodeMapFromContains; private mergeSystemMaps; private subtractSystemMaps; private buildExpansionFromSystemMap; private expandInclude; private expandValueSetByMeta; private ensureExpansionCached; private ensureSnapshotCached; /** * Get snapshot by any FSH style identifier (id, url or name), or by a metadata object. */ getSnapshot(identifier: string | FileIndexEntryWithPkg, packageFilter?: PackageIdentifier): Promise<any>; /** * Get ValueSet expansion by any FSH style identifier (id, url or name), or by a metadata object. */ expandValueSet(identifier: string | FileIndexEntryWithPkg, packageFilter?: PackageIdentifier): Promise<any>; /** * Resolve a CodeSystem by canonical URL inside the provided source package context. * Will NOT attempt a global resolution fallback (that is the responsibility of the external caller / entrypoint). * Only CodeSystems with content === 'complete' are eligible for expansion; if not complete an error is thrown. * @param url Canonical URL of the CodeSystem. * @param sourcePackage The package (id + version) of the ValueSet that is triggering this resolution. * @returns The full CodeSystem resource (content=complete). */ resolveCompleteCodeSystem(url: string, sourcePackage: PackageIdentifier): Promise<any>; } export type { ElementDefinition, ILogger, PackageIdentifier, BaseFhirVersion }; //# sourceMappingURL=index.d.ts.map