Skip to content

Commit

Permalink
Merge branch 'OCD-4783' into qa
Browse files Browse the repository at this point in the history
  • Loading branch information
kekey1 committed Mar 5, 2025
2 parents 3747814 + 1a3387f commit a4256f5
Show file tree
Hide file tree
Showing 42 changed files with 210 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package gov.healthit.chpl.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import gov.healthit.chpl.cqm.CQMCriterionAllVersions;
import gov.healthit.chpl.cqm.CqmManager;
import gov.healthit.chpl.util.SwaggerSecurityRequirement;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "cqms", description = "Endpoints related to Clinical Quality Measures.")
@RestController
@RequestMapping("/cqms")
public class CqmController {
private CqmManager cqmManager;

@Autowired
public CqmController(CqmManager cqmManager) {
this.cqmManager = cqmManager;
}

@Operation(summary = "Retrieve all Clinical Quality Measures. ",
description = "Returns all of the Clinical Quality Measures that are currently in the CHPL.",
security = {
@SecurityRequirement(name = SwaggerSecurityRequirement.API_KEY)
})
@RequestMapping(value = "", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
public @ResponseBody List<CQMCriterionAllVersions> getAllCqms() {
return cqmManager.getAllCqms();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.Serializable;
import java.util.List;

import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMResultDetails;

/**
* Represents a list of CQMResultDetails domain objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ private CacheNames() {}
public static final String CLASSIFICATION_NAMES = "classificationNames";
public static final String MEASURES = "measures";
public static final String MEASURE_TYPES = "measureTypes";
public static final String CQM_CRITERION = "cqmCriterion";
public static final String CQM_CRITERION_NUMBERS = "cqmCriterionNumbers";
public static final String CERTIFICATION_CRITERIA = "certificationCriteria";
public static final String GET_DECERTIFIED_DEVELOPERS = "getDecertifiedDevelopers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import gov.healthit.chpl.certifiedproduct.service.CqmResultsService;
import gov.healthit.chpl.certifiedproduct.service.ListingMeasuresService;
import gov.healthit.chpl.certifiedproduct.service.ListingService;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.dao.CertifiedProductSearchResultDAO;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.domain.CertificationResult;
import gov.healthit.chpl.domain.CertificationStatusEvent;
import gov.healthit.chpl.domain.CertifiedProductSearchDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import gov.healthit.chpl.certificationCriteria.CertificationCriterionWithAttributes;
import gov.healthit.chpl.codeset.CertificationResultCodeSet;
import gov.healthit.chpl.conformanceMethod.domain.CertificationResultConformanceMethod;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.domain.CertificationResult;
import gov.healthit.chpl.domain.CertificationResultAdditionalSoftware;
import gov.healthit.chpl.domain.CertificationResultTestData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

import com.fasterxml.jackson.core.JsonProcessingException;

import gov.healthit.chpl.dao.CQMCriterionDAO;
import gov.healthit.chpl.dao.CQMResultDAO;
import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMCriterion;
import gov.healthit.chpl.cqm.CQMResultCertification;
import gov.healthit.chpl.cqm.CQMResultDTO;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.cqm.dao.CQMCriterionDAO;
import gov.healthit.chpl.cqm.dao.CQMResultDAO;
import gov.healthit.chpl.domain.CertifiedProductSearchDetails;
import gov.healthit.chpl.dto.CQMResultDTO;
import gov.healthit.chpl.exception.EntityCreationException;
import gov.healthit.chpl.exception.EntityRetrievalException;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import gov.healthit.chpl.dao.CQMResultDAO;
import gov.healthit.chpl.dao.CQMResultDetailsDAO;
import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMCriterion;
import gov.healthit.chpl.cqm.CQMResultCertification;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.cqm.CqmCriterionService;
import gov.healthit.chpl.cqm.dao.CQMResultDAO;
import gov.healthit.chpl.cqm.dao.CQMResultDetailsDAO;
import gov.healthit.chpl.domain.comparator.CQMCriteriaComparator;
import gov.healthit.chpl.domain.comparator.CQMResultComparator;
import gov.healthit.chpl.domain.concept.CertificationEditionConcept;
import gov.healthit.chpl.service.CqmCriterionService;
import lombok.extern.log4j.Log4j2;

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import gov.healthit.chpl.certificationCriteria.CertificationCriterion;
import gov.healthit.chpl.codeset.CertificationResultCodeSet;
import gov.healthit.chpl.conformanceMethod.domain.CertificationResultConformanceMethod;
import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMResultCertification;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.domain.CertificationResult;
import gov.healthit.chpl.domain.CertificationResultAdditionalSoftware;
import gov.healthit.chpl.domain.CertificationResultTestData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.domain;
package gov.healthit.chpl.cqm;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package gov.healthit.chpl.cqm;

import java.io.Serializable;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CQMCriterionAllVersions implements Serializable, Comparable<CQMCriterionAllVersions> {
private static final long serialVersionUID = -4748525240792675076L;

private String cmsId;
private String nqfNumber;
private String domain;

//Note that the description is for the highest-numbered version. Other versions may have different descriptions.
private String description;

//Note that the title is for the highest-numbered version. Other versions may have different titles.
private String title;

private List<String> versions;

@Override
public int compareTo(CQMCriterionAllVersions other) {
return this.getCmsId().compareTo(other.getCmsId());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.domain;
package gov.healthit.chpl.cqm;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package gov.healthit.chpl.dto;
package gov.healthit.chpl.cqm;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.entity.listing.CQMResultEntity;
import gov.healthit.chpl.cqm.entity.CQMResultEntity;
import gov.healthit.chpl.util.Util;

public class CQMResultDTO implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.domain;
package gov.healthit.chpl.cqm;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gov.healthit.chpl.service;
package gov.healthit.chpl.cqm;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -10,8 +11,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import gov.healthit.chpl.dao.CQMCriterionDAO;
import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.cqm.dao.CQMCriterionDAO;

@Component
public class CqmCriterionService {
Expand All @@ -23,6 +23,28 @@ public CqmCriterionService(CQMCriterionDAO cqmCriterionDao) {
this.cqmCriterionDao = cqmCriterionDao;
}

public List<CQMCriterionAllVersions> getAllCmsCqmsWithAllVersions() {
List<CQMCriterionAllVersions> result = new ArrayList<CQMCriterionAllVersions>();
//this is an exploded list of CQMs - each one has only one version, but we can group by CMS ID
List<CQMCriterion> allCmsCqms = getAllCmsCqms();
Map<String, List<CQMCriterion>> cqmsGroupedByCmsId = allCmsCqms.stream()
.collect(Collectors.groupingBy(CQMCriterion::getCmsId));
cqmsGroupedByCmsId.keySet().stream()
.forEach(key -> {
CQMCriterion cqmWithMaxVersion = getCqmForMostRecentVersion(cqmsGroupedByCmsId.get(key));

result.add(CQMCriterionAllVersions.builder()
.cmsId(key)
.description(cqmWithMaxVersion.getDescription())
.domain(cqmWithMaxVersion.getCqmDomain())
.nqfNumber(cqmWithMaxVersion.getNqfNumber())
.title(cqmWithMaxVersion.getTitle())
.versions(cqmsGroupedByCmsId.get(key).stream().map(cqm -> cqm.getCqmVersion()).toList())
.build());
});
return result;
}

public List<CQMCriterion> getAllCmsCqms() {
List<CQMCriterion> cmsCqmsWithVersions = cqmCriterionDao.findAll();
cmsCqmsWithVersions = cmsCqmsWithVersions.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package gov.healthit.chpl.cqm;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CqmManager {

private CqmCriterionService cqmCriterionService;

@Autowired
public CqmManager(CqmCriterionService cqmCriterionService) {
this.cqmCriterionService = cqmCriterionService;
}

public List<CQMCriterionAllVersions> getAllCqms() {
List<CQMCriterionAllVersions> allCqms = cqmCriterionService.getAllCmsCqmsWithAllVersions();
allCqms.stream().sorted();
List<CQMCriterion> nqfCqms = cqmCriterionService.getAllNqfCqms();
nqfCqms.stream()
.forEach(nqfCqm -> {
allCqms.add(CQMCriterionAllVersions.builder()
.cmsId(null)
.description(nqfCqm.getDescription())
.domain(nqfCqm.getCqmDomain())
.nqfNumber(nqfCqm.getNqfNumber())
.title(nqfCqm.getTitle())
.versions(List.of())
.build());
});
return allCqms;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package gov.healthit.chpl.dao;
package gov.healthit.chpl.cqm.dao;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.stereotype.Repository;

import gov.healthit.chpl.cqm.CQMCriterion;
import gov.healthit.chpl.cqm.entity.CQMCriterionEntity;
import gov.healthit.chpl.cqm.entity.CQMVersionEntity;
import gov.healthit.chpl.dao.impl.BaseDAOImpl;
import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.entity.CQMCriterionEntity;
import gov.healthit.chpl.entity.CQMVersionEntity;
import gov.healthit.chpl.exception.EntityRetrievalException;
import jakarta.persistence.Query;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.dao;
package gov.healthit.chpl.cqm.dao;

import static gov.healthit.chpl.util.LambdaExceptionUtil.rethrowConsumer;

Expand All @@ -10,13 +10,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import gov.healthit.chpl.cqm.CQMCriterion;
import gov.healthit.chpl.cqm.CQMResultCertification;
import gov.healthit.chpl.cqm.CQMResultDTO;
import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.cqm.entity.CQMResultCriteriaEntity;
import gov.healthit.chpl.cqm.entity.CQMResultEntity;
import gov.healthit.chpl.dao.impl.BaseDAOImpl;
import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.dto.CQMResultDTO;
import gov.healthit.chpl.entity.listing.CQMResultCriteriaEntity;
import gov.healthit.chpl.entity.listing.CQMResultEntity;
import gov.healthit.chpl.exception.EntityCreationException;
import gov.healthit.chpl.exception.EntityRetrievalException;
import jakarta.persistence.Query;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package gov.healthit.chpl.dao;
package gov.healthit.chpl.cqm.dao;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import gov.healthit.chpl.cqm.CQMResultDetails;
import gov.healthit.chpl.cqm.entity.CQMResultDetailsEntity;
import gov.healthit.chpl.dao.impl.BaseDAOImpl;
import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.entity.listing.CQMResultDetailsEntity;
import jakarta.persistence.Query;

@Repository(value = "cqmResultDetailsDAO")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.entity;
package gov.healthit.chpl.cqm.entity;

import jakarta.persistence.Basic;
import jakarta.persistence.Column;
Expand All @@ -10,8 +10,8 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

import gov.healthit.chpl.domain.CQMCriterion;
import gov.healthit.chpl.cqm.CQMCriterion;
import gov.healthit.chpl.entity.EntityAudit;
import gov.healthit.chpl.util.NullSafeEvaluator;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.entity.listing;
package gov.healthit.chpl.cqm.entity;

import jakarta.persistence.Basic;
import jakarta.persistence.Column;
Expand All @@ -12,7 +12,7 @@
import jakarta.persistence.Table;

import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity;
import gov.healthit.chpl.domain.CQMResultCertification;
import gov.healthit.chpl.cqm.CQMResultCertification;
import gov.healthit.chpl.entity.EntityAudit;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package gov.healthit.chpl.entity.listing;
package gov.healthit.chpl.cqm.entity;

import java.util.LinkedHashSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;

import gov.healthit.chpl.domain.CQMResultDetails;
import gov.healthit.chpl.cqm.CQMResultDetails;
import jakarta.persistence.Basic;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.healthit.chpl.entity.listing;
package gov.healthit.chpl.cqm.entity;

import jakarta.persistence.Basic;
import jakarta.persistence.Column;
Expand Down
Loading

0 comments on commit a4256f5

Please sign in to comment.