Search in sources :

Example 86 with Library

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

the class R4LibraryFhirServerResourceResolverTest method resolveByIdentifier.

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

Example 87 with Library

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

the class GraphWalkingElmVisitor method resolveLibrary.

protected Library resolveLibrary(VersionedIdentifier libraryIdentifier) {
    CqlLibraryDescriptor descriptor = new CqlLibraryDescriptor().setLibraryId(libraryIdentifier.getId()).setVersion(libraryIdentifier.getVersion()).setFormat(Format.ELM);
    CqlLibrary library = libraryProvider.getLibrary(descriptor);
    if (library == null) {
        throw new IllegalArgumentException("Missing library " + descriptor.toString());
    }
    LOG.trace(library.getContent());
    Library elmLibrary = JAXB.unmarshal(library.getContentAsStream(), Library.class);
    return elmLibrary;
}
Also used : CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) CqlLibrary(com.ibm.cohort.cql.library.CqlLibrary) Library(org.hl7.elm.r1.Library) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor)

Example 88 with Library

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

the class R4LibraryResourceFieldHandler method setId.

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

Example 89 with Library

use of org.hl7.fhir.r4b.model.Library 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 Library

use of org.hl7.fhir.r4b.model.Library in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeMeasure.

protected void composeMeasure(Complex parent, String parentType, String name, Measure element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Measure", name, element, index);
    if (element.hasModuleMetadata())
        composeModuleMetadata(t, "Measure", "moduleMetadata", element.getModuleMetadata(), -1);
    for (int i = 0; i < element.getLibrary().size(); i++) composeReference(t, "Measure", "library", element.getLibrary().get(i), i);
    if (element.hasDisclaimerElement())
        composeMarkdown(t, "Measure", "disclaimer", element.getDisclaimerElement(), -1);
    if (element.hasScoringElement())
        composeEnum(t, "Measure", "scoring", element.getScoringElement(), -1);
    for (int i = 0; i < element.getType().size(); i++) composeEnum(t, "Measure", "type", element.getType().get(i), i);
    if (element.hasRiskAdjustmentElement())
        composeString(t, "Measure", "riskAdjustment", element.getRiskAdjustmentElement(), -1);
    if (element.hasRateAggregationElement())
        composeString(t, "Measure", "rateAggregation", element.getRateAggregationElement(), -1);
    if (element.hasRationaleElement())
        composeMarkdown(t, "Measure", "rationale", element.getRationaleElement(), -1);
    if (element.hasClinicalRecommendationStatementElement())
        composeMarkdown(t, "Measure", "clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), -1);
    if (element.hasImprovementNotationElement())
        composeString(t, "Measure", "improvementNotation", element.getImprovementNotationElement(), -1);
    if (element.hasDefinitionElement())
        composeMarkdown(t, "Measure", "definition", element.getDefinitionElement(), -1);
    if (element.hasGuidanceElement())
        composeMarkdown(t, "Measure", "guidance", element.getGuidanceElement(), -1);
    if (element.hasSetElement())
        composeString(t, "Measure", "set", element.getSetElement(), -1);
    for (int i = 0; i < element.getGroup().size(); i++) composeMeasureMeasureGroupComponent(t, "Measure", "group", element.getGroup().get(i), i);
    for (int i = 0; i < element.getSupplementalData().size(); i++) composeMeasureMeasureSupplementalDataComponent(t, "Measure", "supplementalData", element.getSupplementalData().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Library (org.hl7.fhir.r4.model.Library)130 Test (org.junit.Test)85 Measure (org.hl7.fhir.r4.model.Measure)60 Patient (org.hl7.fhir.r4.model.Patient)41 HashMap (java.util.HashMap)36 Test (org.junit.jupiter.api.Test)34 ArrayList (java.util.ArrayList)32 Library (org.hl7.fhir.dstu3.model.Library)23 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)21 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)21 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)21 StringType (org.hl7.fhir.r4.model.StringType)21 IOException (java.io.IOException)20 VersionedIdentifier (org.cqframework.cql.elm.execution.VersionedIdentifier)20 FhirContext (ca.uhn.fhir.context.FhirContext)19 IParser (ca.uhn.fhir.parser.IParser)19 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)19 Bundle (org.hl7.fhir.r4.model.Bundle)19 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)18