diff --git a/.gitignore b/.gitignore index bd0c70ff..a7a3c32d 100644 --- a/.gitignore +++ b/.gitignore @@ -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/* diff --git a/regression/bundles/.gitkeep b/regression/bundles/.gitkeep new file mode 100644 index 00000000..3d81b7ba --- /dev/null +++ b/regression/bundles/.gitkeep @@ -0,0 +1 @@ +# keep this directory \ No newline at end of file diff --git a/regression/default-bundles/.gitkeep b/regression/default-bundles/.gitkeep new file mode 100644 index 00000000..3d81b7ba --- /dev/null +++ b/regression/default-bundles/.gitkeep @@ -0,0 +1 @@ +# keep this directory \ No newline at end of file diff --git a/regression/regression.ts b/regression/regression.ts index 71a6c1c2..3a7edfeb 100644 --- a/regression/regression.ts +++ b/regression/regression.ts @@ -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'; @@ -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; @@ -147,7 +149,7 @@ async function main() { ) as fhir4.Bundle; await calculateRegression(patientDirectoryPath, testFilePaths, measureBundle332, `${dir.shortName}-v332`); } - } + }); } main().then(() => console.log('done')); diff --git a/regression/run-regression.sh b/regression/run-regression.sh index 833498aa..62149ba2 100755 --- a/regression/run-regression.sh +++ b/regression/run-regression.sh @@ -10,18 +10,18 @@ GREEN='\033[0;32m' NC='\033[0m' VERBOSE=false -INTERNAL=false +PULL_BUNDLES=false BASE_BRANCH="master" function usage() { cat <] [-v|--verbose] [-i|--internal] + Usage: $0 [-b|--base-branch ] [-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 } @@ -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 @@ -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 @@ -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"