cqm-reports 3.0.0.pre.alpha.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +2 -1
- data/README.md +26 -0
- data/lib/cqm-reports.rb +3 -2
- data/lib/html-export/qdm-patient/data_element/_data_element_other_fields.mustache +129 -5
- data/lib/html-export/qdm-patient/data_element/_data_element_times.mustache +36 -1
- data/lib/html-export/qdm-patient/qdm_patient.rb +39 -5
- data/lib/qrda-export/catI-r5/_header.mustache +2 -2
- data/lib/qrda-export/catI-r5/qrda1_r5.mustache +10 -2
- data/lib/qrda-export/catI-r5/qrda1_r5.rb +33 -2
- data/lib/qrda-export/catI-r5/qrda_header/_record_target.mustache +24 -9
- data/lib/qrda-export/catI-r5/qrda_templates/adverse_event.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/allergy_intolerance.mustache +8 -8
- data/lib/qrda-export/catI-r5/qrda_templates/assessment_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/assessment_performed.mustache +17 -1
- data/lib/qrda-export/catI-r5/qrda_templates/assessment_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +12 -13
- data/lib/qrda-export/catI-r5/qrda_templates/device_applied.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/diagnosis.mustache +9 -9
- data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_performed.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +11 -2
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +9 -3
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/family_history.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache +22 -7
- data/lib/qrda-export/catI-r5/qrda_templates/immunization_order.mustache +8 -2
- data/lib/qrda-export/catI-r5/qrda_templates/intervention_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/intervention_performed.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/intervention_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_performed.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/medication_active.mustache +17 -7
- data/lib/qrda-export/catI-r5/qrda_templates/medication_administered.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +14 -2
- data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +27 -16
- data/lib/qrda-export/catI-r5/qrda_templates/medication_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/patient_care_experience.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_order.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +17 -5
- data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/procedure_order.mustache +11 -1
- data/lib/qrda-export/catI-r5/qrda_templates/procedure_performed.mustache +21 -5
- data/lib/qrda-export/catI-r5/qrda_templates/procedure_recommended.mustache +11 -1
- data/lib/qrda-export/catI-r5/qrda_templates/program_participation.mustache +21 -0
- data/lib/qrda-export/catI-r5/qrda_templates/provider_care_experience.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/related_person.mustache +18 -0
- data/lib/qrda-export/catI-r5/qrda_templates/substance_recommended.mustache +7 -1
- data/lib/qrda-export/catI-r5/qrda_templates/symptom.mustache +10 -8
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_author.mustache +1 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_diagnosis_qdm.mustache +24 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_entity.mustache +12 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_entity_care_partner.mustache +11 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_entity_organization.mustache +11 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_entity_patient.mustache +6 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_entity_practitioner.mustache +19 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_supply_request.mustache +29 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +12 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_rank.mustache +7 -0
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_related_to.mustache +1 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +8 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_status.mustache +1 -1
- data/lib/qrda-export/helper/cat1_view_helper.rb +2 -0
- data/lib/qrda-export/helper/date_helper.rb +27 -4
- data/lib/qrda-import/base-importers/demographics_importer.rb +3 -3
- data/lib/qrda-import/base-importers/section_importer.rb +48 -5
- data/lib/qrda-import/data-element-importers/adverse_event_importer.rb +2 -1
- data/lib/qrda-import/data-element-importers/allergy_intolerance_importer.rb +2 -1
- data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +3 -0
- data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +7 -6
- data/lib/qrda-import/data-element-importers/device_applied_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/device_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/diagnosis_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +3 -0
- data/lib/qrda-import/data-element-importers/encounter_performed_importer.rb +7 -3
- data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/family_history_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +3 -1
- data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +4 -3
- data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/medication_active_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/medication_discharge_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +3 -4
- data/lib/qrda-import/data-element-importers/medication_order_importer.rb +2 -2
- data/lib/qrda-import/data-element-importers/patient_care_experience_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +3 -0
- data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +4 -0
- data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +3 -0
- data/lib/qrda-import/data-element-importers/program_participation_importer.rb +21 -0
- data/lib/qrda-import/data-element-importers/provider_care_experience_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/related_person_importer.rb +19 -0
- data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/substance_order_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +1 -0
- data/lib/qrda-import/data-element-importers/symptom_importer.rb +1 -0
- data/lib/qrda-import/patient_importer.rb +31 -11
- data/lib/util/entity_helper.rb +22 -0
- metadata +19 -9
- data/lib/ext/code.rb +0 -11
- data/lib/ext/data_element.rb +0 -24
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_diagnosis.mustache +0 -23
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_principal_diagnosis.mustache +0 -8
@@ -0,0 +1,18 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<!-- Related Person -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.170" extension="2019-12-01"/>
|
5
|
+
<id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
|
6
|
+
<code code="444018008" codeSystem="2.16.840.1.113883.6.96" displayName="Person with characteristic related to subject of record"/>
|
7
|
+
<!-- QDM Attribute: Code -->
|
8
|
+
{{> qrda_templates/template_partials/_data_element_codes_as_values}}
|
9
|
+
{{#identifier}}
|
10
|
+
<participant typeCode="PRF">
|
11
|
+
<participantRole classCode="PAT">
|
12
|
+
<!-- QDM Attribute: LinkedPatientId -->
|
13
|
+
<id root="{{{namingSystem}}}" extension="{{{value}}}"/>
|
14
|
+
</participantRole>
|
15
|
+
</participant>
|
16
|
+
{{/identifier}}
|
17
|
+
</observation>
|
18
|
+
</entry>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<!-- Conforms to C-CDA R2.1 Planned Medication Activity (V2) -->
|
4
4
|
<templateId root="2.16.840.1.113883.10.20.22.4.42" extension="2014-06-09"/>
|
5
5
|
<!-- Substance Recommended (V4) -->
|
6
|
-
<templateId root="2.16.840.1.113883.10.20.24.3.75" extension="
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.75" extension="2019-12-01"/>
|
7
7
|
<id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
|
8
8
|
<statusCode code="active"/>
|
9
9
|
{{> qrda_templates/template_partials/_medication_details}}
|
@@ -22,6 +22,12 @@
|
|
22
22
|
<!-- QDM Attribute: Author dateTime -->
|
23
23
|
{{> qrda_templates/template_partials/_author}}
|
24
24
|
{{/authorDatetime}}
|
25
|
+
{{#requester}}
|
26
|
+
<!-- QDM Attribute: Requester -->
|
27
|
+
<participant typeCode="PRF">
|
28
|
+
{{> qrda_templates/template_partials/_entity}}
|
29
|
+
</participant>
|
30
|
+
{{/requester}}
|
25
31
|
{{#reason}}
|
26
32
|
<!-- QDM Attribute: Reason -->
|
27
33
|
{{> qrda_templates/template_partials/_reason}}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<!-- Conforms to C-CDA 2.1 Problem Concern Act (V3) -->
|
4
4
|
<templateId root="2.16.840.1.113883.10.20.22.4.3" extension="2015-08-01"/>
|
5
5
|
<!-- Symptom Concern Act (V3) -->
|
6
|
-
<templateId root="2.16.840.1.113883.10.20.24.3.138" extension="
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.138" extension="2019-12-01"/>
|
7
7
|
<id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
|
8
8
|
<code code="CONC" codeSystem="2.16.840.1.113883.5.6" displayName="Concern"/>
|
9
9
|
{{#prevalencePeriod}}
|
@@ -13,6 +13,7 @@
|
|
13
13
|
{{^completed_prevalence_period}}
|
14
14
|
<statusCode code="active" />
|
15
15
|
{{/completed_prevalence_period}}
|
16
|
+
<!-- QDM Attribute: Prevalence Period -->
|
16
17
|
{{{prevalence_period}}}
|
17
18
|
{{/prevalencePeriod}}
|
18
19
|
<entryRelationship typeCode="SUBJ">
|
@@ -20,23 +21,24 @@
|
|
20
21
|
<!-- Conforms to C-CDA R2.1 Problem Observation (V3) -->
|
21
22
|
<templateId root="2.16.840.1.113883.10.20.22.4.4" extension="2015-08-01"/>
|
22
23
|
<!-- Symptom (V2) -->
|
23
|
-
<templateId root="2.16.840.1.113883.10.20.24.3.136" extension="
|
24
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.136" extension="2019-12-01"/>
|
24
25
|
<id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
|
25
26
|
<code code="75325-1" codeSystem="2.16.840.1.113883.6.1">
|
26
27
|
<translation code="418799008" displayName="Symptom" codeSystem="2.16.840.1.113883.6.96"/>
|
27
28
|
</code>
|
28
|
-
{{#prevalencePeriod}}
|
29
|
-
{{#completed_prevalence_period}}
|
30
29
|
<statusCode code="completed" />
|
31
|
-
{{
|
32
|
-
{{^completed_prevalence_period}}
|
33
|
-
<statusCode code="active" />
|
34
|
-
{{/completed_prevalence_period}}
|
30
|
+
{{#prevalencePeriod}}
|
35
31
|
<!-- QDM Attribute: Prevalence Period -->
|
36
32
|
{{{prevalence_period}}}
|
37
33
|
{{/prevalencePeriod}}
|
38
34
|
<!-- QDM Attribute: Code -->
|
39
35
|
{{> qrda_templates/template_partials/_data_element_codes_as_values}}
|
36
|
+
{{#recorder}}
|
37
|
+
<!-- QDM Attribute: Recorder -->
|
38
|
+
<participant typeCode="PRF">
|
39
|
+
{{> qrda_templates/template_partials/_entity}}
|
40
|
+
</participant>
|
41
|
+
{{/recorder}}
|
40
42
|
{{#severity}}
|
41
43
|
<!-- QDM Attribute: Severity -->
|
42
44
|
{{> qrda_templates/template_partials/_severity}}
|
data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_diagnosis_qdm.mustache
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<entryRelationship typeCode="REFR">
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<!-- Encounter Diagnosis QDM -->
|
4
|
+
<templateId extension="2019-12-01" root="2.16.840.1.113883.10.20.24.3.168"/>
|
5
|
+
<code code="29308-4" codeSystem="2.16.840.1.113883.6.1"/>
|
6
|
+
<statusCode code="completed"/>
|
7
|
+
{{#code}}
|
8
|
+
<value {{> _code}} xsi:type="CD"/>
|
9
|
+
{{/code}}
|
10
|
+
{{#rank}}
|
11
|
+
<!-- QDM Attribute: Rank -->
|
12
|
+
{{> qrda_templates/template_partials/_rank}}
|
13
|
+
{{/rank}}
|
14
|
+
{{#presentOnAdmissionIndicator}}
|
15
|
+
<entryRelationship typeCode="REFR">
|
16
|
+
<observation classCode="OBS" moodCode="EVN">
|
17
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.169" extension="2019-12-01"/>
|
18
|
+
<code code="78026-2" displayName="Present on admission" codeSystem="2.16.840.1.113883.6.1"/>
|
19
|
+
<value {{> _code}} xsi:type="CD"/>
|
20
|
+
</observation>
|
21
|
+
</entryRelationship>
|
22
|
+
{{/presentOnAdmissionIndicator}}
|
23
|
+
</observation>
|
24
|
+
</entryRelationship>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{{#care_partner_entity?}}
|
2
|
+
{{> qrda_templates/template_partials/_entity_care_partner}}
|
3
|
+
{{/care_partner_entity?}}
|
4
|
+
{{#patient_entity?}}
|
5
|
+
{{> qrda_templates/template_partials/_entity_patient}}
|
6
|
+
{{/patient_entity?}}
|
7
|
+
{{#practitioner_entity?}}
|
8
|
+
{{> qrda_templates/template_partials/_entity_practitioner}}
|
9
|
+
{{/practitioner_entity?}}
|
10
|
+
{{#organization_entity?}}
|
11
|
+
{{> qrda_templates/template_partials/_entity_organization}}
|
12
|
+
{{/organization_entity?}}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<participantRole>
|
2
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.160" extension="2019-12-01" />
|
3
|
+
{{#identifier}}
|
4
|
+
<id root="{{{namingSystem}}}" extension="{{{value}}}"/>
|
5
|
+
{{/identifier}}
|
6
|
+
{{#relationship}}
|
7
|
+
<playingEntity>
|
8
|
+
<code {{> _code}}/>
|
9
|
+
</playingEntity>
|
10
|
+
{{/relationship}}
|
11
|
+
</participantRole>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<participantRole>
|
2
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.163" extension="2019-12-01" />
|
3
|
+
{{#identifier}}
|
4
|
+
<id root="{{{namingSystem}}}" extension="{{{value}}}"/>
|
5
|
+
{{/identifier}}
|
6
|
+
{{#type}}
|
7
|
+
<playingEntity>
|
8
|
+
<code {{> _code}}/>
|
9
|
+
</playingEntity>
|
10
|
+
{{/type}}
|
11
|
+
</participantRole>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<participantRole>
|
2
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.162" extension="2019-12-01" />
|
3
|
+
{{#identifier}}
|
4
|
+
<id root="{{{namingSystem}}}" extension="{{{value}}}"/>
|
5
|
+
{{/identifier}}
|
6
|
+
{{#role}}
|
7
|
+
<code {{> _code}}/>
|
8
|
+
{{/role}}
|
9
|
+
{{#specialty}}
|
10
|
+
<playingEntity>
|
11
|
+
<code {{> _code}}/>
|
12
|
+
</playingEntity>
|
13
|
+
{{/specialty}}
|
14
|
+
{{#qualification}}
|
15
|
+
<scopingEntity>
|
16
|
+
<code {{> _code}}/>
|
17
|
+
</scopingEntity>
|
18
|
+
{{/qualification}}
|
19
|
+
</participantRole>
|
data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_supply_request.mustache
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
<supply classCode="SPLY" moodCode="RQO">
|
2
|
+
<!-- Immunization Supply Request template -->
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.167" extension="2019-12-01"/>
|
4
|
+
<!-- Conforms to C-CDA R2 Planned Supply (V2) template-->
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.43" extension="2014-06-09" />
|
6
|
+
<id root="{{random_id}}"/>
|
7
|
+
<statusCode code="active"/>
|
8
|
+
{{#relevantPeriod}}
|
9
|
+
{{{medication_supply_request_period}}}
|
10
|
+
{{/relevantPeriod}}
|
11
|
+
{{^relevantPeriod}}
|
12
|
+
{{#authorDatetime}}
|
13
|
+
{{{author_effective_time}}}
|
14
|
+
{{/authorDatetime}}
|
15
|
+
{{/relevantPeriod}}
|
16
|
+
<quantity value="{{{value_as_float}}}"/>
|
17
|
+
<product>
|
18
|
+
<manufacturedProduct classCode="MANU">
|
19
|
+
<!-- Immunization Medication Information (consolidation) template -->
|
20
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.54" extension="2014-06-09"/>
|
21
|
+
<id root="{{random_id}}"/>
|
22
|
+
<manufacturedMaterial>
|
23
|
+
<!-- QDM Attribute: Code -->
|
24
|
+
{{> _codes}}
|
25
|
+
<lotNumberText>1</lotNumberText>
|
26
|
+
</manufacturedMaterial>
|
27
|
+
</manufacturedProduct>
|
28
|
+
</product>
|
29
|
+
</supply>
|
data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<supply classCode="SPLY" moodCode="RQO">
|
2
2
|
<!-- Medication Supply Request (V2) template -->
|
3
|
-
<templateId root="2.16.840.1.113883.10.20.24.3.99" extension="
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.99" extension="2019-12-01"/>
|
4
4
|
<!-- Conforms to C-CDA R2 Planned Supply (V2) template-->
|
5
5
|
<templateId root="2.16.840.1.113883.10.20.22.4.43" extension="2014-06-09" />
|
6
6
|
<id root="{{random_id}}"/>
|
@@ -14,4 +14,15 @@
|
|
14
14
|
{{/authorDatetime}}
|
15
15
|
{{/relevantPeriod}}
|
16
16
|
<quantity value="{{{value_as_float}}}"/>
|
17
|
+
<product>
|
18
|
+
<manufacturedProduct classCode="MANU">
|
19
|
+
<!-- Medication Information (consolidation) template -->
|
20
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.23" extension="2014-06-09"/>
|
21
|
+
<id root="{{random_id}}"/>
|
22
|
+
<manufacturedMaterial>
|
23
|
+
<!-- QDM Attribute: Code -->
|
24
|
+
{{> _codes}}
|
25
|
+
</manufacturedMaterial>
|
26
|
+
</manufacturedProduct>
|
27
|
+
</product>
|
17
28
|
</supply>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<entryRelationship typeCode="REFR">
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.166" extension="2019-12-01"/>
|
4
|
+
<code code="263486008" displayName="Rank" codeSystem="2.16.840.1.113883.6.96"/>
|
5
|
+
<value xsi:type="INT" value="{{{.}}}"/>
|
6
|
+
</observation>
|
7
|
+
</entryRelationship>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<sdtc:inFulfillmentOf1 typeCode="FLFS">
|
2
2
|
<sdtc:templateId root="2.16.840.1.113883.10.20.24.3.150" extension="2017-08-01"/>
|
3
3
|
<sdtc:actReference classCode="ACT" moodCode="EVN">
|
4
|
-
<sdtc:id root="1.3.6.1.4.1.115" extension="{{{
|
4
|
+
<sdtc:id root="1.3.6.1.4.1.115" extension="{{{.}}}"/>
|
5
5
|
</sdtc:actReference>
|
6
6
|
</sdtc:inFulfillmentOf1>
|
@@ -2,10 +2,17 @@
|
|
2
2
|
<observation classCode="OBS" moodCode="EVN">
|
3
3
|
<!-- Conforms to C-CDA R2 Result Observation (V2) -->
|
4
4
|
<templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
|
5
|
+
<!-- Conforms Result (V4) -->
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.87" extension="2019-12-01"/>
|
5
7
|
<id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
|
6
8
|
{{> _codes}}
|
7
9
|
<statusCode code="completed"/>
|
8
|
-
{{
|
10
|
+
{{#result_date_time?}}
|
11
|
+
{{{result_date_time}}}
|
12
|
+
{{/result_date_time?}}
|
13
|
+
{{^result_date_time?}}
|
14
|
+
{{{author_effective_time}}}
|
15
|
+
{{/result_date_time?}}
|
9
16
|
{{{result_value}}}
|
10
17
|
</observation>
|
11
18
|
</entryRelationship>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<entryRelationship typeCode="REFR">
|
2
2
|
<observation classCode="OBS" moodCode="EVN">
|
3
|
-
<templateId root="2.16.840.1.113883.10.20.24.3.93"/>
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.93" extension="2019-12-01"/>
|
4
4
|
<id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
|
5
5
|
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Status"/>
|
6
6
|
<value xsi:type="CD" {{> _code}}/>
|
@@ -67,6 +67,8 @@ module Qrda
|
|
67
67
|
result_value_as_string(self['result'][0])
|
68
68
|
elsif self['result'].is_a? Hash
|
69
69
|
result_value_as_string(self['result'])
|
70
|
+
elsif self['result'].is_a? String
|
71
|
+
"<value xsi:type=\"ST\">#{self['result']}</value>"
|
70
72
|
elsif !self['result'].nil?
|
71
73
|
"<value xsi:type=\"PQ\" value=\"#{self['result']}\" unit=\"1\"/>"
|
72
74
|
end
|
@@ -23,10 +23,16 @@ module Qrda
|
|
23
23
|
Time.now.utc.to_formatted_s(:number)
|
24
24
|
end
|
25
25
|
|
26
|
+
def sent_date_time
|
27
|
+
"<low #{value_or_null_flavor(self['sentDatetime'])}/>"
|
28
|
+
end
|
29
|
+
|
30
|
+
def received_date_time
|
31
|
+
"<high #{value_or_null_flavor(self['receivedDatetime'])}/>"
|
32
|
+
end
|
33
|
+
|
26
34
|
def active_date_time
|
27
|
-
"<effectiveTime
|
28
|
-
"<low #{value_or_null_flavor(self['activeDatetime'])}/>"\
|
29
|
-
"</effectiveTime>"
|
35
|
+
"<effectiveTime #{value_or_null_flavor(self['activeDatetime'])}/>"
|
30
36
|
end
|
31
37
|
|
32
38
|
def author_time
|
@@ -41,6 +47,10 @@ module Qrda
|
|
41
47
|
"<birthTime #{value_or_null_flavor(self['birthDatetime'])}/>"
|
42
48
|
end
|
43
49
|
|
50
|
+
def result_date_time?
|
51
|
+
!self['resultDatetime'].nil?
|
52
|
+
end
|
53
|
+
|
44
54
|
def result_date_time
|
45
55
|
"<effectiveTime #{value_or_null_flavor(self['resultDatetime'])}/>"
|
46
56
|
end
|
@@ -79,11 +89,24 @@ module Qrda
|
|
79
89
|
"</effectiveTime>"
|
80
90
|
end
|
81
91
|
|
92
|
+
def participation_period
|
93
|
+
"<effectiveTime>"\
|
94
|
+
"<low #{value_or_null_flavor(self['participationPeriod']['low'])}/>"\
|
95
|
+
"<high #{value_or_null_flavor(self['participationPeriod']['high'])}/>"\
|
96
|
+
"</effectiveTime>"
|
97
|
+
end
|
98
|
+
|
82
99
|
def relevant_period_as_value
|
83
100
|
"<effectiveTime #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"
|
84
101
|
end
|
85
102
|
|
86
|
-
def
|
103
|
+
def relevant_date_time_low
|
104
|
+
"<effectiveTime>"\
|
105
|
+
"<low #{value_or_null_flavor(self['relevantDatetime'])}/>"\
|
106
|
+
"</effectiveTime>"
|
107
|
+
end
|
108
|
+
|
109
|
+
def relevant_date_time_value
|
87
110
|
"<effectiveTime #{value_or_null_flavor(self['relevantDatetime'])}/>"
|
88
111
|
end
|
89
112
|
|
@@ -15,17 +15,17 @@ module QRDA
|
|
15
15
|
pcs = QDM::PatientCharacteristicSex.new
|
16
16
|
code_element = patient_element.at_xpath('cda:administrativeGenderCode')
|
17
17
|
pcs.dataElementCodes = [code_if_present(code_element)]
|
18
|
-
patient.qdmPatient.dataElements << pcs
|
18
|
+
patient.qdmPatient.dataElements << pcs unless pcs.dataElementCodes.compact.blank?
|
19
19
|
|
20
20
|
pcr = QDM::PatientCharacteristicRace.new
|
21
21
|
code_element = patient_element.at_xpath('cda:raceCode')
|
22
22
|
pcr.dataElementCodes = [code_if_present(code_element)]
|
23
|
-
patient.qdmPatient.dataElements << pcr
|
23
|
+
patient.qdmPatient.dataElements << pcr unless pcr.dataElementCodes.compact.blank?
|
24
24
|
|
25
25
|
pce = QDM::PatientCharacteristicEthnicity.new
|
26
26
|
code_element = patient_element.at_xpath('cda:ethnicGroupCode')
|
27
27
|
pce.dataElementCodes = [code_if_present(code_element)]
|
28
|
-
patient.qdmPatient.dataElements << pce
|
28
|
+
patient.qdmPatient.dataElements << pce unless pce.dataElementCodes.compact.blank?
|
29
29
|
end
|
30
30
|
|
31
31
|
def code_if_present(code_element)
|
@@ -85,8 +85,11 @@ module QRDA
|
|
85
85
|
|
86
86
|
def extract_dates(parent_element, entry)
|
87
87
|
entry.authorDatetime = extract_time(parent_element, @author_datetime_xpath) if @author_datetime_xpath
|
88
|
-
entry.relevantPeriod = extract_interval(parent_element, @relevant_period_xpath) if @relevant_period_xpath
|
89
88
|
entry.prevalencePeriod = extract_interval(parent_element, @prevalence_period_xpath) if @prevalence_period_xpath
|
89
|
+
entry.relevantDatetime = extract_time(parent_element, @relevant_date_time_xpath) if @relevant_date_time_xpath
|
90
|
+
# If there is a relevantDatetime, don't look for a relevantPeriod
|
91
|
+
return if entry.respond_to?(:relevantDatetime) && entry.relevantDatetime
|
92
|
+
entry.relevantPeriod = extract_interval(parent_element, @relevant_period_xpath) if @relevant_period_xpath
|
90
93
|
end
|
91
94
|
|
92
95
|
def extract_interval(parent_element, interval_xpath)
|
@@ -95,13 +98,13 @@ module QRDA
|
|
95
98
|
high_time = DateTime.parse(parent_element.at_xpath(interval_xpath)['value'])
|
96
99
|
end
|
97
100
|
if parent_element.at_xpath("#{interval_xpath}/cda:low")
|
98
|
-
low_time =
|
101
|
+
low_time = if parent_element.at_xpath("#{interval_xpath}/cda:low")['value']
|
102
|
+
DateTime.parse(parent_element.at_xpath("#{interval_xpath}/cda:low")['value'])
|
103
|
+
end
|
99
104
|
end
|
100
105
|
if parent_element.at_xpath("#{interval_xpath}/cda:high")
|
101
106
|
high_time = if parent_element.at_xpath("#{interval_xpath}/cda:high")['value']
|
102
107
|
DateTime.parse(parent_element.at_xpath("#{interval_xpath}/cda:high")['value'])
|
103
|
-
else
|
104
|
-
DateTime.new(9999,1,1)
|
105
108
|
end
|
106
109
|
end
|
107
110
|
if parent_element.at_xpath("#{interval_xpath}/cda:center")
|
@@ -155,7 +158,6 @@ module QRDA
|
|
155
158
|
|
156
159
|
def extract_result_value(value_element)
|
157
160
|
return unless value_element && !value_element['nullFlavor']
|
158
|
-
|
159
161
|
value = value_element['value']
|
160
162
|
if value.present?
|
161
163
|
return value.strip.to_f if (value_element['unit'] == "1" || value_element['unit'].nil?)
|
@@ -163,6 +165,8 @@ module QRDA
|
|
163
165
|
return QDM::Quantity.new(value.strip.to_f, value_element['unit'])
|
164
166
|
elsif value_element['code'].present?
|
165
167
|
return code_if_present(value_element)
|
168
|
+
elsif value_element.text.present?
|
169
|
+
return value_element.text
|
166
170
|
end
|
167
171
|
end
|
168
172
|
|
@@ -236,6 +240,45 @@ module QRDA
|
|
236
240
|
related_ids
|
237
241
|
end
|
238
242
|
|
243
|
+
def extract_entity(parent_element, entity_xpath)
|
244
|
+
care_partner_entity_element = parent_element.at_xpath(entity_xpath + "/cda:participantRole[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.160']")
|
245
|
+
patient_entity_element = parent_element.at_xpath(entity_xpath + "/cda:participantRole[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.161']")
|
246
|
+
practitioner_entity_element = parent_element.at_xpath(entity_xpath + "/cda:participantRole[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.162']")
|
247
|
+
organization_entity_element = parent_element.at_xpath(entity_xpath + "/cda:participantRole[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.163']")
|
248
|
+
return extract_care_partner_entity(care_partner_entity_element) if care_partner_entity_element
|
249
|
+
return extract_patient_entity(patient_entity_element) if patient_entity_element
|
250
|
+
return extract_practitioner_entity(practitioner_entity_element) if practitioner_entity_element
|
251
|
+
return extract_organization_entity(organization_entity_element) if organization_entity_element
|
252
|
+
end
|
253
|
+
|
254
|
+
def extract_care_partner_entity(care_partner_entity_element)
|
255
|
+
care_partner_entity = QDM::CarePartner.new
|
256
|
+
care_partner_entity.identifier = extract_id(care_partner_entity_element, './cda:id')
|
257
|
+
care_partner_entity.relationship = code_if_present(care_partner_entity_element.at_xpath('./cda:playingEntity/cda:code'))
|
258
|
+
care_partner_entity
|
259
|
+
end
|
260
|
+
|
261
|
+
def extract_patient_entity(patient_entity_element)
|
262
|
+
patient_entity = QDM::PatientEntity.new
|
263
|
+
patient_entity.identifier = extract_id(patient_entity_element, './cda:id')
|
264
|
+
patient_entity
|
265
|
+
end
|
266
|
+
|
267
|
+
def extract_practitioner_entity(practitioner_entity_element)
|
268
|
+
practitioner_entity = QDM::Practitioner.new
|
269
|
+
practitioner_entity.identifier = extract_id(practitioner_entity_element, './cda:id')
|
270
|
+
practitioner_entity.role = code_if_present(practitioner_entity_element.at_xpath('./cda:code'))
|
271
|
+
practitioner_entity.specialty = code_if_present(practitioner_entity_element.at_xpath('./cda:playingEntity/cda:code'))
|
272
|
+
practitioner_entity.qualification = code_if_present(practitioner_entity_element.at_xpath('./cda:scopingEntity/cda:code'))
|
273
|
+
practitioner_entity
|
274
|
+
end
|
275
|
+
|
276
|
+
def extract_organization_entity(organization_entity_element)
|
277
|
+
organization_entity = QDM::Organization.new
|
278
|
+
organization_entity.identifier = extract_id(organization_entity_element, './cda:id')
|
279
|
+
organization_entity.type = code_if_present(organization_entity_element.at_xpath('./cda:playingEntity/cda:code'))
|
280
|
+
organization_entity
|
281
|
+
end
|
239
282
|
end
|
240
283
|
end
|
241
284
|
end
|