Skip to content

Commit

Permalink
Remove StudyID Requirement for Single Study in Custom Selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelliney authored and alisman committed Jan 17, 2025
1 parent ce9f9fd commit c9e2193
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,20 @@ export function getLine(line: string): InputLine {
};

const content = line.split(':');
if (content.length === 1) {
parsedResult.caseId = content[0];
} else if (content.length > 1) {
parsedResult.studyId = content[0];
const groupInfo = content[1].split(/\s|\t/g);
const setCaseIdAndValue = (groupInfo: string[]) => {
if (groupInfo.length > 1) {
parsedResult.value = groupInfo[1];
}
parsedResult.caseId = groupInfo[0];
};
if (content.length === 1) {
parsedResult.caseId = content[0];
setCaseIdAndValue(content[0].split(/\s|\t/g));
} else if (content.length > 1) {
parsedResult.studyId = content[0];
setCaseIdAndValue(content[1].split(/\s|\t/g));
}

return parsedResult;
}

Expand Down Expand Up @@ -348,6 +352,17 @@ export function parseContent(
warning: [],
};
let lines: InputLine[] = getLines(content);
if (isSingleStudy) {
lines = lines.map(line => {
if (!line.studyId) {
line.studyId = selectedStudies[0];
line.line = `${line.studyId}:${line.line}`;
}

return line;
});
}

if (lines.length > 0) {
if (needToValidate) {
const result = validateLines(
Expand Down

0 comments on commit c9e2193

Please sign in to comment.