Search in sources :

Example 36 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeCapabilityStatementCapabilityStatementRestSecurityComponent.

protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(Complex parent, String parentType, String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "security", name, element, index);
    if (element.hasCorsElement())
        composeBoolean(t, "CapabilityStatement", "cors", element.getCorsElement(), -1);
    for (int i = 0; i < element.getService().size(); i++) composeCodeableConcept(t, "CapabilityStatement", "service", element.getService().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "CapabilityStatement", "description", element.getDescriptionElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 37 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, CapabilityStatement conf) throws FHIRFormatError, DefinitionException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.h2().addText(conf.getName());
    addMarkdown(x, conf.getDescription());
    if (conf.getRest().size() > 0) {
        CapabilityStatementRestComponent rest = conf.getRest().get(0);
        XhtmlNode t = x.table(null);
        addTableRow(t, "Mode", rest.getMode().toString());
        addTableRow(t, "Description", rest.getDocumentation());
        addTableRow(t, "Transaction", showOp(rest, SystemRestfulInteraction.TRANSACTION));
        addTableRow(t, "System History", showOp(rest, SystemRestfulInteraction.HISTORYSYSTEM));
        addTableRow(t, "System Search", showOp(rest, SystemRestfulInteraction.SEARCHSYSTEM));
        boolean hasVRead = false;
        boolean hasPatch = false;
        boolean hasDelete = false;
        boolean hasHistory = false;
        boolean hasUpdates = false;
        for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
            hasVRead = hasVRead || hasOp(r, TypeRestfulInteraction.VREAD);
            hasPatch = hasPatch || hasOp(r, TypeRestfulInteraction.PATCH);
            hasDelete = hasDelete || hasOp(r, TypeRestfulInteraction.DELETE);
            hasHistory = hasHistory || hasOp(r, TypeRestfulInteraction.HISTORYTYPE);
            hasUpdates = hasUpdates || hasOp(r, TypeRestfulInteraction.HISTORYINSTANCE);
        }
        t = x.table(null);
        XhtmlNode tr = t.tr();
        tr.th().b().tx("Resource Type");
        tr.th().b().tx("Profile");
        tr.th().b().attribute("title", "GET a resource (read interaction)").tx("Read");
        if (hasVRead)
            tr.th().b().attribute("title", "GET past versions of resources (vread interaction)").tx("V-Read");
        tr.th().b().attribute("title", "GET all set of resources of the type (search interaction)").tx("Search");
        tr.th().b().attribute("title", "PUT a new resource version (update interaction)").tx("Update");
        if (hasPatch)
            tr.th().b().attribute("title", "PATCH a new resource version (patch interaction)").tx("Patch");
        tr.th().b().attribute("title", "POST a new resource (create interaction)").tx("Create");
        if (hasDelete)
            tr.th().b().attribute("title", "DELETE a resource (delete interaction)").tx("Delete");
        if (hasUpdates)
            tr.th().b().attribute("title", "GET changes to a resource (history interaction on instance)").tx("Updates");
        if (hasHistory)
            tr.th().b().attribute("title", "GET changes for all resources of the type (history interaction on type)").tx("History");
        for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
            tr = t.tr();
            tr.td().addText(r.getType());
            if (r.hasProfile()) {
                tr.td().ah(prefix + r.getProfile()).addText(r.getProfile());
            }
            tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
            if (hasVRead)
                tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));
            tr.td().addText(showOp(r, TypeRestfulInteraction.SEARCHTYPE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.UPDATE));
            if (hasPatch)
                tr.td().addText(showOp(r, TypeRestfulInteraction.PATCH));
            tr.td().addText(showOp(r, TypeRestfulInteraction.CREATE));
            if (hasDelete)
                tr.td().addText(showOp(r, TypeRestfulInteraction.DELETE));
            if (hasUpdates)
                tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYINSTANCE));
            if (hasHistory)
                tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYTYPE));
        }
    }
    inject(conf, x, NarrativeStatus.GENERATED);
    return true;
}
Also used : XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 38 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.

the class SimpleWorkerContext method connectToTSServer.

