Skip to content

Commit 64f0e12

Browse files
committed
added default value if trialResearchSystem is not provided
1 parent e2281d2 commit 64f0e12

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/extractors/CSVClinicalTrialInformationExtractor.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ class CSVClinicalTrialInformationExtractor extends Extractor {
2626

2727
joinClinicalTrialData(patientId, clinicalTrialData) {
2828
logger.debug('Reformatting clinical trial data from CSV into template format');
29-
const {
30-
trialSubjectID, enrollmentStatus, trialResearchID, trialStatus, trialResearchSystem = '',
29+
let {
30+
trialSubjectID, enrollmentStatus, trialResearchID, trialStatus, trialResearchSystem,
3131
} = clinicalTrialData;
3232
const { clinicalSiteID } = this;
3333

3434
if (!(patientId && clinicalSiteID && trialSubjectID && enrollmentStatus && trialResearchID && trialStatus)) {
3535
throw new Error('Clinical trial missing an expected property: patientId, clinicalSiteID, trialSubjectID, enrollmentStatus, trialResearchID, and trialStatus are required.');
3636
}
3737

38+
//since trialResearchSystem is optional, check for blank value and replace with default value
39+
trialResearchSystem = (trialResearchSystem === '') ? 'http://example.com/clinicaltrialids' : trialResearchSystem;
40+
3841
// Need separate data objects for ResearchSubject and ResearchStudy so that they get different resource ids
3942
return {
4043
formattedDataSubject: {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mrn,trialSubjectID,enrollmentStatus,trialResearchID,trialStatus,trialResearchSystem
22
123,subjectId-1,potential-candidate,researchId-1,approved,system-1
33
456,subjectId-2,on-study-intervention,researchId-1,completed,system-2
4-
789,subjectId-3,on-study-observation,researchId-2,active,system-3
4+
789,subjectId-3,on-study-observation,researchId-2,active,

0 commit comments

Comments
 (0)