Search in sources :

Example 81 with Identifier

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

the class R4LibraryFhirServerResourceResolverTest method resolveByIdentifier_noVersion.

@Test
public void resolveByIdentifier_noVersion() throws IOException {
    String idValue = "Library1-idValue";
    String idSystem = "Library1-idSystem";
    mockRequest(WireMock::get, "/Library\\?identifier=" + idSystem + "%7C" + idValue, 200, IOUtils.resourceToString("/fhir/rest-test/LibraryBundle.json", StandardCharsets.UTF_8));
    FhirResourceResolver<Library> resolver = R4FhirServerResourceResolverFactory.createLibraryResolver(client);
    Library library = resolver.resolveByIdentifier(idValue, idSystem, null);
    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 82 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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 83 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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 84 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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 85 with Identifier

use of org.hl7.fhir.r4.model.Identifier 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)

Aggregations

Identifier (org.hl7.fhir.r4.model.Identifier)212 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)143 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)125 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)116 Test (org.junit.Test)109 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)67 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)66 Reference (org.hl7.fhir.r4.model.Reference)57 Identifier (org.hl7.fhir.dstu3.model.Identifier)55 Patient (org.hl7.fhir.r4.model.Patient)55 Coding (org.hl7.fhir.r4.model.Coding)49 List (java.util.List)47 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)41 Practitioner (org.hl7.fhir.r4.model.Practitioner)41 Date (java.util.Date)40 Collectors (java.util.stream.Collectors)38 Resource (org.hl7.fhir.r4.model.Resource)37 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)36 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)34