Skip to content

Commit

Permalink
MAT-8017: add intended venue to qi-core measures
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-sb committed Jan 9, 2025
1 parent 03534e5 commit 7bcfa97
Show file tree
Hide file tree
Showing 2 changed files with 183 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<dependency>
<groupId>gov.cms.madie</groupId>
<artifactId>madie-java-models</artifactId>
<version>0.6.73-SNAPSHOT</version>
<version>0.6.75-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>gov.cms.madie</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,188 @@ public void testNewMeasureFailedWithoutSecurityToken() throws Exception {
assertEquals("Forbidden", resultStr);
}

@Test
public void testNewFhirMeasurePassesWithValidIntendedVenueOfEh() throws Exception {
CodeConcept eh =
CodeConcept.builder()
.code("eh")
.codeSystem("http://hl7.org/fhir/us/cqfmeasures/CodeSystem/intended-venue-codes")
.display("EH")
.definition(
"An eligible hospital is an acute care facility that is eligible to participate in a quality measurement initiative.")
.build();

FhirMeasure measure =
FhirMeasure.builder()
.id("testId")
.model(String.valueOf(ModelType.QI_CORE))
.measureSetId("testMeasureSetId")
.cqlLibraryName("TestCqlLibraryName")
.ecqmTitle("testECqm")
.measureName("testMeasureName")
.versionId("0.0.000")
.build();

measure.setIntendedVenue(eh);

final String measureAsJson = toJsonString(measure);

when(measureService.createMeasure(
any(Measure.class), anyString(), anyString(), any(Boolean.class)))
.thenReturn(measure);

mockMvc
.perform(
post("/measure")
.with(user(TEST_USER_ID))
.with(csrf())
.header("Authorization", TEST_USER_ID)
.content(measureAsJson)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());

verify(measureService, times(1))
.createMeasure(
measureArgumentCaptor.capture(), anyString(), anyString(), any(Boolean.class));
verifyNoMoreInteractions(measureRepository);
}

@Test
public void testNewFhirMeasurePassesWithValidIntendedVenueOfEc() throws Exception {
CodeConcept ec =
CodeConcept.builder()
.code("ec")
.codeSystem("http://hl7.org/fhir/us/cqfmeasures/CodeSystem/intended-venue-codes")
.display("EC")
.definition(
"An eligible clinician is a clinician who is eligible to participate in a quality measurement initiative.")
.build();

FhirMeasure measure =
FhirMeasure.builder()
.id("testId")
.model(String.valueOf(ModelType.QI_CORE))
.measureSetId("testMeasureSetId")
.cqlLibraryName("TestCqlLibraryName")
.ecqmTitle("testECqm")
.measureName("testMeasureName")
.versionId("0.0.000")
.build();

measure.setIntendedVenue(ec);

final String measureAsJson = toJsonString(measure);

when(measureService.createMeasure(
any(Measure.class), anyString(), anyString(), any(Boolean.class)))
.thenReturn(measure);

mockMvc
.perform(
post("/measure")
.with(user(TEST_USER_ID))
.with(csrf())
.header("Authorization", TEST_USER_ID)
.content(measureAsJson)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());

verify(measureService, times(1))
.createMeasure(
measureArgumentCaptor.capture(), anyString(), anyString(), any(Boolean.class));
verifyNoMoreInteractions(measureRepository);
}

@Test
public void testNewFhirMeasurePassesWithInvalidIntendedVenueOfEh() throws Exception {
CodeConcept invalidEh =
CodeConcept.builder()
.code("invalidEh")
.codeSystem("http://hl7.org/fhir/us/cqfmeasures/CodeSystem/intended-venue-codes")
.display("EH")
.definition(
"An eligible hospital is an acute care facility that is eligible to participate in a quality measurement initiative.")
.build();

FhirMeasure measure =
FhirMeasure.builder()
.id("testId")
.model(String.valueOf(ModelType.QI_CORE))
.measureSetId("testMeasureSetId")
.cqlLibraryName("TestCqlLibraryName")
.ecqmTitle("testECqm")
.measureName("testMeasureName")
.versionId("0.0.000")
.build();

measure.setIntendedVenue(invalidEh);

final String measureAsJson = toJsonString(measure);

when(measureService.createMeasure(
any(Measure.class), anyString(), anyString(), any(Boolean.class)))
.thenReturn(measure);

mockMvc
.perform(
post("/measure")
.with(user(TEST_USER_ID))
.with(csrf())
.header("Authorization", TEST_USER_ID)
.content(measureAsJson)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.validationErrors.measure").value("Intended Venue is invalid"));
verifyNoInteractions(measureRepository);
}

@Test
public void testNewFhirMeasurePassesWithInvalidIntendedVenueOfEc() throws Exception {
CodeConcept invalidEc =
CodeConcept.builder()
.code("invalidEc")
.codeSystem("http://hl7.org/fhir/us/cqfmeasures/CodeSystem/intended-venue-codes")
.display("EH")
.definition(
"An eligible hospital is an acute care facility that is eligible to participate in a quality measurement initiative.")
.build();

FhirMeasure measure =
FhirMeasure.builder()
.id("testId")
.model(String.valueOf(ModelType.QI_CORE))
.measureSetId("testMeasureSetId")
.cqlLibraryName("TestCqlLibraryName")
.ecqmTitle("testECqm")
.measureName("testMeasureName")
.versionId("0.0.000")
.build();

measure.setIntendedVenue(invalidEc);

final String measureAsJson = toJsonString(measure);

when(measureService.createMeasure(
any(Measure.class), anyString(), anyString(), any(Boolean.class)))
.thenReturn(measure);

mockMvc
.perform(
post("/measure")
.with(user(TEST_USER_ID))
.with(csrf())
.header("Authorization", TEST_USER_ID)
.content(measureAsJson)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(jsonPath("$.validationErrors.measure").value("Intended Venue is invalid"));
verifyNoInteractions(measureRepository);
}

@Test
public void testGetMeasuresNoQueryParams() throws Exception {
MeasureListDTO m1 =
Expand Down

0 comments on commit 7bcfa97

Please sign in to comment.