Skip to content

Commit 816e766

Browse files
committed
forgot about mrn parsing... bless you Dylan M
1 parent 031e8fa commit 816e766

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/application/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ async function mcodeApp(Client, fromDate, toDate, config, pathToRunLogs, debug,
3131

3232
// Parse CSV for list of patient mrns
3333
const dataDirectory = config.commonExtractorArgs && config.commonExtractorArgs.dataDirectory;
34-
const patientIds = parsePatientIds(config.patientIdCsvPath, dataDirectory);
34+
const parserOptions = config.commonExtractorArgs && config.commonExtractorArgs.csvParse && config.commonExtractorArgs.csvParse.options ? config.commonExtractorArgs.csvParse.options : {};
35+
const patientIds = parsePatientIds(config.patientIdCsvPath, dataDirectory, parserOptions);
3536

3637
// Get RunInstanceLogger for recording new runs and inferring dates from previous runs
3738
const runLogger = allEntries ? null : new RunInstanceLogger(pathToRunLogs);

src/helpers/appUtils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ function getPatientIdCSVData(patientIdCsvPath, dataDirectory) {
2525
*
2626
* @param {string} patientIdCsvPath filePath to the CSV content to be parsed to get IDs
2727
* @param {string} dataDirectory optional argument for if a dataDirectory was specified by the config
28+
* @param {object} parserOptions options for the csv-parse module
2829
* @returns array of parsed IDs from the CSV
2930
*/
30-
function parsePatientIds(patientIdCsvPath, dataDirectory) {
31+
function parsePatientIds(patientIdCsvPath, dataDirectory, parserOptions) {
3132
const csvData = getPatientIdCSVData(patientIdCsvPath, dataDirectory);
32-
return csvParse(csvData).map((row) => {
33+
return csvParse(csvData, parserOptions).map((row) => {
3334
if (!row.mrn) {
3435
throw new Error(`${patientIdCsvPath} has no "mrn" column`);
3536
}

0 commit comments

Comments
 (0)