Search in sources :

Example 31 with CD

use of org.hl7.v3.CD in project org.hl7.fhir.core by hapifhir.

the class LibraryRenderer method participantRow.

private void participantRow(XhtmlNode t, String label, ContactDetail cd, boolean email, boolean phone, boolean url) {
    XhtmlNode tr = t.tr();
    tr.td().tx(label);
    tr.td().tx(cd.getName());
    if (email) {
        renderContactPoint(tr.td(), cd.getEmail());
    }
    if (phone) {
        renderContactPoint(tr.td(), cd.getPhone());
    }
    if (url) {
        renderContactPoint(tr.td(), cd.getUrl());
    }
}
Also used : XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 32 with CD

use of org.hl7.v3.CD in project org.hl7.fhir.core by hapifhir.

the class LibraryRenderer method render.

public boolean render(XhtmlNode x, Library lib) throws FHIRFormatError, DefinitionException, IOException {
    if (lib.hasAuthor() || lib.hasEditor() || lib.hasReviewer() || lib.hasEndorser()) {
        boolean email = hasCT(lib.getAuthor(), "email") || hasCT(lib.getEditor(), "email") || hasCT(lib.getReviewer(), "email") || hasCT(lib.getEndorser(), "email");
        boolean phone = hasCT(lib.getAuthor(), "phone") || hasCT(lib.getEditor(), "phone") || hasCT(lib.getReviewer(), "phone") || hasCT(lib.getEndorser(), "phone");
        boolean url = hasCT(lib.getAuthor(), "url") || hasCT(lib.getEditor(), "url") || hasCT(lib.getReviewer(), "url") || hasCT(lib.getEndorser(), "url");
        x.h2().tx("Participants");
        XhtmlNode t = x.table("grid");
        for (ContactDetail cd : lib.getAuthor()) {
            participantRow(t, "Author", cd, email, phone, url);
        }
        for (ContactDetail cd : lib.getEditor()) {
            participantRow(t, "Editor", cd, email, phone, url);
        }
        for (ContactDetail cd : lib.getReviewer()) {
            participantRow(t, "Reviewer", cd, email, phone, url);
        }
        for (ContactDetail cd : lib.getEndorser()) {
            participantRow(t, "Endorser", cd, email, phone, url);
        }
    }
    if (lib.hasRelatedArtifact()) {
        x.h2().tx("Related Artifacts");
        XhtmlNode t = x.table("grid");
        boolean label = false;
        boolean display = false;
        boolean citation = false;
        for (RelatedArtifact ra : lib.getRelatedArtifact()) {
            label = label || ra.hasLabel();
            display = display || ra.hasDisplay();
            citation = citation || ra.hasCitation();
        }
        for (RelatedArtifact ra : lib.getRelatedArtifact()) {
            renderArtifact(t, ra, lib, label, display, citation);
        }
    }
    if (lib.hasParameter()) {
        x.h2().tx("Parameters");
        XhtmlNode t = x.table("grid");
        boolean doco = false;
        for (ParameterDefinition p : lib.getParameter()) {
            doco = doco || p.hasDocumentation();
        }
        for (ParameterDefinition p : lib.getParameter()) {
            renderParameter(t, p, doco);
        }
    }
    if (lib.hasDataRequirement()) {
        x.h2().tx("Data Requirements");
        for (DataRequirement p : lib.getDataRequirement()) {
            renderDataRequirement(x, p);
        }
    }
    if (lib.hasContent()) {
        x.h2().tx("Contents");
        boolean isCql = false;
        int counter = 0;
        for (Attachment att : lib.getContent()) {
            renderAttachment(x, att, isCql, counter, lib.getId());
            isCql = isCql || (att.hasContentType() && att.getContentType().startsWith("text/cql"));
            counter++;
        }
    }
    return false;
}
Also used : ContactDetail(org.hl7.fhir.r4b.model.ContactDetail) Attachment(org.hl7.fhir.r4b.model.Attachment) DataRequirement(org.hl7.fhir.r4b.model.DataRequirement) RelatedArtifact(org.hl7.fhir.r4b.model.RelatedArtifact) ContactPoint(org.hl7.fhir.r4b.model.ContactPoint) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) ParameterDefinition(org.hl7.fhir.r4b.model.ParameterDefinition)

Example 33 with CD

use of org.hl7.v3.CD in project org.hl7.fhir.core by hapifhir.

the class XmlParserTests method testXsiDeserialiserXmlParser.

@Test
public /**
 * Deserializes a simplified CDA example into the logical model and checks that
 * xml deserialization works for the xsi:type
 *
 * @throws IOException
 */
void testXsiDeserialiserXmlParser() throws IOException {
    Element cda = Manager.parseSingle(context, TestingUtilities.loadTestResourceStream("validator", "cda", "example-xsi.xml"), FhirFormat.XML);
    ByteArrayOutputStream baosXml = new ByteArrayOutputStream();
    Manager.compose(context, cda, baosXml, FhirFormat.XML, OutputStyle.PRETTY, null);
    String cdaSerialised = baosXml.toString();
    Assertions.assertTrue(cdaSerialised.indexOf("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"") > 0);
    Assertions.assertTrue(cdaSerialised.indexOf("xsi:type=\"CD\"") > 0);
}
Also used : Element(org.hl7.fhir.r4b.elementmodel.Element) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.jupiter.api.Test)

Example 34 with CD

use of org.hl7.v3.CD in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method intersectCodeableConcepts.

private void intersectCodeableConcepts(List<CodeableConcept> tgt, List<CodeableConcept> src) {
    List<CodeableConcept> toRemove = new ArrayList<CodeableConcept>();
    for (CodeableConcept cd : src) {
        boolean remove = false;
        for (CodeableConcept t : tgt) {
            if (t.matches(cd)) {
                remove = true;
            }
        }
        if (remove) {
            toRemove.add(cd);
        }
    }
    tgt.removeAll(toRemove);
}
Also used : ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept)

Example 35 with CD

use of org.hl7.v3.CD in project org.hl7.fhir.core by hapifhir.

the class CodeSystemComparer method intersect.

private ConceptDefinitionComponent intersect(ConceptDefinitionComponent l, ConceptDefinitionComponent r, CodeSystemComparison res) {
    ConceptDefinitionComponent cd = l.copy();
    if (l.hasDisplay() && !r.hasDisplay()) {
        cd.setDisplay(null);
    }
    if (l.hasDefinition() && !r.hasDefinition()) {
        cd.setDefinition(null);
    }
    intersectProps(cd, l, r, res);
    // mergeDesignations(cd, l, r);
    return cd;
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)

Aggregations

ArrayList (java.util.ArrayList)24 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)16 Coding (org.hl7.fhir.r4.model.Coding)10 ValueSet (org.hl7.fhir.r5.model.ValueSet)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)9 BindingSpecification (org.hl7.fhir.definitions.model.BindingSpecification)8 UnsupportedEncodingException (java.io.UnsupportedEncodingException)7 CD (net.ihe.gazelle.hl7v3.datatypes.CD)7 CS (net.ihe.gazelle.hl7v3.datatypes.CS)7 II (net.ihe.gazelle.hl7v3.datatypes.II)7 TS (net.ihe.gazelle.hl7v3.datatypes.TS)7 MCCIMT000100UV01Device (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Device)7 MCCIMT000100UV01Receiver (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Receiver)7 MCCIMT000100UV01Sender (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Sender)7 Identifier (org.hl7.fhir.r4.model.Identifier)7 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)7 IOException (java.io.IOException)6 ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)6 ContactDetail (org.hl7.fhir.r5.model.ContactDetail)5