use of org.hl7.fhir.r4b.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());
}
use of org.hl7.fhir.r4b.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());
}
use of org.hl7.fhir.r4b.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());
}
use of org.hl7.fhir.r4b.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());
}
use of org.hl7.fhir.r4b.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);
}
}
}
Aggregations