use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent.
protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "version", name, element, index);
if (element.hasCodeElement())
composeString(t, "TerminologyCapabilities", "code", element.getCodeElement(), -1);
if (element.hasIsDefaultElement())
composeBoolean(t, "TerminologyCapabilities", "isDefault", element.getIsDefaultElement(), -1);
if (element.hasCompositionalElement())
composeBoolean(t, "TerminologyCapabilities", "compositional", element.getCompositionalElement(), -1);
for (int i = 0; i < element.getLanguage().size(); i++) composeCode(t, "TerminologyCapabilities", "language", element.getLanguage().get(i), i);
for (int i = 0; i < element.getFilter().size(); i++) composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(t, "TerminologyCapabilities", "filter", element.getFilter().get(i), i);
for (int i = 0; i < element.getProperty().size(); i++) composeCode(t, "TerminologyCapabilities", "property", element.getProperty().get(i), i);
}
use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent.
protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "codeSystem", name, element, index);
if (element.hasUriElement())
composeCanonical(t, "TerminologyCapabilities", "uri", element.getUriElement(), -1);
for (int i = 0; i < element.getVersion().size(); i++) composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(t, "TerminologyCapabilities", "version", element.getVersion().get(i), i);
if (element.hasSubsumptionElement())
composeBoolean(t, "TerminologyCapabilities", "subsumption", element.getSubsumptionElement(), -1);
}
use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.
the class TerminologyCacheTests method testCachePersistence.
@Test
public void testCachePersistence() throws IOException, URISyntaxException {
Object lock = new Object();
Path tempCacheDirectory = createTempCacheDirectory();
ValueSet valueSet = new ValueSet();
valueSet.setUrl("dummyValueSetURL");
TerminologyCapabilities terminologyCapabilities = new TerminologyCapabilities();
terminologyCapabilities.getExpansion().setParameter(Arrays.asList());
CapabilityStatement.CapabilityStatementSoftwareComponent software = new CapabilityStatement.CapabilityStatementSoftwareComponent();
software.setVersion("dummyVersion");
CapabilityStatement capabilityStatement = new CapabilityStatement();
capabilityStatement.setSoftware(software);
Coding coding = new Coding();
coding.setCode("dummyCode");
CodeableConcept concept = new CodeableConcept();
concept.addCoding(new Coding().setCode("dummyCode"));
ValueSet ccvalueSet = new ValueSet();
// Add dummy results to the cache
TerminologyCache terminologyCacheA = new TerminologyCache(lock, tempCacheDirectory.toString());
terminologyCacheA.cacheTerminologyCapabilities(terminologyCapabilities);
terminologyCacheA.cacheCapabilityStatement(capabilityStatement);
IWorkerContext.ValidationResult codingResultA = new IWorkerContext.ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo");
TerminologyCache.CacheToken codingTokenA = terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions, coding, valueSet);
terminologyCacheA.cacheValidation(codingTokenA, codingResultA, true);
IWorkerContext.ValidationResult codeableConceptResultA = new IWorkerContext.ValidationResult(ValidationMessage.IssueSeverity.INFORMATION, "dummyInfo");
TerminologyCache.CacheToken codeableConceptTokenA = terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions, concept, valueSet);
terminologyCacheA.cacheValidation(codeableConceptTokenA, codeableConceptResultA, true);
TerminologyCache.CacheToken expansionTokenA = terminologyCacheA.generateExpandToken(valueSet, true);
ValueSetExpander.ValueSetExpansionOutcome expansionOutcomeA = new ValueSetExpander.ValueSetExpansionOutcome(valueSet);
terminologyCacheA.cacheExpansion(expansionTokenA, expansionOutcomeA, true);
// Check that the in-memory cache is returning what we put in
{
assertEquals(terminologyCapabilities, terminologyCacheA.getTerminologyCapabilities());
assertEquals(capabilityStatement, terminologyCacheA.getCapabilityStatement());
assertValidationResultEquals(codingResultA, terminologyCacheA.getValidation(codingTokenA));
assertValidationResultEquals(codeableConceptResultA, terminologyCacheA.getValidation(codeableConceptTokenA));
assertExpansionOutcomeEquals(expansionOutcomeA, terminologyCacheA.getExpansion(expansionTokenA));
}
// Create another cache using the same directory, and check that it gives the same results.
{
TerminologyCache terminologyCacheB = new TerminologyCache(lock, tempCacheDirectory.toString());
assertCanonicalResourceEquals(terminologyCapabilities, terminologyCacheB.getTerminologyCapabilities());
assertCanonicalResourceEquals(capabilityStatement, terminologyCacheB.getCapabilityStatement());
assertValidationResultEquals(codingResultA, terminologyCacheB.getValidation(terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions, coding, valueSet)));
assertValidationResultEquals(codeableConceptResultA, terminologyCacheB.getValidation(terminologyCacheA.generateValidationToken(CacheTestUtils.validationOptions, concept, valueSet)));
assertExpansionOutcomeEquals(expansionOutcomeA, terminologyCacheB.getExpansion(terminologyCacheA.generateExpandToken(valueSet, true)));
}
deleteTempCacheDirectory(tempCacheDirectory);
}
use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent.
protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "implementation", name, element, index);
if (element.hasDescriptionElement())
composeString(t, "TerminologyCapabilities", "description", element.getDescriptionElement(), -1);
if (element.hasUrlElement())
composeUrl(t, "TerminologyCapabilities", "url", element.getUrlElement(), -1);
}
use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent.
protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "translation", name, element, index);
if (element.hasNeedsMapElement())
composeBoolean(t, "TerminologyCapabilities", "needsMap", element.getNeedsMapElement(), -1);
}
Aggregations