/** * Slicing Validator * * Validates sliced elements in FHIR resources: * - Identifies which slice each element belongs to * - Validates slice cardinality (min/max per slice) * - Validates discriminator matching * - Supports discriminator types: value, pattern, type, profile, exists * * Critical for UK Core NHS Number validation (Patient.identifier slicing) */ import type { ValidationIssue } from '../types'; import type { ReferenceResolver } from './slice-types'; import type { StructureDefinition } from '../core/structure-definition-types'; import { type FhirVersionFamily } from '../core/sd-loader-version-utils'; export type { SlicingDiscriminator, SlicingDefinition } from '../core/structure-definition-types'; export type { ReferenceResolver, SliceDefinition } from './slice-types'; /** * Callback used by the slicing validator to resolve a FHIR reference to the * referenced resource. Implementations typically look up the reference in * the current Bundle or `contained[]`. * * The resolver is **synchronous** — it must be able to answer from data the * caller already has in memory. Async resolution (e.g. remote reference * existence checks) should happen in a pre-pass via * `BatchedReferenceChecker` and the resolved bodies passed into the slicing * validator via this resolver. * * Returning `null` means "not resolvable" — the validator will then fall * back to matching against `value.meta.profile` as before. */ /** * Callback that resolves a profile URL to its StructureDefinition. Used by * the slicing validator to follow `type[].profile` on slice elements and * extract discriminator patterns (e.g. ISiKLoincCoding → patternUri on * Coding.system). */ export type TypeProfileResolver = (profileUrl: string) => Promise; export declare class SlicingValidator { private typeProfileConstraintValidator; /** * Optional reference resolver used by the discriminator-by-profile matcher * to chase references inside Bundles / contained resources. Set via * `setReferenceResolver` from whichever validator owns the bundle context. */ private referenceResolver; /** * Optional profile resolver for looking up type profiles on slice elements. * When a slice has `type[].profile` (e.g. ISiKLoincCoding), the resolver * fetches the profile so discriminator patterns can be extracted. */ private typeProfileResolver; /** Lazy-initialised loader for resolving ValueSet compose into code sets. */ private valueSetLoader; private getValueSetLoader; /** * Provide a resolver so `matchProfileDiscriminator` can follow references * to check the referenced resource's `meta.profile`. Pass `null` to clear. */ setReferenceResolver(resolver: ReferenceResolver | null): void; /** * Provide a resolver for type profiles on slice elements. */ setTypeProfileResolver(resolver: TypeProfileResolver | null): void; /** * Validate slicing for a specific element path */ validateSlicing(elements: any[], elementPath: string, profileSD: StructureDefinition, referenceResolverOverride?: ReferenceResolver | null, slicingElementId?: string, fhirVersion?: FhirVersionFamily): Promise; /** * Resolve type profiles on a slice element and merge their pattern/fixed * values into the child maps. When a slice's type carries a profile * (e.g. ISiKLoincCoding), the distinguishing value lives inside that * profile rather than on the slice element itself. */ private extractSlicingInfo; private validateSliceTypeProfileConstraints; /** * Open value slicing can otherwise hide an intended slice when the * discriminator itself is absent. For a single fixed-discriminator slice, * report a low-severity profile constraint on the sliced element if another * required child from that slice is present. */ private emitMissingDiscriminatorIssues; private getRequiredSliceEvidencePaths; } //# sourceMappingURL=slicing-validator.d.ts.map