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

redcap parser included in main processing

parent 2b3d6e67
No related branches found
No related tags found
1 merge request!1Appointments dev
......@@ -77,6 +77,10 @@ public class Main {
today.set(Calendar.HOUR, 5);
appointmentDao.addAppointments(processPrcAppointments(agendaFile, today));
String redCapFile = line.getOptionValue("red-cap");
appointmentDao.addAppointments(processRedCapAppointments(agendaFile));
System.out.println("delete from web_subject_languages;");
System.out.println("delete from web_appointment;");
System.out.println("delete from web_visit;");
......@@ -107,6 +111,11 @@ public class Main {
}
}
private List<AppointmentEntry> processRedCapAppointments(String agendaFile) throws Exception{
RedcapParser parser = new RedcapParser();
return parser.parse(agendaFile);
}
private List<Subject> processLihMappingControls(String lihMappingControlsFile) throws Exception {
LihControlMappingParser parser = new LihControlMappingParser();
return parser.processExcel(lihMappingControlsFile);
......
......@@ -40,32 +40,35 @@ public class RedcapParser {
subject.setSex(tmp[3]);
subject.setBirthDate(tmp[2]);
List<AppointmentEntry> subjectAppointments = new ArrayList<>();
if (!tmp[9].isEmpty()) {
subjectAppointments.add(createEntryLevelA(tmp[9], tmp[10], subject));
//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[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);
}
}
......@@ -98,8 +101,8 @@ public class RedcapParser {
AppointmentEntry entry = new AppointmentEntry();
String date = getDate(from);
String date2 = getDate(to);
if (!date.equals(date2)){
logger.warn("Different start and end date for level BV appointment. Subject: "+subject.getNdNumber());
if (!date.equals(date2)) {
logger.warn("Different start and end date for level BV appointment. Subject: " + subject.getNdNumber());
}
entry.setDay(date);
entry.setSubject(subject);
......@@ -112,8 +115,8 @@ public class RedcapParser {
AppointmentEntry entry = new AppointmentEntry();
String date = getDate(from);
String date2 = getDate(to);
if (!date.equals(date2)){
logger.warn("Different start and end date for level BG appointment. Subject: "+subject.getNdNumber());
if (!date.equals(date2)) {
logger.warn("Different start and end date for level BG appointment. Subject: " + subject.getNdNumber());
}
entry.setDay(date);
entry.setSubject(subject);
......@@ -126,8 +129,8 @@ public class RedcapParser {
AppointmentEntry entry = new AppointmentEntry();
String date = getDate(from);
String date2 = getDate(to);
if (!date.equals(date2)){
logger.warn("Different start and end date for level B appointment. Subject: "+subject.getNdNumber());
if (!date.equals(date2)) {
logger.warn("Different start and end date for level B appointment. Subject: " + subject.getNdNumber());
}
entry.setDay(date);
entry.setSubject(subject);
......@@ -140,8 +143,8 @@ public class RedcapParser {
AppointmentEntry entry = new AppointmentEntry();
String date = getDate(from);
String date2 = getDate(to);
if (!date.equals(date2)){
logger.warn("Different start and end date for level A appointment. Subject: "+subject.getNdNumber()+"; "+date+", "+date2);
if (!date.equals(date2)) {
logger.warn("Different start and end date for level A appointment. Subject: " + subject.getNdNumber() + "; " + date + ", " + date2);
}
String time = getTime(from);
String duration = getDuration(from, to);
......
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