Skip to content

Commit

Permalink
Merge pull request #169 from MeasureAuthoringTool/feature/MAT-6308
Browse files Browse the repository at this point in the history
Feature/mat 6308
  • Loading branch information
RohitKandimalla authored Oct 18, 2023
2 parents effc311 + c9a76ce commit 95237f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.Bundle;

import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.MarkdownType;
import org.hl7.fhir.r4.model.MeasureReport;
Expand Down Expand Up @@ -150,7 +149,7 @@ private MeasureReport buildMeasureReport(
measureReport.setId(UUID.randomUUID().toString());
measureReport.setMeta(new Meta().addProfile(UriConstants.CqfTestCases.CQFM_TEST_CASES));
measureReport.setContained(buildContained(testCase, testCaseBundle));
measureReport.setExtension(buildExtensions(testCase));
measureReport.setExtension(buildExtensions(testCase, measureReport));
measureReport.setModifierExtension(buildModifierExtension());
measureReport.setStatus(MeasureReport.MeasureReportStatus.COMPLETE);
measureReport.setType(MeasureReport.MeasureReportType.INDIVIDUAL);
Expand Down Expand Up @@ -185,7 +184,7 @@ private List<Resource> buildContained(TestCase testCase, Bundle testCaseBundle)
.setName("subject")
.setValue(new StringType(patientResource.get().getResource().getIdPart()));
var parameters =
new Parameters().addParameter(parameter).setId(testCase.getTitle() + "-parameters");
new Parameters().addParameter(parameter).setId(UUID.randomUUID() + "-parameters");
return Collections.singletonList(parameters);
} else {
log.error(
Expand All @@ -201,11 +200,11 @@ private List<Resource> buildContained(TestCase testCase, Bundle testCaseBundle)
* parameter created in "Contained", description extension will only be returned if
* Description is provided in madie testcase.
*/
private List<Extension> buildExtensions(TestCase testCase) {
private List<Extension> buildExtensions(TestCase testCase, MeasureReport measureReport) {
var parametersExtension =
new Extension()
.setUrl(UriConstants.CqfTestCases.CQFM_INPUT_PARAMETERS)
.setValue(new Reference("#" + testCase.getTitle() + "-parameters"));
.setValue(new Reference("#" + measureReport.getContained().get(0).getId()));
var descriptionExtension =
new Extension()
.setUrl(UriConstants.CqfTestCases.CQFM_TEST_CASE_DESCRIPTION)
Expand Down Expand Up @@ -330,7 +329,7 @@ public void setExportBundleType(ExportDTO exportDTO, Measure measure) {
log.debug("You're exporting a Transaction");
// update bundle type and add entry.request for each entry
if (measure.getTestCases() != null) {
measure.getTestCases().stream().forEach(testCase -> updateEntry(testCase, bundleType));
measure.getTestCases().forEach(testCase -> updateEntry(testCase, bundleType));
}
break;
default:
Expand All @@ -354,7 +353,7 @@ public byte[] zipTestCaseContents(
byte[] bytes = utility.getZipBundle(exportableTestCaseBundle, null);

try (ZipOutputStream zos = new ZipOutputStream(baos);
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(bytes)); ) {
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(bytes))) {

// Add the README file to the zip
String readme = generateReadMe(testCases);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,11 @@ void getTestCaseExportBundleMulti() {
measureReport.getMeta().getProfile().get(0).asStringValue());

Parameters parameters = (Parameters) measureReport.getContained().get(0);
assertEquals("test case title-parameters", parameters.getId());
assertEquals("Patient-1", parameters.getParameter().get(0).getValue().toString());

// Reference to parameter created above
Reference reference = (Reference) measureReport.getExtension().get(0).getValue();
assertEquals("#test case title-parameters", reference.getReference());
assertEquals("#" + parameters.getId(), reference.getReference());
assertEquals(MeasureReport.MeasureReportStatus.COMPLETE, measureReport.getStatus());
assertEquals(MeasureReport.MeasureReportType.INDIVIDUAL, measureReport.getType());
assertEquals("madie.cms.gov/Measure/SimpleFhirMeasureLib", measureReport.getMeasure());
Expand Down Expand Up @@ -222,12 +221,11 @@ void getTestCaseExportBundleMultiReducedResult() {
measureReport.getMeta().getProfile().get(0).asStringValue());

Parameters parameters = (Parameters) measureReport.getContained().get(0);
assertEquals("test case title-parameters", parameters.getId());
assertEquals("Patient-1", parameters.getParameter().get(0).getValue().toString());

// Reference to parameter created above
Reference reference = (Reference) measureReport.getExtension().get(0).getValue();
assertEquals("#test case title-parameters", reference.getReference());
assertEquals("#" + parameters.getId(), reference.getReference());
assertEquals(MeasureReport.MeasureReportStatus.COMPLETE, measureReport.getStatus());
assertEquals(MeasureReport.MeasureReportType.INDIVIDUAL, measureReport.getType());
assertEquals("madie.cms.gov/Measure/SimpleFhirMeasureLib", measureReport.getMeasure());
Expand Down

0 comments on commit 95237f1

Please sign in to comment.