Skip to content

Commit

Permalink
Merge branch 'OCD-4565' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
tmy1313 committed Mar 4, 2025
2 parents 52095c5 + 073ff69 commit d17d8d1
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 18 deletions.
22 changes: 22 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Release Notes

## Version 50.0.0
_3 March 2025_

### Breaking Changes
* Remove statistics endpoints, chart data creator job
* Remove 'friendlyName' from user contact
* Remove optional standard citation, description optionalStandardId
* Remove developer 'status' and 'statusEvents' fields
* Remove 'title' from contact information
* Remove 'eventDate' field from listing certificationEvents
* Remove collections/certified-products endpoint

### Features
* Create one time job to update roles in Job data
* Add Risk Summary Information as a searchable attribute
* Add job and endpoints for Real World Testing report in Power BI
* Account for ICS requirement group in ICS errors report
* Create one-time job to review standards and remove retired ones
* Deprecate surveillance endpoints, certifiedProduct field

---

## Version 49.1.0
_18 February 2025_

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ chplUrlBegin=https://chpl.healthit.gov
developerUrlPart=/#/organizations/developers/%s
jndiName=java:comp/env/jdbc/openchpl
persistenceUnitName=openchpl
api.version=49.1.0
api.version=50.0.0
api.description=Created by CHPL Development Team. Please submit any questions using the Health IT \
Feedback Form and select the "Certified Health IT Products List (CHPL)" category. <br/>\
See more at <a href="%s" target="_blank">%s</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,20 @@
import gov.healthit.chpl.email.ChplHtmlEmailBuilder;
import gov.healthit.chpl.email.footer.AdminFooter;
import gov.healthit.chpl.exception.EmailNotSentException;
import gov.healthit.chpl.exception.EntityRetrievalException;
import gov.healthit.chpl.exception.ValidationException;
import gov.healthit.chpl.manager.CertificationBodyManager;
import gov.healthit.chpl.manager.DeveloperManager;
import gov.healthit.chpl.scheduler.job.QuartzJob;
import gov.healthit.chpl.search.ListingSearchService;
import gov.healthit.chpl.search.domain.ListingSearchResult;
import gov.healthit.chpl.search.domain.SearchRequest;
import gov.healthit.chpl.util.CertificationStatusUtil;
import lombok.extern.log4j.Log4j2;

