use of uk.ac.ebi.spot.goci.model.WeeklyTracking in project goci by EBISPOT.
the class WeeklyTrackingService method createAndSaveWeeklyTracking.
public WeeklyTracking createAndSaveWeeklyTracking(StudyTrackingView item, Study study, Date eventDate, Calendar eventCalendarDate, String status) {
WeeklyTracking newWeeklyTracking = createWeeklyTracking(item, study, eventDate, eventCalendarDate, status);
weeklyTrackingRepository.save(newWeeklyTracking);
return newWeeklyTracking;
}
use of uk.ac.ebi.spot.goci.model.WeeklyTracking in project goci by EBISPOT.
the class WeeklyTrackingService method createWeeklyTracking.
public WeeklyTracking createWeeklyTracking(StudyTrackingView item, Study study, Date eventDate, Calendar eventCalendarDate, String status) {
WeeklyTracking weeklyTracking = new WeeklyTracking();
weeklyTracking.setPubmedId(item.getPubmedId());
weeklyTracking.setStudy(study);
weeklyTracking.setEventDate(eventDate);
// The week is from On Sunday to on Sat. JMorales.
eventCalendarDate.add(Calendar.DATE, 1);
weeklyTracking.setWeek(eventCalendarDate.get(Calendar.WEEK_OF_YEAR));
weeklyTracking.setYear(eventCalendarDate.get(Calendar.YEAR));
weeklyTracking.setStatus(status);
return weeklyTracking;
}
use of uk.ac.ebi.spot.goci.model.WeeklyTracking in project goci by EBISPOT.
the class WeeklyProgressReportService method calculateProgressiveQueues2.
public ArrayList<Integer[]> calculateProgressiveQueues2() {
ArrayList<Object[]> progressionQueues = weeklyTrackingService.getMinYearWeek();
BigDecimal yearBigDecimal = (BigDecimal) progressionQueues.get(0)[0];
int year = yearBigDecimal.intValue();
BigDecimal weekBigDecimal = (BigDecimal) progressionQueues.get(0)[1];
int week = weekBigDecimal.intValue();
ArrayList<Integer[]> progressiveQueues = new ArrayList<Integer[]>();
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DATE, 1);
Integer maxYear = calendar.get(Calendar.YEAR);
Integer maxWeek = calendar.get(Calendar.WEEK_OF_YEAR);
Set<Long> queueLevel1 = new HashSet<Long>();
Set<Long> queueLevel2 = new HashSet<Long>();
Set<Long> queueLevel3 = new HashSet<Long>();
List<WeeklyTracking> weeklyTrackingList = weeklyTrackingService.findAll();
while (!((year == maxYear) && (week == maxWeek))) {
//HashSet<Long> queueLevel1_week = weeklyTrackingService.findStudyByStatusAndYearAndWeek("In level 1 queue", year,week);
Integer weekQuery = new Integer(week);
Integer yearQuery = new Integer(year);
Set<Long> queueLevel1_week = weeklyTrackingList.stream().filter(weeklyTracking -> weeklyTracking.getWeek().equals(weekQuery)).filter(weeklyTracking -> weeklyTracking.getYear().equals(yearQuery)).filter(weeklyTracking -> weeklyTracking.getStatus().equals("In level 1 queue")).map(WeeklyTracking::getStudyId).collect(Collectors.toSet());
Set<Long> queueLevel2_week = weeklyTrackingList.stream().filter(weeklyTracking -> weeklyTracking.getWeek().equals(weekQuery)).filter(weeklyTracking -> weeklyTracking.getYear().equals(yearQuery)).filter(weeklyTracking -> weeklyTracking.getStatus().equals("In level 2 queue")).map(WeeklyTracking::getStudyId).collect(Collectors.toSet());
Set<Long> queueLevel3_week = weeklyTrackingList.stream().filter(weeklyTracking -> weeklyTracking.getWeek().equals(weekQuery)).filter(weeklyTracking -> weeklyTracking.getYear().equals(yearQuery)).filter(weeklyTracking -> weeklyTracking.getStatus().equals("In level 3 queue")).map(WeeklyTracking::getStudyId).collect(Collectors.toSet());
Set<Long> queuePublication_week = weeklyTrackingList.stream().filter(weeklyTracking -> weeklyTracking.getWeek().equals(weekQuery)).filter(weeklyTracking -> weeklyTracking.getYear().equals(yearQuery)).filter(weeklyTracking -> weeklyTracking.getStatus().equals("Publication Study")).map(WeeklyTracking::getStudyId).collect(Collectors.toSet());
queueLevel1.removeAll(queueLevel2_week);
queueLevel1.removeAll(queueLevel3_week);
queueLevel1.removeAll(queuePublication_week);
queueLevel1.addAll(queueLevel1_week);
queueLevel2.removeAll(queueLevel3_week);
queueLevel2.removeAll(queuePublication_week);
queueLevel2.addAll(queueLevel2_week);
queueLevel3.removeAll(queuePublication_week);
queueLevel3.addAll(queueLevel3_week);
Integer[] row = { year, week, queueLevel1.size(), queueLevel2.size(), queueLevel3.size(), queuePublication_week.size() };
progressiveQueues.add(row);
// to change
if (week == 52) {
week = 1;
year = year + 1;
} else {
week = week + 1;
}
}
return progressiveQueues;
}
Aggregations