Class: DaVinciPASTestKit::Generator::UseCaseGroupGenerator
- Inherits:
-
Object
- Object
- DaVinciPASTestKit::Generator::UseCaseGroupGenerator
- Defined in:
- lib/davinci_pas_test_kit/generator/use_case_group_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
-
#system ⇒ Object
Returns the value of attribute system.
-
#use_case ⇒ Object
Returns the value of attribute use_case.
Class Method Summary collapse
Instance Method Summary collapse
- #base_metadata_file_name ⇒ Object
- #base_output_file_name ⇒ Object
- #bundle_response_conformance_requirements_verified(operation) ⇒ Object
- #bundle_validation_test_description(operation, type) ⇒ Object
- #bundle_validation_test_title(operation, type) ⇒ Object
- #class_name ⇒ Object
- #description ⇒ Object
- #description_extension_limitation ⇒ Object
- #description_user_input_validation ⇒ Object
- #generate ⇒ Object
- #group_id ⇒ Object
- #ig_version ⇒ Object
- #ig_version_for_id ⇒ Object
- #ig_version_for_link ⇒ Object
-
#initialize(ig_metadata, use_case, base_output_dir, system = 'server') ⇒ UseCaseGroupGenerator
constructor
A new instance of UseCaseGroupGenerator.
- #module_name ⇒ Object
- #notification_conformance_requirements_verified ⇒ Object
- #notification_delivery_requirements_verified ⇒ Object
- #operation_requirements_verified(operation) ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #profile_identifier(profile_metadata) ⇒ Object
- #profile_link(operation, type) ⇒ Object
- #simulation_verification?(type) ⇒ Boolean
- #template ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(ig_metadata, use_case, base_output_dir, system = 'server') ⇒ UseCaseGroupGenerator
Returns a new instance of UseCaseGroupGenerator.
17 18 19 20 21 22 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 17 def initialize(, use_case, base_output_dir, system = 'server') self. = self.use_case = use_case self.base_output_dir = base_output_dir self.system = system end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
15 16 17 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 15 def base_output_dir @base_output_dir end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
15 16 17 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 15 def @ig_metadata end |
#system ⇒ Object
Returns the value of attribute system.
15 16 17 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 15 def system @system end |
#use_case ⇒ Object
Returns the value of attribute use_case.
15 16 17 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 15 def use_case @use_case end |
Class Method Details
.generate(ig_metadata, base_server_output_dir) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 7 def generate(, base_server_output_dir) # Server Test Groups ['approval', 'denial', 'pended'].each do |use_case| new(, use_case, base_server_output_dir, 'server').generate end end |
Instance Method Details
#base_metadata_file_name ⇒ Object
36 37 38 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 36 def 'metadata.yml' end |
#base_output_file_name ⇒ Object
32 33 34 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 32 def base_output_file_name "#{class_name.underscore}.rb" end |
#bundle_response_conformance_requirements_verified(operation) ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 113 def bundle_response_conformance_requirements_verified(operation) case "#{operation}_#{ig_version}" when 'submit_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@64', 'hl7.fhir.us.davinci-pas_2.0.1@100', 'hl7.fhir.us.davinci-pas_2.0.1@101', 'hl7.fhir.us.davinci-pas_2.0.1@102', 'hl7.fhir.us.davinci-pas_2.0.1@103', 'hl7.fhir.us.davinci-pas_2.0.1@107'] when 'inquire_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@131'] end end |
#bundle_validation_test_description(operation, type) ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 182 def bundle_validation_test_description(operation, type) <<~DESCRIPTION #{if simulation_verification?(type) "#{description_user_input_validation}\n" end}This test validates the conformity of the #{simulation_verification?(type) ? 'user input' : "server's response"} to the #{profile_link(operation, type)} profile#{simulation_verification?(type) ? ', ensuring subsequent tests can accurately simulate content.' : '.'} It also checks that other conformance requirements defined in the [PAS Formal Specification](https://hl7.org/fhir/us/davinci-pas/#{ig_version_for_link}/specification.html), such as the presence of all referenced instances within the bundle and the conformance of those instances to the appropriate profiles, are met. It verifies the presence of mandatory elements and that elements with required bindings contain appropriate values. CodeableConcept element bindings will fail if none of their codings have a code/system belonging to the bound ValueSet. Quantity, Coding, and code element bindings will fail if their code/system are not found in the valueset. Note that because X12 value sets are not public, elements bound to value sets containing X12 codes are not validated.#{"\n\n#{description_extension_limitation}" if ig_version == 'v2.0.1'} DESCRIPTION end |
#bundle_validation_test_title(operation, type) ⇒ Object
169 170 171 172 173 174 175 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 169 def bundle_validation_test_title(operation, type) if simulation_verification?(type) "Provided $#{operation} Request Bundle is conformant" else "Server $#{operation} Response Bundle is conformant" end end |
#class_name ⇒ Object
40 41 42 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 40 def class_name "PAS#{system.capitalize}#{use_case.camelize}UseCaseGroup" end |
#description ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 124 def description case system when 'server' case use_case when 'approval' <<~DESCRIPTION Demonstrate the ability of the server to respond to a prior authorization request with an `approved` decision. DESCRIPTION when 'denial' <<~DESCRIPTION Demonstrate the ability of the server to respond to a prior authorization request with a `denied` decision. DESCRIPTION when 'pended' if ig_version == 'v2.2.1' <<~DESCRIPTION Demonstrate a complete prior authorization workflow including a period during which the final decision is pending. This includes demonstrating the ability of the server to - Respond to a prior authorization request with a `pended` status. - Accept a Subscription creation request and send a full-resource notification when the pended claim has been finalized. DESCRIPTION else <<~DESCRIPTION Demonstrate a complete prior authorization workflow including a period during which the final decision is pending. This includes demonstrating the ability of the server to - Respond to a prior authorization request with a `pended` status. - Accept a Subscription creation request and send a notification when the pended claim has been finalized. - Respond to a subsequent inquiry request with a final decision for the request. DESCRIPTION end end end end |
#description_extension_limitation ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 207 def description_extension_limitation <<~EXTENSION_LIMITATION **Limitations** Due to recognized errors in the PAS IG around extension context definitions, this test may not pass due to spurious errors of the form "The extension [extension url] is not allowed at this point". See [this issue](https://github.com/inferno-framework/davinci-pas-test-kit/issues/11) for additional details. EXTENSION_LIMITATION end |
#description_user_input_validation ⇒ Object
219 220 221 222 223 224 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 219 def description_user_input_validation <<~USER_INPUT_INTRO **USER INPUT VALIDATION**: This test validates input provided by the user instead of the system under test. Errors encountered will be treated as a skip instead of a failure. USER_INPUT_INTRO end |
#generate ⇒ Object
83 84 85 86 87 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 83 def generate FileUtils.mkdir_p(base_output_dir) File.write(output_file_name, output) .add_use_case_groups(group_id, base_output_file_name) end |
#group_id ⇒ Object
60 61 62 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 60 def group_id "pas_#{system}_#{.reformatted_version}_#{use_case}_use_case" end |
#ig_version ⇒ Object
64 65 66 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 64 def ig_version .ig_version end |
#ig_version_for_id ⇒ Object
68 69 70 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 68 def ig_version_for_id .reformatted_version end |
#ig_version_for_link ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 72 def ig_version_for_link case ig_version when 'v2.0.1' 'STU2' when 'v2.2.1' '2.2.1' else raise "Implement link string for ig version #{ig_version}" end end |
#module_name ⇒ Object
44 45 46 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 44 def module_name "DaVinciPAS#{.reformatted_version.upcase}" end |
#notification_conformance_requirements_verified ⇒ Object
106 107 108 109 110 111 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 106 def notification_conformance_requirements_verified case ig_version when 'v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@145'] end end |
#notification_delivery_requirements_verified ⇒ Object
99 100 101 102 103 104 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 99 def notification_delivery_requirements_verified case ig_version when 'v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@141'] end end |
#operation_requirements_verified(operation) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 89 def operation_requirements_verified(operation) case "#{operation}_#{ig_version}" when 'submit_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@5', 'hl7.fhir.us.davinci-pas_2.0.1@66', 'hl7.fhir.us.davinci-pas_2.0.1@111', 'hl7.fhir.us.davinci-pas_2.0.1@136', 'hl7.fhir.us.davinci-pas_2.0.1@207'] when 'inquire_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@5', 'hl7.fhir.us.davinci-pas_2.0.1@111', 'hl7.fhir.us.davinci-pas_2.0.1@208'] end end |
#output ⇒ Object
28 29 30 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 28 def output @output ||= ERB.new(template, trim_mode: '-').result(binding) end |
#output_file_name ⇒ Object
52 53 54 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 52 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#profile_identifier(profile_metadata) ⇒ Object
56 57 58 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 56 def profile_identifier() .snake_case_for_profile() end |
#profile_link(operation, type) ⇒ Object
177 178 179 180 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 177 def profile_link(operation, type) "[#{PASConstants.bundle_profile_name_for_operation_and_type(operation, type)}]" \ "(#{PASConstants.bundle_profile_url_for_operation_and_type(operation, type)}|#{ig_version})" end |
#simulation_verification?(type) ⇒ Boolean
165 166 167 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 165 def simulation_verification?(type) type == 'request' end |
#template ⇒ Object
24 25 26 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 24 def template @template ||= File.read(File.join(__dir__, 'templates', 'use_case_group.rb.erb')) end |
#title ⇒ Object
48 49 50 |
# File 'lib/davinci_pas_test_kit/generator/use_case_group_generator.rb', line 48 def title "Successful #{use_case.capitalize} Workflow" end |