@Log4j2(topic = "serviceBaseUrlListUptimeEmailJobLogger")
public class ServiceBaseUrlListUptimeEmailJob extends QuartzJob {
private static final Integer MAX_PAGE_SIZE = 100;

@Autowired
private ChplHtmlEmailBuilder chplHtmlEmailBuilder;
Expand All @@ -52,13 +61,22 @@ public class ServiceBaseUrlListUptimeEmailJob extends QuartzJob {
@Autowired
private CertificationBodyDAO certificationBodyDAO;

@Autowired
private DeveloperManager developerManager;

@Autowired
private CertificationBodyManager certificationBodyManager;

@Autowired
private ListingSearchService listingSearchService;

@Autowired
private JpaTransactionManager txManager;


@Autowired
private Environment env;

private Map<Long, Set<CertificationBody>> developerIdAndCertificationBodyMap;
private List<CertificationBody> activeAcbs;

@Override
Expand All @@ -71,7 +89,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
developerIdAndCertificationBodyMap = getDeveloperIdAndCertificationBodyMap();
//developerIdAndCertificationBodyMap = getDeveloperIdAndCertificationBodyMap();
activeAcbs = certificationBodyDAO.findAllActive();

sendEmail(context, getReportRows());
Expand All @@ -83,13 +101,6 @@ protected void doInTransactionWithoutResult(TransactionStatus status) {
LOGGER.info("********* Completed the Service Base Url List Uptime Email job *********");
}

private Map<Long, Set<CertificationBody>> getDeveloperIdAndCertificationBodyMap() {
Map<Developer, Set<CertificationBody>> developerAcbMaps = developerDAO.findAllDevelopersWithAcbs();
return developerAcbMaps.entrySet().stream()
.filter(entry -> !CollectionUtils.isEmpty(entry.getValue()))
.collect(Collectors.toMap(entry -> entry.getKey().getId(), entry -> entry.getValue()));
}

private List<ServiceBaseUrlListUptimeReport> getReportRows() {
List<ServiceBaseUrlListUptimeReport> reportRows = serviceBaseUrlListUptimeCalculator.calculateRowsForReport();
reportRows.forEach(row -> {
Expand All @@ -101,7 +112,7 @@ private List<ServiceBaseUrlListUptimeReport> getReportRows() {
}

private Map<Long, Boolean> getApplicableAcbsForDeveloper(Long developerId) {
Set<CertificationBody> acbsForDeveloper = developerIdAndCertificationBodyMap.get(developerId);
Set<CertificationBody> acbsForDeveloper = getAssociatedCertificationBodies(developerId);
if (CollectionUtils.isEmpty(acbsForDeveloper)) {
LOGGER.warn("The developer " + developerId + " has no associated ACBs and will not be included in the report.");
return new HashMap<Long, Boolean>();
Expand All @@ -111,19 +122,19 @@ private Map<Long, Boolean> getApplicableAcbsForDeveloper(Long developerId) {
.collect(Collectors.toMap(
acb -> acb.getId(),
acb -> acbsForDeveloper.stream()
.filter(acbForDev -> acbForDev.getId().equals(acb.getId()))
.findAny().isPresent()));
.filter(acbForDev -> acbForDev.getId().equals(acb.getId()))
.findAny().isPresent()));

}

private void sendEmail(JobExecutionContext context, List<ServiceBaseUrlListUptimeReport> rows) throws EmailNotSentException, IOException {
LOGGER.info("Sending email to: " + context.getMergedJobDataMap().getString("email"));
chplEmailFactory.emailBuilder()
.recipient(context.getMergedJobDataMap().getString("email"))
.subject(env.getProperty("serviceBaseUrlListUptime.report.subject"))
.htmlMessage(createHtmlMessage())
.fileAttachments(Arrays.asList(serviceBaseUrlListUptimeCsvWriter.generateFile(rows)))
.sendEmail();
.recipient(context.getMergedJobDataMap().getString("email"))
.subject(env.getProperty("serviceBaseUrlListUptime.report.subject"))
.htmlMessage(createHtmlMessage())
.fileAttachments(Arrays.asList(serviceBaseUrlListUptimeCsvWriter.generateFile(rows)))
.sendEmail();
LOGGER.info("Completed Sending email to: " + context.getMergedJobDataMap().getString("email"));
}

Expand All @@ -136,4 +147,35 @@ private String createHtmlMessage() {
.footer(AdminFooter.class)
.build();
}

public Set<CertificationBody> getAssociatedCertificationBodies(Long developerId) {
try {
return getListingDataForDeveloper(developerManager.getById(developerId)).stream()
.map(listing -> listing.getCertificationBody())
.collect(Collectors.toSet()).stream()
.map(pair -> getCertificationBody(pair.getId()))
.collect(Collectors.toSet());
} catch (ValidationException | EntityRetrievalException e) {
LOGGER.error("Could not identify Certification Body for Developer with id: {}", developerId);
return null;
}
}

private CertificationBody getCertificationBody(Long acbId) {
try {
return certificationBodyManager.getById(acbId);
} catch (Exception e) {
LOGGER.error("Could not identify Certification Body with id: {}", acbId);
return null;
}
}

private List<ListingSearchResult> getListingDataForDeveloper(Developer developer) throws ValidationException {
SearchRequest request = SearchRequest.builder()
.certificationStatuses(CertificationStatusUtil.getActiveStatuses().stream().map(status -> status.getName()).collect(Collectors.toSet()))
.developer(developer.getName())
.pageSize(MAX_PAGE_SIZE)
.build();
return listingSearchService.getAllPagesOfSearchResults(request);
}
}

0 comments on commit d17d8d1

Please sign in to comment.