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());
}
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());
}
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);
}
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);
}
}
}
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());
}
Aggregations