@Test public void processWeeklyView() throws Exception { when(weeklyProgressViewRepository.findAll()).thenReturn(Arrays.asList(STUDY_CREATION, STUDY_LEVEL_1_EV_01, STUDY_LEVEL_1_EV_02, STUDY_LEVEL_2, STUDY_PUBLISH)); List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach(date -> { String content = "overall"; List<ReportsWeeklyProgressView> views = weeklyProgressService.processWeeklyView(content); assertThat(views).hasSize(1); assertThat(views).extracting("studiesCreated", "studiesLevel1Completed", "studiesLevel2Completed", "studiesPublished") .containsOnly(tuple(Collections.singleton(STUDY_CREATION.getStudyId()), Collections.singleton(102L), Collections.singleton(STUDY_LEVEL_2.getStudyId()), Collections.singleton(STUDY_PUBLISH.getStudyId()))); }); }
public List<ReportsWeeklyProgressView> processWeeklyView(String content) { getLog().info("Creating weekly progress view"); Set<Long> previouslyPublished_Studies = new HashSet<>(); Set<Long> previousLevel1_CurationDone_Studies = new HashSet<>(); Set<Long> previousLevel2_CurationDone_Studies = new HashSet<>(); List<WeeklyProgressView> weeklyProgressViews = weeklyProgressViewRepository.findAll(); List<ReportsWeeklyProgressView> reportsWeeklyProgressViews = new ArrayList<>(); List<Map.Entry> publicationToStudies = null; if(content.equals("overall")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToStudyMappings(); } if(content.equals("targeted")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToTargetedArrayStudyMappings(); } HashMap<String, PublicationWeeklyProgressStatus> publicationWeeklyProgressStatusData = new HashMap<>(); List<String> allPMIDs = new ArrayList<String>(); for (java.util.Map.Entry entry: publicationToStudies){ String pmid = entry.getKey().toString(); List studyIds = new ArrayList<>(Arrays.asList(entry.getValue().toString().split("\\s*,\\s*"))); allPMIDs.add(pmid); PublicationWeeklyProgressStatus publicationWeeklyProgressStatus = new PublicationWeeklyProgressStatus(pmid, studyIds); publicationWeeklyProgressStatusData.put(pmid, publicationWeeklyProgressStatus); } List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach((Date date) -> { ReportsWeeklyProgressView reportsWeeklyProgressView = new ReportsWeeklyProgressView(date); Map<String, List<WeeklyProgressView>> collect = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_CREATION")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> it = collect.entrySet().iterator(); Set<Long> studiesCreatedThatWeek = new HashSet<>(); Set<String> publicationsCreatedThatWeek = new HashSet<>(); while (it.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pair = it.next(); String pmid = pair.getKey().toString(); if (allPMIDs.contains(pmid)) { int counter = 0; for (WeeklyProgressView item : pair.getValue()) { if (!studiesCreatedThatWeek.contains(item.getStudyId())) { counter++; studiesCreatedThatWeek.add((item.getStudyId())); } publicationWeeklyProgressStatusData.get(pmid).setCount_Created(publicationWeeklyProgressStatusData.get(pmid).getCount_Created() + counter); } Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmid).getTotalStudyCount(); Long totalStudiesCreatedToDate = publicationWeeklyProgressStatusData.get(pmid).getCount_Created(); if (totalStudiesCreatedToDate.equals(totalNumStudies)) { if (!publicationsCreatedThatWeek.contains(pmid)) { publicationsCreatedThatWeek.add(publicationWeeklyProgressStatusData.get(pmid).getPubmedId()); } } } } Map<String, List<WeeklyProgressView>> collectPublished = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_PUBLISH_STUDY")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevelPublished = collectPublished.entrySet().iterator(); Set<Long> studiesPublishedThatWeek = new HashSet<>(); Set<String> publicationsPublishedThatWeek = new HashSet<>(); while (itLevelPublished.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairPublished = itLevelPublished.next(); String pmidPublished = pairPublished.getKey().toString(); if (allPMIDs.contains(pmidPublished)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidPublished).getTotalStudyCount(); for (WeeklyProgressView itemPublished : pairPublished.getValue()) { if (!previouslyPublished_Studies.contains(itemPublished.getStudyId())) { studiesPublishedThatWeek.add((itemPublished.getStudyId())); publicationWeeklyProgressStatusData.get(pmidPublished).setCount_Published(publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published() + 1L); if (publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published().equals(totalNumStudies)) { if (!publicationsPublishedThatWeek.contains(pmidPublished)) { publicationsPublishedThatWeek.add(publicationWeeklyProgressStatusData.get(pmidPublished).getPubmedId()); } } previouslyPublished_Studies.add(itemPublished.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel1 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel1 = collectLevel1.entrySet().iterator(); Set<Long> studiesWithLevel1Completed = new HashSet<>(); Set<String> publicationsWithLevel1Completed = new HashSet<>(); while (itLevel1.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel1 = itLevel1.next(); String pmidLevel1 = pairLevel1.getKey().toString(); if (allPMIDs.contains(pmidLevel1)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel1).getTotalStudyCount(); for (WeeklyProgressView itemLevel1 : pairLevel1.getValue()) { if (!previousLevel1_CurationDone_Studies.contains(itemLevel1.getStudyId())) { studiesWithLevel1Completed.add((itemLevel1.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel1).setCount_Level1_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel1Completed.contains(pmidLevel1)) { publicationsWithLevel1Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel1).getPubmedId()); } } previousLevel1_CurationDone_Studies.add(itemLevel1.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel2 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_2_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel2 = collectLevel2.entrySet().iterator(); Set<Long> studiesWithLevel2Completed = new HashSet<>(); Set<String> publicationsWithLevel2Completed = new HashSet<>(); while (itLevel2.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel2 = itLevel2.next(); String pmidLevel2 = pairLevel2.getKey().toString(); if (allPMIDs.contains(pmidLevel2)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel2).getTotalStudyCount(); for (WeeklyProgressView itemLevel2 : pairLevel2.getValue()) { if (!previousLevel2_CurationDone_Studies.contains(itemLevel2.getStudyId())) { studiesWithLevel2Completed.add((itemLevel2.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel2).setCount_Level2_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel2Completed.contains(pmidLevel2)) { publicationsWithLevel2Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel2).getPubmedId()); } } previousLevel2_CurationDone_Studies.add(itemLevel2.getStudyId()); } } } } reportsWeeklyProgressView.setStudiesCreated(studiesCreatedThatWeek); reportsWeeklyProgressView.setStudiesPublished(studiesPublishedThatWeek); reportsWeeklyProgressView.setStudiesLevel1Completed(studiesWithLevel1Completed); reportsWeeklyProgressView.setStudiesLevel2Completed(studiesWithLevel2Completed); reportsWeeklyProgressView.setPublicationsCreated(publicationsCreatedThatWeek); reportsWeeklyProgressView.setPublicationsLevel1Completed(publicationsWithLevel1Completed); reportsWeeklyProgressView.setPublicationsLevel2Completed(publicationsWithLevel2Completed); reportsWeeklyProgressView.setPublicationsPublished(publicationsPublishedThatWeek); reportsWeeklyProgressViews.add(reportsWeeklyProgressView); }); return reportsWeeklyProgressViews; }
WeeklyProgressService { public List<ReportsWeeklyProgressView> processWeeklyView(String content) { getLog().info("Creating weekly progress view"); Set<Long> previouslyPublished_Studies = new HashSet<>(); Set<Long> previousLevel1_CurationDone_Studies = new HashSet<>(); Set<Long> previousLevel2_CurationDone_Studies = new HashSet<>(); List<WeeklyProgressView> weeklyProgressViews = weeklyProgressViewRepository.findAll(); List<ReportsWeeklyProgressView> reportsWeeklyProgressViews = new ArrayList<>(); List<Map.Entry> publicationToStudies = null; if(content.equals("overall")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToStudyMappings(); } if(content.equals("targeted")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToTargetedArrayStudyMappings(); } HashMap<String, PublicationWeeklyProgressStatus> publicationWeeklyProgressStatusData = new HashMap<>(); List<String> allPMIDs = new ArrayList<String>(); for (java.util.Map.Entry entry: publicationToStudies){ String pmid = entry.getKey().toString(); List studyIds = new ArrayList<>(Arrays.asList(entry.getValue().toString().split("\\s*,\\s*"))); allPMIDs.add(pmid); PublicationWeeklyProgressStatus publicationWeeklyProgressStatus = new PublicationWeeklyProgressStatus(pmid, studyIds); publicationWeeklyProgressStatusData.put(pmid, publicationWeeklyProgressStatus); } List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach((Date date) -> { ReportsWeeklyProgressView reportsWeeklyProgressView = new ReportsWeeklyProgressView(date); Map<String, List<WeeklyProgressView>> collect = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_CREATION")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> it = collect.entrySet().iterator(); Set<Long> studiesCreatedThatWeek = new HashSet<>(); Set<String> publicationsCreatedThatWeek = new HashSet<>(); while (it.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pair = it.next(); String pmid = pair.getKey().toString(); if (allPMIDs.contains(pmid)) { int counter = 0; for (WeeklyProgressView item : pair.getValue()) { if (!studiesCreatedThatWeek.contains(item.getStudyId())) { counter++; studiesCreatedThatWeek.add((item.getStudyId())); } publicationWeeklyProgressStatusData.get(pmid).setCount_Created(publicationWeeklyProgressStatusData.get(pmid).getCount_Created() + counter); } Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmid).getTotalStudyCount(); Long totalStudiesCreatedToDate = publicationWeeklyProgressStatusData.get(pmid).getCount_Created(); if (totalStudiesCreatedToDate.equals(totalNumStudies)) { if (!publicationsCreatedThatWeek.contains(pmid)) { publicationsCreatedThatWeek.add(publicationWeeklyProgressStatusData.get(pmid).getPubmedId()); } } } } Map<String, List<WeeklyProgressView>> collectPublished = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_PUBLISH_STUDY")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevelPublished = collectPublished.entrySet().iterator(); Set<Long> studiesPublishedThatWeek = new HashSet<>(); Set<String> publicationsPublishedThatWeek = new HashSet<>(); while (itLevelPublished.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairPublished = itLevelPublished.next(); String pmidPublished = pairPublished.getKey().toString(); if (allPMIDs.contains(pmidPublished)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidPublished).getTotalStudyCount(); for (WeeklyProgressView itemPublished : pairPublished.getValue()) { if (!previouslyPublished_Studies.contains(itemPublished.getStudyId())) { studiesPublishedThatWeek.add((itemPublished.getStudyId())); publicationWeeklyProgressStatusData.get(pmidPublished).setCount_Published(publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published() + 1L); if (publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published().equals(totalNumStudies)) { if (!publicationsPublishedThatWeek.contains(pmidPublished)) { publicationsPublishedThatWeek.add(publicationWeeklyProgressStatusData.get(pmidPublished).getPubmedId()); } } previouslyPublished_Studies.add(itemPublished.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel1 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel1 = collectLevel1.entrySet().iterator(); Set<Long> studiesWithLevel1Completed = new HashSet<>(); Set<String> publicationsWithLevel1Completed = new HashSet<>(); while (itLevel1.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel1 = itLevel1.next(); String pmidLevel1 = pairLevel1.getKey().toString(); if (allPMIDs.contains(pmidLevel1)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel1).getTotalStudyCount(); for (WeeklyProgressView itemLevel1 : pairLevel1.getValue()) { if (!previousLevel1_CurationDone_Studies.contains(itemLevel1.getStudyId())) { studiesWithLevel1Completed.add((itemLevel1.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel1).setCount_Level1_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel1Completed.contains(pmidLevel1)) { publicationsWithLevel1Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel1).getPubmedId()); } } previousLevel1_CurationDone_Studies.add(itemLevel1.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel2 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_2_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel2 = collectLevel2.entrySet().iterator(); Set<Long> studiesWithLevel2Completed = new HashSet<>(); Set<String> publicationsWithLevel2Completed = new HashSet<>(); while (itLevel2.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel2 = itLevel2.next(); String pmidLevel2 = pairLevel2.getKey().toString(); if (allPMIDs.contains(pmidLevel2)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel2).getTotalStudyCount(); for (WeeklyProgressView itemLevel2 : pairLevel2.getValue()) { if (!previousLevel2_CurationDone_Studies.contains(itemLevel2.getStudyId())) { studiesWithLevel2Completed.add((itemLevel2.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel2).setCount_Level2_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel2Completed.contains(pmidLevel2)) { publicationsWithLevel2Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel2).getPubmedId()); } } previousLevel2_CurationDone_Studies.add(itemLevel2.getStudyId()); } } } } reportsWeeklyProgressView.setStudiesCreated(studiesCreatedThatWeek); reportsWeeklyProgressView.setStudiesPublished(studiesPublishedThatWeek); reportsWeeklyProgressView.setStudiesLevel1Completed(studiesWithLevel1Completed); reportsWeeklyProgressView.setStudiesLevel2Completed(studiesWithLevel2Completed); reportsWeeklyProgressView.setPublicationsCreated(publicationsCreatedThatWeek); reportsWeeklyProgressView.setPublicationsLevel1Completed(publicationsWithLevel1Completed); reportsWeeklyProgressView.setPublicationsLevel2Completed(publicationsWithLevel2Completed); reportsWeeklyProgressView.setPublicationsPublished(publicationsPublishedThatWeek); reportsWeeklyProgressViews.add(reportsWeeklyProgressView); }); return reportsWeeklyProgressViews; } }
WeeklyProgressService { public List<ReportsWeeklyProgressView> processWeeklyView(String content) { getLog().info("Creating weekly progress view"); Set<Long> previouslyPublished_Studies = new HashSet<>(); Set<Long> previousLevel1_CurationDone_Studies = new HashSet<>(); Set<Long> previousLevel2_CurationDone_Studies = new HashSet<>(); List<WeeklyProgressView> weeklyProgressViews = weeklyProgressViewRepository.findAll(); List<ReportsWeeklyProgressView> reportsWeeklyProgressViews = new ArrayList<>(); List<Map.Entry> publicationToStudies = null; if(content.equals("overall")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToStudyMappings(); } if(content.equals("targeted")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToTargetedArrayStudyMappings(); } HashMap<String, PublicationWeeklyProgressStatus> publicationWeeklyProgressStatusData = new HashMap<>(); List<String> allPMIDs = new ArrayList<String>(); for (java.util.Map.Entry entry: publicationToStudies){ String pmid = entry.getKey().toString(); List studyIds = new ArrayList<>(Arrays.asList(entry.getValue().toString().split("\\s*,\\s*"))); allPMIDs.add(pmid); PublicationWeeklyProgressStatus publicationWeeklyProgressStatus = new PublicationWeeklyProgressStatus(pmid, studyIds); publicationWeeklyProgressStatusData.put(pmid, publicationWeeklyProgressStatus); } List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach((Date date) -> { ReportsWeeklyProgressView reportsWeeklyProgressView = new ReportsWeeklyProgressView(date); Map<String, List<WeeklyProgressView>> collect = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_CREATION")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> it = collect.entrySet().iterator(); Set<Long> studiesCreatedThatWeek = new HashSet<>(); Set<String> publicationsCreatedThatWeek = new HashSet<>(); while (it.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pair = it.next(); String pmid = pair.getKey().toString(); if (allPMIDs.contains(pmid)) { int counter = 0; for (WeeklyProgressView item : pair.getValue()) { if (!studiesCreatedThatWeek.contains(item.getStudyId())) { counter++; studiesCreatedThatWeek.add((item.getStudyId())); } publicationWeeklyProgressStatusData.get(pmid).setCount_Created(publicationWeeklyProgressStatusData.get(pmid).getCount_Created() + counter); } Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmid).getTotalStudyCount(); Long totalStudiesCreatedToDate = publicationWeeklyProgressStatusData.get(pmid).getCount_Created(); if (totalStudiesCreatedToDate.equals(totalNumStudies)) { if (!publicationsCreatedThatWeek.contains(pmid)) { publicationsCreatedThatWeek.add(publicationWeeklyProgressStatusData.get(pmid).getPubmedId()); } } } } Map<String, List<WeeklyProgressView>> collectPublished = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_PUBLISH_STUDY")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevelPublished = collectPublished.entrySet().iterator(); Set<Long> studiesPublishedThatWeek = new HashSet<>(); Set<String> publicationsPublishedThatWeek = new HashSet<>(); while (itLevelPublished.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairPublished = itLevelPublished.next(); String pmidPublished = pairPublished.getKey().toString(); if (allPMIDs.contains(pmidPublished)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidPublished).getTotalStudyCount(); for (WeeklyProgressView itemPublished : pairPublished.getValue()) { if (!previouslyPublished_Studies.contains(itemPublished.getStudyId())) { studiesPublishedThatWeek.add((itemPublished.getStudyId())); publicationWeeklyProgressStatusData.get(pmidPublished).setCount_Published(publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published() + 1L); if (publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published().equals(totalNumStudies)) { if (!publicationsPublishedThatWeek.contains(pmidPublished)) { publicationsPublishedThatWeek.add(publicationWeeklyProgressStatusData.get(pmidPublished).getPubmedId()); } } previouslyPublished_Studies.add(itemPublished.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel1 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel1 = collectLevel1.entrySet().iterator(); Set<Long> studiesWithLevel1Completed = new HashSet<>(); Set<String> publicationsWithLevel1Completed = new HashSet<>(); while (itLevel1.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel1 = itLevel1.next(); String pmidLevel1 = pairLevel1.getKey().toString(); if (allPMIDs.contains(pmidLevel1)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel1).getTotalStudyCount(); for (WeeklyProgressView itemLevel1 : pairLevel1.getValue()) { if (!previousLevel1_CurationDone_Studies.contains(itemLevel1.getStudyId())) { studiesWithLevel1Completed.add((itemLevel1.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel1).setCount_Level1_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel1Completed.contains(pmidLevel1)) { publicationsWithLevel1Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel1).getPubmedId()); } } previousLevel1_CurationDone_Studies.add(itemLevel1.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel2 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_2_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel2 = collectLevel2.entrySet().iterator(); Set<Long> studiesWithLevel2Completed = new HashSet<>(); Set<String> publicationsWithLevel2Completed = new HashSet<>(); while (itLevel2.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel2 = itLevel2.next(); String pmidLevel2 = pairLevel2.getKey().toString(); if (allPMIDs.contains(pmidLevel2)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel2).getTotalStudyCount(); for (WeeklyProgressView itemLevel2 : pairLevel2.getValue()) { if (!previousLevel2_CurationDone_Studies.contains(itemLevel2.getStudyId())) { studiesWithLevel2Completed.add((itemLevel2.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel2).setCount_Level2_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel2Completed.contains(pmidLevel2)) { publicationsWithLevel2Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel2).getPubmedId()); } } previousLevel2_CurationDone_Studies.add(itemLevel2.getStudyId()); } } } } reportsWeeklyProgressView.setStudiesCreated(studiesCreatedThatWeek); reportsWeeklyProgressView.setStudiesPublished(studiesPublishedThatWeek); reportsWeeklyProgressView.setStudiesLevel1Completed(studiesWithLevel1Completed); reportsWeeklyProgressView.setStudiesLevel2Completed(studiesWithLevel2Completed); reportsWeeklyProgressView.setPublicationsCreated(publicationsCreatedThatWeek); reportsWeeklyProgressView.setPublicationsLevel1Completed(publicationsWithLevel1Completed); reportsWeeklyProgressView.setPublicationsLevel2Completed(publicationsWithLevel2Completed); reportsWeeklyProgressView.setPublicationsPublished(publicationsPublishedThatWeek); reportsWeeklyProgressViews.add(reportsWeeklyProgressView); }); return reportsWeeklyProgressViews; } @Autowired  WeeklyProgressService(WeeklyProgressViewRepository weeklyProgressViewRepository); }
WeeklyProgressService { public List<ReportsWeeklyProgressView> processWeeklyView(String content) { getLog().info("Creating weekly progress view"); Set<Long> previouslyPublished_Studies = new HashSet<>(); Set<Long> previousLevel1_CurationDone_Studies = new HashSet<>(); Set<Long> previousLevel2_CurationDone_Studies = new HashSet<>(); List<WeeklyProgressView> weeklyProgressViews = weeklyProgressViewRepository.findAll(); List<ReportsWeeklyProgressView> reportsWeeklyProgressViews = new ArrayList<>(); List<Map.Entry> publicationToStudies = null; if(content.equals("overall")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToStudyMappings(); } if(content.equals("targeted")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToTargetedArrayStudyMappings(); } HashMap<String, PublicationWeeklyProgressStatus> publicationWeeklyProgressStatusData = new HashMap<>(); List<String> allPMIDs = new ArrayList<String>(); for (java.util.Map.Entry entry: publicationToStudies){ String pmid = entry.getKey().toString(); List studyIds = new ArrayList<>(Arrays.asList(entry.getValue().toString().split("\\s*,\\s*"))); allPMIDs.add(pmid); PublicationWeeklyProgressStatus publicationWeeklyProgressStatus = new PublicationWeeklyProgressStatus(pmid, studyIds); publicationWeeklyProgressStatusData.put(pmid, publicationWeeklyProgressStatus); } List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach((Date date) -> { ReportsWeeklyProgressView reportsWeeklyProgressView = new ReportsWeeklyProgressView(date); Map<String, List<WeeklyProgressView>> collect = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_CREATION")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> it = collect.entrySet().iterator(); Set<Long> studiesCreatedThatWeek = new HashSet<>(); Set<String> publicationsCreatedThatWeek = new HashSet<>(); while (it.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pair = it.next(); String pmid = pair.getKey().toString(); if (allPMIDs.contains(pmid)) { int counter = 0; for (WeeklyProgressView item : pair.getValue()) { if (!studiesCreatedThatWeek.contains(item.getStudyId())) { counter++; studiesCreatedThatWeek.add((item.getStudyId())); } publicationWeeklyProgressStatusData.get(pmid).setCount_Created(publicationWeeklyProgressStatusData.get(pmid).getCount_Created() + counter); } Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmid).getTotalStudyCount(); Long totalStudiesCreatedToDate = publicationWeeklyProgressStatusData.get(pmid).getCount_Created(); if (totalStudiesCreatedToDate.equals(totalNumStudies)) { if (!publicationsCreatedThatWeek.contains(pmid)) { publicationsCreatedThatWeek.add(publicationWeeklyProgressStatusData.get(pmid).getPubmedId()); } } } } Map<String, List<WeeklyProgressView>> collectPublished = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_PUBLISH_STUDY")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevelPublished = collectPublished.entrySet().iterator(); Set<Long> studiesPublishedThatWeek = new HashSet<>(); Set<String> publicationsPublishedThatWeek = new HashSet<>(); while (itLevelPublished.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairPublished = itLevelPublished.next(); String pmidPublished = pairPublished.getKey().toString(); if (allPMIDs.contains(pmidPublished)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidPublished).getTotalStudyCount(); for (WeeklyProgressView itemPublished : pairPublished.getValue()) { if (!previouslyPublished_Studies.contains(itemPublished.getStudyId())) { studiesPublishedThatWeek.add((itemPublished.getStudyId())); publicationWeeklyProgressStatusData.get(pmidPublished).setCount_Published(publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published() + 1L); if (publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published().equals(totalNumStudies)) { if (!publicationsPublishedThatWeek.contains(pmidPublished)) { publicationsPublishedThatWeek.add(publicationWeeklyProgressStatusData.get(pmidPublished).getPubmedId()); } } previouslyPublished_Studies.add(itemPublished.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel1 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel1 = collectLevel1.entrySet().iterator(); Set<Long> studiesWithLevel1Completed = new HashSet<>(); Set<String> publicationsWithLevel1Completed = new HashSet<>(); while (itLevel1.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel1 = itLevel1.next(); String pmidLevel1 = pairLevel1.getKey().toString(); if (allPMIDs.contains(pmidLevel1)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel1).getTotalStudyCount(); for (WeeklyProgressView itemLevel1 : pairLevel1.getValue()) { if (!previousLevel1_CurationDone_Studies.contains(itemLevel1.getStudyId())) { studiesWithLevel1Completed.add((itemLevel1.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel1).setCount_Level1_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel1Completed.contains(pmidLevel1)) { publicationsWithLevel1Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel1).getPubmedId()); } } previousLevel1_CurationDone_Studies.add(itemLevel1.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel2 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_2_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel2 = collectLevel2.entrySet().iterator(); Set<Long> studiesWithLevel2Completed = new HashSet<>(); Set<String> publicationsWithLevel2Completed = new HashSet<>(); while (itLevel2.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel2 = itLevel2.next(); String pmidLevel2 = pairLevel2.getKey().toString(); if (allPMIDs.contains(pmidLevel2)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel2).getTotalStudyCount(); for (WeeklyProgressView itemLevel2 : pairLevel2.getValue()) { if (!previousLevel2_CurationDone_Studies.contains(itemLevel2.getStudyId())) { studiesWithLevel2Completed.add((itemLevel2.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel2).setCount_Level2_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel2Completed.contains(pmidLevel2)) { publicationsWithLevel2Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel2).getPubmedId()); } } previousLevel2_CurationDone_Studies.add(itemLevel2.getStudyId()); } } } } reportsWeeklyProgressView.setStudiesCreated(studiesCreatedThatWeek); reportsWeeklyProgressView.setStudiesPublished(studiesPublishedThatWeek); reportsWeeklyProgressView.setStudiesLevel1Completed(studiesWithLevel1Completed); reportsWeeklyProgressView.setStudiesLevel2Completed(studiesWithLevel2Completed); reportsWeeklyProgressView.setPublicationsCreated(publicationsCreatedThatWeek); reportsWeeklyProgressView.setPublicationsLevel1Completed(publicationsWithLevel1Completed); reportsWeeklyProgressView.setPublicationsLevel2Completed(publicationsWithLevel2Completed); reportsWeeklyProgressView.setPublicationsPublished(publicationsPublishedThatWeek); reportsWeeklyProgressViews.add(reportsWeeklyProgressView); }); return reportsWeeklyProgressViews; } @Autowired  WeeklyProgressService(WeeklyProgressViewRepository weeklyProgressViewRepository); List<ReportsWeeklyProgressView> processWeeklyView(String content); }
WeeklyProgressService { public List<ReportsWeeklyProgressView> processWeeklyView(String content) { getLog().info("Creating weekly progress view"); Set<Long> previouslyPublished_Studies = new HashSet<>(); Set<Long> previousLevel1_CurationDone_Studies = new HashSet<>(); Set<Long> previousLevel2_CurationDone_Studies = new HashSet<>(); List<WeeklyProgressView> weeklyProgressViews = weeklyProgressViewRepository.findAll(); List<ReportsWeeklyProgressView> reportsWeeklyProgressViews = new ArrayList<>(); List<Map.Entry> publicationToStudies = null; if(content.equals("overall")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToStudyMappings(); } if(content.equals("targeted")) { publicationToStudies = weeklyProgressViewRepository.getAllPublicationToTargetedArrayStudyMappings(); } HashMap<String, PublicationWeeklyProgressStatus> publicationWeeklyProgressStatusData = new HashMap<>(); List<String> allPMIDs = new ArrayList<String>(); for (java.util.Map.Entry entry: publicationToStudies){ String pmid = entry.getKey().toString(); List studyIds = new ArrayList<>(Arrays.asList(entry.getValue().toString().split("\\s*,\\s*"))); allPMIDs.add(pmid); PublicationWeeklyProgressStatus publicationWeeklyProgressStatus = new PublicationWeeklyProgressStatus(pmid, studyIds); publicationWeeklyProgressStatusData.put(pmid, publicationWeeklyProgressStatus); } List<Date> uniqueWeekStartDate = weeklyProgressViewRepository.getAllWeekStartDates(); uniqueWeekStartDate.forEach((Date date) -> { ReportsWeeklyProgressView reportsWeeklyProgressView = new ReportsWeeklyProgressView(date); Map<String, List<WeeklyProgressView>> collect = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_CREATION")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> it = collect.entrySet().iterator(); Set<Long> studiesCreatedThatWeek = new HashSet<>(); Set<String> publicationsCreatedThatWeek = new HashSet<>(); while (it.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pair = it.next(); String pmid = pair.getKey().toString(); if (allPMIDs.contains(pmid)) { int counter = 0; for (WeeklyProgressView item : pair.getValue()) { if (!studiesCreatedThatWeek.contains(item.getStudyId())) { counter++; studiesCreatedThatWeek.add((item.getStudyId())); } publicationWeeklyProgressStatusData.get(pmid).setCount_Created(publicationWeeklyProgressStatusData.get(pmid).getCount_Created() + counter); } Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmid).getTotalStudyCount(); Long totalStudiesCreatedToDate = publicationWeeklyProgressStatusData.get(pmid).getCount_Created(); if (totalStudiesCreatedToDate.equals(totalNumStudies)) { if (!publicationsCreatedThatWeek.contains(pmid)) { publicationsCreatedThatWeek.add(publicationWeeklyProgressStatusData.get(pmid).getPubmedId()); } } } } Map<String, List<WeeklyProgressView>> collectPublished = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_PUBLISH_STUDY")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevelPublished = collectPublished.entrySet().iterator(); Set<Long> studiesPublishedThatWeek = new HashSet<>(); Set<String> publicationsPublishedThatWeek = new HashSet<>(); while (itLevelPublished.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairPublished = itLevelPublished.next(); String pmidPublished = pairPublished.getKey().toString(); if (allPMIDs.contains(pmidPublished)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidPublished).getTotalStudyCount(); for (WeeklyProgressView itemPublished : pairPublished.getValue()) { if (!previouslyPublished_Studies.contains(itemPublished.getStudyId())) { studiesPublishedThatWeek.add((itemPublished.getStudyId())); publicationWeeklyProgressStatusData.get(pmidPublished).setCount_Published(publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published() + 1L); if (publicationWeeklyProgressStatusData.get(pmidPublished).getCount_Published().equals(totalNumStudies)) { if (!publicationsPublishedThatWeek.contains(pmidPublished)) { publicationsPublishedThatWeek.add(publicationWeeklyProgressStatusData.get(pmidPublished).getPubmedId()); } } previouslyPublished_Studies.add(itemPublished.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel1 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel1 = collectLevel1.entrySet().iterator(); Set<Long> studiesWithLevel1Completed = new HashSet<>(); Set<String> publicationsWithLevel1Completed = new HashSet<>(); while (itLevel1.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel1 = itLevel1.next(); String pmidLevel1 = pairLevel1.getKey().toString(); if (allPMIDs.contains(pmidLevel1)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel1).getTotalStudyCount(); for (WeeklyProgressView itemLevel1 : pairLevel1.getValue()) { if (!previousLevel1_CurationDone_Studies.contains(itemLevel1.getStudyId())) { studiesWithLevel1Completed.add((itemLevel1.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel1).setCount_Level1_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel1).getCount_Level1_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel1Completed.contains(pmidLevel1)) { publicationsWithLevel1Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel1).getPubmedId()); } } previousLevel1_CurationDone_Studies.add(itemLevel1.getStudyId()); } } } } Map<String, List<WeeklyProgressView>> collectLevel2 = weeklyProgressViews.stream() .filter(weeklyProgressView -> weeklyProgressView.getWeekStartDay().equals(date)) .filter(weeklyProgressView -> weeklyProgressView.getEventType().equals( "STUDY_STATUS_CHANGE_LEVEL_2_CURATION_DONE")) .collect(Collectors.groupingBy(WeeklyProgressView::getPubmedId)); Iterator<Map.Entry<String, List<WeeklyProgressView>>> itLevel2 = collectLevel2.entrySet().iterator(); Set<Long> studiesWithLevel2Completed = new HashSet<>(); Set<String> publicationsWithLevel2Completed = new HashSet<>(); while (itLevel2.hasNext()) { Map.Entry<String, List<WeeklyProgressView>> pairLevel2 = itLevel2.next(); String pmidLevel2 = pairLevel2.getKey().toString(); if (allPMIDs.contains(pmidLevel2)) { Long totalNumStudies = publicationWeeklyProgressStatusData.get(pmidLevel2).getTotalStudyCount(); for (WeeklyProgressView itemLevel2 : pairLevel2.getValue()) { if (!previousLevel2_CurationDone_Studies.contains(itemLevel2.getStudyId())) { studiesWithLevel2Completed.add((itemLevel2.getStudyId())); publicationWeeklyProgressStatusData.get(pmidLevel2).setCount_Level2_CurationDone(publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone() + 1L); if (publicationWeeklyProgressStatusData.get(pmidLevel2).getCount_Level2_CurationDone().equals(totalNumStudies)) { if (!publicationsWithLevel2Completed.contains(pmidLevel2)) { publicationsWithLevel2Completed.add(publicationWeeklyProgressStatusData.get(pmidLevel2).getPubmedId()); } } previousLevel2_CurationDone_Studies.add(itemLevel2.getStudyId()); } } } } reportsWeeklyProgressView.setStudiesCreated(studiesCreatedThatWeek); reportsWeeklyProgressView.setStudiesPublished(studiesPublishedThatWeek); reportsWeeklyProgressView.setStudiesLevel1Completed(studiesWithLevel1Completed); reportsWeeklyProgressView.setStudiesLevel2Completed(studiesWithLevel2Completed); reportsWeeklyProgressView.setPublicationsCreated(publicationsCreatedThatWeek); reportsWeeklyProgressView.setPublicationsLevel1Completed(publicationsWithLevel1Completed); reportsWeeklyProgressView.setPublicationsLevel2Completed(publicationsWithLevel2Completed); reportsWeeklyProgressView.setPublicationsPublished(publicationsPublishedThatWeek); reportsWeeklyProgressViews.add(reportsWeeklyProgressView); }); return reportsWeeklyProgressViews; } @Autowired  WeeklyProgressService(WeeklyProgressViewRepository weeklyProgressViewRepository); List<ReportsWeeklyProgressView> processWeeklyView(String content);  }