Search in sources :

Example 86 with Measure

use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class R4MeasureFhirServerResoureResolverTest method resolveByIdentifier.

@Test
public void resolveByIdentifier() throws IOException {
    String idValue = "Measure1-idValue";
    String idSystem = "Measure1-idSystem";
    String version = "1.0.0";
    mockRequest(WireMock::get, "/Measure\\?identifier=" + idSystem + "%7C" + idValue + "&version=" + version, 200, IOUtils.resourceToString("/fhir/rest-test/MeasureBundle.json", StandardCharsets.UTF_8));
    FhirResourceResolver<Measure> resolver = R4FhirServerResourceResolverFactory.createMeasureResolver(client);
    Measure measure = resolver.resolveByIdentifier(idValue, idSystem, version);
    String expected = "Measure/Measure1-id";
    Assert.assertEquals(expected, measure.getId());
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) WireMock(com.github.tomakehurst.wiremock.client.WireMock) Test(org.junit.Test)

Example 87 with Measure

use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class R4MeasureFhirServerResoureResolverTest method resolveByIdentifier_noVersion.

@Test
public void resolveByIdentifier_noVersion() throws IOException {
    String idValue = "Measure1-idValue";
    String idSystem = "Measure1-idSystem";
    mockRequest(WireMock::get, "/Measure\\?identifier=" + idSystem + "%7C" + idValue, 200, IOUtils.resourceToString("/fhir/rest-test/MeasureBundle.json", StandardCharsets.UTF_8));
    FhirResourceResolver<Measure> resolver = R4FhirServerResourceResolverFactory.createMeasureResolver(client);
    Measure measure = resolver.resolveByIdentifier(idValue, idSystem, null);
    String expected = "Measure/Measure1-id";
    Assert.assertEquals(expected, measure.getId());
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) WireMock(com.github.tomakehurst.wiremock.client.WireMock) Test(org.junit.Test)

Example 88 with Measure

use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class R4MeasureResourceFieldHandler method setId.

@Override
public void setId(String id, Measure resource) {
    IdType idType = new IdType(resource.fhirType(), id);
    resource.setId(idType);
}
Also used : IdType(org.hl7.fhir.r4.model.IdType)

Example 89 with Measure

use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class R4QualityMeasureResolverFactory method consumeFile.

private void consumeFile(String filename, String content, ResourceFieldHandler<Library, Identifier> libraryFieldHandler, MapFhirResourceResolver<Library, Identifier> libraryResolver, ResourceFieldHandler<Measure, Identifier> measureFieldHandler, MapFhirResourceResolver<Measure, Identifier> measureResolver) {
    String filenameId = FilenameUtils.getBaseName(filename);
    if (HapiUtils.canParseFile(filename, parser)) {
        IBaseResource baseResource = parser.parseResource(content);
        if (libraryFieldHandler.getSupportedClass().isInstance(baseResource)) {
            Library library = (Library) baseResource;
            setIdIfNotPresent(library, libraryFieldHandler, filenameId);
            libraryResolver.addResource(library);
        } else if (measureFieldHandler.getSupportedClass().isInstance(baseResource)) {
            Measure measure = (Measure) baseResource;
            setIdIfNotPresent(measure, measureFieldHandler, filenameId);
            measureResolver.addResource(measure);
        }
    }
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) Library(org.hl7.fhir.r4.model.Library) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource)

Example 90 with Measure

use of org.hl7.fhir.r5.model.Measure in project quality-measure-and-cohort-service by Alvearie.

the class SHA256NameVersionIdStrategyTest method different_versions_same_name___output_different_ids.

@Test
public void different_versions_same_name___output_different_ids() throws Exception {
    String name = "COL-InitialPopulation";
    List<String> versions = Arrays.asList("1.0.0", "1.2.0", "2.1.0");
    Set<String> ids = new HashSet<>();
    for (String version : versions) {
        MetadataResource resource = new Measure();
        resource.setName(name);
        resource.setVersion(version);
        ids.add(strategy.generateId(resource));
    }
    assertEquals(versions.size(), ids.size());
}
Also used : MetadataResource(org.hl7.fhir.r4.model.MetadataResource) Measure(org.hl7.fhir.r4.model.Measure) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Measure (org.hl7.fhir.r4.model.Measure)119 Test (org.junit.Test)97 Library (org.hl7.fhir.r4.model.Library)61 Patient (org.hl7.fhir.r4.model.Patient)45 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)44 HashMap (java.util.HashMap)24 ArrayList (java.util.ArrayList)23 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)22 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)22 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)22 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)21 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)20 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)20 Test (org.junit.jupiter.api.Test)18 Extension (org.hl7.fhir.r4.model.Extension)15 StringType (org.hl7.fhir.r4.model.StringType)15 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)14 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)14 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14