class CqmValidators::QrdaQdmTemplateValidator
Constants
- QRDA_CAT_1_R5_1_QDM_OIDS
Hash of templateIds/extensions specified in the Patient Data Section QDM for QRDA R5.1
- QRDA_CAT_1_R5_QDM_OIDS
Hash of templateIds/extensions specified in the Patient Data Section QDM for QRDA R5
Public Class Methods
# File lib/qrda_qdm_template_validator.rb, line 129 def initialize(qrda_version) @name = 'QRDA QDM Template Validator' @templateshash = case qrda_version when 'r5' then QRDA_CAT_1_R5_QDM_OIDS when 'r5_1' then QRDA_CAT_1_R5_1_QDM_OIDS end end
Public Instance Methods
# File lib/qrda_qdm_template_validator.rb, line 158 def entry_value_for_qrda_version(entry, data = {}) # an entry may have multiple templateIds tids = entry.xpath('./*/cda:templateId') # an entry only needs one valid templateId to be acceptable unless tids.map { |tid| @templateshash.key?(tid['root']) && @templateshash[tid['root']] == tid['extension'] }.include? true msg = "#{tids.map { |tid| "#{tid['root']}:#{tid['extension']}" }} are not valid Patient Data Section QDM entries for this QRDA Version" @errors << build_error(msg, entry.path, data[:file_name]) end end
returns a list of the patient data entries
# File lib/qrda_qdm_template_validator.rb, line 169 def extract_entries @doc.xpath('//cda:component/cda:section[cda:templateId/@root="2.16.840.1.113883.10.20.24.2.1"]/cda:entry') end
Validates that a QRDA Cat I file's Patient Data Section QDM (V3) contains entries that conform to the QDM approach to QRDA. In contrast to a QRDA Framework Patient Data Section that requires but does not specify the structured entries, the Patient Data Section QDM contained entry templates have specific requirements to align the quality measure data element type with its corresponding NQF QDM HQMF pattern, its referenced value set and potential QDM attributes. The result will be an Array of execution errors indicating use of templates that are not valid for the specified QRDA version
# File lib/qrda_qdm_template_validator.rb, line 144 def validate(file, data = {}) @errors = [] # if validator does not support the qrda version specified, no checks are made unless @templateshash.nil? @doc = get_document(file) @doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3') extract_entries.each do |entry| # each entry is evaluated separetly. entry_value_for_qrda_version(entry, data) end end @errors end