public String connectToTSServer(TerminologyClient client, String log) {
    try {
        tlog("Connect to " + client.getAddress());
        txClient = client;
        if (log != null && log.endsWith(".txt")) {
            txLog = new TextClientLogger(log);
        } else {
            txLog = new HTMLClientLogger(log);
        }
        txClient.setLogger(txLog);
        txClient.setUserAgent(userAgent);
        CapabilityStatement cps = txClient.getCapabilitiesStatementQuick();
        setTxCaps(txClient.getTerminologyCapabilities());
        return cps.getSoftware().getVersion();
    } catch (Exception e) {
        throw new FHIRException(formatMessage(canNoTS ? I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ : I18nConstants.UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER, e.getMessage()), e);
    }
}
Also used : CapabilityStatement(org.hl7.fhir.r4b.model.CapabilityStatement) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) DataFormatException(ca.uhn.fhir.parser.DataFormatException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 39 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method fetchResourceWithException.

@SuppressWarnings("unchecked")
public <T extends Resource> T fetchResourceWithException(String cls, String uri, CanonicalResource source) throws FHIRException {
    if (uri == null) {
        return null;
    }
    if ("StructureDefinition".equals(cls)) {
        uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
    }
    synchronized (lock) {
        String version = null;
        if (uri.contains("|")) {
            version = uri.substring(uri.lastIndexOf("|") + 1);
            uri = uri.substring(0, uri.lastIndexOf("|"));
        }
        if (uri.contains("#")) {
            uri = uri.substring(0, uri.indexOf("#"));
        }
        if (cls == null || "Resource".equals(cls)) {
            if (structures.has(uri)) {
                return (T) structures.get(uri, version);
            }
            if (guides.has(uri)) {
                return (T) guides.get(uri, version);
            }
            if (capstmts.has(uri)) {
                return (T) capstmts.get(uri, version);
            }
            if (measures.has(uri)) {
                return (T) measures.get(uri, version);
            }
            if (libraries.has(uri)) {
                return (T) libraries.get(uri, version);
            }
            if (valueSets.has(uri)) {
                return (T) valueSets.get(uri, version);
            }
            if (codeSystems.has(uri)) {
                return (T) codeSystems.get(uri, version);
            }
            if (operations.has(uri)) {
                return (T) operations.get(uri, version);
            }
            if (searchParameters.has(uri)) {
                return (T) searchParameters.get(uri, version);
            }
            if (plans.has(uri)) {
                return (T) plans.get(uri, version);
            }
            if (maps.has(uri)) {
                return (T) maps.get(uri, version);
            }
            if (transforms.has(uri)) {
                return (T) transforms.get(uri, version);
            }
            if (questionnaires.has(uri)) {
                return (T) questionnaires.get(uri, version);
            }
            for (Map<String, ResourceProxy> rt : allResourcesById.values()) {
                for (ResourceProxy r : rt.values()) {
                    if (uri.equals(r.getUrl())) {
                        return (T) r.getResource();
                    }
                }
            }
        } else if ("ImplementationGuide".equals(cls)) {
            return (T) guides.get(uri, version);
        } else if ("CapabilityStatement".equals(cls)) {
            return (T) capstmts.get(uri, version);
        } else if ("Measure".equals(cls)) {
            return (T) measures.get(uri, version);
        } else if ("Library".equals(cls)) {
            return (T) libraries.get(uri, version);
        } else if ("StructureDefinition".equals(cls)) {
            return (T) structures.get(uri, version);
        } else if ("StructureMap".equals(cls)) {
            return (T) transforms.get(uri, version);
        } else if ("ValueSet".equals(cls)) {
            return (T) valueSets.get(uri, version);
        } else if ("CodeSystem".equals(cls)) {
            return (T) codeSystems.get(uri, version);
        } else if ("ConceptMap".equals(cls)) {
            return (T) maps.get(uri, version);
        } else if ("PlanDefinition".equals(cls)) {
            return (T) plans.get(uri, version);
        } else if ("OperationDefinition".equals(cls)) {
            OperationDefinition od = operations.get(uri, version);
            return (T) od;
        } else if ("Questionnaire.class".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        } else if ("SearchParameter.class".equals(cls)) {
            SearchParameter res = searchParameters.get(uri, version);
            return (T) res;
        }
        if ("CodeSystem".equals(cls) && codeSystems.has(uri)) {
            return (T) codeSystems.get(uri, version);
        }
        if ("ValueSet".equals(cls) && valueSets.has(uri)) {
            return (T) valueSets.get(uri, version);
        }
        if ("Questionnaire".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        }
        if (cls == null) {
            if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet")) {
                return null;
            }
            // it might be a special URL.
            if (Utilities.isAbsoluteUrl(uri) || uri.startsWith("ValueSet/")) {
                // findTxValueSet(uri);
                Resource res = null;
                if (res != null) {
                    return (T) res;
                }
            }
            return null;
        }
        if (supportedCodeSystems.contains(uri)) {
            return null;
        }
        throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));
    }
}
Also used : CanonicalResource(org.hl7.fhir.r4b.model.CanonicalResource) Resource(org.hl7.fhir.r4b.model.Resource) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) OperationDefinition(org.hl7.fhir.r4b.model.OperationDefinition) FHIRException(org.hl7.fhir.exceptions.FHIRException) CanonicalResourceProxy(org.hl7.fhir.r4b.context.CanonicalResourceManager.CanonicalResourceProxy) ResourceProxy(org.hl7.fhir.r4b.context.BaseWorkerContext.ResourceProxy)

Example 40 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project org.hl7.fhir.core by hapifhir.

the class BaseWorkerContext method fetchResourceWithException.

@SuppressWarnings("unchecked")
public <T extends Resource> T fetchResourceWithException(String cls, String uri, CanonicalResource source) throws FHIRException {
    if (uri == null) {
        return null;
    }
    if ("StructureDefinition".equals(cls)) {
        uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
    }
    synchronized (lock) {
        String version = null;
        if (uri.contains("|")) {
            version = uri.substring(uri.lastIndexOf("|") + 1);
            uri = uri.substring(0, uri.lastIndexOf("|"));
        }
        if (uri.contains("#")) {
            uri = uri.substring(0, uri.indexOf("#"));
        }
        if (cls == null || "Resource".equals(cls)) {
            if (structures.has(uri)) {
                return (T) structures.get(uri, version);
            }
            if (guides.has(uri)) {
                return (T) guides.get(uri, version);
            }
            if (capstmts.has(uri)) {
                return (T) capstmts.get(uri, version);
            }
            if (measures.has(uri)) {
                return (T) measures.get(uri, version);
            }
            if (libraries.has(uri)) {
                return (T) libraries.get(uri, version);
            }
            if (valueSets.has(uri)) {
                return (T) valueSets.get(uri, version);
            }
            if (codeSystems.has(uri)) {
                return (T) codeSystems.get(uri, version);
            }
            if (operations.has(uri)) {
                return (T) operations.get(uri, version);
            }
            if (searchParameters.has(uri)) {
                return (T) searchParameters.get(uri, version);
            }
            if (plans.has(uri)) {
                return (T) plans.get(uri, version);
            }
            if (maps.has(uri)) {
                return (T) maps.get(uri, version);
            }
            if (transforms.has(uri)) {
                return (T) transforms.get(uri, version);
            }
            if (questionnaires.has(uri)) {
                return (T) questionnaires.get(uri, version);
            }
            for (Map<String, ResourceProxy> rt : allResourcesById.values()) {
                for (ResourceProxy r : rt.values()) {
                    if (uri.equals(r.getUrl())) {
                        return (T) r.getResource();
                    }
                }
            }
        } else if ("ImplementationGuide".equals(cls)) {
            return (T) guides.get(uri, version);
        } else if ("CapabilityStatement".equals(cls)) {
            return (T) capstmts.get(uri, version);
        } else if ("Measure".equals(cls)) {
            return (T) measures.get(uri, version);
        } else if ("Library".equals(cls)) {
            return (T) libraries.get(uri, version);
        } else if ("StructureDefinition".equals(cls)) {
            return (T) structures.get(uri, version);
        } else if ("StructureMap".equals(cls)) {
            return (T) transforms.get(uri, version);
        } else if ("ValueSet".equals(cls)) {
            return (T) valueSets.get(uri, version);
        } else if ("CodeSystem".equals(cls)) {
            return (T) codeSystems.get(uri, version);
        } else if ("ConceptMap".equals(cls)) {
            return (T) maps.get(uri, version);
        } else if ("PlanDefinition".equals(cls)) {
            return (T) plans.get(uri, version);
        } else if ("OperationDefinition".equals(cls)) {
            OperationDefinition od = operations.get(uri, version);
            return (T) od;
        } else if ("Questionnaire.class".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        } else if ("SearchParameter.class".equals(cls)) {
            SearchParameter res = searchParameters.get(uri, version);
            return (T) res;
        }
        if ("CodeSystem".equals(cls) && codeSystems.has(uri)) {
            return (T) codeSystems.get(uri, version);
        }
        if ("ValueSet".equals(cls) && valueSets.has(uri)) {
            return (T) valueSets.get(uri, version);
        }
        if ("Questionnaire".equals(cls)) {
            return (T) questionnaires.get(uri, version);
        }
        if (cls == null) {
            if (uri.matches(Constants.URI_REGEX) && !uri.contains("ValueSet")) {
                return null;
            }
            // it might be a special URL.
            if (Utilities.isAbsoluteUrl(uri) || uri.startsWith("ValueSet/")) {
                // findTxValueSet(uri);
                Resource res = null;
                if (res != null) {
                    return (T) res;
                }
            }
            return null;
        }
        if (supportedCodeSystems.contains(uri)) {
            return null;
        }
        throw new FHIRException(formatMessage(I18nConstants.NOT_DONE_YET_CANT_FETCH_, uri));
    }
}
Also used : CanonicalResource(org.hl7.fhir.r5.model.CanonicalResource) Resource(org.hl7.fhir.r5.model.Resource) SearchParameter(org.hl7.fhir.r5.model.SearchParameter) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition) FHIRException(org.hl7.fhir.exceptions.FHIRException) CanonicalResourceProxy(org.hl7.fhir.r5.context.CanonicalResourceManager.CanonicalResourceProxy)

Aggregations

CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)39 Test (org.junit.Test)24 Patient (org.hl7.fhir.r4.model.Patient)22 Library (org.hl7.fhir.r4.model.Library)20 Measure (org.hl7.fhir.r4.model.Measure)20 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)18 ArrayList (java.util.ArrayList)17 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)16 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)15 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 CapabilityStatement (org.hl7.fhir.dstu3.model.CapabilityStatement)13 HashMap (java.util.HashMap)12 Test (org.junit.jupiter.api.Test)11 Date (java.util.Date)10 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)10 StringType (org.hl7.fhir.r4.model.StringType)10 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)9 Coding (org.hl7.fhir.r4.model.Coding)9 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)9 Extension (org.hl7.fhir.r4.model.Extension)8