Search in sources :

Example 1 with TerminologyCapabilities

use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent.

protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "parameter", name, element, index);
    if (element.hasNameElement())
        composeCode(t, "TerminologyCapabilities", "name", element.getNameElement(), -1);
    if (element.hasDocumentationElement())
        composeString(t, "TerminologyCapabilities", "documentation", element.getDocumentationElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 2 with TerminologyCapabilities

use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent.

protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "validateCode", name, element, index);
    if (element.hasTranslationsElement())
        composeBoolean(t, "TerminologyCapabilities", "translations", element.getTranslationsElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 3 with TerminologyCapabilities

use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent.

protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(Complex parent, String parentType, String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "software", name, element, index);
    if (element.hasNameElement())
        composeString(t, "TerminologyCapabilities", "name", element.getNameElement(), -1);
    if (element.hasVersionElement())
        composeString(t, "TerminologyCapabilities", "version", element.getVersionElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 4 with TerminologyCapabilities

use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method supportsSystem.

@Override
public boolean supportsSystem(String system) throws TerminologyServiceException {
    synchronized (lock) {
        if (codeSystems.has(system) && codeSystems.get(system).getContent() != CodeSystemContentMode.NOTPRESENT) {
            return true;
        } else if (supportedCodeSystems.contains(system)) {
            return true;
        } else if (system.startsWith("http://example.org") || system.startsWith("http://acme.com") || system.startsWith("http://hl7.org/fhir/valueset-") || system.startsWith("urn:oid:")) {
            return false;
        } else {
            if (noTerminologyServer) {
                return false;
            }
            if (txcaps == null) {
                try {
                    logger.logMessage("Terminology server: Check for supported code systems for " + system);
                    final TerminologyCapabilities capabilityStatement = txCache.hasTerminologyCapabilities() ? txCache.getTerminologyCapabilities() : txClient.getTerminologyCapabilities();
                    txCache.cacheTerminologyCapabilities(capabilityStatement);
                    setTxCaps(capabilityStatement);
                } catch (Exception e) {
                    if (canRunWithoutTerminology) {
                        noTerminologyServer = true;
                        logger.logMessage("==============!! Running without terminology server !! ==============");
                        if (txClient != null) {
                            logger.logMessage("txServer = " + txClient.getAddress());
                            logger.logMessage("Error = " + e.getMessage() + "");
                        }
                        logger.logMessage("=====================================================================");
                        return false;
                    } else {
                        e.printStackTrace();
                        throw new TerminologyServiceException(e);
                    }
                }
                if (supportedCodeSystems.contains(system)) {
                    return true;
                }
            }
        }
        return false;
    }
}
Also used : TerminologyCapabilities(org.hl7.fhir.r5.model.TerminologyCapabilities) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) NoTerminologyServiceException(org.hl7.fhir.exceptions.NoTerminologyServiceException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) FileNotFoundException(java.io.FileNotFoundException) NoTerminologyServiceException(org.hl7.fhir.exceptions.NoTerminologyServiceException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 5 with TerminologyCapabilities

use of org.hl7.fhir.r5.model.TerminologyCapabilities in project org.hl7.fhir.core by hapifhir.

the class TerminologyCache method loadCapabilityCache.

private void loadCapabilityCache(String fn) {
    try {
        String src = TextFile.fileToString(Utilities.path(folder, fn));
        JsonObject o = (JsonObject) new com.google.gson.JsonParser().parse(src);
        Resource resource = new JsonParser().parse(o);
        if (fn.startsWith(CAPABILITY_STATEMENT_TITLE)) {
            this.capabilityStatementCache = (CapabilityStatement) resource;
        } else if (fn.startsWith(TERMINOLOGY_CAPABILITIES_TITLE)) {
            this.terminologyCapabilitiesCache = (TerminologyCapabilities) resource;
        }
    } catch (Exception e) {
        throw new FHIRException("Error loading " + fn + ": " + e.getMessage(), e);
    }
}
Also used : JsonObject(com.google.gson.JsonObject) FHIRException(org.hl7.fhir.exceptions.FHIRException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) FHIRException(org.hl7.fhir.exceptions.FHIRException) JsonParser(org.hl7.fhir.r5.formats.JsonParser)

Aggregations

Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)11 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 FHIRException (org.hl7.fhir.exceptions.FHIRException)3 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)2 TerminologyCapabilities (org.hl7.fhir.r5.model.TerminologyCapabilities)2 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 JsonObject (com.google.gson.JsonObject)1 Path (java.nio.file.Path)1 NoTerminologyServiceException (org.hl7.fhir.exceptions.NoTerminologyServiceException)1 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)1 JsonParser (org.hl7.fhir.r5.formats.JsonParser)1 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)1 CodeableConcept (org.hl7.fhir.r5.model.CodeableConcept)1 Coding (org.hl7.fhir.r5.model.Coding)1 ValueSet (org.hl7.fhir.r5.model.ValueSet)1 ValueSetExpander (org.hl7.fhir.r5.terminologies.ValueSetExpander)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1