Search in sources :

Example 1 with StructureDefinitionMappingComponent

use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent in project kindling by HL7.

the class PageProcessor method mapOnPageProfile.

private String mapOnPageProfile(StructureDefinition source) {
    if (source.getMapping().size() < 2)
        return "";
    StringBuilder b = new StringBuilder();
    b.append("<div class=\"itoc\">\r\n<p>Mappings:</p>\r\n");
    for (StructureDefinitionMappingComponent map : source.getMapping()) {
        b.append("<p class=\"link\"><a href=\"#").append(map.getIdentity()).append("\">").append(map.getName()).append("</a></p>");
    }
    b.append("</div>\r\n");
    return b.toString();
}
Also used : StructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 2 with StructureDefinitionMappingComponent

use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent in project kindling by HL7.

the class PageProcessor method genImplementationList.

private String genImplementationList(ResourceDefn logical) throws FHIRException {
    String url = logical.getMappingUrl();
    StringBuilder b = new StringBuilder();
    b.append("<table class=\"lines\">\r\n");
    for (String s : sorted(definitions.getResources().keySet())) {
        ResourceDefn rd = definitions.getResourceByName(s);
        StructureDefinition sd = rd.getProfile();
        String code = null;
        for (StructureDefinitionMappingComponent m : sd.getMapping()) {
            if (m.getUri().equals(url))
                code = m.getIdentity();
        }
        if (code != null) {
            if (hasLogicalMapping(sd, logical, code)) {
                b.append(" <tr>\r\n");
                b.append("  <td><a href=\"" + rd.getName().toLowerCase() + ".html\">" + rd.getName() + "</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\n");
                b.append("  <td><a href=\"" + rd.getName().toLowerCase() + "-mappings.html#" + url + "\">Mappings</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\n");
                b.append("  <td><a href=\"" + rd.getName().toLowerCase() + "-examples.html\">Examples</a></td>\r\n");
                b.append(" </tr>\r\n");
            }
        }
    }
    b.append("</table>");
    return b.toString();
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) StructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn)

Example 3 with StructureDefinitionMappingComponent

use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent in project kindling by HL7.

the class MappingsGenerator method generate.

public void generate(StructureDefinition profile) throws IOException {
    if (profile.getMapping().isEmpty())
        mappings = "<p>No Mappings</p>";
    else {
        StringBuilder s = new StringBuilder();
        for (StructureDefinitionMappingComponent map : profile.getMapping()) {
            s.append("<a name=\"" + map.getIdentity() + "\"> </a><h3>" + map.getName() + " (" + map.getUri() + ")</h3>");
            if (map.hasComment())
                s.append("<p>" + Utilities.escapeXml(map.getComment()) + "</p>");
            else if (definitions.getMapTypes().containsKey(map.getUri())) {
                XhtmlNode pre = definitions.getMapTypes().get(map.getUri()).getPreamble();
                if (pre != null)
                    s.append(new XhtmlComposer(XhtmlComposer.HTML).compose(pre));
            }
            s.append("<table class=\"grid\">\r\n");
            s.append(" <tr><td colspan=\"3\"><b>" + Utilities.escapeXml(profile.getName()) + "</b></td></tr>\r\n");
            String path = null;
            for (ElementDefinition e : profile.getSnapshot().getElement()) {
                if (path == null || !e.getPath().startsWith(path)) {
                    path = null;
                    if (e.hasMax() && e.getMax().equals("0")) {
                        path = e.getPath() + ".";
                    } else
                        genElement(s, e, map.getIdentity());
                }
            }
            s.append("</table>\r\n");
        }
        mappings = s.toString();
    }
}
Also used : StructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent) XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 4 with StructureDefinitionMappingComponent

use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent in project kindling by HL7.

the class MappingsGenerator method generateExtension.

