Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
elsaperelli committed Jan 4, 2025
1 parent e22c406 commit bd54eed
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions util/ValueSetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,9 @@ export function minimizeTestCaseResources(
codeInfo.primaryCodePath
) as fhir4.CodeableConcept[];
if (primaryCodeValue) {
if (matchingDRType.valueSets.length > 0) {
const vsCodesAndSystems = getValueSetCodes(matchingDRType.valueSets, measureBundle);
primaryCodeValue.forEach(pcv => {
if (
vsCodesAndSystems.find(vscas =>
pcv.coding?.find(c => c.code === vscas.code && c.system === vscas.system)
)
) {
newResources.push(r);
}
});
}
if (matchingDRType.directCodes.length > 0) {
primaryCodeValue.forEach(pcv => {
if (matchingDRType.directCodes.find(dc => pcv.coding?.find(c => c.code === dc.code))) {
newResources.push(r);
}
});
}
primaryCodeValue.forEach(pcv => {
checkCodesAndValueSets(pcv, matchingDRType, measureBundle, r, newResources);
});
}
} else {
const primaryCodeValue = fhirpath.evaluate(
Expand All @@ -150,7 +134,14 @@ export function minimizeTestCaseResources(
`${codeInfo.primaryCodePath}Coding`
) as fhir4.Coding;
if (primaryCodeValue) {
if (matchingDRType.valueSets.length > 0) {
if (
matchingDRType.directCodes.length > 0 &&
matchingDRType.directCodes.find(
dc => dc.code === primaryCodeValue.code && dc.system === primaryCodeValue.system
)
) {
newResources.push(r);
} else if (matchingDRType.valueSets.length > 0) {
const vsCodesAndSystems = getValueSetCodes(matchingDRType.valueSets, measureBundle);
if (
vsCodesAndSystems.find(
Expand All @@ -160,15 +151,6 @@ export function minimizeTestCaseResources(
newResources.push(r);
}
}
if (matchingDRType.directCodes.length > 0) {
if (
matchingDRType.directCodes.find(
dc => dc.code === primaryCodeValue.code && dc.system === primaryCodeValue.system
)
) {
newResources.push(r);
}
}
}
}
} else {
Expand Down

0 comments on commit bd54eed

Please sign in to comment.