use of org.hl7.fhir.r5.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCompositionCompositionRelatesToComponent.
protected void composeCompositionCompositionRelatesToComponent(Complex parent, String parentType, String name, Composition.CompositionRelatesToComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "relatesTo", name, element, index);
if (element.hasCodeElement())
composeEnum(t, "Composition", "code", element.getCodeElement(), -1);
if (element.hasTarget())
composeType(t, "Composition", "target", element.getTarget(), -1);
}
use of org.hl7.fhir.r5.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeComposition.
protected void composeComposition(Complex parent, String parentType, String name, Composition element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Composition", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "Composition", "identifier", element.getIdentifier(), -1);
if (element.hasStatusElement())
composeEnum(t, "Composition", "status", element.getStatusElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Composition", "type", element.getType(), -1);
for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "Composition", "category", element.getCategory().get(i), i);
if (element.hasSubject())
composeReference(t, "Composition", "subject", element.getSubject(), -1);
if (element.hasEncounter())
composeReference(t, "Composition", "encounter", element.getEncounter(), -1);
if (element.hasDateElement())
composeDateTime(t, "Composition", "date", element.getDateElement(), -1);
for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "Composition", "author", element.getAuthor().get(i), i);
if (element.hasTitleElement())
composeString(t, "Composition", "title", element.getTitleElement(), -1);
if (element.hasConfidentialityElement())
composeEnum(t, "Composition", "confidentiality", element.getConfidentialityElement(), -1);
for (int i = 0; i < element.getAttester().size(); i++) composeCompositionCompositionAttesterComponent(t, "Composition", "attester", element.getAttester().get(i), i);
if (element.hasCustodian())
composeReference(t, "Composition", "custodian", element.getCustodian(), -1);
for (int i = 0; i < element.getRelatesTo().size(); i++) composeCompositionCompositionRelatesToComponent(t, "Composition", "relatesTo", element.getRelatesTo().get(i), i);
for (int i = 0; i < element.getEvent().size(); i++) composeCompositionCompositionEventComponent(t, "Composition", "event", element.getEvent().get(i), i);
for (int i = 0; i < element.getSection().size(); i++) composeCompositionSectionComponent(t, "Composition", "section", element.getSection().get(i), i);
}
use of org.hl7.fhir.r5.model.Composition in project org.hl7.fhir.core by hapifhir.
the class BundleValidator method validateDocumentSubReference.
public void validateDocumentSubReference(List<ValidationMessage> errors, List<Element> entries, Element composition, NodeStack stack, String fullUrl, String id, String title, String parent, boolean repeats, String propName) {
List<Element> list = new ArrayList<>();
composition.getNamedChildren(parent, list);
int i = 1;
for (Element elem : list) {
validateDocumentReference(errors, entries, elem, stack.push(elem, i, null, null), fullUrl, id, repeats, propName, title + "." + parent);
i++;
}
}
use of org.hl7.fhir.r5.model.Composition in project org.hl7.fhir.core by hapifhir.
the class BundleValidator method validateSections.
private void validateSections(List<ValidationMessage> errors, List<Element> entries, Element focus, NodeStack stack, String fullUrl, String id) {
List<Element> sections = new ArrayList<Element>();
focus.getNamedChildren("section", sections);
int i = 1;
for (Element section : sections) {
NodeStack localStack = stack.push(section, i, null, null);
// technically R4+, but there won't be matches from before that
validateDocumentReference(errors, entries, section, stack, fullUrl, id, true, "author", "Section");
validateDocumentReference(errors, entries, section, stack, fullUrl, id, false, "focus", "Section");
List<Element> sectionEntries = new ArrayList<Element>();
section.getNamedChildren(ENTRY, sectionEntries);
int j = 1;
for (Element sectionEntry : sectionEntries) {
NodeStack localStack2 = localStack.push(sectionEntry, j, null, null);
validateBundleReference(errors, entries, sectionEntry, "Section Entry", localStack2, fullUrl, "Composition", id);
j++;
}
validateSections(errors, entries, section, localStack, fullUrl, id);
i++;
}
}
use of org.hl7.fhir.r5.model.Composition in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generateDocumentNarrative.
public XhtmlNode generateDocumentNarrative(Bundle feed) {
/*
When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order:
* The Composition resource
* The Subject resource
* Resources referenced in the section.content
*/
XhtmlNode root = new XhtmlNode(NodeType.Element, "div");
Composition comp = (Composition) feed.getEntry().get(0).getResource();
root.getChildNodes().add(comp.getText().getDiv());
Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference());
if (subject != null && subject instanceof DomainResource) {
root.addTag("hr");
root.getChildNodes().add(((DomainResource) subject).getText().getDiv());
}
List<SectionComponent> sections = comp.getSection();
renderSections(feed, root, sections, 1);
return root;
}
Aggregations