Skip to content

Commit

Permalink
coverage-structured folders in bundles dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lmd59 committed Nov 17, 2024
1 parent ff532c7 commit c81ed1b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 31 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ coverage
cache
test/integration/.start-translator
regression/output/*-*
regression/connectathon
regression/coverage-script-bundles
regression/ecqm-content-r4-2021
regression/ecqm-content-qicore-2022
regression/bundles/*
regression/default-bundles/*
data-requirements/fqm-e-dr/*
data-requirements/jan-2024-connectathon/*
data-requirements/sept-2023-connectathon/*
Expand Down
1 change: 1 addition & 0 deletions regression/bundles/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# keep this directory
1 change: 1 addition & 0 deletions regression/default-bundles/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# keep this directory
20 changes: 11 additions & 9 deletions regression/regression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { Calculator } from '../src';

const regressionBaseName = process.argv[2] ?? 'regression-output';
const verbose = process.argv[3] === 'true';
const internal = process.argv[4] === 'true';

const REGRESSION_OUTPUT_DIR = path.join(__dirname, `./output/${regressionBaseName}`);
const CTHON_BASE_PATH = path.join(__dirname, './connectathon/fhir401/bundles/measure');
const ECQM_CONTENT_BASE_PATH = path.join(__dirname, './ecqm-content-r4-2021/bundles/measure');
const ECQM_CONTENT_QICORE_BASE_PATH = path.join(__dirname, './ecqm-content-qicore-2022/bundles/measure');
const COVERAGE_BASE_PATH = path.join(__dirname, './coverage-script-bundles/measure');
const CTHON_BASE_PATH = path.join(__dirname, './default-bundles/connectathon/fhir401/bundles/measure');
const ECQM_CONTENT_BASE_PATH = path.join(__dirname, './default-bundles/ecqm-content-r4-2021/bundles/measure');
const ECQM_CONTENT_QICORE_BASE_PATH = path.join(__dirname, './default-bundles/ecqm-content-qicore-2022/bundles/measure');
const BUNDLES_BASE_PATH = path.join(__dirname, './bundles'); // folders in this directory are assumed to have a coverage script bundles format

const RESET = '\x1b[0m';
const FG_YELLOW = '\x1b[33m';
Expand Down Expand Up @@ -120,11 +119,14 @@ async function main() {
await calculateRegression(filesPath, testFilePaths, measureBundle, dir.shortName);
}

if (internal) {
// Everything in the BUNDLES_BASE_PATH directory is expected in $set_name/measure/$measure_name structure with
// $measure_name-v332.json, $measure_name-v314.json, and $measure_name-TestCases folder within
const baseBundlePaths = fs.readdirSync(BUNDLES_BASE_PATH).filter(f => !f.startsWith('.')).map(f => (path.join(BUNDLES_BASE_PATH, f, 'measure')));
await baseBundlePaths.forEach( async dirPath => {
// coverage directory organized with multiple measures for each set of test files
const covDirs = fs.readdirSync(COVERAGE_BASE_PATH).map(f => ({
const covDirs = fs.readdirSync(dirPath).map(f => ({
shortName: f,
fullPath: path.join(COVERAGE_BASE_PATH, f)
fullPath: path.join(dirPath, f)
}));
for (const dir of covDirs) {
const basePath = dir.fullPath;
Expand All @@ -147,7 +149,7 @@ async function main() {
) as fhir4.Bundle;
await calculateRegression(patientDirectoryPath, testFilePaths, measureBundle332, `${dir.shortName}-v332`);
}
}
});
}

main().then(() => console.log('done'));
40 changes: 22 additions & 18 deletions regression/run-regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ GREEN='\033[0;32m'
NC='\033[0m'

VERBOSE=false
INTERNAL=false
PULL_BUNDLES=false
BASE_BRANCH="master"

function usage() {
cat <<USAGE
Usage: $0 [-b|--base-branch <branch-name>] [-v|--verbose] [-i|--internal]
Usage: $0 [-b|--base-branch <branch-name>] [-v|--verbose] [-p|--pull-bundles]
Options:
-b/--base-branch: Base branch to compare results with (default: master)
-v/--verbose: Use verbose regression. Will print out diffs of failing JSON files with spacing (default: false)
-i/--internal: Include limited-access internal resources in the test files (default: false)
-p/--pull-bundles: Pull bundles from default repositories into the default-bundles directory
USAGE
exit 1
}
Expand All @@ -30,7 +30,7 @@ while test $# != 0
do
case "$1" in
-v | --verbose) VERBOSE=true ;;
-i | --internal) INTERNAL=true ;;
-p | --pull-bundles) PULL_BUNDLES=true ;;
-b | --base-branch)
shift
BASE_BRANCH=$1
Expand All @@ -40,20 +40,24 @@ do
shift
done

if [ ! -d "regression/connectathon" ]; then
git clone https://github.com/dbcg/connectathon.git regression/connectathon
fi

if [ ! -d "regression/ecqm-content-r4-2021" ]; then
git clone https://github.com/cqframework/ecqm-content-r4-2021.git regression/ecqm-content-r4-2021
fi
if [ $PULL_BUNDLES = "true" ]; then
if [ ! -d "regression/default-bundles/connectathon" ]; then
git clone https://github.com/dbcg/connectathon.git regression/default-bundles/connectathon
else
git -C regression/default-bundles/connectathon/ pull origin master
fi

if [ ! -d "regression/ecqm-content-qicore-2022" ]; then
git clone https://github.com/cqframework/ecqm-content-qicore-2022.git regression/ecqm-content-qicore-2022
fi
if [ ! -d "regression/default-bundles/ecqm-content-r4-2021" ]; then
git clone https://github.com/cqframework/ecqm-content-r4-2021.git regression/default-bundles/ecqm-content-r4-2021
else
git -C regression/default-bundles/ecqm-content-r4-2021/ pull origin master
fi

if [ $INTERNAL = "true" ] && [ ! -d "regression/coverage-script-bundles" ]; then
git clone https://gitlab.mitre.org/flame/coverage-script-bundles.git regression/coverage-script-bundles
if [ ! -d "regression/default-bundles/ecqm-content-qicore-2022" ]; then
git clone https://github.com/cqframework/ecqm-content-qicore-2022.git regression/default-bundles/ecqm-content-qicore-2022
else
git -C regression/default-bundles/ecqm-content-qicore-2022/ pull origin master
fi
fi

git fetch --all
Expand All @@ -70,13 +74,13 @@ TIMESTAMP=$(date +%s)
echo "Gathering results on current branch '$CURRENT_BRANCH'"

npm i
npx ts-node --files ./regression/regression.ts "$CURRENT_BRANCH-$TIMESTAMP" $VERBOSE $INTERNAL
npx ts-node --files ./regression/regression.ts "$CURRENT_BRANCH-$TIMESTAMP" $VERBOSE

echo "Gathering results on base branch '$BASE_BRANCH'"
git checkout $BASE_BRANCH

npm i
npx ts-node --files ./regression/regression.ts "$BASE_BRANCH-$TIMESTAMP" $VERBOSE $INTERNAL
npx ts-node --files ./regression/regression.ts "$BASE_BRANCH-$TIMESTAMP" $VERBOSE

FAILURES=()
BASE_BRANCH_BASE_PATH="regression/output/$BASE_BRANCH-$TIMESTAMP"
Expand Down

0 comments on commit c81ed1b

Please sign in to comment.