Search in sources :

Example 56 with Value

use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.

the class CDAGenerator method buildInfrastructureRoot.

private void buildInfrastructureRoot() throws DefinitionException {
    StructureDefinition sd = new StructureDefinition();
    sd.setId("InfrastructureRoot");
    sd.setUrl("http://hl7.org/fhir/cda/StructureDefinition/InfrastructureRoot");
    library.put(sd.getUrl(), sd);
    sd.setName("Base Type for all classes in the CDA structure");
    sd.setTitle("InfrastructureRoot");
    sd.setStatus(PublicationStatus.ACTIVE);
    sd.setExperimental(false);
    sd.setPublisher("HL7");
    sd.setDescription("Defines the base elements and attributes on all CDA elements (other than data types)");
    sd.setKind(StructureDefinitionKind.LOGICAL);
    sd.setType(sd.getUrl());
    sd.setAbstract(true);
    sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:v3"));
    sd.setBaseDefinition("http://hl7.org/fhir/cda/StructureDefinition/ANY");
    sd.setDerivation(TypeDerivationRule.SPECIALIZATION);
    ElementDefinition edb = new ElementDefinition();
    edb.setPath(sd.getId());
    seePath(edb);
    edb.setMin(1);
    edb.setMax("*");
    edb.addType().setCode("Element");
    sd.getDifferential().getElement().add(edb);
    ElementDefinition ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.realmCode");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("*");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of realm-specific constraints. The value of this attribute identifies the realm in question");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CS");
    sd.getDifferential().getElement().add(ed);
    ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.typeId");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of constraints defined in an HL7-specified message type. This might be a common type (also known as CMET in the messaging communication environment), or content included within a wrapper. The value of this attribute provides a unique identifier for the type in question.");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
    sd.getDifferential().getElement().add(ed);
    ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.templateId");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("*");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of a set of template-defined constraints. The value of this attribute provides a unique identifier for the templates in question");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
    sd.getDifferential().getElement().add(ed);
    new ProfileUtilities(null, null, null).setIds(sd, true);
    structures.add(sd);
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) ProfileUtilities(org.hl7.fhir.r5.conformance.ProfileUtilities) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) UriType(org.hl7.fhir.r5.model.UriType)

Example 57 with Value

use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.

the class CDAGenerator method addValueAttribute.

private void addValueAttribute(List<ElementDefinition> list, String dtn, String t) {
    ElementDefinition ed = new ElementDefinition();
    ed.setPath(dtn + ".value");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode(t);
    if (dtn.equals("ST"))
        ed.addRepresentation(PropertyRepresentation.XMLTEXT);
    else
        ed.addRepresentation(PropertyRepresentation.XMLATTR);
    if (dtn.equals("TS"))
        ed.addExtension().setUrl("http://www.healthintersections.com.au/fhir/StructureDefinition/elementdefinition-dateformat").setValue(new StringType("v3"));
    list.add(ed);
}
Also used : StringType(org.hl7.fhir.r5.model.StringType) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition)

Example 58 with Value

use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.

the class CDAGenerator method addCDExtensions.

private void addCDExtensions(List<ElementDefinition> list, String n) {
    ElementDefinition ed = new ElementDefinition();
    ed.setPath(n + ".valueSet");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode("string");
    ed.addRepresentation(PropertyRepresentation.XMLATTR);
    ed.setDefinition("The valueSet extension adds an attribute for elements with a CD dataType which indicates the particular value set constraining the coded concept");
    ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
    ed = new ElementDefinition();
    ed.setPath(n + ".valueSetVersion");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.addType().setCode("string");
    ed.addRepresentation(PropertyRepresentation.XMLATTR);
    ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
    ed.setDefinition("The valueSetVersion extension adds an attribute for elements with a CD dataType which indicates the version of the particular value set constraining the coded concept.");
    list.add(ed);
}
Also used : ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) UriType(org.hl7.fhir.r5.model.UriType)

Example 59 with Value

use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.

the class BuildWorkerContext method queryForTerm.

