diff --git a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java index a989eb3e..768edc00 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java @@ -53,7 +53,10 @@ public org.hl7.fhir.r4.model.Measure createFhirMeasureForMadieMeasure(Measure ma String rationale = madieMeasure.getMeasureMetaData().getRationale(); Instant approvalDate = madieMeasure.getReviewMetaData().getApprovalDate(); Instant lastReviewDate = madieMeasure.getReviewMetaData().getLastReviewDate(); - + String version = madieMeasure.getVersion().toString(); + if (madieMeasure.getMeasureMetaData() != null && madieMeasure.getMeasureMetaData().isDraft()) { + version = "Draft based on " + version; + } org.hl7.fhir.r4.model.Measure measure = new org.hl7.fhir.r4.model.Measure(); measure .setName(madieMeasure.getCqlLibraryName()) @@ -62,7 +65,7 @@ public org.hl7.fhir.r4.model.Measure createFhirMeasureForMadieMeasure(Measure ma .setExperimental(madieMeasure.getMeasureMetaData().isExperimental()) .setUrl( FhirResourceHelpers.buildResourceFullUrl("Measure", madieMeasure.getCqlLibraryName())) - .setVersion(madieMeasure.getVersion().toString()) + .setVersion(version) .setEffectivePeriod( getPeriodFromDates( madieMeasure.getMeasurementPeriodStart(), madieMeasure.getMeasurementPeriodEnd())) diff --git a/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java b/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java index ddb82197..36ec4da5 100644 --- a/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java +++ b/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java @@ -289,6 +289,7 @@ public void testCreateFhirMeasureForMadieMeasure() { measure.getSupplementalData().get(2).getCriteria().getExpression()); assertEquals("Risk Adjustments example", measure.getSupplementalData().get(2).getDescription()); assertFalse(measure.getSupplementalData().get(2).getUsage().get(0).getCoding().isEmpty()); + assertEquals("0.0.000", measure.getVersion()); } @Test @@ -912,4 +913,12 @@ public void testBuildScoringConceptContinuousVariable() { assertNotNull(codeConcept); assertEquals("continuous-variable", codeConcept.getCoding().get(0).getCode()); } + + @Test + public void testCreateFhirMeasureForDraftMadieMeasure() { + madieMeasure.getMeasureMetaData().setDraft(true); + org.hl7.fhir.r4.model.Measure measure = + measureTranslatorService.createFhirMeasureForMadieMeasure(madieMeasure); + assertEquals("Draft based on 0.0.000", measure.getVersion()); + } }