-
Hospital Discharge Diagnosis
.Kidney Malrotation. Discharged August 1, 2013
diff --git a/data/Templates/Ccda/Entry/HospitalDischargeMedication/_entry_act_entryRelationship.liquid b/data/Templates/Ccda/Entry/HospitalDischargeMedication/_entry_act_entryRelationship.liquid
index ba10ee2d1..34ba6aa49 100644
--- a/data/Templates/Ccda/Entry/HospitalDischargeMedication/_entry_act_entryRelationship.liquid
+++ b/data/Templates/Ccda/Entry/HospitalDischargeMedication/_entry_act_entryRelationship.liquid
@@ -2,8 +2,10 @@
{% include 'Resource/MedicationAdministration' medicationAdministration: relationship.substanceAdministration, ID: substanceAdministrationId -%}
{% assign manufacturedMaterialId = relationship.substanceAdministration.consumable.manufacturedProduct.manufacturedMaterial | to_json_string | generate_uuid -%}
{% include 'Resource/Medication' medication: relationship.substanceAdministration.consumable.manufacturedProduct.manufacturedMaterial, ID: manufacturedMaterialId -%}
-{% assign organizationId = relationship.substanceAdministration.performer.assignedEntity.representedOrganization | to_json_string | generate_uuid -%}
-{% include 'Resource/Organization' organization: relationship.substanceAdministration.performer.assignedEntity.representedOrganization, ID: organizationId -%}
+{% if relationship.substanceAdministration.performer.assignedEntity.representedOrganization -%}
+ {% assign organizationId = relationship.substanceAdministration.performer.assignedEntity.representedOrganization | to_json_string | generate_uuid -%}
+ {% include 'Resource/Organization' organization: relationship.substanceAdministration.performer.assignedEntity.representedOrganization, ID: organizationId -%}
+{% endif -%}
{% include 'Reference/MedicationAdministration/Subject' ID: substanceAdministrationId, REF: fullPatientId -%}
{% assign fullManufacturedMaterialId = manufacturedMaterialId | prepend: 'Medication/' -%}
{% include 'Reference/MedicationAdministration/MedicationReference' ID: substanceAdministrationId, REF: fullManufacturedMaterialId -%}
diff --git a/data/Templates/Ccda/Header.liquid b/data/Templates/Ccda/Header.liquid
index 1ef34159a..db3d12918 100644
--- a/data/Templates/Ccda/Header.liquid
+++ b/data/Templates/Ccda/Header.liquid
@@ -12,13 +12,12 @@
{% include 'Resource/Encounter' encounter: msg.ClinicalDocument.componentOf.encompassingEncounter ID: encounterId -%}
{% assign fullEncounterId = encounterId | prepend: 'Encounter/' -%}
{% include 'Reference/Composition/Encounter' ID: compositionId, REF: fullEncounterId -%}
-{% endif -%}
-
-{% if msg.ClinicalDocument.componentOf.encompassingEncounter.location -%}
- {% assign locationId = msg.ClinicalDocument.componentOf.encompassingEncounter.location | to_json_string | generate_uuid -%}
- {% include 'Resource/Location' location: msg.ClinicalDocument.componentOf.encompassingEncounter.location ID: locationId -%}
- {% assign fullLocationId = locationId | prepend: 'Location/' -%}
- {% include 'Reference/Encounter/Location_Location' ID: encounterId, REF: fullLocationId -%}
+ {% if msg.ClinicalDocument.componentOf.encompassingEncounter.location -%}
+ {% assign locationId = msg.ClinicalDocument.componentOf.encompassingEncounter.location | to_json_string | generate_uuid -%}
+ {% include 'Resource/Location' location: msg.ClinicalDocument.componentOf.encompassingEncounter.location ID: locationId -%}
+ {% assign fullLocationId = locationId | prepend: 'Location/' -%}
+ {% include 'Reference/Encounter/Location_Location' ID: encounterId, REF: fullLocationId -%}
+ {% endif -%}
{% endif -%}
{% if msg.ClinicalDocument.custodian.assignedCustodian.representedCustodianOrganization.name._ -%}
@@ -46,7 +45,7 @@
{% endif -%}
{% endif -%}
- {% if author.assignedAuthor -%}
+ {% if author.assignedAuthor.assignedPerson -%}
{% evaluate practitionerId using 'Utils/GenerateId' obj: author.assignedAuthor -%}
{% include 'Resource/Practitioner' practitioner: author.assignedAuthor ID: practitionerId -%}
{% assign fullPractitionerId = practitionerId | prepend: 'Practitioner/' -%}
diff --git a/data/Templates/Ccda/Resource/_AllergyIntolerance.liquid b/data/Templates/Ccda/Resource/_AllergyIntolerance.liquid
index aacf5c3b7..506885437 100644
--- a/data/Templates/Ccda/Resource/_AllergyIntolerance.liquid
+++ b/data/Templates/Ccda/Resource/_AllergyIntolerance.liquid
@@ -16,7 +16,7 @@
[
{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
- "code":{% include 'ValueSet/AllergyStatus' code: allergyStatus.code -%},
+ "code":"{{ allergyStatus.code | get_property: 'ValueSet/AllergyStatus' }}",
}
]
},
@@ -31,7 +31,6 @@
"substance":{ {% include 'DataType/CodeableConcept' CodeableConcept: allergyEntry.participant.participantRole.playingEntity.code -%} },
{% endif -%}
-
{% if r.observation.templateId | to_json_string | contains: '"2.16.840.1.113883.10.20.22.4.9"' -%}
"manifestation":
[
@@ -43,14 +42,15 @@
],
"onset": "{{ r.observation.effectiveTime.low.value | format_as_date_time }}",
{% endif -%}
-
- {% if r.observation.templateId | to_json_string | contains: '"2.16.840.1.113883.10.20.22.4.8"' -%}
- {% if r.observation.value.translation -%}
- "severity":{% include 'ValueSet/AllergySeverity' code: r.observation.value.translation.displayName -%},
- {% else -%}
- "severity":{% include 'ValueSet/AllergySeverity' code: r.observation.value.displayName -%},
+ {% for templateId in r.observation.templateId -%}
+ {% if templateId.root == "2.16.840.1.113883.10.20.22.4.8" -%}
+ {% if r.observation.value.translation -%}
+ "severity":"{{ r.observation.value.translation.displayName | downcase | get_property: 'ValueSet/AllergySeverity' }}",
+ {% else -%}
+ "severity":"{{ r.observation.value.displayName | downcase | get_property: 'ValueSet/AllergySeverity' }}",
+ {% endif -%}
{% endif -%}
- {% endif -%}
+ {% endfor -%}
},
{% endfor -%}
diff --git a/data/Templates/Ccda/Resource/_Composition.liquid b/data/Templates/Ccda/Resource/_Composition.liquid
index 3164c37a8..b36de11e9 100644
--- a/data/Templates/Ccda/Resource/_Composition.liquid
+++ b/data/Templates/Ccda/Resource/_Composition.liquid
@@ -40,6 +40,7 @@
"period":
{
"start":"{{ composition.documentationOf.serviceEvent.effectiveTime.low.value | format_as_date_time }}",
+ "end":"{{ composition.documentationOf.serviceEvent.effectiveTime.high.value | format_as_date_time }}",
},
},
],
@@ -47,28 +48,29 @@
[
{% assign components = composition.component.structuredBody.component | to_array -%}
{% for component in components -%}
- {
- {% if component.section.title._ -%}
- "title":"{{ component.section.title._ }}",
- {% endif -%}
- {% if component.section.title._ == null -%}
- "title":"{{ component.section.code.displayName }}",
- {% endif -%}
- "text":
- {
- "status":"generated",
+ {
+ {% if component.section -%}
{% if component.section.title._ -%}
- "div":"{{ component.section.title._ }}
",
+ "title":"{{ component.section.title._ }}",
{% endif -%}
{% if component.section.title._ == null -%}
- "div":"{{ component.section.code.displayName }}
",
+ "title":"{{ component.section.code.displayName }}",
{% endif -%}
- },
- "code":
- {
- {% include 'DataType/CodeableConcept' CodeableConcept: component.section.code -%}
- },
- "mode":"snapshot",
+ "text":
+ {
+ "status":"generated",
+ {% if component.section.title._ -%}
+ "div":"{{ component.section.title._ | escape }}
",
+ {% else -%}
+ "div":"{{ component.section.code.displayName | escape }}
",
+ {% endif -%}
+ },
+ "code":
+ {
+ {% include 'DataType/CodeableConcept' CodeableConcept: component.section.code -%}
+ },
+ "mode":"snapshot",
+ {% endif -%}
},
{% endfor -%}
],
diff --git a/data/Templates/Ccda/Resource/_Encounter.liquid b/data/Templates/Ccda/Resource/_Encounter.liquid
index eb7993132..f6be8de8b 100644
--- a/data/Templates/Ccda/Resource/_Encounter.liquid
+++ b/data/Templates/Ccda/Resource/_Encounter.liquid
@@ -19,10 +19,6 @@
{% include 'DataType/Coding' Coding: encounter.code -%}
{% endif -%}
},
- "type":
- [
- { {% include 'DataType/CodeableConcept' CodeableConcept: encounter.code -%} },
- ],
"identifier":
[
{% assign ids = encounter.id | to_array -%}
diff --git a/data/Templates/Ccda/Resource/_Immunization.liquid b/data/Templates/Ccda/Resource/_Immunization.liquid
index 872de48fb..ad27a394d 100644
--- a/data/Templates/Ccda/Resource/_Immunization.liquid
+++ b/data/Templates/Ccda/Resource/_Immunization.liquid
@@ -29,13 +29,17 @@
{% assign manufacturedProducts = consumable.manufacturedProduct | to_array -%}
{% for manufacturedProduct in manufacturedProducts -%}
{% if manufacturedProduct.templateId | to_json_string | contains '"2.16.840.1.113883.10.20.22.4.54"' -%}
- "vaccineCode":{ {% include 'DataType/CodeableConcept' CodeableConcept: manufacturedProduct.manufacturedMaterial.code -%} },
+ {% if manufacturedProduct.manufacturedMaterial.code.translation -%}
+ "vaccineCode":{ {% include 'DataType/CodeableConcept' CodeableConcept: manufacturedProduct.manufacturedMaterial.code.translation -%} },
+ {% else -%}
+ "vaccineCode":{ {% include 'DataType/CodeableConcept' CodeableConcept: manufacturedProduct.manufacturedMaterial.code -%} },
+ {% endif -%}
"lotNumber":"{{ manufacturedProduct.manufacturedMaterial.IotNumberText._ }}",
{% endif -%}
{% endfor -%}
{% endfor -%}
- "status":"{{immunization.statusCode.code}}",
+ "status":"{{immunization.statusCode.code | get_property: 'ValueSet/ImmunizationStatus' }}",
"route":{ {% include 'DataType/CodeableConcept' CodeableConcept: immunization.routeCode -%}},
"site":{ {% include 'DataType/CodeableConcept' CodeableConcept: immunization.approachSiteCode -%} },
},
diff --git a/data/Templates/Ccda/Resource/_MedicationAdministration.liquid b/data/Templates/Ccda/Resource/_MedicationAdministration.liquid
index 1cdfa29a9..3df98bf71 100644
--- a/data/Templates/Ccda/Resource/_MedicationAdministration.liquid
+++ b/data/Templates/Ccda/Resource/_MedicationAdministration.liquid
@@ -10,11 +10,12 @@
{ {% include 'DataType/Identifier' Identifier: id -%} },
{% endfor -%}
],
- "status":"{{ medicationAdministration.statusCode.code }}",
+ "status":"{{ medicationAdministration.statusCode.code | get_property: 'ValueSet/MedicationAdministrationStatus' }}",
"effectivePeriod":
{
- "start":"{{ medicationAdministration.effectiveTime.low.value | format_as_date_time }}",
- "end":"{{ medicationAdministration.effectiveTime.high.value | format_as_date_time }}",
+ {% assign effectiveTimes = medicationAdministration.effectiveTime | to_array -%}
+ "start":"{{ effectiveTimes.first.low.value | format_as_date_time }}",
+ "end":"{{ effectiveTimes.first.high.value | format_as_date_time }}",
},
"dosage":
{
diff --git a/data/Templates/Ccda/Resource/_Patient.liquid b/data/Templates/Ccda/Resource/_Patient.liquid
index c250f0d12..bc06fa8cf 100644
--- a/data/Templates/Ccda/Resource/_Patient.liquid
+++ b/data/Templates/Ccda/Resource/_Patient.liquid
@@ -25,7 +25,7 @@
{% endfor -%}
],
"birthDate":"{{ patientRole.patient.birthTime.value | add_hyphens_date }}",
- "gender":"{{ patientRole.patient.administrativeGenderCode.displayName | downcase }}",
+ "gender":"{{ patientRole.patient.administrativeGenderCode.code | get_property: 'ValueSet/Gender' }}",
"extension":
[
{ {% include 'Extension/Race' Race: patientRole.patient -%} },
@@ -56,8 +56,8 @@
[
{
"system":"urn:ietf:bcp:47",
- "code":"{{ languageCommunication.languageCode.code }}",
- "display":"{{ languageCommunication.languageCode.code | downcase | get_property: 'ValueSet/Language' }}",
+ "code":"{{ languageCommunication.languageCode.code | downcase | get_property: 'ValueSet/Language', , 'code' }}",
+ "display":"{{ languageCommunication.languageCode.code | downcase | get_property: 'ValueSet/Language', , 'display' }}",
},
],
},
diff --git a/data/Templates/Ccda/Resource/_Procedure.liquid b/data/Templates/Ccda/Resource/_Procedure.liquid
index e3a442749..b8129ca0c 100644
--- a/data/Templates/Ccda/Resource/_Procedure.liquid
+++ b/data/Templates/Ccda/Resource/_Procedure.liquid
@@ -17,14 +17,17 @@
"status":"{{ procedureEntry.statusCode.code }}",
"code":
{
- {% if procedureEntry.code.translation -%}
- {% include 'DataType/CodeableConcept' CodeableConcept: procedureEntry.code.translation -%}
- {% endif -%}
- {% if procedureEntry.code.translation == null -%}
{% include 'DataType/CodeableConcept' CodeableConcept: procedureEntry.code -%}
- {% endif -%}
},
- "performedDateTime":"{{ procedureEntry.effectiveTime.value | format_as_date_time }}",
+ {% if procedureEntry.effectiveTime.value -%}
+ "performedDateTime":"{{ procedureEntry.effectiveTime.value | format_as_date_time }}",
+ {% else -%}
+ "performedPeriod":
+ {
+ "start":"{{ procedureEntry.effectiveTime.low.value | format_as_date_time }}",
+ "end":"{{ procedureEntry.effectiveTime.high.value | format_as_date_time }}",
+ },
+ {% endif -%}
"bodySite":
[
{ {% include 'DataType/CodeableConcept' CodeableConcept: procedureEntry.targetSiteCode -%} },
diff --git a/data/Templates/Ccda/Resource/_ServiceRequest.liquid b/data/Templates/Ccda/Resource/_ServiceRequest.liquid
index c5c4061d3..d503c5c0c 100644
--- a/data/Templates/Ccda/Resource/_ServiceRequest.liquid
+++ b/data/Templates/Ccda/Resource/_ServiceRequest.liquid
@@ -20,8 +20,8 @@
{% include 'DataType/CodeableConcept' CodeableConcept: serviceEntry.code -%}
{% endif -%}
},
- "priority":"{{ serviceEntry.priorityCode.displayName }}",
- "occuranceDateTime":"{{serviceEntry.effectiveTime.value | format_as_date_time }}",
+ "priority":"{{ serviceEntry.priorityCode.code | get_property: 'ValueSet/ServiceRequestPriority' }}",
+ "occurrenceDateTime":"{{serviceEntry.effectiveTime.value | format_as_date_time }}",
},
"request":{
"method":"PUT",
diff --git a/data/Templates/Ccda/Section/_HospitalAdmissionDiagnosis.liquid b/data/Templates/Ccda/Section/_HospitalAdmissionDiagnosis.liquid
index 9523fc4a6..965a133ef 100644
--- a/data/Templates/Ccda/Section/_HospitalAdmissionDiagnosis.liquid
+++ b/data/Templates/Ccda/Section/_HospitalAdmissionDiagnosis.liquid
@@ -1,2 +1,2 @@
{% assign firstSections = msg | get_first_ccda_sections_by_template_id: '2.16.840.1.113883.10.20.22.4.34' -%}
-{{ firstSections.2_16_840_1_113883_10_20_22_4_34.entry | to_array | batch_render: 'Entry/_HospitalAdmissionDiagnosis/entry', 'entry' }}
\ No newline at end of file
+{{ firstSections.2_16_840_1_113883_10_20_22_4_34.entry | to_array | batch_render: 'Entry/HospitalAdmissionDiagnosis/entry', 'entry' }}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/ValueSet.json b/data/Templates/Ccda/ValueSet/ValueSet.json
index 65d23d5e5..b6ffdceef 100644
--- a/data/Templates/Ccda/ValueSet/ValueSet.json
+++ b/data/Templates/Ccda/ValueSet/ValueSet.json
@@ -15,6 +15,9 @@
},
"BAD": {
"code": "old"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/AllergyCategory": {
@@ -41,6 +44,9 @@
},
"419199007": {
"code": "other"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/AllergySeverity": {
@@ -55,6 +61,9 @@
},
"mild": {
"code": "mild"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/AllergyStatus": {
@@ -69,6 +78,9 @@
},
"suspended": {
"code": "inactive"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/CompositionStatus": {
@@ -95,47 +107,20 @@
},
"error": {
"code": "entered-in-error"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/DiagnosticReportStatus": {
- "registered": {
- "code": "registered"
- },
- "received": {
- "code": "registered"
- },
- "preliminary": {
- "code": "preliminary"
- },
- "final": {
- "code": "final"
- },
"completed": {
"code": "final"
},
- "amended": {
- "code": "amended"
- },
- "corrected": {
- "code": "corrected"
- },
- "appended": {
- "code": "appended"
- },
"cancelled": {
"code": "cancelled"
},
- "abandoned": {
- "code": "cancelled"
- },
- "entered-in-error": {
- "code": "entered-in-error"
- },
- "error": {
- "code": "entered-in-error"
- },
- "unknown": {
- "code": "unknown"
+ "__default__": {
+ "code": ""
}
},
"ValueSet/EncounterStatus": {
@@ -183,6 +168,9 @@
},
"unknown": {
"code": "unknown"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/EventStatus": {
@@ -230,6 +218,9 @@
},
"unknown": {
"code": "unknown"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/FMStatus": {
@@ -250,49 +241,129 @@
},
"draft": {
"code": "draft"
+ },
+ "__default__": {
+ "code": ""
+ }
+ },
+ "ValueSet/Gender": {
+ "F": {
+ "code": "female"
+ },
+ "M": {
+ "code": "male"
+ },
+ "UN": {
+ "code": "unknown"
+ },
+ "__default__": {
+ "code": ""
+ }
+ },
+ "ValueSet/ImmunizationStatus": {
+ "cancelled": {
+ "code": "not-done"
+ },
+ "completed": {
+ "code": "completed"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/Language": {
"en": {
- "code": "English"
+ "code": "en",
+ "display": "English"
+ },
+ "eng": {
+ "code": "en",
+ "display": "English"
},
"en-au": {
- "code": "English (Australia)"
+ "code": "en-au",
+ "display": "English (Australia)"
},
"en-ca": {
- "code": "English (Canada)"
+ "code": "en-ca",
+ "display": "English (Canada)"
},
"en-in": {
- "code": "English (India)"
+ "code": "en-in",
+ "display": "English (India)"
},
"en-gb": {
- "code": "English (Great Britain)"
+ "code": "en-gb",
+ "display": "English (Great Britain)"
},
"en-nz": {
- "code": "English (New Zeland)"
+ "code": "en-nz",
+ "display": "English (New Zeland)"
},
"en-sg": {
- "code": "English (Singapore)"
+ "code": "en-sg",
+ "display": "English (Singapore)"
},
"en-us": {
- "code": "English (United States)"
+ "code": "en-us",
+ "display": "English (United States)"
},
"es": {
- "code": "Spanish"
+ "code": "es",
+ "display": "Spanish"
},
"de": {
- "code": "German"
+ "code": "de",
+ "display": "German"
},
"da": {
- "code": "Danish"
+ "code": "da",
+ "display": "Danish"
},
"fr": {
- "code": "French"
+ "code": "fr",
+ "display": "French"
+ },
+ "it": {
+ "code": "it",
+ "display": "Italian"
+ },
+ "ita": {
+ "code": "it",
+ "display": "Italian"
+ },
+ "spa": {
+ "code": "es",
+ "display": "Spanish"
+ },
+ "__default__": {
+ "code": "",
+ "display": ""
+ }
+ },
+ "ValueSet/MedicationAdministrationStatus": {
+ "aborted": {
+ "code": "stopped"
+ },
+ "active": {
+ "code": "in-progress"
+ },
+ "completed": {
+ "code": "completed"
+ },
+ "suspended": {
+ "code": "on-hold"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/MedicationStatementStatus": {
"aborted": {
"code": "stopped"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/NameUse": {
@@ -304,6 +375,9 @@
},
"P": {
"code": "nickname"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/ObservationStatus": {
@@ -342,6 +416,9 @@
},
"unknown": {
"code": "unknown"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/RequestStatus": {
@@ -374,6 +451,23 @@
},
"unknown": {
"code": "unknown"
+ },
+ "__default__": {
+ "code": ""
+ }
+ },
+ "ValueSet/ServiceRequestPriority": {
+ "A": {
+ "code": "asap"
+ },
+ "EM": {
+ "code": "stat"
+ },
+ "R": {
+ "code": "routine"
+ },
+ "__default__": {
+ "code": ""
}
},
"ValueSet/TelecomUse": {
@@ -394,6 +488,9 @@
},
"MC": {
"code": "mobile"
+ },
+ "__default__": {
+ "code": ""
}
}
}
diff --git a/data/Templates/Ccda/ValueSet/_AddressUse.liquid b/data/Templates/Ccda/ValueSet/_AddressUse.liquid
index 60ee69d9c..5901269da 100644
--- a/data/Templates/Ccda/ValueSet/_AddressUse.liquid
+++ b/data/Templates/Ccda/ValueSet/_AddressUse.liquid
@@ -10,5 +10,5 @@
{% when "BAD" -%}
"old",
{% else -%}
- "{{ code }}",
-{% endcase %}
\ No newline at end of file
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_AllergyCategory.liquid b/data/Templates/Ccda/ValueSet/_AllergyCategory.liquid
index 917dd64db..846311849 100644
--- a/data/Templates/Ccda/ValueSet/_AllergyCategory.liquid
+++ b/data/Templates/Ccda/ValueSet/_AllergyCategory.liquid
@@ -16,7 +16,7 @@
{% when "419199007" -%}
"other",
{% else -%}
- "{{ code }}",
+ "",
{% endcase %}
diff --git a/data/Templates/Ccda/ValueSet/_AllergySeverity.liquid b/data/Templates/Ccda/ValueSet/_AllergySeverity.liquid
index 0df933778..86b80d085 100644
--- a/data/Templates/Ccda/ValueSet/_AllergySeverity.liquid
+++ b/data/Templates/Ccda/ValueSet/_AllergySeverity.liquid
@@ -9,5 +9,5 @@
{% when "mild" -%}
"mild",
{% else -%}
- "{{ code }}",
-{% endcase %}
\ No newline at end of file
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_AllergyStatus.liquid b/data/Templates/Ccda/ValueSet/_AllergyStatus.liquid
index df649ef70..cadc0fc0b 100644
--- a/data/Templates/Ccda/ValueSet/_AllergyStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_AllergyStatus.liquid
@@ -8,5 +8,5 @@
{% when "suspended" -%}
"inactive",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_CompositionStatus.liquid b/data/Templates/Ccda/ValueSet/_CompositionStatus.liquid
index 576f7a46a..5619a7052 100644
--- a/data/Templates/Ccda/ValueSet/_CompositionStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_CompositionStatus.liquid
@@ -16,5 +16,5 @@
{% when "error" -%}
"entered-in-error",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_DiagnosticReportStatus.liquid b/data/Templates/Ccda/ValueSet/_DiagnosticReportStatus.liquid
index fe1dc9ea3..80e7ee251 100644
--- a/data/Templates/Ccda/ValueSet/_DiagnosticReportStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_DiagnosticReportStatus.liquid
@@ -1,30 +1,8 @@
{% case code -%}
- {% when "registered" -%}
- "registered",
- {% when "received" -%}
- "registered",
- {% when "preliminary" -%}
- "preliminary",
- {% when "final" -%}
+ {% when "completed " -%}
"final",
- {% when "completed" -%}
- "final",
- {% when "amended" -%}
- "amended",
- {% when "corrected" -%}
- "corrected",
- {% when "appended" -%}
- "appended",
{% when "cancelled" -%}
"cancelled",
- {% when "abandoned" -%}
- "cancelled",
- {% when "entered-in-error" -%}
- "entered-in-error",
- {% when "error" -%}
- "entered-in-error",
- {% when "unknown" -%}
- "unknown",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_EncounterStatus.liquid b/data/Templates/Ccda/ValueSet/_EncounterStatus.liquid
index f321b20e8..cf8da5b62 100644
--- a/data/Templates/Ccda/ValueSet/_EncounterStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_EncounterStatus.liquid
@@ -30,5 +30,5 @@
{% when "unknown" -%}
"unknown",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_EventStatus.liquid b/data/Templates/Ccda/ValueSet/_EventStatus.liquid
index 2cc79b8bd..7204710a8 100644
--- a/data/Templates/Ccda/ValueSet/_EventStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_EventStatus.liquid
@@ -30,5 +30,5 @@
{% when "unknown" -%}
"unknown",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_FMStatus.liquid b/data/Templates/Ccda/ValueSet/_FMStatus.liquid
index b7dc8968d..11b30a274 100644
--- a/data/Templates/Ccda/ValueSet/_FMStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_FMStatus.liquid
@@ -12,5 +12,5 @@
{% when "draft" -%}
"draft",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_Gender.liquid b/data/Templates/Ccda/ValueSet/_Gender.liquid
new file mode 100644
index 000000000..a4363acff
--- /dev/null
+++ b/data/Templates/Ccda/ValueSet/_Gender.liquid
@@ -0,0 +1,10 @@
+{% case code -%}
+ {% when "F" -%}
+ "female",
+ {% when "M" -%}
+ "male",
+ {% when "UN" -%}
+ "unknown",
+ {% else -%}
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_ImmunizationStatus.liquid b/data/Templates/Ccda/ValueSet/_ImmunizationStatus.liquid
new file mode 100644
index 000000000..450816c0d
--- /dev/null
+++ b/data/Templates/Ccda/ValueSet/_ImmunizationStatus.liquid
@@ -0,0 +1,8 @@
+{% case code -%}
+ {% when "cancelled" -%}
+ "not-done",
+ {% when "completed " -%}
+ "completed",
+ {% else -%}
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_Language.liquid b/data/Templates/Ccda/ValueSet/_Language.liquid
index b7a8578da..bd4f3cfde 100644
--- a/data/Templates/Ccda/ValueSet/_Language.liquid
+++ b/data/Templates/Ccda/ValueSet/_Language.liquid
@@ -25,5 +25,5 @@
{% when "fr" -%}
"French",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_MedicationAdministrationStatus.liquid b/data/Templates/Ccda/ValueSet/_MedicationAdministrationStatus.liquid
new file mode 100644
index 000000000..9ac42f7a5
--- /dev/null
+++ b/data/Templates/Ccda/ValueSet/_MedicationAdministrationStatus.liquid
@@ -0,0 +1,12 @@
+{% case code -%}
+ {% when "aborted " -%}
+ "stopped",
+ {% when "active" -%}
+ "in-progress",
+ {% when "completed" -%}
+ "completed",
+ {% when "suspended" -%}
+ "on-hold",
+ {% else -%}
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_MedicationStatementStatus.liquid b/data/Templates/Ccda/ValueSet/_MedicationStatementStatus.liquid
index d26763326..d71b47ab7 100644
--- a/data/Templates/Ccda/ValueSet/_MedicationStatementStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_MedicationStatementStatus.liquid
@@ -3,5 +3,5 @@
{% when "aborted" -%}
"stopped",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_NameUse.liquid b/data/Templates/Ccda/ValueSet/_NameUse.liquid
index a364c7151..4aba3ad5d 100644
--- a/data/Templates/Ccda/ValueSet/_NameUse.liquid
+++ b/data/Templates/Ccda/ValueSet/_NameUse.liquid
@@ -6,5 +6,5 @@
{% when "P" -%}
"nickname",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_ObservationStatus.liquid b/data/Templates/Ccda/ValueSet/_ObservationStatus.liquid
index d9ba57019..66b513750 100644
--- a/data/Templates/Ccda/ValueSet/_ObservationStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_ObservationStatus.liquid
@@ -24,5 +24,5 @@
{% when "unknown" -%}
"unknown",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_RequestStatus.liquid b/data/Templates/Ccda/ValueSet/_RequestStatus.liquid
index ca6c914b0..8fb1d412c 100644
--- a/data/Templates/Ccda/ValueSet/_RequestStatus.liquid
+++ b/data/Templates/Ccda/ValueSet/_RequestStatus.liquid
@@ -20,5 +20,5 @@
{% when "unknown" -%}
"unknown",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_ServiceRequestPriority.liquid b/data/Templates/Ccda/ValueSet/_ServiceRequestPriority.liquid
new file mode 100644
index 000000000..9d53655ee
--- /dev/null
+++ b/data/Templates/Ccda/ValueSet/_ServiceRequestPriority.liquid
@@ -0,0 +1,10 @@
+{% case code -%}
+ {% when "A " -%}
+ "asap",
+ {% when "EM" -%}
+ "stat",
+ {% when "R" -%}
+ "routine",
+ {% else -%}
+ "",
+{% endcase -%}
\ No newline at end of file
diff --git a/data/Templates/Ccda/ValueSet/_SystemReference.liquid b/data/Templates/Ccda/ValueSet/_SystemReference.liquid
index d7d94ec2d..2bf8b6d91 100644
--- a/data/Templates/Ccda/ValueSet/_SystemReference.liquid
+++ b/data/Templates/Ccda/ValueSet/_SystemReference.liquid
@@ -22,7 +22,11 @@
{% when "2.16.840.1.113883.6.59" -%}
"http://hl7.org/fhir/sid/cvx"
{% when "2.16.840.1.113883.6.101" -%}
- "http://nucc.org/provider-taxonomy"
+ "http://nucc.org/provider-taxonomy"
+ {% when "2.16.840.1.113883.6.238" -%}
+ ""
+ {% when "2.16.840.1.113883.6.12" -%}
+ "http://www.ama-assn.org/go/cpt"
{% else -%}
{% if s == 1%}
"urn:oid:{{ code }}"
diff --git a/data/Templates/Ccda/ValueSet/_TelecomUse.liquid b/data/Templates/Ccda/ValueSet/_TelecomUse.liquid
index 779a0be11..014801296 100644
--- a/data/Templates/Ccda/ValueSet/_TelecomUse.liquid
+++ b/data/Templates/Ccda/ValueSet/_TelecomUse.liquid
@@ -12,5 +12,5 @@
{% when "MC" -%}
"mobile",
{% else -%}
- "{{ code }}",
+ "",
{% endcase -%}
\ No newline at end of file
diff --git a/release.yml b/release.yml
index 1e326ce8c..b434de30e 100644
--- a/release.yml
+++ b/release.yml
@@ -16,7 +16,7 @@ variables:
functionalTests: "**/*FunctionalTests/*.csproj"
buildConfiguration: 'Release'
major: 4
- minor: 0
+ minor: 1
bulidnum: $[counter(format('{0}.{1}',variables['major'],variables['minor']), 100)]
revision: $[counter(format('{0:yyyyMMdd}', pipeline.startTime), 1)]
version: $(major).$(minor).$(bulidnum).$(revision)
diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/RuleBasedTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/RuleBasedTests.cs
index aece3114c..c1f389e70 100644
--- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/RuleBasedTests.cs
+++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/RuleBasedTests.cs
@@ -13,7 +13,9 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Hl7.Fhir.Serialization;
+using Microsoft.Health.Fhir.Liquid.Converter.Ccda;
using Microsoft.Health.Fhir.Liquid.Converter.Hl7v2;
+using Microsoft.Health.Fhir.Liquid.Converter.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
@@ -25,8 +27,12 @@ public class RuleBasedTests
{
private static readonly string _hl7TemplateFolder = Path.Combine(Constants.TemplateDirectory, "Hl7v2");
private static readonly string _hl7DataFolder = Path.Combine(Constants.SampleDataDirectory, "Hl7v2");
+ private static readonly string _ccdaTemplateFolder = Path.Combine(Constants.TemplateDirectory, "Ccda");
+ private static readonly string _ccdaDataFolder = Path.Combine(Constants.SampleDataDirectory, "Ccda");
private static readonly Hl7v2TemplateProvider _hl7TemplateProvider = new Hl7v2TemplateProvider(_hl7TemplateFolder);
+ private static readonly CcdaTemplateProvider _ccdaTemplateProvider = new CcdaTemplateProvider(_ccdaTemplateFolder);
+
private static readonly FhirJsonParser _fhirParser = new FhirJsonParser();
private static readonly int _maxRevealDepth = 1 << 7;
@@ -57,30 +63,104 @@ public static IEnumerable