Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public CriteriaUpToDateReportController(CertificationBodyManager acbManager,
})
@LogMethodUsage
@RequestMapping(value = "/listings", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
public @ResponseBody List<ListingNotUpToDateReport> getCriteriaUpToDateListings() {
public @ResponseBody List<ListingNotUpToDateReport> getCriteriaNotUpToDateByListing() {
return reportDataManager.getCriteriaAttributeUpToDateService().getAllListingNotUpToDateReports();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.web.bind.annotation.RestController;

import gov.healthit.chpl.developer.search.DeveloperSearchResult;
import gov.healthit.chpl.developer.search.DeveloperSearchService;
import gov.healthit.chpl.manager.StatisticsManager;
import gov.healthit.chpl.report.ReportDataManager;
import gov.healthit.chpl.report.criteriamigrationreport.CriteriaMigrationReportDenormalized;
Expand Down Expand Up @@ -41,15 +40,12 @@
public class ReportDataController {
private ReportDataManager reportDataManager;
private StatisticsManager statisticsManager;
private DeveloperSearchService developerSearchService;

@Autowired
public ReportDataController(ReportDataManager reportDataManager,
StatisticsManager statisticsManager,
DeveloperSearchService developerSearchService) {
StatisticsManager statisticsManager) {
this.reportDataManager = reportDataManager;
this.statisticsManager = statisticsManager;
this.developerSearchService = developerSearchService;
}

@Operation(summary = "Retrieves the data used to generate the HTI-1 Criteria Migration Report.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,20 @@ public CertificationCriteriaManager(CertificationCriterionDAO certificationCrite
public List<CertificationCriterionWithAttributes> getAllWithAttributes() {
LOGGER.debug("Getting all criterion with attributes from the database (not cached).");
List<CertificationCriterion> allCriteria = getAll();
return allCriteria.stream()
List<CertificationCriterionWithAttributes> allCriteriaWithAttributes = allCriteria.stream()
.map(criterion -> buildCertificationCriterionWithAttributes(criterion))
.sorted(criterionComparator)
.collect(Collectors.toList());
setSortOrder(allCriteriaWithAttributes);
return allCriteriaWithAttributes;
}

public List<CertificationCriterionWithAttributes> getActiveWithAttributes(String certificationEdition,
LocalDate startDay, LocalDate endDay) {
return getActive(certificationEdition, startDay, endDay).stream()
List<CertificationCriterionWithAttributes> activeCriteriaWithAttributes = getActive(certificationEdition, startDay, endDay).stream()
.map(criterion -> buildCertificationCriterionWithAttributes(criterion))
.sorted(criterionComparator)
.collect(Collectors.toList());
setSortOrder(activeCriteriaWithAttributes);
return activeCriteriaWithAttributes;
}

public List<CertificationCriterion> getActive(String certificationEdition, LocalDate startDay, LocalDate endDay) {
Expand All @@ -65,24 +67,23 @@ public List<CertificationCriterion> getActive(String certificationEdition, Local
.filter(criterion -> StringUtils.isEmpty(certificationEdition)
? true
: criterion.getCertificationEdition() == null || criterion.getCertificationEdition().equals(certificationEdition))
.sorted(criterionComparator)
.collect(Collectors.toList());
}

public List<CertificationCriterion> getCriteriaAvailableToListingAndUser(CertifiedProductSearchDetails listing) {
List<CertificationCriterion> allCriteriaAvailableToListing = Stream.concat(
return Stream.concat(
getAttestedCriteria(listing).stream(),
getEditableCriteria(listing).stream())
.distinct()
.sorted(criterionComparator)
.collect(Collectors.toList());
return allCriteriaAvailableToListing;
}

private List<CertificationCriterion> getAttestedCriteria(CertifiedProductSearchDetails listing) {
return listing.getCertificationResults().stream()
.filter(certResult -> certResult.getSuccess())
.map(certResult -> certResult.getCriterion())
.sorted(criterionComparator)
.collect(Collectors.toList());
}

Expand All @@ -95,6 +96,7 @@ private List<CertificationCriterion> getEditableCriteria(CertifiedProductSearchD
&& !resourcePermissionsFactory.get().isUserRoleOnc()) {
return allActiveCriteria.stream()
.filter(criterion -> criterion.isEditable())
.sorted(criterionComparator)
.collect(Collectors.toList());
}
return allActiveCriteria;
Expand All @@ -113,6 +115,7 @@ public List<CertificationCriterion> getActiveBetween(LocalDate startDay, LocalDa
.filter(criterion -> DateUtil.datesOverlap(
Pair.of(criterion.getStartDay(), criterion.getEndDay()),
Pair.of(startDay, endDay)))
.sorted(criterionComparator)
.collect(Collectors.toList());
}

Expand All @@ -123,6 +126,7 @@ public List<CertificationCriterion> getActiveToday() {
.filter(criterion -> DateUtil.datesOverlap(
Pair.of(criterion.getStartDay(), criterion.getEndDay()),
Pair.of(today, today)))
.sorted(criterionComparator)
.collect(Collectors.toList());
}

Expand Down Expand Up @@ -164,4 +168,10 @@ private CertificationCriterionWithAttributes buildCertificationCriterionWithAttr
.build())
.build();
}

private void setSortOrder(List<CertificationCriterionWithAttributes> criteria) {
for (int i = 0; i < criteria.size(); i++) {
criteria.get(i).setSortOrder(i);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import tools.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonSerialize;

import gov.healthit.chpl.criteriaattribute.rule.Rule;
import gov.healthit.chpl.domain.CertifiedProductSearchDetails;
Expand All @@ -25,6 +23,8 @@
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import tools.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonSerialize;

@JsonIgnoreProperties(ignoreUnknown = true)
@SuperBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CertificationCriterionWithAttributes extends CertificationCriterion
private static final long serialVersionUID = 5732322243571111895L;

private AllowedAttributes attributes;
private Integer sortOrder;

@Override
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class CriteriaUpToDateReportService {
private SummaryStatisticsDAO summaryStatisticsDao;
private List<CertificationStatus> allCertificationStatuses;
private String unformattedListingDetailsUrl;
private String unformattedDeveloperDetailsUrl;

@Autowired
public CriteriaUpToDateReportService(CriteriaUpToDateStatusReportDateService reportDateService,
Expand All @@ -45,13 +46,15 @@ public CriteriaUpToDateReportService(CriteriaUpToDateStatusReportDateService rep
SummaryStatisticsDAO summaryStatisticsDao,
CertificationStatusDAO certificationStatusDao,
@Value("${chplUrlBegin}") String chplUrlBegin,
@Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) {
@Value("${listingDetailsUrlPart}") String listingDetailsUrlPart,
@Value("${developerUrlPart}") String developerDetailsUrlPart) {
this.reportDateService = reportDateService;
this.criteriaManager = criteriaManager;
this.updatedCriteriaStatusReportDao = updatedCriteriaStatusReportDao;
this.summaryStatisticsDao = summaryStatisticsDao;
this.allCertificationStatuses = certificationStatusDao.findAll();
this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart;
this.unformattedDeveloperDetailsUrl = chplUrlBegin + developerDetailsUrlPart;

}

Expand Down Expand Up @@ -110,6 +113,9 @@ public List<ListingNotUpToDateReport> getAllListingNotUpToDateReports() {
.chplProductNumber(report.getChplProductNumber())
.certifiedProductId(report.getCertifiedProductId())
.listingDetailsUrl(String.format(unformattedListingDetailsUrl, report.getCertifiedProductId()))
.developerName(report.getDeveloper())
.developerDetailsUrl(String.format(unformattedDeveloperDetailsUrl, report.getDeveloperId()))
.requiredDay(report.getRequiredDay())
.build())
.collect(Collectors.toSet());
return results.stream().collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package gov.healthit.chpl.report.criteriauptodate;

import java.time.LocalDate;

import gov.healthit.chpl.certificationCriteria.CertificationCriterion;
import gov.healthit.chpl.util.LocalDateDeserializer;
import gov.healthit.chpl.util.LocalDateSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import tools.jackson.databind.annotation.JsonDeserialize;
import tools.jackson.databind.annotation.JsonSerialize;

@Data
@Builder
Expand All @@ -14,4 +20,10 @@ public class ListingNotUpToDateReport {
private Long certifiedProductId;
private String listingDetailsUrl;
private String chplProductNumber;
private String developerName;
private String developerDetailsUrl;

@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate requiredDay;
}
Loading