Search in sources :

Example 76 with Library

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

the class R4LibraryDependencyGathererTest method library_with_no_valid_data___returns_nothing.

@Test
public void library_with_no_valid_data___returns_nothing() {
    String libraryId = "lib";
    Library lib = new Library();
    withIdentifiers(lib, libraryId, null, null);
    MapFhirResourceResolver<Library, Identifier> resourceResolver = getMapFhirResourceResolver();
    resourceResolver.addResource(lib);
    R4LibraryDependencyGatherer dependencyGatherer = new R4LibraryDependencyGatherer(resourceResolver);
    List<Library> libraries = dependencyGatherer.gatherForLibraryId(libraryId);
    Assert.assertTrue(libraries.isEmpty());
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Library(org.hl7.fhir.r4.model.Library) Test(org.junit.Test)

Example 77 with Library

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

the class R4LibraryDependencyGathererTest method withRelation.

private void withRelation(Library library, String relatedUrl) {
    RelatedArtifact relation = new RelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.DEPENDSON).setResource(relatedUrl);
    library.addRelatedArtifact(relation);
}
Also used : RelatedArtifact(org.hl7.fhir.r4.model.RelatedArtifact)

Example 78 with Library

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

the class R4TranslatingLibraryLoaderTest method withContent.

private void withContent(Library library, String resourcePath, String contentType) throws IOException {
    Attachment attachment = new Attachment();
    attachment.setContentType(contentType);
    attachment.setData(IOUtils.resourceToByteArray(resourcePath));
    library.addContent(attachment);
}
Also used : Attachment(org.hl7.fhir.r4.model.Attachment)

Example 79 with Library

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

the class R4TranslatingLibraryLoaderTest method load_validCql.

@Test
public void load_validCql() throws IOException {
    Library library = new Library();
    withIdentifiers(library, NAME, VERSION);
    withContent(library, "/cql/basic/Test-1.0.0.cql", "text/cql");
    R4TranslatingLibraryLoader loader = getLoader(getLibraryResolver(NAME, VERSION, library));
    VersionedIdentifier identifier = new VersionedIdentifier().withId(NAME).withVersion(VERSION);
    org.cqframework.cql.elm.execution.Library actual = loader.load(identifier);
    Assert.assertEquals(identifier, actual.getIdentifier());
    Assert.assertEquals(4, actual.getStatements().getDef().size());
}
Also used : VersionedIdentifier(org.cqframework.cql.elm.execution.VersionedIdentifier) Library(org.hl7.fhir.r4.model.Library) Test(org.junit.Test)

Example 80 with Library

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

the class R4LibraryResourceFieldHandlerTest method getUrl.

@Test
public void getUrl() {
    String url = "url";
    Library library = new Library();
    library.setUrl(url);
    Assert.assertEquals(url, libraryFieldHandler.getUrl(library));
}
Also used : Library(org.hl7.fhir.r4.model.Library) Test(org.junit.Test)

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