Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add id to Parameters #307

Merged
merged 1 commit into from
Jul 21, 2021
Merged
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 @@ -265,6 +265,7 @@ public Parameters careGapsReport(@OperationParam(name = "periodStart") String pe
//TODO: topic should allow many and be a union of them
//TODO: "The Server needs to make sure that practitioner is authorized to get the gaps in care report for and know what measures the practitioner are eligible or qualified."
Parameters returnParams = new Parameters();
returnParams.setId((UUID.randomUUID().toString()));
if(careGapParameterValidation(periodStart, periodEnd, subject, topic, practitioner, measure, status, organization)) {
if(subject.startsWith("Patient/")){
returnParams.addParameter(new Parameters.ParametersParameterComponent()
Expand Down Expand Up @@ -374,7 +375,7 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
CqfmSoftwareSystemHelper helper = new CqfmSoftwareSystemHelper();
Device device = helper.createSoftwareSystemDevice(cqfRulerSoftwareSystem);
composition.setAuthor(Arrays.asList(new Reference(device)));
careGapReport.addEntry(new BundleEntryComponent().setResource(device).setFullUrl(String.format(serverAddress, device.fhirType(), device.getIdElement().getIdPart())));
careGapReport.addEntry(new BundleEntryComponent().setResource(device).setFullUrl(getFullUrl(device.fhirType(), device.getIdElement().getIdPart())));

List<MeasureReport> reports = new ArrayList<>();
List<DetectedIssue> detectedIssues = new ArrayList<DetectedIssue>();
Expand Down Expand Up @@ -480,9 +481,9 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
if((null == status || status == "") //everything
|| (hasIssue && !"closed-gap".equalsIgnoreCase(status)) //filter out closed-gap that has issues for OPEN-GAP
||(!hasIssue && !"open-gap".equalsIgnoreCase(status))){ //filet out open-gap without issues for CLOSE-GAP
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(composition).setFullUrl(String.format(serverAddress, composition.fhirType(), composition.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(composition).setFullUrl(getFullUrl(composition.fhirType(), composition.getIdElement().getIdPart())));
for (MeasureReport rep : reports) {
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(rep).setFullUrl(String.format(serverAddress, rep.fhirType(), rep.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(rep).setFullUrl(getFullUrl(rep.fhirType(), rep.getIdElement().getIdPart())));
if (report.hasEvaluatedResources()) {
IBaseResource evaluatedResourcesBaseBundle = registry.getResourceDao("Bundle").read(report.getEvaluatedResources().getReferenceElement());
if (evaluatedResourcesBaseBundle == null || !(evaluatedResourcesBaseBundle instanceof Bundle)) {
Expand All @@ -493,13 +494,13 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
for (BundleEntryComponent entry : evaluatedResourcesBundle.getEntry()) {
Resource resource = entry.getResource();
if (resource != null) {
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(resource).setFullUrl(String.format(serverAddress, resource.fhirType(), resource.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(resource).setFullUrl(getFullUrl(resource.fhirType(), resource.getIdElement().getIdPart())));
}
}
}
}
for (DetectedIssue detectedIssue : detectedIssues) {
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(detectedIssue).setFullUrl(String.format(serverAddress, detectedIssue.fhirType(), detectedIssue.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(detectedIssue).setFullUrl(getFullUrl(detectedIssue.fhirType(), detectedIssue.getIdElement().getIdPart())));
}
}
if(careGapReport.getEntry().isEmpty()){
Expand All @@ -508,6 +509,11 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
return careGapReport;
}

private String getFullUrl(String fhirType, String elementId) {
String fullUrl = String.format("%s%s/%s", serverAddress, fhirType, elementId);
return fullUrl;
}

private List<IBaseResource> getMeasureList(SearchParameterMap theParams, String measure){
if(measure != null && measure.length() > 0){
List<IBaseResource> finalMeasureList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public Parameters careGapsReport(
//TODO: topic should allow many and be a union of them
//TODO: "The Server needs to make sure that practitioner is authorized to get the gaps in care report for and know what measures the practitioner are eligible or qualified."
Parameters returnParams = new Parameters();
returnParams.setId((UUID.randomUUID().toString()));

// Setting periodStart, periodEnd, and subject to lists to check if multiple have been supplied.
// This is a hack and I hate it. I don't know how to just pull the current url due to
Expand Down Expand Up @@ -563,10 +564,10 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
return null;
}

careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(composition).setFullUrl(String.format("%s%s/%s", serverAddress, composition.fhirType(), composition.getIdElement().getIdPart())));
careGapReport.addEntry(new BundleEntryComponent().setResource(compositionAuthor).setFullUrl(String.format("%s%s/%s", serverAddress, compositionAuthor.fhirType(), compositionAuthor.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(composition).setFullUrl(getFullUrl(composition.fhirType(), composition.getIdElement().getIdPart())));
careGapReport.addEntry(new BundleEntryComponent().setResource(compositionAuthor).setFullUrl(getFullUrl(compositionAuthor.fhirType(), compositionAuthor.getIdElement().getIdPart())));
for (MeasureReport rep : reports) {
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(rep).setFullUrl(String.format("%s%s/%s", serverAddress, rep.fhirType(), rep.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(rep).setFullUrl(getFullUrl(rep.fhirType(), rep.getIdElement().getIdPart())));
if (report.hasEvaluatedResource()) {
for (Reference evaluatedResource : report.getEvaluatedResource()) {
// Assuming data is local only for now...
Expand All @@ -576,19 +577,24 @@ private Bundle patientCareGap(String periodStart, String periodEnd, String subje
IBaseResource resourceBase = registry.getResourceDao(resourceType).read(theId);
if (resourceBase != null && resourceBase instanceof Resource) {
Resource resource = (Resource) resourceBase;
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(resource).setFullUrl(String.format("%s%s/%s", serverAddress, resource.fhirType(), resource.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(resource).setFullUrl(getFullUrl(resource.fhirType(), resource.getIdElement().getIdPart())));
}
}
}
}
}
for (DetectedIssue detectedIssue : detectedIssues) {
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(detectedIssue).setFullUrl(String.format("%s%s/%s", serverAddress, detectedIssue.fhirType(), detectedIssue.getIdElement().getIdPart())));
careGapReport.addEntry(new Bundle.BundleEntryComponent().setResource(detectedIssue).setFullUrl(getFullUrl(detectedIssue.fhirType(), detectedIssue.getIdElement().getIdPart())));
}

return careGapReport;
}

private String getFullUrl(String fhirType, String elementId) {
String fullUrl = String.format("%s%s/%s", serverAddress, fhirType, elementId);
return fullUrl;
}

private Resource getCompositionAuthor() {
return getLocalOrganization();
}
Expand All @@ -603,6 +609,7 @@ private Resource getLocalOrganization() {
if (localOrganization != null) {
return localOrganization;
} else {
//getting weird behavior where the organization isn't updating. I think this grabs the first version so if you update you don't see it.
IFhirResourceDao<Organization> orgDao = this.registry.getResourceDao(Organization.class);
List<IBaseResource> org = orgDao.search(new SearchParameterMap()).getResources(0, 1);
if (org.isEmpty()) {
Expand Down