Search in sources :

Example 11 with CompartmentDefinition

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

the class PageProcessor method genDiffLinks.

private String genDiffLinks() {
    StringBuilder b = new StringBuilder();
    b.append("<ul>\r\n");
    pageDiffLinks(b, "resourcelist");
    pageDiffLinks(b, "lifecycle");
    pageDiffLinks(b, "compartmentdefinition");
    pageDiffLinks(b, "rdf");
    pageDiffLinks(b, "terminologies-systems");
    pageDiffLinks(b, "mappings");
    pageDiffLinks(b, "versioning");
    pageDiffLinks(b, "history");
    pageDiffLinks(b, "diff");
    pageDiffLinks(b, "r3maps");
    pageDiffLinks(b, "overview");
    pageDiffLinks(b, "overview-dev");
    pageDiffLinks(b, "overview-clinical");
    pageDiffLinks(b, "overview-arch");
    pageDiffLinks(b, "summary");
    pageDiffLinks(b, "help");
    pageDiffLinks(b, "license");
    pageDiffLinks(b, "credits");
    pageDiffLinks(b, "todo");
    pageDiffLinks(b, "change");
    pageDiffLinks(b, "async");
    pageDiffLinks(b, "graphql");
    pageDiffLinks(b, "documents");
    pageDiffLinks(b, "messaging");
    pageDiffLinks(b, "services");
    pageDiffLinks(b, "storage");
    pageDiffLinks(b, "dosage");
    pageDiffLinks(b, "fivews");
    pageDiffLinks(b, "event");
    pageDiffLinks(b, "request");
    pageDiffLinks(b, "definition");
    pageDiffLinks(b, "downloads");
    pageDiffLinks(b, "versioning");
    pageDiffLinks(b, "validation");
    pageDiffLinks(b, "best-practices");
    pageDiffLinks(b, "mapping-language");
    pageDiffLinks(b, "testing");
    pageDiffLinks(b, "security");
    pageDiffLinks(b, "safety");
    pageDiffLinks(b, "managing");
    pageDiffLinks(b, "resourceguide");
    pageDiffLinks(b, "languages");
    pageDiffLinks(b, "updates");
    pageDiffLinks(b, "pushpull");
    pageDiffLinks(b, "integrated-examples");
    pageDiffLinks(b, "usecases");
    pageDiffLinks(b, "comparison-v2");
    pageDiffLinks(b, "comparison-v3");
    pageDiffLinks(b, "comparison-cda");
    pageDiffLinks(b, "comparison-other");
    for (String n : definitions.sortedResourceNames()) {
        resourceDiffLinks(b, n);
    }
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 12 with CompartmentDefinition

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

the class PageProcessor method getCompLinks.

private String getCompLinks(ResourceDefn resource, String param) {
    List<String> names = new ArrayList<String>();
    for (Compartment comp : definitions.getCompartments()) {
        if (comp.getResources().containsKey(resource) && !Utilities.noString(comp.getResources().get(resource)))
            names.add(comp.getName());
    }
    StringBuilder b = new StringBuilder();
    b.append("<a href=\"compartmentdefinition.html\">Compartments</a>: ");
    if ("n/a".equals(param))
        b.append("N/A");
    else {
        if (names.isEmpty())
            b.append("Not linked to any defined compartments");
        else {
            Collections.sort(names);
            boolean first = true;
            for (String name : names) {
                if (first)
                    first = false;
                else
                    b.append(", ");
                b.append("<a href=\"compartmentdefinition-" + name.toLowerCase() + ".html\">" + definitions.getCompartmentByName(name).getTitle() + "</a>");
            }
        }
    }
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) Compartment(org.hl7.fhir.definitions.model.Compartment) ArrayList(java.util.ArrayList)

Example 13 with CompartmentDefinition

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

the class Publisher method generateCompartmentDefinition.

private void generateCompartmentDefinition(Compartment c) throws Exception {
    CompartmentDefinition cpd = new CompartmentDefinition();
    cpd.setId(c.getName());
    cpd.setUrl("http://hl7.org/fhir/CompartmentDefinition/" + c.getName());
    cpd.setName("Base FHIR compartment definition for " + c.getTitle());
    cpd.setStatus(PublicationStatus.DRAFT);
    cpd.setDescription(c.getIdentity() + ". " + c.getDescription());
    cpd.setExperimental(true);
    cpd.setVersion(page.getVersion().toCode());
    cpd.setDate(page.getGenDate().getTime());
    cpd.setPublisher("FHIR Project Team");
    cpd.addContact().getTelecom().add(Factory.newContactPoint(ContactPointSystem.URL, "http://hl7.org/fhir"));
    cpd.setCode(CompartmentType.fromCode(c.getTitle()));
    cpd.setSearch(true);
    for (String rn : page.getDefinitions().sortedResourceNames()) {
        ResourceDefn rd = page.getDefinitions().getResourceByName(rn);
        String rules = c.getResources().get(rd);
        CompartmentDefinitionResourceComponent cc = cpd.addResource().setCode(rd.getName());
        if (!Utilities.noString(rules)) {
            for (String p : rules.split("\\|")) cc.addParam(p.trim());
        }
    }
    RenderingContext lrc = page.getRc().copy().setLocalPrefix("").setTooCostlyNoteEmpty(PageProcessor.TOO_MANY_CODES_TEXT_EMPTY).setTooCostlyNoteNotEmpty(PageProcessor.TOO_MANY_CODES_TEXT_NOT_EMPTY);
    RendererFactory.factory(cpd, lrc).render(cpd);
    FileOutputStream s = new FileOutputStream(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".xml");
    new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(s, cpd);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".canonical.xml");
    new XmlParser().setOutputStyle(OutputStyle.CANONICAL).compose(s, cpd);
    s.close();
    cloneToXhtml("compartmentdefinition-" + c.getName().toLowerCase(), "Compartment Definition for " + c.getName(), true, "resource-instance:CompartmentDefinition", "Compartment Definition for " + c.getName(), null, wg("fhir"));
    s = new FileOutputStream(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".json");
    new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(s, cpd);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".canonical.json");
    new JsonParser().setOutputStyle(OutputStyle.CANONICAL).compose(s, cpd);
    s.close();
    jsonToXhtml("compartmentdefinition-" + c.getName().toLowerCase(), "Compartment Definition for " + c.getName(), resource2Json(cpd), "resource-instance:CompartmentDefinition", "Compartment Definition for " + c.getName(), null, wg("fhir"));
    s = new FileOutputStream(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".ttl");
    new RdfParser().setOutputStyle(OutputStyle.PRETTY).compose(s, cpd);
    s.close();
    ttlToXhtml("compartmentdefinition-" + c.getName().toLowerCase(), "Compartment Definition for " + c.getName(), resource2Ttl(cpd), "resource-instance:CompartmentDefinition", "Compartment Definition for " + c.getName(), null, wg("fhir"));
    Utilities.copyFile(new CSFile(page.getFolders().dstDir + "compartmentdefinition-" + c.getName().toLowerCase() + ".xml"), new CSFile(page.getFolders().dstDir + "examples" + File.separator + "compartmentdefinition-" + c.getName().toLowerCase() + ".xml"));
    addToResourceFeed(cpd, page.getResourceBundle());
}
Also used : RenderingContext(org.hl7.fhir.r5.renderers.utils.RenderingContext) XmlParser(org.hl7.fhir.r5.formats.XmlParser) CompartmentDefinitionResourceComponent(org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent) CompartmentDefinition(org.hl7.fhir.r5.model.CompartmentDefinition) FileOutputStream(java.io.FileOutputStream) CSFile(org.hl7.fhir.utilities.CSFile) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn) JsonParser(org.hl7.fhir.r5.formats.JsonParser) RdfParser(org.hl7.fhir.r5.formats.RdfParser)