private SnomedServerResponse queryForTerm(String code) throws Exception {
    if (!triedServer || serverOk) {
        triedServer = true;
        HttpClient httpclient = new DefaultHttpClient();
        HttpGet httpget = new HttpGet("http://tx.fhir.org/snomed/tool/" + SNOMED_EDITION + "/" + URLEncoder.encode(code, "UTF-8").replace("+", "%20"));
        // HttpGet httpget = new HttpGet("http://local.fhir.org:960/r4/snomed/tool/"+SNOMED_EDITION+"/"+URLEncoder.encode(code, "UTF-8").replace("+", "%20")); // don't like the url encoded this way
        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();
        InputStream instream = entity.getContent();
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document xdoc = builder.parse(instream);
            // we always get back a version, and a type. What we do depends on the type
            String t = xdoc.getDocumentElement().getAttribute("type");
            serverOk = true;
            if (t.equals("error"))
                throw new Exception(xdoc.getDocumentElement().getAttribute("message"));
            if (t.equals("description"))
                throw new Exception("The Snomed code (\"" + code + "\") is a description id not a concept id which is not valid");
            if (t.equals("concept")) {
                Concept c = new Concept();
                c.display = xdoc.getDocumentElement().getAttribute("display");
                Element child = XMLUtil.getFirstChild(xdoc.getDocumentElement());
                while (child != null) {
                    c.displays.add(child.getAttribute("value"));
                    child = XMLUtil.getNextSibling(child);
                }
                snomedCodes.put(code, c);
                return null;
            }
            if (t.equals("expression")) {
                SnomedServerResponse resp = new SnomedServerResponse();
                resp.correctExpression = xdoc.getDocumentElement().getAttribute("expressionMinimal");
                resp.display = xdoc.getDocumentElement().getAttribute("display");
                if (!snomedCodes.containsKey(resp.correctExpression)) {
                    Concept c = new Concept();
                    c.display = resp.display;
                    snomedCodes.put(resp.correctExpression, c);
                }
                return resp;
            }
            throw new Exception("Unrecognised response from server");
        } finally {
            instream.close();
        }
    } else
        return null;
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) HttpEntity(org.apache.http.HttpEntity) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream) InputStream(java.io.InputStream) HttpGet(org.apache.http.client.methods.HttpGet) Element(org.w3c.dom.Element) HttpResponse(org.apache.http.HttpResponse) Document(org.w3c.dom.Document) DefaultHttpClient(org.apache.http.impl.client.DefaultHttpClient) UcumException(org.fhir.ucum.UcumException) TerminologyServiceException(org.hl7.fhir.exceptions.TerminologyServiceException) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) EFhirClientException(org.hl7.fhir.r5.utils.client.EFhirClientException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) FHIRException(org.hl7.fhir.exceptions.FHIRException) DocumentBuilder(javax.xml.parsers.DocumentBuilder) DefaultHttpClient(org.apache.http.impl.client.DefaultHttpClient) HttpClient(org.apache.http.client.HttpClient)

Example 60 with Value

use of org.hl7.fhir.utilities.graphql.Value in project kindling by HL7.

the class PageProcessor method genExtensionTypeList.

private String genExtensionTypeList() {
    StringBuilder b = new StringBuilder();
    for (WildcardInformation wi : TypesUtilities.wildcards(version.toCode())) {
        b.append("<li>value");
        b.append(Utilities.capitalize(wi.getTypeName()));
        b.append(": <a href=\"");
        b.append(definitions.getSrcFile(wi.getTypeName()) + ".html#" + wi.getTypeName());
        b.append("\">");
        b.append(wi.getTypeName());
        b.append("</a>");
        if (!Utilities.noString(wi.getComment())) {
            b.append(" " + wi.getComment());
        }
        b.append("</li>");
    }
    return b.toString();
}
Also used : WildcardInformation(org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

Test (org.junit.jupiter.api.Test)222 ArrayList (java.util.ArrayList)183 FHIRException (org.hl7.fhir.exceptions.FHIRException)107 List (java.util.List)97 DisplayName (org.junit.jupiter.api.DisplayName)96 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)89 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)85 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)70 Identifier (org.hl7.fhir.r4.model.Identifier)69 Test (org.junit.Test)66 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)64 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)54 IOException (java.io.IOException)52 Bundle (org.hl7.fhir.r4.model.Bundle)49 Coding (org.hl7.fhir.r4.model.Coding)49 ValueSet (org.hl7.fhir.r5.model.ValueSet)48 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)46 Resource (org.hl7.fhir.r4.model.Resource)46 BigDecimal (java.math.BigDecimal)45 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)44