Skip to content
Snippets Groups Projects
Commit f527251c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

redcap parser handles improper rows

parent 3b700683
No related branches found
No related tags found
1 merge request!1Appointments dev
......@@ -33,41 +33,45 @@ public class RedcapParser {
if (subject == null) {
logger.warn("Cannot find subject with id: " + ndNumber);
} else {
subject.addLanguage(tmp[4]);
subject.addLanguage(tmp[5]);
subject.addLanguage(tmp[6]);
subject.addLanguage(tmp[7]);
subject.setSex(tmp[3]);
subject.setBirthDate(tmp[2]);
//for now only PRC and flying team subjects
if (subject.getToBeSeenAt().startsWith("P") || subject.getToBeSeenAt().startsWith("F")) {
List<AppointmentEntry> subjectAppointments = new ArrayList<>();
if (!tmp[9].isEmpty()) {
subjectAppointments.add(createEntryLevelA(tmp[9], tmp[10], subject));
if (tmp.length < 8) {
logger.warn("Invalid row (not enough cells): " + line);
} else {
subject.addLanguage(tmp[4]);
subject.addLanguage(tmp[5]);
subject.addLanguage(tmp[6]);
subject.addLanguage(tmp[7]);
subject.setSex(tmp[3]);
subject.setBirthDate(tmp[2]);
// for now only PRC and flying team subjects
if (subject.getToBeSeenAt() == null || subject.getToBeSeenAt().startsWith("P") || subject.getToBeSeenAt().startsWith("F")) {
List<AppointmentEntry> subjectAppointments = new ArrayList<>();
if (!tmp[9].isEmpty()) {
subjectAppointments.add(createEntryLevelA(tmp[9], tmp[10], subject));
}
if (!tmp[13].isEmpty()) {
subjectAppointments.add(createEntryLevelB(tmp[13], tmp[14], subject));
}
if (!tmp[17].isEmpty()) {
subjectAppointments.add(createEntryLevelBG(tmp[17], tmp[18], subject));
}
if (!tmp[21].isEmpty()) {
subjectAppointments.add(createEntryLevelBV(tmp[21], tmp[22], subject));
}
if (!tmp[41].isEmpty()) {
subjectAppointments.add(createEntryLevelSB(tmp[41], subject));
}
if (!tmp[45].isEmpty()) {
subjectAppointments.add(createEntryLevelMPower(tmp[45], subject));
}
result.addAll(subjectAppointments);
}
if (!tmp[13].isEmpty()) {
subjectAppointments.add(createEntryLevelB(tmp[13], tmp[14], subject));
}
if (!tmp[17].isEmpty()) {
subjectAppointments.add(createEntryLevelBG(tmp[17], tmp[18], subject));
}
if (!tmp[21].isEmpty()) {
subjectAppointments.add(createEntryLevelBV(tmp[21], tmp[22], subject));
}
if (!tmp[41].isEmpty()) {
subjectAppointments.add(createEntryLevelSB(tmp[41], subject));
}
if (!tmp[45].isEmpty()) {
subjectAppointments.add(createEntryLevelMPower(tmp[45], subject));
}
result.addAll(subjectAppointments);
}
}
......
......@@ -5,3 +5,4 @@ ND0002 Visit 1 1956-05-22 14:53 M Polish Yes 2015-03-04 14:56 2015-03-04 17:4
ND0002 Visit 2 Yes 2016-01-18 10:00 2016-01-18 13:10 1 Yes 2016-05-26 2016-05-26 1 Yes 2016-01-18 Yes 2016-01-18 Yes Yes 2016-05-26 2016-05-26 Yes 2016-05-26 Yes 2016-01-18
ND0003 Visit 1 1957-07-15 09:21 F Polish German Rusian English Yes 2015-03-11 09:25 2015-03-11 14:58 1 Yes 2015-11-12 2015-11-12 1 Yes 2015-03-11 Yes 2015-03-11 Yes 2015-03-11
ND0003 Visit 2 Yes 2016-04-27 11:31 2016-05-11 13:30 2 Yes 2016-06-16 2016-06-16 1 Yes 2016-08-18 2016-08-18 1 Yes 2016-04-27 Yes 2016-04-27 Yes Yes 2016-04-27 2016-04-28 Yes 2016-07-28 Yes 2016-04-27
ND0003 Visit 3
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment