Search in sources :

Example 16 with CompartmentDefinition

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

the class RdfParser method composeCompartmentDefinitionCompartmentDefinitionResourceComponent.

protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(Complex parent, String parentType, String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "resource", name, element, index);
    if (element.hasCodeElement())
        composeCode(t, "CompartmentDefinition", "code", element.getCodeElement(), -1);
    for (int i = 0; i < element.getParam().size(); i++) composeString(t, "CompartmentDefinition", "param", element.getParam().get(i), i);
    if (element.hasDocumentationElement())
        composeString(t, "CompartmentDefinition", "documentation", element.getDocumentationElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 17 with CompartmentDefinition

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

the class RdfParser method composeCompartmentDefinition.

protected void composeCompartmentDefinition(Complex parent, String parentType, String name, CompartmentDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "CompartmentDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "CompartmentDefinition", "url", element.getUrlElement(), -1);
    if (element.hasVersionElement())
        composeString(t, "CompartmentDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "CompartmentDefinition", "name", element.getNameElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "CompartmentDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "CompartmentDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "CompartmentDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "CompartmentDefinition", "publisher", element.getPublisherElement(), -1);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "CompartmentDefinition", "contact", element.getContact().get(i), i);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "CompartmentDefinition", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "CompartmentDefinition", "useContext", element.getUseContext().get(i), i);
    if (element.hasPurposeElement())
        composeMarkdown(t, "CompartmentDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasCodeElement())
        composeEnum(t, "CompartmentDefinition", "code", element.getCodeElement(), -1);
    if (element.hasSearchElement())
        composeBoolean(t, "CompartmentDefinition", "search", element.getSearchElement(), -1);
    for (int i = 0; i < element.getResource().size(); i++) composeCompartmentDefinitionCompartmentDefinitionResourceComponent(t, "CompartmentDefinition", "resource", element.getResource().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 18 with CompartmentDefinition

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

the class RdfParser method composeCompartmentDefinition.

protected void composeCompartmentDefinition(Complex parent, String parentType, String name, CompartmentDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "CompartmentDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "CompartmentDefinition", "url", element.getUrlElement(), -1);
    if (element.hasNameElement())
        composeString(t, "CompartmentDefinition", "name", element.getNameElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "CompartmentDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "CompartmentDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "CompartmentDefinition", "publisher", element.getPublisherElement(), -1);
    for (int i = 0; i < element.getContact().size(); i++) composeCompartmentDefinitionCompartmentDefinitionContactComponent(t, "CompartmentDefinition", "contact", element.getContact().get(i), i);
    if (element.hasDateElement())
        composeDateTime(t, "CompartmentDefinition", "date", element.getDateElement(), -1);
    if (element.hasDescriptionElement())
        composeString(t, "CompartmentDefinition", "description", element.getDescriptionElement(), -1);
    if (element.hasRequirementsElement())
        composeString(t, "CompartmentDefinition", "requirements", element.getRequirementsElement(), -1);
    if (element.hasCodeElement())
        composeEnum(t, "CompartmentDefinition", "code", element.getCodeElement(), -1);
    if (element.hasSearchElement())
        composeBoolean(t, "CompartmentDefinition", "search", element.getSearchElement(), -1);
    for (int i = 0; i < element.getResource().size(); i++) composeCompartmentDefinitionCompartmentDefinitionResourceComponent(t, "CompartmentDefinition", "resource", element.getResource().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 19 with CompartmentDefinition

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

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, CompartmentDefinition cpd) {
    StringBuilder in = new StringBuilder();
    StringBuilder out = new StringBuilder();
    for (CompartmentDefinitionResourceComponent cc : cpd.getResource()) {
        CommaSeparatedStringBuilder rules = new CommaSeparatedStringBuilder();
        if (!cc.hasParam()) {
            out.append(" <li><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></li>\r\n");
        } else if (!rules.equals("{def}")) {
            for (StringType p : cc.getParam()) rules.append(p.asStringValue());
            in.append(" <tr><td><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></td><td>").append(rules.toString()).append("</td></tr>\r\n");
        }
    }
    XhtmlNode x;
    try {
        x = new XhtmlParser().parseFragment("<div><p>\r\nThe following resources may be in this compartment:\r\n</p>\r\n" + "<table class=\"grid\">\r\n" + " <tr><td><b>Resource</b></td><td><b>Inclusion Criteria</b></td></tr>\r\n" + in.toString() + "</table>\r\n" + "<p>\r\nA resource is in this compartment if the nominated search parameter (or chain) refers to the patient resource that defines the compartment.\r\n</p>\r\n" + "<p>\r\n\r\n</p>\r\n" + "<p>\r\nThe following resources are never in this compartment:\r\n</p>\r\n" + "<ul>\r\n" + out.toString() + "</ul></div>\r\n");
        inject(cpd, x, NarrativeStatus.GENERATED);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) XhtmlParser(org.hl7.fhir.utilities.xhtml.XhtmlParser) CompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent) StringType(org.hl7.fhir.dstu3.model.StringType) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) ParseException(java.text.ParseException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 20 with CompartmentDefinition

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

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, CompartmentDefinition cpd) {
    StringBuilder in = new StringBuilder();
    StringBuilder out = new StringBuilder();
    for (CompartmentDefinitionResourceComponent cc : cpd.getResource()) {
        CommaSeparatedStringBuilder rules = new CommaSeparatedStringBuilder();
        if (!cc.hasParam()) {
            out.append(" <li><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></li>\r\n");
        } else if (!rules.equals("{def}")) {
            for (StringType p : cc.getParam()) rules.append(p.asStringValue());
            in.append(" <tr><td><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></td><td>").append(rules.toString()).append("</td></tr>\r\n");
        }
    }
    XhtmlNode x;
    try {
        x = new XhtmlParser().parseFragment("<div><p>\r\nThe following resources may be in this compartment:\r\n</p>\r\n" + "<table class=\"grid\">\r\n" + " <tr><td><b>Resource</b></td><td><b>Inclusion Criteria</b></td></tr>\r\n" + in.toString() + "</table>\r\n" + "<p>\r\nA resource is in this compartment if the nominated search parameter (or chain) refers to the patient resource that defines the compartment.\r\n</p>\r\n" + "<p>\r\n\r\n</p>\r\n" + "<p>\r\nThe following resources are never in this compartment:\r\n</p>\r\n" + "<ul>\r\n" + out.toString() + "</ul></div>\r\n");
        inject(cpd, x, NarrativeStatus.GENERATED);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) XhtmlParser(org.hl7.fhir.utilities.xhtml.XhtmlParser) CompartmentDefinitionResourceComponent(org.hl7.fhir.r4.model.CompartmentDefinition.CompartmentDefinitionResourceComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ParseException(java.text.ParseException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)8 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)5 XhtmlParser (org.hl7.fhir.utilities.xhtml.XhtmlParser)5 IOException (java.io.IOException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 FHIRException (org.hl7.fhir.exceptions.FHIRException)4 NotImplementedException (org.apache.commons.lang3.NotImplementedException)3 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)3 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)3 CompartmentDefinitionResourceComponent (org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent)3 ParseException (java.text.ParseException)2 Compartment (org.hl7.fhir.definitions.model.Compartment)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)2 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)2 CompartmentDefinition (org.hl7.fhir.r5.model.CompartmentDefinition)2 StringType (org.hl7.fhir.r5.model.StringType)2 Configuration (au.csiro.pathling.Configuration)1 StringLiteralPath (au.csiro.pathling.fhirpath.literal.StringLiteralPath)1 FhirContext (ca.uhn.fhir.context.FhirContext)1