Example 14 with CompartmentDefinition

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

the class Publisher method addToResourceFeed.

private void addToResourceFeed(CompartmentDefinition cd, Bundle dest) throws Exception {
    if (cd.getId() == null)
        throw new Exception("Resource has no id");
    if (ResourceUtilities.getById(dest, ResourceType.CompartmentDefinition, cd.getId()) != null)
        throw new Exception("Attempt to add duplicate Compartment Definition " + cd.getId());
    if (!cd.hasText() || !cd.getText().hasDiv()) {
        RendererFactory.factory(cd, page.getRc().copy()).render(cd);
    }
    if (cd.getText() == null || cd.getText().getDiv() == null)
        throw new Exception("Example Compartment Definition " + cd.getId() + " does not have any narrative");
    ResourceUtilities.meta(cd).setLastUpdated(page.getGenDate().getTime());
    if (!cd.getUrl().equals("http://hl7.org/fhir/" + cd.getResourceType().toString() + "/" + cd.getId()))
        throw new Exception("URL mismatch on concept map");
    dest.getEntry().add(new BundleEntryComponent().setResource(cd).setFullUrl("http://hl7.org/fhir/" + cd.fhirType() + "/" + cd.getId()));
}
Also used : BundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 15 with CompartmentDefinition

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

the class RdfParser method composeCompartmentDefinitionCompartmentDefinitionContactComponent.

protected void composeCompartmentDefinitionCompartmentDefinitionContactComponent(Complex parent, String parentType, String name, CompartmentDefinition.CompartmentDefinitionContactComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "contact", name, element, index);
    if (element.hasNameElement())
        composeString(t, "CompartmentDefinition", "name", element.getNameElement(), -1);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "CompartmentDefinition", "telecom", element.getTelecom().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

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