use of org.hl7.fhir.r4b.model.Identifier in project quality-measure-and-cohort-service by Alvearie.
the class RestFhirMeasureResolverIntegrationTest method resolve_by_identifier_without_version___returns_newest_semver.
@Test
public void resolve_by_identifier_without_version___returns_newest_semver() throws Exception {
String measureName = "Measure1";
Identifier identifier = mockMultipleSearchResults(measureName, "2.0.0", "1.1.0");
Measure resolved = resolver.resolveByIdentifier(identifier.getValue(), identifier.getSystem(), null);
assertEquals("2.0.0", resolved.getVersion());
}
use of org.hl7.fhir.r4b.model.Identifier in project quality-measure-and-cohort-service by Alvearie.
the class DefaultVT method testMeasureEvaluationByMeasureIdentifier.
// to tag a specific test to be part of DVT (deployment verification test)
@Category(DVT.class)
@Test
public /**
* Test a successful measure evaluation using identifier and version as the lookup key
*/
void testMeasureEvaluationByMeasureIdentifier() throws Exception {
// You want -Denabled.dark.features=all in your Liberty jvm.options
Assume.assumeTrue(isServiceDarkFeatureEnabled(CohortEngineRestConstants.DARK_LAUNCHED_MEASURE_EVALUATION));
final String RESOURCE = getUrlBase() + CohortServiceAPISpec.CREATE_DELETE_EVALUATION_PATH;
FhirContext fhirContext = FhirContext.forR4();
IParser parser = fhirContext.newJsonParser().setPrettyPrint(true);
Library library = TestHelper.getTemplateLibrary();
Identifier identifier = new Identifier().setValue("measure-identifier").setSystem("http://ibm.com/health/test");
Measure measure = TestHelper.getTemplateMeasure(library);
measure.setIdentifier(Arrays.asList(identifier));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TestHelper.createMeasureArtifact(baos, parser, measure, library);
// Files.write( baos.toByteArray(), new File("target/test_measure_v1_0_0.zip"));
Map<String, Parameter> parameterOverrides = new HashMap<>();
parameterOverrides.put("Measurement Period", new IntervalParameter(new DateParameter("2019-07-04"), true, new DateParameter("2020-07-04"), true));
MeasureEvaluation requestData = new MeasureEvaluation();
requestData.setDataServerConfig(dataServerConfig);
requestData.setTerminologyServerConfig(termServerConfig);
// This is a patient ID that is assumed to exist in the target FHIR server
requestData.setPatientId(VALID_PATIENT_ID);
requestData.setMeasureContext(new MeasureContext(null, parameterOverrides, new com.ibm.cohort.engine.measure.Identifier(identifier.getSystem(), identifier.getValue()), measure.getVersion()));
requestData.setEvidenceOptions(new MeasureEvidenceOptions(false, MeasureEvidenceOptions.DefineReturnOptions.NONE));
ObjectMapper om = new ObjectMapper();
System.out.println(om.writeValueAsString(requestData));
RequestSpecification request = buildBaseRequest(new Headers()).queryParam(CohortEngineRestHandler.VERSION, ServiceBuildConstants.DATE).multiPart(CohortEngineRestHandler.REQUEST_DATA_PART, requestData, "application/json").multiPart(CohortEngineRestHandler.MEASURE_PART, "test_measure_v1_0_0.zip", new ByteArrayInputStream(baos.toByteArray()));
ValidatableResponse response = request.post(RESOURCE, getServiceVersion()).then();
ValidatableResponse vr = runSuccessValidation(response, ContentType.JSON, HttpStatus.SC_OK);
String expected = getJsonFromFile(ServiceAPIGlobalSpec.EXP_FOLDER_TYPE, "measure_evaluation_exp.json");
String actual = vr.extract().asString();
assertMeasureReportEquals(parser, expected, actual, false);
}
use of org.hl7.fhir.r4b.model.Identifier in project quality-measure-and-cohort-service by Alvearie.
the class FHIRRestUtilsTest method testGetParametersForMeasureIdentifier.
/**
* Test the successful building of a response.
*/
@Test
public void testGetParametersForMeasureIdentifier() {
String idValue = "idValue";
String idSystem = "idSystem";
Identifier identifier = new Identifier().setValue(idValue).setSystem(idSystem);
String version = "1.0.0";
FhirResourceResolver<Measure> measureResolver = Mockito.mock(FhirResourceResolver.class);
Mockito.when(measureResolver.resolveByIdentifier(idValue, idSystem, version)).thenReturn(createMeasure(testMeasureDef));
List<MeasureParameterInfo> parameterInfoList = FHIRRestUtils.getParametersForMeasureIdentifier(measureResolver, identifier, version);
MeasureParameterInfo expectedParamInfo = new MeasureParameterInfo();
expectedParamInfo.setname("aName");
expectedParamInfo.setUse("In");
expectedParamInfo.setMax("1");
expectedParamInfo.setMin(0);
expectedParamInfo.setType("String");
expectedParamInfo.setDocumentation(null);
expectedParamInfo.defaultValue("42");
assertThat(parameterInfoList, containsInAnyOrder(expectedParamInfo));
}
use of org.hl7.fhir.r4b.model.Identifier in project quality-measure-and-cohort-service by Alvearie.
the class IdentifierBuilderTest method testBuilder.
@Test
public void testBuilder() {
String system = "TEST SYSTEM";
String code = "TEST CODE";
String display = "TEST DISPLAY";
String value = "TEST VALUE";
Coding coding = new Coding(system, code, display);
CodeableConcept type = new CodeableConcept(coding);
Period period = new Period();
period.setStart(new Date());
period.setEnd(new Date());
Reference assigner = new Reference("TEST REFERENCE");
Identifier identifier = new IdentifierBuilder().buildUse(IdentifierUse.OFFICIAL).buildSystem(system).buildType(type).buildPeriod(period).buildValue(value).buildAssigner(assigner).build();
assertEquals(IdentifierUse.OFFICIAL, identifier.getUse());
assertEquals(system, identifier.getSystem());
assertEquals(type, identifier.getType());
assertEquals(period, identifier.getPeriod());
assertEquals(value, identifier.getValue());
assertEquals(assigner, identifier.getAssigner());
}
use of org.hl7.fhir.r4b.model.Identifier in project quality-measure-and-cohort-service by Alvearie.
the class IdentifierBuilderTest method testStringUse.
@Test
public void testStringUse() {
Identifier identifier = new IdentifierBuilder().buildUse("official").build();
assertEquals(IdentifierUse.OFFICIAL, identifier.getUse());
}
Aggregations