Skip to content

Commit b621721

Browse files
committed
Log individual files per patient output
1 parent 33070c8 commit b621721

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/cli/app.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ async function mcodeApp(Client, fromDate, toDate, pathToConfig, pathToRunLogs, d
109109
logger.info(`Creating directory ${outputPath}`);
110110
fs.mkdirSync(outputPath);
111111
}
112-
const outputFile = path.join(outputPath, 'mcode-extraction.json');
113-
logger.debug(`Logging mCODE output to ${outputFile}`);
114-
fs.writeFileSync(outputFile, JSON.stringify(extractedData), 'utf8');
115-
logger.info(`Successfully logged mCODE bundle to ${outputFile}`);
112+
// For each bundle in our extractedData, write it to our output directory
113+
extractedData.forEach((bundle, i) => {
114+
const outputFile = path.join(outputPath, `mcode-extraction-patient-${i + 1}.json`);
115+
logger.debug(`Logging mCODE output to ${outputFile}`);
116+
fs.writeFileSync(outputFile, JSON.stringify(bundle), 'utf8');
117+
});
118+
logger.info(`Successfully logged ${extractedData.length} mCODE bundle(S) to ${outputPath}`);
116119
} catch (e) {
117120
logger.error(e.message);
118121
logger.debug(e.stack);

0 commit comments

Comments
 (0)