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