diff --git a/Gemfile.lock b/Gemfile.lock index 162d0e44f..1dea279b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,24 +1,26 @@ GIT remote: https://github.com/projecttacoma/simplexml_parser.git - revision: 0ea6c4cf9c5cb70c848ee7beaf30779b9ea77f15 + revision: 9f83211e2407f0d933afbd1648c57f500b7527af branch: master specs: - simplexml_parser (1.0.0) + simplexml_parser (1.1.0) + health-data-standards (~> 4.3.4) + tilt (~> 1.4) PATH remote: . specs: health-data-standards (4.0.3) - activesupport (~> 4.2.0) + activesupport (< 6.0) builder (~> 3.1) erubis (~> 2.7.0) highline (~> 1.7.0) log4r (~> 1.1.10) memoist (~> 0.9.1) - mongoid (~> 5.0.0) - mongoid-tree (~> 2.0.0) - nokogiri (~> 1.8.2) - protected_attributes (~> 1.0.5) + mongoid (~> 7.0.0) + mongoid-tree (~> 2.1.1) + nokogiri (>= 1.10.5) + protected_attributes_continued (~> 1.5.0) rest-client (~> 1.8.0) rubyzip (~> 1.2.1) uuid (~> 2.3.7) @@ -27,104 +29,104 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (4.2.6) - activesupport (= 4.2.6) - builder (~> 3.1) - activesupport (4.2.6) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) + activemodel (5.2.4) + activesupport (= 5.2.4) + activesupport (5.2.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.4.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) - awesome_print (1.7.0) - bson (4.2.2) - builder (3.2.2) - bundler-audit (0.6.0) - bundler (~> 1.2) + awesome_print (1.8.0) + bson (4.7.0) + builder (3.2.4) + bundler-audit (0.6.1) + bundler (>= 1.2.0, < 3) thor (~> 0.18) byebug (6.0.2) cane (2.3.0) parallel + concurrent-ruby (1.1.5) crack (0.4.3) safe_yaml (~> 1.0.0) - docile (1.1.5) - domain_name (0.5.20170404) + docile (1.3.2) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) factory_girl (4.1.0) activesupport (>= 3.0.0) - hashdiff (0.3.0) - highline (1.7.8) + hashdiff (1.0.0) + highline (1.7.10) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.7.0) - json (1.8.6) + i18n (1.7.0) + concurrent-ruby (~> 1.0) + json (2.3.0) log4r (1.1.10) log_switch (1.0.0) - macaddr (1.7.1) - systemu (~> 2.6.2) + macaddr (1.7.2) + systemu (~> 2.6.5) memoist (0.9.3) mime-types (2.99.3) - mini_portile2 (2.3.0) - minitest (5.9.0) - minitest-reporters (1.1.9) + mini_portile2 (2.4.0) + minitest (5.13.0) + minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar - mongo (2.4.3) - bson (>= 4.2.1, < 5.0.0) - mongoid (5.0.2) - activemodel (~> 4.0) - mongo (~> 2.1) - origin (~> 2.1) - tzinfo (>= 0.3.37) - mongoid-tree (2.0.1) - mongoid (>= 4.0, < 6.0) + mongo (2.11.2) + bson (>= 4.6.0, < 5.0.0) + mongoid (7.0.5) + activemodel (>= 5.1, < 6.1) + mongo (>= 2.5.1, < 3.0.0) + mongoid-tree (2.1.1) + mongoid (>= 4.0, < 8) netrc (0.11.0) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) - origin (2.3.1) - parallel (1.9.0) - protected_attributes (1.0.9) - activemodel (>= 4.0.1, < 5.0) - rake (11.2.2) + nokogiri (1.10.7) + mini_portile2 (~> 2.4.0) + parallel (1.19.1) + protected_attributes_continued (1.5.0) + activemodel (>= 5.0) + public_suffix (4.0.1) + rake (13.0.1) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) - ruby-progressbar (1.8.1) - rubyzip (1.2.2) - safe_yaml (1.0.4) - simplecov (0.11.2) - docile (~> 1.1.0) - json (~> 1.8) + ruby-progressbar (1.10.1) + rubyzip (1.2.4) + safe_yaml (1.0.5) + simplecov (0.17.1) + docile (~> 1.1) + json (>= 1.8, < 3) simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) + simplecov-html (0.10.2) systemu (2.6.5) tailor (1.1.5) log_switch (>= 0.3.0) term-ansicolor (>= 1.0.5) text-table (>= 1.2.2) - term-ansicolor (1.3.2) + term-ansicolor (1.7.1) tins (~> 1.0) text-table (1.2.4) - thor (0.20.0) - thread_safe (0.3.5) - tins (1.10.2) - tzinfo (1.2.2) + thor (0.20.3) + thread_safe (0.3.6) + tilt (1.4.1) + tins (1.22.2) + tzinfo (1.2.5) thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.4) - uuid (2.3.8) + unf_ext (0.0.7.6) + uuid (2.3.9) macaddr (~> 1.0) - webmock (2.1.0) + webmock (3.7.6) addressable (>= 2.3.6) crack (>= 0.3.2) - hashdiff + hashdiff (>= 0.4.0, < 2.0.0) zip-zip (0.3) rubyzip (>= 1.0.0) @@ -147,4 +149,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.16.1 + 1.17.3 diff --git a/README.md b/README.md index be7a4c109..880723f2e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +Q-Centrix has two versions of ECQM: + 1. [ECQM-API](https://github.com/q-centrix/ecqm-api) - original repo; from 2015 + 2. [ECQM-API-V2](https://github.com/q-centrix/ecqm-api-v2) - created 2019 + +Both Q-Centrix ECQM repositories rely on this repo, health-data-standards, to run calculations. The main branch for each repo: + 1. ECQM-API uses branch 'acs-1691-to-mongoid7' + 2. ECQM-API-V2 uses branch 'r5' + This is a project to generate and consume HITSP C32, QRDA Category I, and QRDA Category III. In addition this project also contains libraries for parsing HQMF documents and for dealing with NLM valuesets. diff --git a/health-data-standards.gemspec b/health-data-standards.gemspec index 790404ee9..61ed09556 100644 --- a/health-data-standards.gemspec +++ b/health-data-standards.gemspec @@ -13,14 +13,14 @@ Gem::Specification.new do |s| s.add_dependency 'rest-client', '~>1.8.0' s.add_dependency 'erubis', '~> 2.7.0' - s.add_dependency 'mongoid', '~> 5.0.0' - s.add_dependency 'mongoid-tree', '~> 2.0.0' - s.add_dependency 'activesupport', '~> 4.2.0' + s.add_dependency 'mongoid', '~> 7.0.0' + s.add_dependency 'mongoid-tree', '~> 2.1.1' + s.add_dependency 'activesupport', '< 6.0' - s.add_dependency 'protected_attributes', '~> 1.0.5' + s.add_dependency 'protected_attributes_continued', '~> 1.5.0' s.add_dependency 'uuid', '~> 2.3.7' s.add_dependency 'builder', '~> 3.1' - s.add_dependency 'nokogiri', '~> 1.8.2' + s.add_dependency 'nokogiri', '>= 1.10.5' s.add_dependency 'highline', "~> 1.7.0" s.add_dependency 'rubyzip', '~> 1.2.1' diff --git a/lib/health-data-standards.rb b/lib/health-data-standards.rb index f4adbe8bc..8fc170254 100644 --- a/lib/health-data-standards.rb +++ b/lib/health-data-standards.rb @@ -9,7 +9,7 @@ require 'ostruct' require 'log4r' require 'memoist' -require 'protected_attributes' +require 'protected_attributes_continued' # Freedom patches require_relative 'health-data-standards/ext/symbol' @@ -34,63 +34,65 @@ require_relative 'health-data-standards/import/provider_import_utils' require_relative 'health-data-standards/import/hdata/metadata_importer' -require_relative 'health-data-standards/models/thing_with_codes' -require_relative 'health-data-standards/models/result_value' -require_relative 'health-data-standards/models/coded_result_value' -require_relative 'health-data-standards/models/physical_quantity_result_value' -require_relative 'health-data-standards/models/cda_identifier' -require_relative 'health-data-standards/models/reference' -require_relative 'health-data-standards/models/entry' -require_relative 'health-data-standards/models/allergy' -require_relative 'health-data-standards/models/encounter' -require_relative 'health-data-standards/models/condition' -require_relative 'health-data-standards/models/communication' -require_relative 'health-data-standards/models/immunization' -require_relative 'health-data-standards/models/fulfillment_history' -require_relative 'health-data-standards/models/order_information' -require_relative 'health-data-standards/models/medication' -require_relative 'health-data-standards/models/procedure' -require_relative 'health-data-standards/models/lab_result' -require_relative 'health-data-standards/models/family_history' -require_relative 'health-data-standards/models/functional_status' -require_relative 'health-data-standards/models/care_experience' -require_relative 'health-data-standards/models/medical_equipment' -require_relative 'health-data-standards/models/record' -require_relative 'health-data-standards/models/personable' -require_relative 'health-data-standards/models/provider' -require_relative 'health-data-standards/models/provider_performance' -require_relative 'health-data-standards/models/support' -require_relative 'health-data-standards/models/vital_sign' -require_relative 'health-data-standards/models/insurance_provider' -require_relative 'health-data-standards/models/guarantor' -require_relative 'health-data-standards/models/person' -require_relative 'health-data-standards/models/organization' -require_relative 'health-data-standards/models/address' -require_relative 'health-data-standards/models/telecom' -require_relative 'health-data-standards/models/transfer' +# require_relative 'health-data-standards/models/thing_with_codes' +# require_relative 'health-data-standards/models/result_value' +# require_relative 'health-data-standards/models/coded_result_value' +# require_relative 'health-data-standards/models/physical_quantity_result_value' +# require_relative 'health-data-standards/models/cda_identifier' +# require_relative 'health-data-standards/models/reference' +# require_relative 'health-data-standards/models/entry' +# require_relative 'health-data-standards/models/allergy' +# require_relative 'health-data-standards/models/encounter' +# require_relative 'health-data-standards/models/condition' +# require_relative 'health-data-standards/models/communication' +# require_relative 'health-data-standards/models/immunization' +# require_relative 'health-data-standards/models/fulfillment_history' +# require_relative 'health-data-standards/models/order_information' +# require_relative 'health-data-standards/models/medication' +# require_relative 'health-data-standards/models/procedure' +# require_relative 'health-data-standards/models/lab_result' +# require_relative 'health-data-standards/models/family_history' +# require_relative 'health-data-standards/models/functional_status' +# require_relative 'health-data-standards/models/care_experience' +# require_relative 'health-data-standards/models/medical_equipment' +# require_relative 'health-data-standards/models/record' +# require_relative 'health-data-standards/models/personable' +# require_relative 'health-data-standards/models/provider' +# require_relative 'health-data-standards/models/provider_performance' +# require_relative 'health-data-standards/models/support' +# require_relative 'health-data-standards/models/vital_sign' +# require_relative 'health-data-standards/models/insurance_provider' +# require_relative 'health-data-standards/models/guarantor' +# require_relative 'health-data-standards/models/person' +# require_relative 'health-data-standards/models/organization' +# require_relative 'health-data-standards/models/address' +# require_relative 'health-data-standards/models/telecom' +# require_relative 'health-data-standards/models/transfer' require_relative 'health-data-standards/models/svs/value_set' require_relative 'health-data-standards/models/svs/concept' -require_relative 'health-data-standards/models/admission_source' -require_relative 'health-data-standards/models/facility' -require_relative 'health-data-standards/models/component' -require_relative 'health-data-standards/models/metadata/base' -require_relative 'health-data-standards/models/metadata/author' -require_relative 'health-data-standards/models/metadata/change_info' -require_relative 'health-data-standards/models/metadata/link_info' -require_relative 'health-data-standards/models/metadata/pedigree' -require_relative 'health-data-standards/models/provider_preference' -require_relative 'health-data-standards/models/patient_preference' -require_relative 'health-data-standards/models/care_goal' -require_relative 'health-data-standards/models/encounter_principal_diagnosis' -require_relative 'health-data-standards/models/assessment' -require_relative 'health-data-standards/models/adverse_event' +# require_relative 'health-data-standards/models/admission_source' +# require_relative 'health-data-standards/models/facility' +# require_relative 'health-data-standards/models/component' +# require_relative 'health-data-standards/models/metadata/base' +# require_relative 'health-data-standards/models/metadata/author' +# require_relative 'health-data-standards/models/metadata/change_info' +# require_relative 'health-data-standards/models/metadata/link_info' +# require_relative 'health-data-standards/models/metadata/pedigree' +# require_relative 'health-data-standards/models/provider_preference' +# require_relative 'health-data-standards/models/patient_preference' +# require_relative 'health-data-standards/models/care_goal' +# require_relative 'health-data-standards/models/encounter_principal_diagnosis' +# require_relative 'health-data-standards/models/assessment' +# require_relative 'health-data-standards/models/adverse_event' require_relative 'health-data-standards/models/qrda/id' require_relative 'health-data-standards/models/qrda/device' require_relative 'health-data-standards/models/qrda/person' require_relative 'health-data-standards/models/qrda/organization' +require_relative 'health-data-standards/models/qrda/information_recipient' require_relative 'health-data-standards/models/qrda/custodian' require_relative 'health-data-standards/models/qrda/legal_authenticator' +require_relative 'health-data-standards/models/qrda/participant' require_relative 'health-data-standards/models/qrda/author' require_relative 'health-data-standards/models/qrda/header' diff --git a/lib/health-data-standards/export/cat_3.rb b/lib/health-data-standards/export/cat_3.rb index 2df8febaf..ea187df79 100644 --- a/lib/health-data-standards/export/cat_3.rb +++ b/lib/health-data-standards/export/cat_3.rb @@ -15,6 +15,7 @@ def export(measures, header, effective_date, start_date, end_date, qrda3_version measures.each do |measure| results[measure['hqmf_id']] = HealthDataStandards::CQM::QueryCache.aggregate_measure(measure['hqmf_id'], effective_date, filter, test_id) end + @rendering_context.render(:template => 'show', :locals => {:measures => measures, :start_date => start_date, :end_date => end_date, @@ -23,4 +24,4 @@ def export(measures, header, effective_date, start_date, end_date, qrda3_version end end end -end \ No newline at end of file +end diff --git a/lib/health-data-standards/export/helper/scooped_view_helper.rb b/lib/health-data-standards/export/helper/scooped_view_helper.rb index c2ece2bf8..fe8b3565c 100644 --- a/lib/health-data-standards/export/helper/scooped_view_helper.rb +++ b/lib/health-data-standards/export/helper/scooped_view_helper.rb @@ -120,14 +120,28 @@ def entries_for_data_criteria(data_criteria, patient) entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.12') when '2.16.840.1.113883.3.560.1.12' entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.5') + when '2.16.840.1.113883.3.560.1.106' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.6') when '2.16.840.1.113883.3.560.1.6' - entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.63') + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.63') + when '2.16.840.1.113883.3.560.1.78' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.17') + when '2.16.840.1.113883.3.560.1.146' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.46') + when '2.16.840.1.113883.3.560.1.200' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.199') when '2.16.840.1.113883.3.560.1.63' - entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.6') + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.6') when '2.16.840.1.113883.3.560.1.3' - entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.11') + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.11') when '2.16.840.1.113883.3.560.1.11' - entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.3') + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.3') + when '2.16.840.1.113883.3.560.1.114' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.14') + when '2.16.840.1.113883.3.560.1.110' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.10') + when '2.16.840.1.113883.3.560.1.137' + entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.37') when '2.16.840.1.113883.3.560.1.71', '2.16.840.1.113883.3.560.1.72' # transfers entries.concat patient.entries_for_oid('2.16.840.1.113883.3.560.1.79') diff --git a/lib/health-data-standards/import/c32/patient_importer.rb b/lib/health-data-standards/import/c32/patient_importer.rb index 8e92519a1..56c2f47ae 100644 --- a/lib/health-data-standards/import/c32/patient_importer.rb +++ b/lib/health-data-standards/import/c32/patient_importer.rb @@ -138,6 +138,7 @@ def get_demographics(patient, doc) patient.gender = gender_node['code'] id_node = patient_role_element.at_xpath('./cda:id') patient.medical_record_number = id_node['extension'] + patient.medical_record_assigner = id_node['root'] # parse race, ethnicity, and spoken language race_node = patient_element.at_xpath('cda:raceCode') diff --git a/lib/health-data-standards/import/cat1/patient_importer.rb b/lib/health-data-standards/import/cat1/patient_importer.rb index 513ac9fe0..931ca00ed 100644 --- a/lib/health-data-standards/import/cat1/patient_importer.rb +++ b/lib/health-data-standards/import/cat1/patient_importer.rb @@ -34,6 +34,7 @@ def initialize generate_importer(CDA::MedicationImporter, "./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']", '2.16.840.1.113883.3.560.1.17', 'ordered'), #medication order TODO: ADD NEGATON REASON HANDLING SOMEHOW generate_importer(MedicationDispensedImporter, nil, '2.16.840.1.113883.3.560.1.8', 'dispensed'), generate_importer(MedicationDispensedActImporter, nil, '2.16.840.1.113883.3.560.1.8', 'dispensed'), + generate_importer(CDA::MedicationImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.42']/cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.16']", '2.16.840.1.113883.3.560.1.14', 'administered'), #medication administered generate_importer(ImmunizationAdministeredImporter, nil, '2.16.840.1.113883.10.20.28.3.112', 'administered')] #immunization @section_importers[:communications] = [generate_importer(CDA::CommunicationImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.3']", '2.16.840.1.113883.3.560.1.31'), #comm from provider to patient generate_importer(CDA::CommunicationImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.2']", '2.16.840.1.113883.3.560.1.30'), #comm from patient to provider diff --git a/lib/health-data-standards/import/cda/condition_importer.rb b/lib/health-data-standards/import/cda/condition_importer.rb index 155eb591b..d58aa73cc 100644 --- a/lib/health-data-standards/import/cda/condition_importer.rb +++ b/lib/health-data-standards/import/cda/condition_importer.rb @@ -51,7 +51,7 @@ def extract_priority(entry_element, condition) def extract_severity(entry_element,condition) severity = entry_element.at_xpath(@severity_xpath) if(severity) - condition.severity = { 'code_system' => CodeSystemHelper.code_system_for(severity['codeSystem']), 'code' => severity['code'] } + condition.severity = { 'code_system' => CodeSystemHelper.code_system_for(severity['codeSystem']), 'code' => severity['code'], 'title' => severity['codeSystemName'] } end end @@ -59,8 +59,8 @@ def extract_laterality(entry_element,condition) laterality = entry_element.at_xpath(@laterality_xpath) if laterality # kept to be backward compatible - condition.laterality = { 'code_system' => CodeSystemHelper.code_system_for(laterality['codeSystem']), 'code' => laterality['code'] } - condition.anatomical_location = { 'code_system' => CodeSystemHelper.code_system_for(laterality['codeSystem']), 'code' => laterality['code'] } + condition.laterality = { 'code_system' => CodeSystemHelper.code_system_for(laterality['codeSystem']), 'code' => laterality['code'] , 'title' => laterality['codeSystemName']} + condition.anatomical_location = { 'code_system' => CodeSystemHelper.code_system_for(laterality['codeSystem']), 'code' => laterality['code'], 'title' => laterality['codeSystemName'] } end end end diff --git a/lib/health-data-standards/import/cda/encounter_importer.rb b/lib/health-data-standards/import/cda/encounter_importer.rb index c0e783f8c..7e86ab476 100644 --- a/lib/health-data-standards/import/cda/encounter_importer.rb +++ b/lib/health-data-standards/import/cda/encounter_importer.rb @@ -13,6 +13,7 @@ def initialize(entry_finder=EntryFinder.new("//cda:section[cda:templateId/@root= def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) encounter = super extract_performer(entry_element, encounter) + extract_admit_source(entry_element, encounter) extract_facility(entry_element, encounter) extract_reason(entry_element, encounter, nrh) extract_reason_or_negation(entry_element, encounter) @@ -34,6 +35,17 @@ def extract_performer(parent_element, encounter) encounter.performer = import_actor(performer_element) if performer_element end + def extract_admit_source(parent_element, encounter) + admit_source_element = parent_element.at_xpath("./cda:participant[@typeCode='LOC']/cda:participantRole[@classCode='SDLOC'][cda:templateId/@root='2.16.840.1.113883.10.20.24.3.151']") + if admit_source_element + admissionSource = AdmissionSource.new + code_hash = extract_code(admit_source_element, './cda:code') + admissionSource['code'] = code_hash["code"] + admissionSource['code_system'] = code_hash["code_system"] + encounter.admission_source = admissionSource + end + end + def extract_facility(parent_element, encounter) participant_element = parent_element.at_xpath("./cda:participant[@typeCode='LOC']/cda:participantRole[@classCode='SDLOC']") if (participant_element) @@ -42,7 +54,8 @@ def extract_facility(parent_element, encounter) facility.telecoms = participant_element.xpath("./cda:telecom").try(:map) {|te| import_telecom(te)} facility.code = extract_code(participant_element, './cda:code') extract_dates(participant_element.parent, facility, "time") - encounter.facility = facility.as_json() + facility_raw = facility.as_json() + encounter.facility = update_facility(facility_raw) end end @@ -64,7 +77,11 @@ def extract_admission(parent_element, encounter) def extract_discharge_disposition(parent_element, encounter) encounter.discharge_time = encounter.end_time - encounter.discharge_disposition = extract_code(parent_element, "./sdtc:dischargeDispositionCode") + discharge_disposition = extract_code(parent_element, "./sdtc:dischargeDispositionCode") + if discharge_disposition.present? + discharge_disposition["code_system"] = discharge_disposition["codeSystem"] if discharge_disposition["codeSystem"] + end + encounter.discharge_disposition = discharge_disposition end def extract_transfer(transfer_element, encounter) @@ -85,6 +102,14 @@ def transfer_from_or_to(transfer_element) transfer_to = true if transfer_element['typeCode'] && transfer_element['typeCode'] == 'DST' [transfer_from, transfer_to] end + def update_facility(raw_result) + raw_result["locationPeriodLow"] = raw_result["start_time"] + raw_result["locationPeriodHigh"] = raw_result["end_time"] + updated_facility = {} + updated_facility[:values] = [] + updated_facility[:values].push(raw_result) + updated_facility + end end end end diff --git a/lib/health-data-standards/import/cda/medication_importer.rb b/lib/health-data-standards/import/cda/medication_importer.rb index 3d2ba4862..23763c146 100644 --- a/lib/health-data-standards/import/cda/medication_importer.rb +++ b/lib/health-data-standards/import/cda/medication_importer.rb @@ -39,7 +39,7 @@ def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) medication.indication = extract_code(entry_element, @indication_xpath, 'SNOMED-CT') medication.vehicle = extract_code(entry_element, @vehicle_xpath, 'SNOMED-CT') - medication.allowed_administrations = extract_scalar(entry_element, "./cda:repeatNumber").value unless extract_scalar(entry_element, "./cda:repeatNumber").nil? + medication.allowed_administrations = extract_scalar(entry_element, "./cda:repeatNumber")['value'] unless extract_scalar(entry_element, "./cda:repeatNumber").nil? extract_order_information(entry_element, medication) diff --git a/lib/health-data-standards/import/cda/result_importer.rb b/lib/health-data-standards/import/cda/result_importer.rb index ef6d485c2..c928906b7 100644 --- a/lib/health-data-standards/import/cda/result_importer.rb +++ b/lib/health-data-standards/import/cda/result_importer.rb @@ -5,7 +5,7 @@ class ResultImporter < SectionImporter def initialize(entry_finder=EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15.1'] | //cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15']")) super(entry_finder) @entry_class = LabResult - @value_xpath = "cda:value | ./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.87']/cda:value" + @value_xpath = "cda:value | ./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.87']/cda:value | ./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.2']/cda:value" end def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) @@ -34,4 +34,4 @@ def extract_reference_range(parent_element, result) end end end -end \ No newline at end of file +end diff --git a/lib/health-data-standards/import/cda/section_importer.rb b/lib/health-data-standards/import/cda/section_importer.rb index 09e63a769..e1772a717 100644 --- a/lib/health-data-standards/import/cda/section_importer.rb +++ b/lib/health-data-standards/import/cda/section_importer.rb @@ -17,6 +17,7 @@ def initialize(entry_finder) @check_for_usable = true @entry_class = Entry @value_xpath = 'cda:value' + @docutype = nil end # Traverses an HL7 CDA document passed in and creates an Array of Entry @@ -27,6 +28,11 @@ def initialize(entry_finder) # @return [Array] will be a list of Entry objects def create_entries(doc, nrh = NarrativeReferenceHandler.new) entry_list = [] + if doc.at_xpath("/cda:ClinicalDocument/cda:templateId[@root='2.16.840.1.113883.3.88.11.32.1']") || doc.at_xpath("/cda:ClinicalDocument/cda:templateId[@root='2.16.840.1.113883.10.20.24.1.2']") + @docutype = "cat1" + elsif doc.at_xpath("/cda:ClinicalDocument/cda:templateId[@root='2.16.840.1.113883.10.20.22.1.2']") + @docutype = "ccda" + end entry_elements = @entry_finder.entries(doc) entry_elements.each do |entry_element| entry = create_entry(entry_element, nrh) @@ -48,6 +54,9 @@ def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) extract_values(entry_element, entry) end extract_description(entry_element, entry, nrh) + if(@docutype == "ccda") + verify_description(entry_element, entry) + end if @status_xpath extract_status(entry_element, entry) end @@ -55,7 +64,22 @@ def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) end private - + def update_default_description(parent_element, entry) + templateid = parent_element.at_xpath("./cda:templateId/@root").to_s + template_id_file = File.expand_path('../../../util/description_mapper.json', __FILE__) + data = JSON.parse(File.read(template_id_file)) + entry.description = data[templateid] + end + + def verify_description(parent_element, entry) + if entry.description != nil && entry.description.length > 0 + if (entry.description.rindex(":") == nil) + update_default_description(parent_element, entry) + end + else + update_default_description(parent_element, entry) + end + end def extract_description(parent_element, entry, nrh) orig_text_ref_element = parent_element.at_xpath(@description_xpath) desc_ref_element = parent_element.at_xpath("./cda:text/cda:reference") @@ -91,6 +115,7 @@ def extract_reason_description(parent_element, entry, nrh) tag = code_element['value'] entry.description = nrh.lookup_tag(tag) end + verify_description(parent_element, entry) end def extract_codes(parent_element, entry) @@ -185,13 +210,20 @@ def import_person(person_element) # coded_parent_element is the 'parent' element when the coded is nested (e.g., medication order) def extract_reason_or_negation(parent_element, entry, coded_parent_element = nil) coded_parent_element ||= parent_element - reason_element = parent_element.at_xpath("./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value | ./cda:entryRelationship[@typeCode='RSON']/cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:code") + reason_element = parent_element.at_xpath("./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value + | ./cda:entryRelationship[@typeCode='RSON']/cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:code + | ./cda:entryRelationship[@typeCode='SUBJ']/cda:substanceAdministration/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value + | ./cda:entryRelationship[@typeCode='SUBJ']/cda:supply/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value" ) + + # | ./cda:entryRelationship[@typeCode='SUBJ']/cda:substanceAdministration/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value negation_indicator = parent_element['negationInd'] + if reason_element code_system_oid = reason_element['codeSystem'] code = reason_element['code'] code_system = HealthDataStandards::Util::CodeSystemHelper.code_system_for(code_system_oid) entry.negation_ind = negation_indicator.eql?('true') + if entry.negation_ind entry.negation_reason = {'code' => code, 'code_system' => code_system, 'codeSystem' => code_system} else @@ -208,8 +240,10 @@ def extract_negated_code(coded_parent_element, entry) code_elements.each do |code_element| if code_element['nullFlavor'] == 'NA' && code_element['sdtc:valueSet'] # choose code from valueset - # valueset = HealthDataStandards::SVS::ValueSet.where(oid: code_element['sdtc:valueSet'], bundle_id: get_bundle_id(coded_parent_element)) - # entry.add_code(valueset.first.concepts.first['code'], valueset.first.concepts.first['code_system_name']) + valueset = HealthDataStandards::SVS::ValueSet.where(oid: code_element['sdtc:valueSet'], bundle_id: get_bundle_id(coded_parent_element)) + if valueset.first + entry.add_code(valueset.first.concepts.first['code'], valueset.first.concepts.first['code_system_name']) + end # A "code" is added to indicate the Non-Applicable valueset. entry.add_code(code_element['sdtc:valueSet'], 'NA_VALUESET') end @@ -233,9 +267,11 @@ def extract_code(parent_element, code_xpath, code_system=nil) code_hash = {'code' => code_element['code']} if code_system code_hash['codeSystem'] = code_system + code_hash['code_system'] = code_system else code_hash['codeSystemOid'] = code_element['codeSystem'] code_hash['codeSystem'] = CodeSystemHelper.code_system_for(code_hash['codeSystemOid']) + code_hash['code_system'] = code_hash['codeSystem'] end end diff --git a/lib/health-data-standards/import/provider_import_utils.rb b/lib/health-data-standards/import/provider_import_utils.rb index 8db9654aa..62fe19d27 100644 --- a/lib/health-data-standards/import/provider_import_utils.rb +++ b/lib/health-data-standards/import/provider_import_utils.rb @@ -6,24 +6,24 @@ def extract_provider(performer, element_name="assignedEntity") end def find_or_create_provider(provider_hash, patient=nil) - provider = Provider.by_npi(provider_hash[:npi]).first if provider_hash[:npi] && !provider_hash[:npi].empty? + provider = HealthDataStandards::Provider.by_npi(provider_hash[:npi]).first if provider_hash[:npi] && !provider_hash[:npi].empty? unless provider if provider_hash[:npi] - provider = Provider.create(provider_hash) + provider = HealthDataStandards::Provider.create(provider_hash) provider.npi = provider_hash[:npi] else ident_roots = provider_hash[:cda_identifiers].map {|ident| ident.root} ident_extensions = provider_hash[:cda_identifiers].map {|ident| ident.extension} unless ident_roots.size == 0 - provider ||= Provider.in("cda_identifiers.root" => ident_roots).and.in("cda_identifiers.extension" => ident_extensions).first + provider ||= HealthDataStandards::Provider.in("cda_identifiers.root" => ident_roots).and.in("cda_identifiers.extension" => ident_extensions).first end - provider_query = {:title => provider_hash[:title], - :given_name => provider_hash[:given_name], + provider_query = {:title => provider_hash[:title], + :given_name => provider_hash[:given_name], :family_name=> provider_hash[:family_name], :specialty => provider_hash[:specialty]} - provider ||= Provider.where(provider_query).first - provider ||= Provider.resolve_provider(provider_hash, patient) - provider ||= Provider.create(provider_hash) + provider ||= HealthDataStandards::Provider.where(provider_query).first + provider ||= HealthDataStandards::Provider.resolve_provider(provider_hash, patient) + provider ||= HealthDataStandards::Provider.create(provider_hash) end end provider diff --git a/lib/health-data-standards/models/cqm/aggregate_objects.rb b/lib/health-data-standards/models/cqm/aggregate_objects.rb index b7fde46fc..5fc8c7aa1 100644 --- a/lib/health-data-standards/models/cqm/aggregate_objects.rb +++ b/lib/health-data-standards/models/cqm/aggregate_objects.rb @@ -136,4 +136,4 @@ def is_cv? end end -end \ No newline at end of file +end diff --git a/lib/health-data-standards/models/encounter.rb b/lib/health-data-standards/models/encounter.rb index 282531a77..51f27fdd2 100755 --- a/lib/health-data-standards/models/encounter.rb +++ b/lib/health-data-standards/models/encounter.rb @@ -3,36 +3,28 @@ class Encounter < Entry field :dischargeDisposition, as: :discharge_disposition, type: Hash field :admitTime, as: :admit_time, type: Integer field :dischargeTime, as: :discharge_time, type: Integer - field :diagnosis, type: Hash # This is a Hash to align with the 'Collection' object - field :facility, type: Hash + field :principalDiagnosis, as: :principal_diagnosis, type: Hash + field :diagnosis, type: Hash - embeds_one :principalDiagnosis, class_name: "EncounterPrincipalDiagnosis" - embeds_one :transferTo, class_name: "Transfer" embeds_one :transferFrom, class_name: "Transfer" - embeds_one :admission_source, class_name: "AdmissionSource" + embeds_one :facility, class_name: "HealthDataStandards::Facility" embeds_one :reason, class_name: "Entry" - belongs_to :performer, class_name: "Provider" + belongs_to :performer, class_name: "HealthDataStandards::Provider" alias :transfer_to :transferTo alias :transfer_to= :transferTo= alias :transfer_from :transferFrom alias :transfer_from= :transferFrom= - alias :principal_diagnosis :principalDiagnosis - alias :principal_diagnosis= :principalDiagnosis= - alias :admissionSource :admission_source - alias :admissionSource= :admission_source= def shift_dates(date_diff) super if self.facility - # Facility is now stored as a Hash; shift its dates by updating its start_time and end_time values. - self.facility['start_time'] += date_diff if self.facility['start_time'] - self.facility['end_time'] += date_diff if self.facility['end_time'] + self.facility.shift_dates(date_diff) end - + self.admitTime = (self.admitTime.nil?) ? nil : self.admitTime + date_diff self.dischargeTime = (self.dischargeTime.nil?) ? nil : self.dischargeTime + date_diff end diff --git a/lib/health-data-standards/models/fulfillment_history.rb b/lib/health-data-standards/models/fulfillment_history.rb index d8e758a71..ab1e71675 100644 --- a/lib/health-data-standards/models/fulfillment_history.rb +++ b/lib/health-data-standards/models/fulfillment_history.rb @@ -1,16 +1,16 @@ class FulfillmentHistory include Mongoid::Document include Mongoid::Attributes::Dynamic - + field :prescriptionNumber, as: :prescription_number, type: String field :dispenseDate, as: :dispense_date, type: Integer field :quantityDispensed, as: :quantity_dispensed, type: Hash field :fillNumber, as: :fill_number, type: Integer field :fillStatus, as: :fill_status, type: String - - belongs_to :provider, class_name: "Provider" + + belongs_to :provider, class_name: "HealthDataStandards::Provider" def shift_dates(date_diff) self.dispenseDate = (self.dispenseDate.nil?) ? nil : self.dispenseDate + date_diff end -end \ No newline at end of file +end diff --git a/lib/health-data-standards/models/immunization.rb b/lib/health-data-standards/models/immunization.rb index 5fdc37793..d82bb09e3 100644 --- a/lib/health-data-standards/models/immunization.rb +++ b/lib/health-data-standards/models/immunization.rb @@ -1,15 +1,15 @@ class Immunization < Entry field :seriesNumber, type: Integer field :reaction, type: Hash - - belongs_to :performer, class_name: "Provider" - + + belongs_to :performer, class_name: "HealthDataStandards::Provider" + embeds_one :medication_product - + alias :refusal_ind :negationInd alias :refusal_ind= :negationInd= alias :refusal_reason :negationReason alias :refusal_reason= :negationReason= alias :series_number :seriesNumber alias :series_number= :seriesNumber= -end \ No newline at end of file +end diff --git a/lib/health-data-standards/models/procedure.rb b/lib/health-data-standards/models/procedure.rb index 0e6ca94b3..8e317a026 100644 --- a/lib/health-data-standards/models/procedure.rb +++ b/lib/health-data-standards/models/procedure.rb @@ -1,29 +1,19 @@ class Procedure < Entry - field :incisionTime, type: Integer, as: :incision_time + field :incisionTime, type: Integer, as: :incision_time field :ordinality, type: Hash field :source, type: Hash field :anatomical_approach, type: Hash field :anatomical_target, type: Hash - field :anatomical_location, type: Hash field :method, type: Hash - field :reaction, type: Hash - # The resulting status of a procedure as defined in the QDM documentation. This is different - # than the status associated with the `Entry` object, which relates to the data criteria - # status as defined in health-data-standards/lib/hqmf-model/data_criteria.json. - field :qdm_status, type: Hash + field :reaction, type: Hash - field :radiation_dose, type: Hash + field :radiation_dose, type: Hash field :radiation_duration, type: Hash - # QDM 5.0 addition to Diagnostic Study, Performed - field :result_date_time, type: Integer - # Component attribute is for Diagnostic, Performed which is classified as a procedure - field :components, type: Hash - - field :facility, type: Hash + embeds_one :facility, class_name: "HealthDataStandards::Facility" - belongs_to :performer, class_name: "Provider" + belongs_to :performer, class_name: "HealthDataStandards::Provider" def shift_dates(date_diff) super diff --git a/lib/health-data-standards/models/qrda/header.rb b/lib/health-data-standards/models/qrda/header.rb index b45c3ff18..e2c98f572 100644 --- a/lib/health-data-standards/models/qrda/header.rb +++ b/lib/health-data-standards/models/qrda/header.rb @@ -6,9 +6,9 @@ class Header embeds_many :authors embeds_one :custodian embeds_one :legal_authenticator - embeds_many :performers, class_name: "Provider" + embeds_many :performers, class_name: "HealthDataStandards::Provider" field :time , type: DateTime, default: Time.now end - -end \ No newline at end of file + +end diff --git a/lib/health-data-standards/models/qrda/information_recipient.rb b/lib/health-data-standards/models/qrda/information_recipient.rb new file mode 100644 index 000000000..1868dece4 --- /dev/null +++ b/lib/health-data-standards/models/qrda/information_recipient.rb @@ -0,0 +1,8 @@ +module Qrda + + class InformationRecipient + include Mongoid::Document + embeds_one :identifier, class_name: "Qrda::Id" + end + +end diff --git a/lib/health-data-standards/models/qrda/participant.rb b/lib/health-data-standards/models/qrda/participant.rb new file mode 100644 index 000000000..84137634b --- /dev/null +++ b/lib/health-data-standards/models/qrda/participant.rb @@ -0,0 +1,9 @@ +module Qrda + + class Participant + include Mongoid::Document + embeds_one :identifier, class_name: "Qrda::Id" + embeds_many :addresses + end + +end diff --git a/lib/health-data-standards/models/reference.rb b/lib/health-data-standards/models/reference.rb index f24285384..2d35a91cf 100644 --- a/lib/health-data-standards/models/reference.rb +++ b/lib/health-data-standards/models/reference.rb @@ -16,7 +16,7 @@ def resolve_reference def resolve_referenced_id resolved_reference = entry.record.entries.find do |e| e.class.to_s == referenced_type && - e.identifier == referenced_id + e.identifier.extension == referenced_id end self.referenced_id = resolved_reference.id.to_s end diff --git a/lib/health-data-standards/util/description_mapper.json b/lib/health-data-standards/util/description_mapper.json new file mode 100644 index 000000000..cd839cc94 --- /dev/null +++ b/lib/health-data-standards/util/description_mapper.json @@ -0,0 +1,15 @@ +{ + "2.16.840.1.113883.10.20.22.4.49": "encounter performed: office visit", + "2.16.840.1.113883.10.20.22.4.4": "Diagnosis:", + "2.16.840.1.113883.10.20.22.4.16": "Medication Administered:", + "2.16.840.1.113883.10.20.22.4.30": "Allergy Intolerance:", + "2.16.840.1.113883.10.20.22.4.1": "LaboratoryTest Performed:", + "2.16.840.1.113883.10.20.22.4.14": "Procedure Performed:", + "2.16.840.1.113883.10.20.22.4.52": "Immunization Administered:", + "2.16.840.1.113883.10.20.22.4.60": "Patient Characterisitic Payer", + "2.16.840.1.113883.10.20.22.4.2": "LaboratoryTest Performed:", + "2.16.840.1.113883.10.20.22.4.27": "PhysicalExam Performed:", + "2.16.840.1.113883.10.20.22.4.40": "Care Goal:", + "2.16.840.1.113883.10.20.22.4.20": "Care Goal:", + "2.16.840.1.113883.10.20.22.4.7": "Allergy Intolerance:" +} diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.105.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.105.cat1.erb index 691bc8498..91f5a4ec5 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.105.cat1.erb @@ -58,8 +58,10 @@ + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> + <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %> - <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %> + diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.140.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.140.cat1.erb index a47c1ea9f..d6df84dfe 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.140.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.140.cat1.erb @@ -20,6 +20,7 @@ + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'reason', :locals => {:entry => entry,:reason_oids=>field_oids["REASON"]}) %> - \ No newline at end of file + diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.144.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.144.cat1.erb index e4dae6c3f..74630dada 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.144.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.144.cat1.erb @@ -15,6 +15,7 @@ /> <%== render(:partial => 'result_value', :locals => {:values => [value], :result_oids=>result_oids} ) %> + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %> <% if entry.components -%> <%== render(:partial => 'components', :locals => {:entry => entry} ) %> diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.146.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.146.cat1.erb index af00b8e41..120beae25 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.146.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.146.cat1.erb @@ -26,8 +26,8 @@ - <%== code_display(entry, 'tag_name' => 'value', 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %> + <%== code_display(entry, 'tag_name' => 'value', 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*'],'extra_content' => "xsi:type=\"CD\"") %> - \ No newline at end of file + diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.23.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.23.cat1.erb index 5a1d8bb9d..f464ab75a 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.23.cat1.erb @@ -21,23 +21,32 @@ /> <% if entry.discharge_disposition.present? %> - + <% end -%> + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <% if entry.respond_to?(:facility) && entry.facility.present? -%> <% if entry.facility[:values][0].present? -%> - + " + codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.facility.values[0][0]["code"][:code_system]) %>"/> <% else -%> <% end -%> @@ -81,7 +90,7 @@ /> - + diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.32.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.32.cat1.erb index c7e98151e..cc9ac1ad3 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.32.cat1.erb @@ -12,6 +12,7 @@ /> /> + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'reason', :locals => {:entry => entry ,:reason_oids=>field_oids["REASON"]}) %> <%if !entry.values.empty? %> <%== render(:partial=> 'result_value', :locals => {:values => entry.values}) %> diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.41.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.41.cat1.erb index 12e601b58..a7dfa305b 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.41.cat1.erb @@ -37,7 +37,7 @@ - + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'medication_dispense', :collection => entry.fulfillmentHistory, :locals => {:entry => entry, :value_set_map => value_set_map, :value_set_oid => value_set_oid}) %> diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.42.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.42.cat1.erb index bd0dc5172..39cdb22df 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.42.cat1.erb @@ -22,6 +22,13 @@ + + + <%== render(:partial => 'reason', :locals => {:entry => entry,:reason_oids=>field_oids["REASON"]}) %> - \ No newline at end of file + diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.59.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.59.cat1.erb index 6a59eb6e5..aae4a5753 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.59.cat1.erb @@ -16,6 +16,7 @@ /> <%== render(:partial => 'result_value', :locals => {:values => [value], :result_oids=>result_oids}) %> + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %> <% if entry.components -%> <%== render(:partial => 'components', :locals => {:entry => entry} ) %> diff --git a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.64.cat1.erb b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.64.cat1.erb index ea07a4562..d0b70840a 100644 --- a/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +++ b/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.64.cat1.erb @@ -13,6 +13,7 @@ /> <%== render(:partial => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINAL"]}) %> + <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %> <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %> <% if entry.respond_to?(:incision_time) && entry.incision_time.present? -%> diff --git a/templates/cat1/r5/_component_value.cat1.erb b/templates/cat1/r5/_component_value.cat1.erb index 09f854c44..7f4e5e999 100644 --- a/templates/cat1/r5/_component_value.cat1.erb +++ b/templates/cat1/r5/_component_value.cat1.erb @@ -1,5 +1,7 @@ -<% if result['code'] -%> - +<% if result[:code] -%> + + <% elsif result['scalar'] %> <% end %> + diff --git a/templates/cat1/r5/_components.cat1.erb b/templates/cat1/r5/_components.cat1.erb index 0f62faa79..2ca8859f3 100644 --- a/templates/cat1/r5/_components.cat1.erb +++ b/templates/cat1/r5/_components.cat1.erb @@ -1,11 +1,12 @@ -<% entry.components['values'].each do |component| %> +<% entry.components[:values].each do |component| %> - - <%== render(:partial => 'component_value', :locals => {:result => component.result} ) %> + + + <%== render(:partial => 'component_value', :locals => {:result => component[:result]} ) %> -<% end %> +<% end %> \ No newline at end of file diff --git a/templates/cat1/r5/_providers.cat1.erb b/templates/cat1/r5/_providers.cat1.erb index 576fe02f9..a29a4bad2 100644 --- a/templates/cat1/r5/_providers.cat1.erb +++ b/templates/cat1/r5/_providers.cat1.erb @@ -25,52 +25,55 @@ <% else -%> - <% patient.provider_performances.each do |pp| -%> - - /> - /> - - - - - - <% pp.provider.cda_identifiers.each do |cda_id| -%> - <% unless cda_id.root.eql? '2.16.840.1.113883.4.2' -%> - + + + + + <% patient.provider_performances.each do |pp| -%> + <% if pp.provider.cda_identifiers.reduce(false){|found, item| + found || /2\.16\.840\.1\.113883\.4\.[26]/ === item['root']} -%> + + + + + <% pp.provider.cda_identifiers.each do |cda_id| -%> + <% unless cda_id.root.eql? '2.16.840.1.113883.4.2' -%> + + <% end -%> + <% end -%> + <% if pp.provider.specialty %> + + <% end %> + <%== render :partial => "address", :collection => pp.provider.addresses %> + <%== render :partial => "telecom", :collection => pp.provider.telecoms %> + + + <%= pp.provider.given_name %> + <%= pp.provider.family_name %> + + + + <% pp.provider.cda_identifiers.each do |cda_id| -%> + <% if cda_id.root.eql?('2.16.840.1.113883.4.2') -%> + + <% end -%> + <% end -%> + <% if pp.provider.organization %> + <%= pp.provider.organization.name %> + <%== render :partial => "address", :collection => pp.provider.organization.addresses %> + <%== render :partial => "telecom", :collection => pp.provider.organization.telecoms %> + <% else %> + <%== render :partial => "address", :collection => pp.provider.addresses %> + <%== render :partial => "telecom", :collection => pp.provider.telecoms %> + <% end %> + + + <% end -%> - <% end -%> - <% if pp.provider.specialty %> - - <% end %> - <%== render :partial=>"address" , :collection=>pp.provider.addresses %> - <%== render :partial=>"telecom", :collection=>pp.provider.telecoms %> - - - <%= pp.provider.given_name %> - <%= pp.provider.family_name %> - - - - <% pp.provider.cda_identifiers.each do |cda_id| -%> - <% if cda_id.root.eql?('2.16.840.1.113883.4.2') -%> - - <% end -%> - <% end -%> - <%if pp.provider.organization %> - <%= pp.provider.organization.name %> - <%== render :partial=>"address" , :collection=>pp.provider.organization.addresses %> - <%== render :partial=>"telecom", :collection=>pp.provider.organization.telecoms %> - <% else %> - <%== render :partial=>"address" , :collection=>pp.provider.addresses %> - <%== render :partial=>"telecom", :collection=>pp.provider.telecoms %> - <% end %> - - - + <% end -%> <% end -%> - <% end -%> diff --git a/templates/cat1/r5/_reason.cat1.erb b/templates/cat1/r5/_reason.cat1.erb index d4e6a8bc6..c9c7d0ada 100644 --- a/templates/cat1/r5/_reason.cat1.erb +++ b/templates/cat1/r5/_reason.cat1.erb @@ -8,7 +8,7 @@ -%> - + <% if (patient.race) %> - displayName="<%= patient.race[:name] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/> + displayName="<%= patient.race['name'] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/> <% end %> <% if (patient.ethnicity) %> - displayName="<%= patient.ethnicity[:name] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/> + displayName="<%= patient.ethnicity['name'] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/> <% end %> <% languages = patient.languages diff --git a/templates/cat1/r5/_reporting_parameters.cat1.erb b/templates/cat1/r5/_reporting_parameters.cat1.erb index 09b68d1f7..7f76a1c82 100644 --- a/templates/cat1/r5/_reporting_parameters.cat1.erb +++ b/templates/cat1/r5/_reporting_parameters.cat1.erb @@ -9,7 +9,11 @@ Reporting Parameters - Reporting period: <%= start_date.to_formatted_s(:long_ordinal) %> - <%= end_date.to_formatted_s(:long_ordinal) %> + <% if start_date.is_a? Integer %> + Reporting period: <%= Time.at(start_date).utc.to_formatted_s(:number) %> - <%= Time.at(end_date).utc.to_formatted_s(:number) %> + <% else %> + Reporting period: <%= start_date.to_formatted_s(:number) %> - <%= end_date.to_formatted_s(:number) %> + <% end %> @@ -22,10 +26,15 @@ - - + <% if start_date.is_a? Integer %> + + + <% else %> + + + <% end %> - \ No newline at end of file + diff --git a/templates/cat1/r5/_telecom.cat1.erb b/templates/cat1/r5/_telecom.cat1.erb index d1db862c9..02ef82fae 100644 --- a/templates/cat1/r5/_telecom.cat1.erb +++ b/templates/cat1/r5/_telecom.cat1.erb @@ -1 +1,5 @@ - \ No newline at end of file +<% if telecom.is_a?(Hash)%> +" value="tel:+<%=telecom["value"]%>" /> +<% else %> + +<% end %> \ No newline at end of file diff --git a/templates/cat1/r5/show.cat1.erb b/templates/cat1/r5/show.cat1.erb index 24eed46de..9262a12a9 100644 --- a/templates/cat1/r5/show.cat1.erb +++ b/templates/cat1/r5/show.cat1.erb @@ -5,6 +5,14 @@ else 'HQR_EHR' end -%> +<% if measures.first.type == 'eh' %> + <% if header %> + <% eh_program = true %> + <% reporting_program = header.information_recipient.identifier.extension.to_s %> + <% reporting_program_root = header.information_recipient.identifier.root.to_s %> + <% cms_compatibility = true %> + <% end %> +<% end %> - + <% end %> @@ -84,17 +92,17 @@ - <% if cms_compatibility %> - <% patient.provider_performances.each do |pp| -%> - <% pp.provider.cda_identifiers.each do |cda_id| -%> - <% if cda_id.root.eql?('2.16.840.1.113883.4.6') -%> - - <% end -%> - <% end -%> - <% end -%> - <% else %> - - <% end %> + <% # < % if cms_compatibility % > %> + <% patient.provider_performances.each do |pp| -%> + <% pp.provider.cda_identifiers.each do |cda_id| -%> + <% if cda_id.root.eql?('2.16.840.1.113883.4.6') -%> + + <% end -%> + <% end -%> + <% end -%> + <% # < % else % > %> + <% # %> + <% # < % end % > %> 202 Burlington Rd. Bedford @@ -134,7 +142,7 @@ <% if cms_compatibility %> - + <% end %> diff --git a/templates/cat3/r2_1/_measure_data.cat3.erb b/templates/cat3/r2_1/_measure_data.cat3.erb index 7149862c5..9c5b5a338 100644 --- a/templates/cat3/r2_1/_measure_data.cat3.erb +++ b/templates/cat3/r2_1/_measure_data.cat3.erb @@ -3,6 +3,7 @@ + <%= population.id %> --> <% payer_templates_ids = ['2.16.840.1.113883.10.20.27.3.9'] %> <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Payer Supplemental Data', - :template_ids => payer_templates_ids, :extension => '2016-02-01', :supplemental_data_code => '48768-6', + :template_ids => payer_templates_ids, :extension => '2016-02-01', :addtn_template_id => '2.16.840.1.113883.10.20.27.3.18', :addtn_extension => '2018-05-01', :supplemental_data_code => '48768-6', :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => payer, :supplemental_data_value_code_system => '2.16.840.1.113883.3.221.5', :count => count, :qrda3_version => qrda3_version} %> <% end -%> @@ -133,4 +134,4 @@ - \ No newline at end of file + diff --git a/templates/cat3/r2_1/_performance_rate.cat3.erb b/templates/cat3/r2_1/_performance_rate.cat3.erb index 5960e95d4..cd2779631 100644 --- a/templates/cat3/r2_1/_performance_rate.cat3.erb +++ b/templates/cat3/r2_1/_performance_rate.cat3.erb @@ -1,6 +1,7 @@ + diff --git a/templates/cat3/r2_1/_providers.cat3.erb b/templates/cat3/r2_1/_providers.cat3.erb index 0486a4f8a..f363db4f8 100644 --- a/templates/cat3/r2_1/_providers.cat3.erb +++ b/templates/cat3/r2_1/_providers.cat3.erb @@ -25,11 +25,11 @@ <% else -%> - <% providers.each do |prov| -%> + <% providers.each do |prov| -%> - \ No newline at end of file + diff --git a/templates/cat3/r2_1/ep/_address.cat3.erb b/templates/cat3/r2_1/ep/_address.cat3.erb new file mode 100644 index 000000000..ed00624c8 --- /dev/null +++ b/templates/cat3/r2_1/ep/_address.cat3.erb @@ -0,0 +1,9 @@ + + <% address.street.each do |street| %> + <%= street %> + <% end %> + <%= address.city %> + <%= address.state %> + <%= address.zip %> + <%= address.country %> + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_author.cat3.erb b/templates/cat3/r2_1/ep/_author.cat3.erb new file mode 100644 index 000000000..a751a5db3 --- /dev/null +++ b/templates/cat3/r2_1/ep/_author.cat3.erb @@ -0,0 +1,28 @@ + + + diff --git a/templates/cat3/r2_1/ep/_continuous_variable_value.cat3.erb b/templates/cat3/r2_1/ep/_continuous_variable_value.cat3.erb new file mode 100644 index 000000000..a4bf34871 --- /dev/null +++ b/templates/cat3/r2_1/ep/_continuous_variable_value.cat3.erb @@ -0,0 +1,22 @@ + + + + + + + Time Difference + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_id.cat3.erb b/templates/cat3/r2_1/ep/_id.cat3.erb new file mode 100644 index 000000000..2bc202a32 --- /dev/null +++ b/templates/cat3/r2_1/ep/_id.cat3.erb @@ -0,0 +1 @@ + extension="<%= identifier.extension %>"/> diff --git a/templates/cat3/r2_1/ep/_measure_data.cat3.erb b/templates/cat3/r2_1/ep/_measure_data.cat3.erb new file mode 100644 index 000000000..45c8a84b7 --- /dev/null +++ b/templates/cat3/r2_1/ep/_measure_data.cat3.erb @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + <% population.stratifications.each do |strat| -%> + + + + + + + + + + + + Stratum + + + + + + + + + + + + + <% if population.type == 'MSRPOPL' -%> + <% + #need to lookup the observation population entry and then find the stratification entry for it + observ = aggregate_count.populations.find{|p| p.type == "OBSERV"} + obs_strat = observ.stratifications.find{|s| s.id == strat.id} + if obs_strat + %> + <%== render :partial => 'continuous_variable_value', :locals => {:id => observ.id, :value=>obs_strat.value } %> + <% + end + end -%> + + + + + + + + <% end -%> + <% if population.supplemental_data.present? -%> + <% sex_supplimental_data = population.supplemental_data["SEX"] + if sex_supplimental_data.present? + sex_supplimental_data.each do |sex, count| -%> + + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Sex Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.6','2.16.840.1.113883.10.20.27.3.21'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '76689-9', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => sex, + :supplemental_data_value_code_system => '2.16.840.1.113883.5.1', :count => count, :qrda3_version => qrda3_version} %> + <% end -%> + <% else -%> + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Sex Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.6','2.16.840.1.113883.10.20.27.3.21'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '76689-9', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => '', + :supplemental_data_value_code_system => '2.16.840.1.113883.5.1', :count => 0, :qrda3_version => qrda3_version} %> +<% end -%> + <% ethnicity_supplimental_data = population.supplemental_data["ETHNICITY"] + if ethnicity_supplimental_data.present? + ethnicity_supplimental_data.each do |ethnicity, count| -%> + + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Ethnicity Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.7','2.16.840.1.113883.10.20.27.3.22'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '69490-1', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => ethnicity, + :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => count, :qrda3_version => qrda3_version} %> + <% end -%> + <% else -%> + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Ethnicity Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.7','2.16.840.1.113883.10.20.27.3.22'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '69490-1', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => '', + :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => 0, :qrda3_version => qrda3_version} %> + + <% end -%> + <% race_supplimental_data = population.supplemental_data["RACE"] + if race_supplimental_data.present? + race_supplimental_data.each do |race, count| -%> + + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Race Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.8','2.16.840.1.113883.10.20.27.3.19'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '72826-1', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => race, + :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => count, :qrda3_version => qrda3_version} %> + <% end -%> + <% else -%> + + + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Race Supplemental Data', + :template_ids => ['2.16.840.1.113883.10.20.27.3.8','2.16.840.1.113883.10.20.27.3.19'], :extensiones => ['2016-09-01','2016-11-01'], :supplemental_data_code => '72826-1', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => '', + :supplemental_data_value_code_system => '2.16.840.1.113883.6.238', :count => 0, :qrda3_version => qrda3_version} %> + + + + <% end -%> + <% payer_supplimental_data = population.supplemental_data["PAYER"] + if payer_supplimental_data.present? + payer_supplimental_data.each do |payer, count| -%> + + + <% payer_templates_ids = ['2.16.840.1.113883.10.20.27.3.9','2.16.840.1.113883.10.20.27.3.18'] %> + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Payer Supplemental Data', + :template_ids => payer_templates_ids, :extensiones => ['2016-02-01','2018-05-01'], :supplemental_data_code => '48768-6', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => payer, + :supplemental_data_value_code_system => '2.16.840.1.113883.3.221.5', :count => count, :qrda3_version => qrda3_version} %> + <% end -%> + <% else -%> + + <% payer_templates_ids = ['2.16.840.1.113883.10.20.27.3.9','2.16.840.1.113883.10.20.27.3.18'] %> + <%== render :partial => 'supplemental_data', :locals => {:template_name => 'Payer Supplemental Data', + :template_ids => payer_templates_ids, :extensiones => ['2016-02-01','2018-05-01'], :supplemental_data_code => '48768-6', + :supplemental_data_code_system => '2.16.840.1.113883.6.1', :supplemental_data_value_code => '9', + :supplemental_data_value_code_system => '2.16.840.1.113883.3.221.5', :count => 0, :qrda3_version => qrda3_version} %> + <% end -%> + <% end -%> + <% if population.type == 'MSRPOPL' -%> + <% observ = aggregate_count.populations.find{|p| p.type == "OBSERV"} %> + <%== render :partial => 'continuous_variable_value', :locals => {:id => observ.id, :value=>observ.value}%> + <% end -%> + + + + + + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_organization.cat3.erb b/templates/cat3/r2_1/ep/_organization.cat3.erb new file mode 100644 index 000000000..a6b70ae74 --- /dev/null +++ b/templates/cat3/r2_1/ep/_organization.cat3.erb @@ -0,0 +1,6 @@ +<<%=tag_name %>> + + <%== render :partial=>"id", :collection=>organization.ids, :id=> "identifier" %> + + <%= organization.name %> +> \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_performance_rate.cat3.erb b/templates/cat3/r2_1/ep/_performance_rate.cat3.erb new file mode 100644 index 000000000..e3cb8f078 --- /dev/null +++ b/templates/cat3/r2_1/ep/_performance_rate.cat3.erb @@ -0,0 +1,21 @@ + + + + + + + + <% if population_group.performance_rate_denominator > 0 %> + + <% else %> + + <% end %> + + + + + + + diff --git a/templates/cat3/r2_1/ep/_providers.cat3.erb b/templates/cat3/r2_1/ep/_providers.cat3.erb new file mode 100644 index 000000000..f363db4f8 --- /dev/null +++ b/templates/cat3/r2_1/ep/_providers.cat3.erb @@ -0,0 +1,57 @@ + + + <% if providers.empty? -%> + + + + + + + + + + + + + + + + + + + + <% else -%> + + + + + <% providers.each do |prov| -%> + + + + + <% prov.cda_identifiers.each do |cda_id| -%> + <% unless cda_id.root.eql? '2.16.840.1.113883.4.2' -%> + + <% end -%> + <% end -%> + + <% prov.cda_identifiers.each do |cda_id| -%> + <% if cda_id.root.eql?('2.16.840.1.113883.4.2') -%> + + <% end -%> + <% end -%> + + + + <% end -%> + <% end -%> + + diff --git a/templates/cat3/r2_1/ep/_reporting_parameters.cat3.erb b/templates/cat3/r2_1/ep/_reporting_parameters.cat3.erb new file mode 100644 index 000000000..550242729 --- /dev/null +++ b/templates/cat3/r2_1/ep/_reporting_parameters.cat3.erb @@ -0,0 +1,20 @@ + +
+ + + + + + + + Reporting Parameters + + + Reporting period: <%= start_date.to_formatted_s(:long_ordinal) %> - <%= end_date.to_formatted_s(:long_ordinal) %> + + + + <%== render :partial => 'reporting_parameters_act', :locals => {:start_date => start_date, :end_date => end_date} %> + +
+
\ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_reporting_parameters_act.cat3.erb b/templates/cat3/r2_1/ep/_reporting_parameters_act.cat3.erb new file mode 100644 index 000000000..d9e0dfd9b --- /dev/null +++ b/templates/cat3/r2_1/ep/_reporting_parameters_act.cat3.erb @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_supplemental_data.cat3.erb b/templates/cat3/r2_1/ep/_supplemental_data.cat3.erb new file mode 100644 index 000000000..8a36dfae2 --- /dev/null +++ b/templates/cat3/r2_1/ep/_supplemental_data.cat3.erb @@ -0,0 +1,66 @@ + + + + + + <% for idx in (0..1) %> + + <% end %> + + + + <% if supplemental_data_value_code == "" || supplemental_data_value_code == "UNK" -%> + + <% else + if template_name == "Payer Supplemental Data" + case supplemental_data_value_code + when "1" + payer_grouping_code = "A" + payer_grouping_print_name = "Medicare" + when "2" + payer_grouping_code = "B" + payer_grouping_print_name = "Medicaid" + when "5" + payer_grouping_code = "C" + payer_grouping_print_name = "Private Health Insurance" + when "6" + payer_grouping_code = "C" + payer_grouping_print_name = "Private Health Insurance" + else + payer_grouping_code = "D" + payer_grouping_print_name = "Other" + end + -%> + + + + <% else -%> + + <% end -%> + <% end %> + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/_telecom.cat3.erb b/templates/cat3/r2_1/ep/_telecom.cat3.erb new file mode 100644 index 000000000..d1db862c9 --- /dev/null +++ b/templates/cat3/r2_1/ep/_telecom.cat3.erb @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/cat3/r2_1/ep/show.cat3.erb b/templates/cat3/r2_1/ep/show.cat3.erb new file mode 100644 index 000000000..cc1bc990b --- /dev/null +++ b/templates/cat3/r2_1/ep/show.cat3.erb @@ -0,0 +1,180 @@ + + + + + + + + + + + <%== render :partial=>"id", :locals=>{identifier: header.identifier} %> + + + + + QRDA Calculated Summary Report + + + + + + + + + + + + + + <%== render :partial=>"author", :collection=>header.authors %> + + + + + + + <%== render :partial=>"organization", :locals=>{organization: header.custodian.organization, tag_name: "representedCustodianOrganization"} %> + + + + + + + + + + + + + + + + + + + <% if header.information_recipient.identifier.extension == "CPCPLUS" -%> + + + + + + + + <%== render :partial=>"address" , :collection=>header.participant.addresses %> + + + <% end -%> + + <%== render :partial=>"providers", :locals=>{providers: header.performers, start_date: start_date, end_date: end_date} %> + + + + + + + +
+ + + + + + + + + Measure Section + + + + <% measures.each do |measure| %> + + + + + + + + + + + + + + + + + + <%= measure['name'] %> + + + + + + + + <% result = results[measure['hqmf_id']] + unless result.is_cv? + result.population_groups.each do |pg| + -%> + + <%== render :partial => 'performance_rate', :locals => {:population_group => pg, :qrda3_version => qrda3_version} %> + + <% end + end -%> + <% result.populations.each do |pop| + unless pop.type == 'OBSERV' -%> + + <%== render :partial => 'measure_data', :locals => {:aggregate_count => result, :population => pop, :qrda3_version => qrda3_version} %> + + <% end + end -%> + + + <% end %> + + <%== render :partial => 'reporting_parameters_act', :locals => {:start_date => start_date, :end_date => end_date} %> + +
+
+
+
+
diff --git a/templates/cat3/r2_1/show.cat3.erb b/templates/cat3/r2_1/show.cat3.erb index d040ea37b..6a8d40821 100644 --- a/templates/cat3/r2_1/show.cat3.erb +++ b/templates/cat3/r2_1/show.cat3.erb @@ -12,6 +12,7 @@ + <%== render :partial=>"id", :locals=>{identifier: header.identifier} %> @@ -95,6 +96,7 @@ Measure Section + Measure Section @@ -107,6 +109,7 @@ Measure Section +