diff --git a/data-requirements/compare.sh b/data-requirements/compare.sh index 3b18efb9..08338f38 100755 --- a/data-requirements/compare.sh +++ b/data-requirements/compare.sh @@ -37,7 +37,7 @@ if [ ! -d "elm-parser-for-ecqms" ]; then ruby parse_elm.rb --bundle qicore cd .. if [ -d "elm-parser-dr" ]; then - rm -rf elm-parser-dr + rm -rf elm-parser-dr/*.json fi mkdir elm-parser-dr SOURCE_DIR="elm-parser-for-ecqms/data_requirements/library" diff --git a/data-requirements/fqm-e-dr.ts b/data-requirements/fqm-e-dr.ts index 2b2e0f1d..8510d188 100644 --- a/data-requirements/fqm-e-dr.ts +++ b/data-requirements/fqm-e-dr.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import fs, { readdirSync } from 'fs'; import path from 'path'; import { Calculator } from '../src'; @@ -16,12 +16,16 @@ const JAN_2024_CONNECTATHON_BASE_PATH = path.join(__dirname, './jan-2024-connect async function main() { // if the fqm-e-dr directory already exists, remove it and its contents if (fs.existsSync('./fqm-e-dr')) { - fs.rmSync('./fqm-e-dr', { recursive: true }); + readdirSync('./fqm-e-dr').forEach(file => { + if (file.endsWith('.json')) { + fs.rmSync(`./fqm-e-dr/${file}`); + } + }); + } else { + // create new fqm-e-dr directory within the data-requirements directory + fs.mkdirSync('./fqm-e-dr'); } - // create new fqm-e-dr directory within the data-requirements directory - fs.mkdirSync('./fqm-e-dr'); - // get all of the file names (short and fullPath) from the jan-2024-connectathon directory const allBundles = fs .readdirSync(JAN_2024_CONNECTATHON_BASE_PATH) diff --git a/data-requirements/summary-compare.sh b/data-requirements/summary-compare.sh index 90158106..56d60462 100755 --- a/data-requirements/summary-compare.sh +++ b/data-requirements/summary-compare.sh @@ -42,7 +42,7 @@ if [ ! -d "elm-parser-for-ecqms" ]; then ruby parse_elm.rb --bundle qicore cd .. if [ -d "elm-parser-dr" ]; then - rm -rf elm-parser-dr + rm -rf elm-parser-dr/*.json fi mkdir elm-parser-dr SOURCE_DIR="elm-parser-for-ecqms/data_requirements/library"