public void generateExtension(StructureDefinition ed) throws IOException {
    if (ed.getMapping().isEmpty())
        mappings = "<p>No Mappings</p>";
    else {
        StringBuilder s = new StringBuilder();
        for (StructureDefinitionMappingComponent map : ed.getMapping()) {
            s.append("<a name=\"" + map.getIdentity() + "\"> </a><h3>" + map.getName() + " (" + map.getUri() + ")</h3>");
            if (map.hasComment())
                s.append("<p>" + Utilities.escapeXml(map.getComment()) + "</p>");
            else if (definitions.getMapTypes().containsKey(map.getUri())) {
                XhtmlNode pre = definitions.getMapTypes().get(map.getUri()).getPreamble();
                if (pre != null)
                    s.append(new XhtmlComposer(XhtmlComposer.HTML).compose(pre));
            }
            s.append("<table class=\"grid\">\r\n");
            s.append(" <tr><td colspan=\"3\"><b>" + Utilities.escapeXml(ed.getName()) + "</b></td></tr>\r\n");
            String path = null;
            for (ElementDefinition e : ed.getSnapshot().getElement()) {
                if (path == null || !e.getPath().startsWith(path)) {
                    path = null;
                    if (e.hasMax() && e.getMax().equals("0")) {
                        path = e.getPath() + ".";
                    } else
                        genElement(s, e, map.getIdentity());
                }
            }
            s.append("</table>\r\n");
        }
        mappings = s.toString();
    }
}
Also used : StructureDefinitionMappingComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent) XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 5 with StructureDefinitionMappingComponent

use of org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent in project kindling by HL7.

the class ProfileGenerator method addElementConstraint.

/*
   *     // resource
    // domain resource
    for (ElementDefn child : definitions.getBaseResources().get("DomainResource").getRoot().getElements()) 
      defineElement(null, p, p.getSnapshot(), child, r.getRoot().getName()+"."+child.getName(), containedSlices, new ArrayList<ProfileGenerator.SliceHandle>(), SnapShotMode.Resource);

   */
/*
  private String registerMapping(ConformancePackage ap, StructureDefinition p, String m) {
    for (StructureDefinitionMappingComponent map : p.getMapping()) {
      if (map.getUri().equals(m))
        return map.getIdentity();
    }
    StructureDefinitionMappingComponent map = new StructureDefinitionMappingComponent();
    MappingSpace space = definitions.getMapTypes().get(m);
    if (space != null)
      map.setIdentity(space.getId());
    else
      map.setIdentity("m" + Integer.toString(p.getMapping().size()+1));
    map.setUri(m);
    String name = ap.metadata(m+"-name");
    if (Utilities.noString(name) && space != null)
      name = space.getTitle();
    if (!Utilities.noString(name))
      map.setName(name);
    String comments = ap.metadata(m+"-comments");
    if (Utilities.noString(comments) && space != null)
        comments = space.getPreamble();
    if (!Utilities.noString(comments))
      map.setComments(comments);
    return map.getIdentity();
  }
   */
private ElementDefinition addElementConstraint(StructureDefinition sd, ElementDefinition ed) {
    if (!ed.getPath().contains(".") && sd.getKind() == StructureDefinitionKind.RESOURCE)
        return ed;
    if (hasSystemType(ed))
        return ed;
    if (isResource(ed))
        return ed;
    if (hasConstraint(ed, "ele-1"))
        return ed;
    ElementDefinitionConstraintComponent inv = ed.addConstraint();
    inv.setKey("ele-1");
    inv.setSeverity(ConstraintSeverity.ERROR);
    inv.setHuman("All FHIR elements must have a @value or children");
    inv.setExpression("hasValue() or (children().count() > id.count())");
    inv.setXpath("@value|f:*|h:div");
    inv.setSource("http://hl7.org/fhir/StructureDefinition/Element");
    return ed;
}
Also used : ElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent)

Aggregations

StructureDefinitionMappingComponent (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent)14 Row (org.apache.poi.ss.usermodel.Row)10 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)10 StructureDefinitionMappingComponent (org.hl7.fhir.r4b.model.StructureDefinition.StructureDefinitionMappingComponent)8 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)8 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)8 XSSFSheet (org.apache.poi.xssf.usermodel.XSSFSheet)6 ElementDefinitionMappingComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent)6 StructureDefinitionMappingComponent (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent)5 ElementDefinitionMappingComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionMappingComponent)5 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)5 ConditionalFormattingRule (org.apache.poi.ss.usermodel.ConditionalFormattingRule)4 FontFormatting (org.apache.poi.ss.usermodel.FontFormatting)4 PatternFormatting (org.apache.poi.ss.usermodel.PatternFormatting)4 SheetConditionalFormatting (org.apache.poi.ss.usermodel.SheetConditionalFormatting)4 CellAddress (org.apache.poi.ss.util.CellAddress)4 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)4 ElementDefinitionMappingComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent)4 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)4 CTAutoFilter (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTAutoFilter)4