import { PopulationType, CompositeScoreType } from '../types/Enums'; import { CalculationOptions, ComponentResults, PopulationResult, valueSetOutput } from '../types/Calculator'; import { ELM, ELMIdentifier } from '../types/ELMTypes'; import { ExtractedLibrary } from '../types/CQLTypes'; import 'core-js/proposals/array-buffer-base64'; export declare function getImprovementNotationFromGroup(group?: fhir4.MeasureGroup): string | null; export declare function getScoringCodeFromGroup(group?: fhir4.MeasureGroup): string | null; export declare function getScoringCodeFromMeasure(measure: fhir4.Measure): string | undefined; export declare function getCompositeScoringFromGroup(group?: fhir4.MeasureGroup): string; export declare function getCompositeScoringFromMeasure(measure: fhir4.Measure): CompositeScoreType | undefined; /** * Extracts all component measures that are defined on the relatedArtifact of a composite measure. * @param compositeMeasureResource composite measure resource * @param measureBundle FHIR Measure Bundle * @returns array of measures with libraries included */ export declare function extractComponentsFromMeasure(compositeMeasureResource: fhir4.Measure, measureBundle: fhir4.Bundle): MeasureWithLibrary[]; export declare function extractCompositeMeasure(measureBundle: fhir4.Bundle): fhir4.Measure | undefined; /** * Extracts CQFM Group Id from a given composite measure Related Artifact. * https://hl7.org/fhir/us/cqfmeasures/STU5/StructureDefinition-cqfm-groupId.html * @param relatedArtifact related artifact defined on the composite measure * @returns group id, if defined */ export declare function getGroupIdForComponent(relatedArtifact: fhir4.RelatedArtifact): string | null; export declare function getGroupIdForComponentFromExtension(extension: fhir4.Extension): string | null; /** * Extracts CQFM Weight from a given composite measure Related Artifact. * https://hl7.org/fhir/us/cqfmeasures/STU5/StructureDefinition-cqfm-weight.html * @param relatedArtifact related artifact defined on the composite measure * @returns weight extension value, or 1 if not defined */ export declare function getWeightForComponent(relatedArtifact: fhir4.RelatedArtifact): number; export declare function getWeightForComponentFromExtension(extension: fhir4.Extension): number; /** * Filters component results using mapping of group ids defined by the CQFM Group Id extension on the * composite measure. Throws error if a component contains multiple groups but no group is specified to * be used for measure score calculation. * @param componentGroupIds mapping of components to group ids defined by the CQFM Group Id extension on the composite * @param componentResults array of component results from detailed results * @returns component results, filtered by desired group Ids */ export declare function filterComponentResults(componentGroupIds: Record | number | string>, componentResults?: ComponentResults[]): ComponentResults[]; /** * Checks if a given measure/measure group has scoring code 'ratio.' * @param group measure group (used to extract scoring code if present on the group) * @param measureScoringCode scoring code for measure (used if scoring code not provided at the group level) * @returns true if scoring code is 'ratio' for the group or at the measure root, false otherwise */ export declare function isRatioMeasure(group?: fhir4.MeasureGroup, measureScoringCode?: string): boolean; /** * Checks if a given measure/measure group has scoring code 'cv' (continuous variable) * @param group measure group (used to extract scoring code if present on the group) * @param measureScoringCode scoring code for measure (used if scoring code not provided at the group level) * @returns true if scoring code is 'cv' for the group or at the measure root, false otherwise */ export declare function isCVMeasure(group?: fhir4.MeasureGroup, measureScoringCode?: string): boolean; /** * Check if a measure is an episode of care measure or not. Look for the cqfm-populationBasis extension. * If it is found return true if valueCode is not 'boolean' otherwise return false. * * @param {fhir4.Measure} measure FHIR Measure resource. * @returns {boolean} true if this is an episode of care, false if it is a patient measure. */ export declare function isEpisodeOfCareMeasure(measure: fhir4.Measure): boolean; /** * Check if a group is an episode of care group or not. Look for the cqfm-populationBasis extension. * If it is found return true if valueCode is not 'boolean'. If the extension cannot be found, fallback * to looking at the measure. * * @param {fhir4.Measure} measure FHIR Measure resource. * @returns {boolean} true if this is an episode of care, false if it is a patient measure. */ export declare function isEpisodeOfCareGroup(measure: fhir4.Measure, group: fhir4.MeasureGroup): boolean; /** * Measure Observation populations can specify which population in the measure they are drawing observations from (e.g. Numerator/Denominator/etc.) * This is done by referencing the ID of that population in the valueString of the cqfm-criteriaReference extension * This function identifies the ID used in one of those measure observation populations * * @param population within a Measure resource that may reference another population within the same Measure * @returns the corresponding ID from the extension used in the population, or null if none is found */ export declare function getCriteriaReferenceIdFromPopulation(population: fhir4.MeasureGroupPopulation): string | null; export declare function hasMultipleIPPs(group: fhir4.MeasureGroup): boolean; /** * Uses the criteriaReference extension for a given population to look up which IPP it draws from * This is useful in the case of multiple IPPs in ratio measures, as the numerator and denominator can each draw from * different IPPs */ export declare function getRelevantIPPFromPopulation(group: fhir4.MeasureGroup, fromPopulationType: PopulationType): fhir4.MeasureGroupPopulation | null; /** * Finds the measure observation that references the desired population in its criteria reference * and returns its populationResult */ export declare function getObservationResultForPopulation(group: fhir4.MeasureGroup, popResults: PopulationResult[], desiredPopulationType: PopulationType): PopulationResult | null; /** * Converts FHIR CodeableConcept value for the measure population type to a PopulationType enum value. * * @param {fhir4.CodeableConcept|undefined} concept The FHIR CodeableConcept value for the measure population. * @returns {PopulationType|null} null if not a proper population type. The PopulationType if it is. */ export declare function codeableConceptToPopulationType(concept: fhir4.CodeableConcept | undefined): PopulationType | null; /** * Pulls the measurement period out of the provided FHIR Measure resource, assuming one is set. * * @param measure FHIR Measure resource * @returns {CalculationOptions} object with only the measurement period start/end fields filled out, * or the year 2019 set as the calculation period if not set in the Measure. */ export declare function extractMeasurementPeriod(measure: fhir4.Measure): CalculationOptions; /** * Figure out if a string is a valid URL or if it's just a string * @public * @param {string} libraryName - The name of the library depending on the origin of the measure this may a url * @return {boolean} If the statement is a function or not. */ export declare function isValidLibraryURL(libraryName: string): boolean; /** * Returns the cqls, rootLibIdentifier, and elmJSONs for a collection of libraries * within a Library Bundle */ export declare function extractLibrariesFromLibraryBundle(libraryBundle: fhir4.Bundle, rootLibRef: string): { cqls: ExtractedLibrary[]; rootLibIdentifier: ELMIdentifier; elmJSONs: ELM[]; }; /** * Parses a library reference as canonical url or Library/id to an id and version. * * @param rootLibRef * @returns Library id and version */ export declare function parseLibRef(libRef: string): { libId: string; libVersion: string | undefined; }; /** * Returns the cqls, rootLibIdentifier, and elmJSONs for a collection of libraries * within a Bundle */ export declare function extractLibrariesFromBundle(bundle: fhir4.Bundle, rootLibId: string, rootLibVersion?: string): { cqls: ExtractedLibrary[]; rootLibIdentifier: ELMIdentifier; elmJSONs: ELM[]; }; /** * Returns the cqls, rootLibIdentifier, and elmJSONs for a collection of libraries * within a Measure Bundle */ export declare function extractLibrariesFromMeasureBundle(measureBundle: fhir4.Bundle, measure?: MeasureWithLibrary): { cqls: ExtractedLibrary[]; rootLibIdentifier: ELMIdentifier; elmJSONs: ELM[]; }; export type MeasureWithLibrary = fhir4.Measure & { library: string[]; }; export declare function extractMeasureFromBundle(measureBundle: fhir4.Bundle): MeasureWithLibrary; /** * Detects missing ValueSets in the given measure bundle, retrieves them from VSAC, and adds * them as entries to the measure bundle. * @param {fhir4.Bundle} measureBundle the FHIR Bundle object containing the Measure resource * @param {CalculationOptions} options Options for calculation (may contain API key as an attribute) * @return {fhir4.Bundle} measure bundle with entries for missing ValueSets (fetched from VSAC) */ export declare function addValueSetsToMeasureBundle(measureBundle: fhir4.Bundle, options: CalculationOptions): Promise;