Composition Section API
The CompositionSection
object represents a section of a composition. This object is not an extension of ResourceBuilder
and as such, you cannot use dot notation to set its fields.
To create a CompositionSection
, use the ResourceBuilder.build('Composition').addSection(sectionType)
method as described in the Composition Resource section of this documentation.
Add resource references to this section.
Note that any Fhir.search().forResource(resource)... .asList()
call will return a List<Resource>
that this method can use for input.
You can view the available options for Fhir.search() here.
Inputs:
resources
– the list of Resources from which to add referencesOutputs:
Composition.section.entry
with references to the provided resources.Example:
var composition = ResourceBuilder.build('Composition');
var section = composition.addSection();
var observations = Fhir
.search()
.forResource('Observation')
.asList();
section.populate(observations);
Note that if you used a supported value for section type when creating this object, the title will already be set for you. In case you are manually setting the section type or would prefer your own title, you can use this method.
Inputs:
title
– the value to set the title to.Outputs:
Example:
var composition = ResourceBuilder.build('Composition');
var section = composition.addSection('problems');
section.setTitle('I got 99 problems');
Note that if you used a supported value for section type when creating this object, the code will be properly populated for you. If you would like to override manually setting the section type or would prefer your own title, you can use this method.
Inputs:
system
– the desired systemcode
– the desired codesystem
– the desired display nameOutputs:
Example:
var composition = ResourceBuilder.build('Composition');
var section = composition.addSection();
section.setCode('mySystem', 'myCode', 'myDisplay');
This method can be used to create a subsection within a section. The following C-CDA sections use subsections to cluster resources. Please refer to the documentation for each section for the details on how clustering will affect the generated document.
Inputs:
var composition = ResourceBuilder.build('Composition');
var vitalSignsSection = composition.addSection('vitalsign');
var vitalSignsCluster = vitalSignsSection.addSection();
Outputs: