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();
}
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();
}
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());
}
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()));
}
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);
}
Aggregations