Class: DaVinciPASTestKit::DaVinciPASV221::MustSupportWithAttestationOption

Inherits:
Inferno::Test
  • Object
show all
Includes:
URLs, MustSupportDataGathering
Defined in:
lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb

Overview

Aggregates the must support assessment across a list of profiles. Each must support element that was not observed is logged as an info message, and when at least one was not observed the tester is given the opportunity to attest that the client system does not collect that data (and is not required to under the PAS implementation guide). A true attestation passes the test; a false attestation fails it. When every must support element was observed, the test passes without requiring any further input.

The must support assessment - including the shared X12 / DataAbsentReason false-positive handling (remove_must_support_false_positives) is leveraged from the cross_suite must support

Constant Summary

Constants included from MustSupportDataGathering

MustSupportDataGathering::DATA_ABSENT_REASON_URL, MustSupportDataGathering::X12_CHILD, MustSupportDataGathering::X12_SLICE, MustSupportDataGathering::X12_SYSTEM_FRAGMENT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from URLs

#suite_id

Methods included from ClientURLs

#fhir_base_url, #fhir_subscription_url, #inquire_url, #registration_url, #session_fhir_base_url, #session_fhir_subscription_url, #session_inquire_url, #session_submit_url, #submit_url, #token_url, #udap_discovery_url

Methods included from BaseURLs

#base_url, #resume_fail_url, #resume_pass_url, #resume_skip_url

Methods included from MustSupportDataGathering

#error_message, #fetch_tagged_resources, #load_metadata_for_profile_version, #remove_must_support_false_positives, #resources_of_interest, #tag, #tagged_resources

Methods included from ParametersHelper

#extract_bundles_from_pas_inquiry_response_parameters

Class Method Details

.build_description(options) ⇒ Object

Builds the test's description from the configured profiles' metadata at load time, so the generated group files stay lean and the listed must support elements stay in sync with the IG metadata. Called from the generated groups: description build_description(config.options).



157
158
159
160
161
162
163
164
165
166
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 157

def self.build_description(options)
  profiles = options[:profiles] || []

  sections = profiles.map do |profile|
     = (profile[:profile_key], options[:ig_version])
    "### #{profile[:title] || profile[:resource_type]}\n#{.must_support_list_string(indent: 0)}"
  end.join("\n\n")

  "#{description_intro(require_one_of: options[:require_one_of])}\n\n#{sections}"
end

.description_intro(require_one_of:) ⇒ Object

The require_one_of intro reproduces the original PasClientMustSupportRequestProfilesTest description, tweaked only to describe the attestation option.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 170

def self.description_intro(require_one_of:)
  if require_one_of
    <<~INTRO.chomp
      The PAS IG includes four profiles for providing the specifics of the service or product requested
      in the prior authorization request. Any one of these profiles can be referenced in
      the must support element `Claim.item.extension:requestedService`:

      * PAS Medication Request
      * PAS Service Request
      * PAS Device Request
      * PAS Nutrition Order

      System are allowed to support only the request profiles that fit their use cases. However,
      they must support at least one of them (because `Claim.item.extension:requestedService` is a
      must support element) and for any request profiles they support, they must be able to
      populate all of the defined must support elements as long as that data is collected within
      and displayed by the system.

      This test ensures that the submitted request bundles include at least one instance of a
      profile listed above. Then for each profile observed, it checks for the presence of
      each must support element defined in that profile. For must support elements not observed
      on an included request profile, testers can attest that they are not supported by the
      client system.

      The test will look through the instances included in submissions made by the client
      for the following must support elements:
    INTRO
  else
    <<~INTRO.chomp
      PAS client systems are required to be able to populate must support elements representing
      data collected and displayed to users on instances of all profiles included in requests.
      This test checks all identified instances of the profiles listed below within requests sent
      by the client to ensure that the must support elements are observed. For those not observed,
      testers can attest that they are not supported by the client system.
    INTRO
  end
end

.load_profile_metadata(profile_key, version) ⇒ Object



208
209
210
211
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 208

def self.(profile_key, version)
  path = File.join(__dir__, '..', '..', '..', 'cross_suite', 'generated', version, profile_key, 'metadata.yml')
  Generator::ProfileMetadata.new(YAML.load_file(path, aliases: true))
end

Instance Method Details

#attestation_message(unobserved_by_profile) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 134

def attestation_message(unobserved_by_profile)
  unobserved_list = unobserved_by_profile.flat_map do |profile_title, elements|
    elements.map { |element| "- #{profile_title}: #{element}" }
  end.join("\n")

  <<~MESSAGE
    The following #{operation} request must support elements were not observed in the
    requests made by the client:

    #{unobserved_list}

    Attest that the client system does **not** collect the data for these unobserved
    must support elements (and is not required to under the PAS implementation guide).

    [Click here](#{attest_true_url}) if the above statement is **true**. The test will **pass**.

    [Click here](#{attest_false_url}) if the above statement is **false**. The test will **fail**.
  MESSAGE
end

#gather_unobserved_elementsObject

Returns unobserved must support elements keyed by profile title.

Returns:

  • unobserved must support elements keyed by profile title



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 110

def gather_unobserved_elements
  profiles.each_with_object({}) do |profile, result|
    profile_title = profile[:title] || profile[:resource_type]
    resources = grouped_resources[profile[:resource_type]] || []

    if resources.blank?
      # In require_one_of mode the tester only needs to demonstrate one of the alternatives,
      # so a profile with no instances is not flagged. Otherwise, the absence of any instance
      # means the profile's must support elements could not be observed at all - flag the
      # resource type itself rather than enumerating every element.
      next if require_one_of

      result[profile_title] = ["(no #{profile[:resource_type]} instances were observed)"]
      next
    end

     = (profile[:profile_key], ig_version)
    missing = missing_must_support_elements(resources, nil, metadata:)
    missing = remove_must_support_false_positives(missing, resources, profile[:resource_type])

    result[profile_title] = missing if missing.present?
  end
end

#grouped_resourcesObject



64
65
66
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 64

def grouped_resources
  @grouped_resources ||= (resources_of_interest || []).group_by(&:resourceType)
end

#ig_versionObject



44
45
46
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 44

def ig_version
  config.options[:ig_version]
end

#must_support_requestsObject

Query the repository directly instead of the data gathering default (load_tagged_requests): these requests are owned by the gather test, so associating them here would duplicate that association onto each attestation test's result.



71
72
73
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 71

def must_support_requests
  @must_support_requests ||= Inferno::Repositories::Requests.new.tagged_requests(test_session_id, [tag])
end

#operationObject



52
53
54
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 52

def operation
  config.options[:operation]
end

#profilesObject

config.options:

profiles:        Array of { resource_type:, profile_key:, title: } describing the profiles
               to assess.
require_one_of:  Boolean. When true, at least one of the listed resource types must be
               present (a hard requirement) and only the profiles that are actually
               present are assessed - used for the "at least one request profile" case.
               When false, every listed profile is assessed.
ig_version:, type: ('request'), operation: ('submit' / 'inquire')


36
37
38
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 36

def profiles
  config.options[:profiles]
end

#require_one_ofObject



40
41
42
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 40

def require_one_of
  config.options[:require_one_of]
end

#target_resource_typesObject



56
57
58
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 56

def target_resource_types
  @target_resource_types ||= profiles.map { |profile| profile[:resource_type] }.uniq
end

#typeObject



48
49
50
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 48

def type
  config.options[:type]
end

#type_of_interest?(resource_type) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/davinci_pas_test_kit/client/v2.2.1/must_support/must_support_with_attestation_option.rb', line 60

def type_of_interest?(resource_type)
  target_resource_types.include?(resource_type)
end