ecqm-bundler
Advanced tools
Comparing version
@@ -101,9 +101,28 @@ "use strict"; | ||
] | ||
}, relatedArtifact: components.map(c => ({ | ||
type: 'composed-of', | ||
display: c, | ||
resource: combineURLs(canonicalBase, `/Measure/${c}`) | ||
})) }); | ||
}, relatedArtifact: components.map(c => makeCompositeRelatedArtifact(c, canonicalBase)) }); | ||
} | ||
exports.generateCompositeMeasureResource = generateCompositeMeasureResource; | ||
function makeCompositeRelatedArtifact(componentInfo, canonicalBase) { | ||
const ra = { | ||
type: 'composed-of', | ||
display: componentInfo.measureSlug, | ||
resource: combineURLs(canonicalBase, `/Measure/${componentInfo.measureSlug}`) | ||
}; | ||
if (componentInfo.groupId || componentInfo.weight) { | ||
ra.extension = []; | ||
if (componentInfo.groupId) { | ||
ra.extension.push({ | ||
url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-groupId', | ||
valueString: componentInfo.groupId | ||
}); | ||
} | ||
if (componentInfo.weight) { | ||
ra.extension.push({ | ||
url: 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-weight', | ||
valueDecimal: componentInfo.weight | ||
}); | ||
} | ||
} | ||
return ra; | ||
} | ||
function generateMeasureResource(measureId, libraryId, canonicalBase, groupInfo, measureVersion) { | ||
@@ -110,0 +129,0 @@ logger_1.default.info(`Creating Measure/${measureId}`); |
@@ -30,3 +30,3 @@ #!/usr/bin/env node | ||
const program = new commander_1.Command(); | ||
program.version('v0.3.0'); | ||
program.version('v0.3.1'); | ||
program | ||
@@ -106,2 +106,11 @@ .command('generate', { isDefault: true }) | ||
.default('all-or-nothing')) | ||
.option('--detailed-component <component...>', 'Specify measure components with specific group IDs or weights. Format "measureId(|version)?(#groupId)?(#weight)?" (e.g. "measure|1.0.0#group-2#0.1")', (val, current) => { | ||
const [measureSlug, groupId, weight] = val.split('#'); | ||
return current.concat([ | ||
Object.assign(Object.assign({ measureSlug }, (groupId && | ||
groupId !== '' && { | ||
groupId: groupId | ||
})), (weight && { weight: parseFloat(weight) })) | ||
]); | ||
}, []) | ||
.argument('<path...>') | ||
@@ -114,3 +123,5 @@ .action((paths, opts) => { | ||
const measures = bundles.flatMap(b => { var _a, _b; return (_b = (_a = b.entry) === null || _a === void 0 ? void 0 : _a.find(e => { var _a; return ((_a = e.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Measure'; })) === null || _b === void 0 ? void 0 : _b.resource; }); | ||
const components = measures.map((m, i) => m.id || `measure-${i}`); | ||
const components = opts.detailedComponent.length === 0 | ||
? measures.map((m, i) => ({ measureSlug: m.id || `measure-${i}` })) | ||
: opts.detailedComponent; | ||
const compositeMeausureResource = (0, fhir_1.generateCompositeMeasureResource)(`measure-composite-${measures.map(m => { var _a; return (_a = m.id) !== null && _a !== void 0 ? _a : ''; }).join('')}`, baseOpts.canonicalBase, baseOpts.improvementNotation, opts.compositeScoring, components, baseOpts.measureVersion); | ||
@@ -117,0 +128,0 @@ const uniqueSubEntries = bundles |
{ | ||
"name": "ecqm-bundler", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "CLI for bundling FHIR-based eCQMs", | ||
@@ -37,2 +37,3 @@ "main": "dist/index.js", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.8.4", | ||
"ts-jest": "^27.1.4", | ||
@@ -39,0 +40,0 @@ "ts-node": "^10.7.0", |
@@ -213,3 +213,16 @@ # ecqm-bundler | ||
To customize the group ID or weight of one of the components, use the `--detailed-component` option, and be sure to follow the proper string format. For example: | ||
```bash | ||
ecqm-bundler make-composite <...> --detailed-component "MyMeasure#group-1" # just measure and group | ||
ecqm-bundler make-composite <...> --detailed-component "MyMeasure|1.0.0#group-1" # measure version and group | ||
ecqm-bundler make-composite <...> --detailed-component "MyMeasure#group-1#0.1" # measure group and weight | ||
ecqm-bundler make-composite <...> --detailed-component "MyMeasure##0.1" # just measure and weight | ||
``` | ||
Note that the measure identifying info is required, but group ID and weight are both optional. | ||
:warning: Use of this option will override the autodetection of canonicals that happens in the component measures. Please ensure that the measure identifying info you provide matches the canonical in the corresponding measure resource :warning: | ||
``` | ||
Usage: ecqm-bundler make-composite [options] <path...> | ||
@@ -221,2 +234,3 @@ | ||
--composite-scoring <scoring> Composite scoring method of the measure (choices: "opportunity", "all-or-nothing", "linear", "weighted", default: "all-or-nothing") | ||
--detailed-component <component...> Specify measure components with specific group IDs or weights. Format "measureId(|version)?(#groupId)?(#weight)?" (e.g. "measure|1.0.0#group-2#0.1") (default: []) | ||
-h, --help display help for command | ||
@@ -223,0 +237,0 @@ ``` |
85510
3.03%1149
2.68%320
4.58%15
7.14%