# Smile CDR Tutorial Resource - CDA Export Template Example

```json
{
	"id": "default-ccd-template",
	"script": "function generateCdaExchangeComposition(inputMap) {    /* create the composition for our document */    let composition = ResourceBuilder.build('Composition');    /* currently CCD is the document type with the most support. There is limited support for 'TransferSummary' as well. */    composition.setType('ContinuityOfCareDocument');    let patient = inputMap['patient'];   composition.setSubject(patient);    /* get current timeStamp for use in auto-generated IDs and timestamps */    let currentDate = Date.now();    composition.setDate(currentDate);    /* boilerplate fields for this document-generation template */    composition.language = 'en-US';    composition.identifier.system = '1.23.456.7.890123.4.5678';    let splitSubject = patient.split('/');    if (splitSubject.length > 1) {      composition.identifier.value = patient.split('/')[1] + currentDate;    } else {      composition.identifier.value = patient + currentDate;    }    composition.title = 'Continuity of Care Document';    let problemSection = composition.addSection('problem');    let problemList = Fhir        .search()        .forResource('Condition')        .where('subject', patient)        .asList();    problemSection.populate(problemList);    let medicationSection = composition.addSection('medication');    let medicationList = Fhir        .search()        .forResource('MedicationRequest')        .where('subject', patient)        .asList();    let medicationList2 = Fhir        .search()        .forResource('MedicationAdministration')        .where('subject', patient)        .asList();    medicationSection        .populate(medicationList)        .populate(medicationList2);    let resultSection = composition.addSection('result');    let resultList = Fhir       .search()       .forResource('DiagnosticReport')       .where('subject', patient)       .asList();    resultSection.populate(resultList);    let vitalSection = composition.addSection('vitalsign');    let vitalList = Fhir        .search()        .forResource('Observation')        .where('subject', patient)        .where('category', 'vital-signs')        .asList();    vitalSection.populate(vitalList);    let allergySection = composition.addSection('allergyIntolerance');    let allergyList = Fhir        .search()        .forResource('AllergyIntolerance')        .where('patient', patient)        .asList();    allergySection.populate(allergyList);    let socialHistorySection = composition.addSection('socialHistory');    let historyList = Fhir        .search()        .forResource('Observation')        .where('subject', patient)        .where('category', 'social-history')        .asList();    socialHistorySection.populate(historyList);    /* let immunizationSection = composition.addSection('immunization');    let immunizationList = Fhir        .search()        .forResource('Immunization')        .where('patient', patient)        .asList();    immunizationSection.populate(immunizationList); */    /* let proceduresSection = composition.addSection('procedures');    let proceduresList = Fhir        .search()        .forResource('Procedure')        .where('subject', patient)        .asList();    proceduresSection.populate(proceduresList); */    let medicalEquipmentSection = composition.addSection('medicalequipment');    let deviceList = Fhir        .search()        .forResource('DeviceUseStatement')        .where('subject', patient)        .asList();medicalEquipmentSection.populate(deviceList);    return composition;}",
	"params": ["Patient"],
	"description": "Aggregate CCD Template"
}
```

Copy

[CDA Import JSON example](/content/docs/guide_tutorials/tutorial_cda_import_json.html)

CDA Export Template JSON example

Tutorials

[Introduction](/content/docs/guide_tutorials/tutorial_intro.html)
[Integration Testing Tutorial](/content/docs/guide_tutorials/tutorial_integration_test.html)
[Custom Operations Tutorial](/content/docs/guide_tutorials/tutorial_custom_operations.html)
[HL7 v2.x Ingestion Tutorial](/content/docs/guide_tutorials/tutorial_processing_hl7_v2x_feeds.html)
[Federated OAuth2/OIDC Tutorial](/content/docs/guide_tutorials/tutorial_federated_oauth2.html)
[MDM Tutorial](/content/docs/guide_tutorials/tutorial_mdm.html)
[MDM UI Tutorial](/content/docs/guide_tutorials/tutorial_mdm_ui.html)
[MDM First Golden Resource Tutorial](/content/docs/guide_tutorials/first_golden_resource.html)
[MDM Advanced Rule Authoring Tutorial](/content/docs/guide_tutorials/advanced_rule_authoring.html)
[MDM Web UI Admin Setup Tutorial](/content/docs/guide_tutorials/mdm_web_ui_admin_setup.html)
[CDA Import Tutorial](/content/docs/guide_tutorials/tutorial_cda_import.html)
[CDA Export Tutorial](/content/docs/guide_tutorials/tutorial_cda_export.html)
[CDA Export - Custom Narrative Generation Tutorial](/content/docs/guide_tutorials/tutorial_cda_export_narrative_generation.html)
[CDA Import JSON example](/content/docs/guide_tutorials/tutorial_cda_import_json.html)
[CDA Export Template JSON example](/content/docs/guide_tutorials/tutorial_cda_export_json.html)
[Consent Tutorial](/content/docs/guide_tutorials/tutorial_consent.html)
[CMS-0057-F IG Setup Tutorial](/content/docs/guide_tutorials/tutorial_terminology_cms57f.html)

[Consent Tutorial](/content/docs/guide_tutorials/tutorial_consent.html)
