Search in sources :

Example 11 with NamingSystem

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

the class NamingSystemRenderer method render.

public boolean render(XhtmlNode x, NamingSystem ns) throws FHIRFormatError, DefinitionException, IOException {
    x.h3().tx("Summary");
    XhtmlNode tbl = x.table("grid");
    row(tbl, "Defining URL", ns.getUrl());
    if (ns.hasVersion()) {
        row(tbl, "Version", ns.getVersion());
    }
    if (ns.hasName()) {
        row(tbl, "Name", gt(ns.getNameElement()));
    }
    if (ns.hasTitle()) {
        row(tbl, "Title", gt(ns.getTitleElement()));
    }
    row(tbl, "Status", ns.getStatus().toCode());
    if (ns.hasDescription()) {
        addMarkdown(row(tbl, "Definition"), ns.getDescription());
    }
    if (ns.hasPublisher()) {
        row(tbl, "Publisher", gt(ns.getPublisherElement()));
    }
    if (ns.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
        renderCommitteeLink(row(tbl, "Committee"), ns);
    }
    if (CodeSystemUtilities.hasOID(ns)) {
        row(tbl, "OID", CodeSystemUtilities.getOID(ns)).tx("(" + translate("ns.summary", "for OID based terminology systems") + ")");
    }
    if (ns.hasCopyright()) {
        addMarkdown(row(tbl, "Copyright"), ns.getCopyright());
    }
    boolean hasPreferred = false;
    boolean hasPeriod = false;
    boolean hasComment = false;
    for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
        hasPreferred = hasPreferred || id.hasPreferred();
        hasPeriod = hasPeriod || id.hasPeriod();
        hasComment = hasComment || id.hasComment();
    }
    x.h3().tx("Identifiers");
    tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx(translate("ns.summary", "Type"));
    tr.td().b().tx(translate("ns.summary", "Value"));
    if (hasPreferred) {
        tr.td().b().tx(translate("ns.summary", "Preferred"));
    }
    if (hasPeriod) {
        tr.td().b().tx(translate("ns.summary", "Period"));
    }
    if (hasComment) {
        tr.td().b().tx(translate("ns.summary", "Comment"));
    }
    for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
        tr = tbl.tr();
        tr.td().tx(id.getType().getDisplay());
        tr.td().tx(id.getValue());
        if (hasPreferred) {
            tr.td().tx(id.getPreferredElement().primitiveValue());
        }
        if (hasPeriod) {
            tr.td().tx(display(id.getPeriod()));
        }
        if (hasComment) {
            tr.td().tx(id.getComment());
        }
    }
    return false;
}
Also used : NamingSystemUniqueIdComponent(org.hl7.fhir.r4b.model.NamingSystem.NamingSystemUniqueIdComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 12 with NamingSystem

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

the class TurtleTests method test_namingsystem_example.

@Test
public void test_namingsystem_example() throws FileNotFoundException, IOException, Exception {
    System.out.println("namingsystem-example.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\namingsystem-example.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 13 with NamingSystem

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

the class TurtleTests method test_namingsystem_registry.

@Test
public void test_namingsystem_registry() throws FileNotFoundException, IOException, Exception {
    System.out.println("namingsystem-registry.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\namingsystem-registry.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 14 with NamingSystem

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

the class NamingSystemRenderer method render.

public boolean render(XhtmlNode x, NamingSystem ns) throws FHIRFormatError, DefinitionException, IOException {
    x.h3().tx("Summary");
    XhtmlNode tbl = x.table("grid");
    row(tbl, "Defining URL", ns.getUrl());
    if (ns.hasVersion()) {
        row(tbl, "Version", ns.getVersion());
    }
    if (ns.hasName()) {
        row(tbl, "Name", gt(ns.getNameElement()));
    }
    if (ns.hasTitle()) {
        row(tbl, "Title", gt(ns.getTitleElement()));
    }
    row(tbl, "Status", ns.getStatus().toCode());
    if (ns.hasDescription()) {
        addMarkdown(row(tbl, "Definition"), ns.getDescription());
    }
    if (ns.hasPublisher()) {
        row(tbl, "Publisher", gt(ns.getPublisherElement()));
    }
    if (ns.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
        renderCommitteeLink(row(tbl, "Committee"), ns);
    }
    if (CodeSystemUtilities.hasOID(ns)) {
        row(tbl, "OID", CodeSystemUtilities.getOID(ns)).tx("(" + translate("ns.summary", "for OID based terminology systems") + ")");
    }
    if (ns.hasCopyright()) {
        addMarkdown(row(tbl, "Copyright"), ns.getCopyright());
    }
    boolean hasPreferred = false;
    boolean hasPeriod = false;
    boolean hasComment = false;
    for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
        hasPreferred = hasPreferred || id.hasPreferred();
        hasPeriod = hasPeriod || id.hasPeriod();
        hasComment = hasComment || id.hasComment();
    }
    x.h3().tx("Identifiers");
    tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx(translate("ns.summary", "Type"));
    tr.td().b().tx(translate("ns.summary", "Value"));
    if (hasPreferred) {
        tr.td().b().tx(translate("ns.summary", "Preferred"));
    }
    if (hasPeriod) {
        tr.td().b().tx(translate("ns.summary", "Period"));
    }
    if (hasComment) {
        tr.td().b().tx(translate("ns.summary", "Comment"));
    }
    for (NamingSystemUniqueIdComponent id : ns.getUniqueId()) {
        tr = tbl.tr();
        tr.td().tx(id.getType().getDisplay());
        tr.td().tx(id.getValue());
        if (hasPreferred) {
            tr.td().tx(id.getPreferredElement().primitiveValue());
        }
        if (hasPeriod) {
            tr.td().tx(display(id.getPeriod()));
        }
        if (hasComment) {
            tr.td().tx(id.getComment());
        }
    }
    return false;
}
Also used : NamingSystemUniqueIdComponent(org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 15 with NamingSystem

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

the class DataRenderer method isCanonical.

private boolean isCanonical(String path) {
    if (!path.endsWith(".url"))
        return false;
    String t = path.substring(0, path.length() - 4);
    StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
    if (sd == null)
        return false;
    if (Utilities.existsInList(t, VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()))) {
        return true;
    }
    if (Utilities.existsInList(t, "ActivityDefinition", "CapabilityStatement", "CapabilityStatement2", "ChargeItemDefinition", "Citation", "CodeSystem", "CompartmentDefinition", "ConceptMap", "ConditionDefinition", "EventDefinition", "Evidence", "EvidenceReport", "EvidenceVariable", "ExampleScenario", "GraphDefinition", "ImplementationGuide", "Library", "Measure", "MessageDefinition", "NamingSystem", "PlanDefinition"))
        return true;
    return sd.getBaseDefinitionElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-codegen-super");
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition)

Aggregations

DefinitionException (org.hl7.fhir.exceptions.DefinitionException)8 CodeSystem (org.hl7.fhir.r5.model.CodeSystem)6 NamingSystem (org.hl7.fhir.r5.model.NamingSystem)6 Test (org.junit.jupiter.api.Test)6 FHIRException (org.hl7.fhir.exceptions.FHIRException)5 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)4 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)4 ValueSet (org.hl7.fhir.r5.model.ValueSet)4 FileOutputStream (java.io.FileOutputStream)3 ArrayList (java.util.ArrayList)3 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)3 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)3 CanonicalResource (org.hl7.fhir.r5.model.CanonicalResource)3 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)3 NamingSystemUniqueIdComponent (org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent)3 DataFormatException (ca.uhn.fhir.parser.DataFormatException)2 File (java.io.File)2 TransformerException (javax.xml.transform.TransformerException)2