Skip to content

Commit 67b348b

Browse files
committed
created the application folder
1 parent 6a28ac8 commit 67b348b

18 files changed

+27
-27
lines changed

src/cli/app.js renamed to src/application/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ const fs = require('fs');
22
const path = require('path');
33
const moment = require('moment');
44
const logger = require('../helpers/logger');
5-
const { RunInstanceLogger } = require('./RunInstanceLogger');
6-
const { sendEmailNotification, zipErrors } = require('./emailNotifications');
7-
const { extractDataForPatients } = require('./mcodeExtraction');
5+
const { RunInstanceLogger } = require('./tools/RunInstanceLogger');
6+
const { sendEmailNotification, zipErrors } = require('./tools/emailNotifications');
7+
const { extractDataForPatients } = require('./tools/mcodeExtraction');
88
const { maskMRN } = require('../helpers/patientUtils');
99
const { parsePatientIds } = require('../helpers/appUtils');
1010

src/application/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { mcodeApp } = require('./app');
2+
const { RunInstanceLogger } = require('./tools/RunInstanceLogger');
3+
const { sendEmailNotification, zipErrors } = require('./tools/emailNotifications');
4+
const { extractDataForPatients } = require('./tools/mcodeExtraction');
5+
6+
module.exports = {
7+
mcodeApp,
8+
RunInstanceLogger,
9+
extractDataForPatients,
10+
sendEmailNotification,
11+
zipErrors,
12+
};

src/cli/RunInstanceLogger.js renamed to src/application/tools/RunInstanceLogger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22
const moment = require('moment');
33
const fs = require('fs');
4-
const logger = require('../helpers/logger');
4+
const logger = require('../../helpers/logger');
55

66
// Sort Log records by `dateRun`, more recent (larger) dates to least recent (smaller)
77
function logSorter(a, b) {

src/cli/emailNotifications.js renamed to src/application/tools/emailNotifications.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const nodemailer = require('nodemailer');
2-
const logger = require('../helpers/logger');
2+
const logger = require('../../helpers/logger');
33

44
function zipErrors(...allErrorSources) {
55
// NOTE: assumes each error object is a k-v pair: k is the MRN-id CSV row of the patient, v is an [errors] for that patient at some pipeline step

src/cli/mcodeExtraction.js renamed to src/application/tools/mcodeExtraction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const logger = require('../helpers/logger');
2-
const { getResourceCountInBundle } = require('../helpers/fhirUtils');
1+
const logger = require('../../helpers/logger');
2+
const { getResourceCountInBundle } = require('../../helpers/fhirUtils');
33

44
async function extractDataForPatients(patientIds, mcodeClient, fromDate, toDate) {
55
// Using an initialized mcodeClient, extract data for patient ids in the appropriate toDate-fromDate range

src/cli/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const program = require('commander');
44
const { MCODEClient } = require('../client/MCODEClient');
55
const logger = require('../helpers/logger');
6-
const { mcodeApp } = require('./app');
6+
const { mcodeApp } = require('../application');
77

88
const defaultPathToConfig = path.join('config', 'csv.config.json');
99
const defaultPathToRunLogs = path.join('logs', 'run-logs.json');

src/cli/index.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {
77
extractDataForPatients,
88
sendEmailNotification,
99
zipErrors,
10-
} = require('./cli');
10+
} = require('./application');
1111
const {
1212
BaseFHIRExtractor,
1313
CSVAdverseEventExtractor,

test/cli/app.test.js renamed to test/application/app.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ const fs = require('fs');
22
const rewire = require('rewire');
33
const testConfig = require('./fixtures/test-config.json');
44

5-
const app = rewire('../../src/cli/app.js');
5+
const app = rewire('../../src/application/app.js');
66
const getConfig = app.__get__('getConfig');
77
const checkInputAndConfig = app.__get__('checkInputAndConfig');
88
const checkLogFile = app.__get__('checkLogFile');
99
const getEffectiveFromDate = app.__get__('getEffectiveFromDate');
1010

1111
describe('App Tests', () => {
1212
describe('getConfig', () => {
13-
const pathToConfig = 'test/cli/fixtures/test-config.json';
13+
const pathToConfig = 'test/application/fixtures/test-config.json';
1414

1515
it('should throw error when pathToConfig does not point to valid JSON file.', () => {
1616
expect(() => getConfig()).toThrowError();

test/cli/emailNotifications.test.js renamed to test/application/emailNotifications.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const nodemailer = require('nodemailer');
2-
const { sendEmailNotification } = require('../../src/cli/emailNotifications');
2+
const { sendEmailNotification } = require('../../src/application/tools/emailNotifications');
33

44
const createTransportSpy = jest.spyOn(nodemailer, 'createTransport');
55

0 commit comments

Comments
 (0)