davinci_pas_test_kit 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/davinci_pas_test_kit/client_suite.rb +289 -0
  4. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/claim_status/pas_claim_status_test.rb +109 -0
  5. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_response_attest.rb +39 -0
  6. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_test.rb +38 -0
  7. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_denial_submit_response_attest.rb +38 -0
  8. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_denial_submit_test.rb +43 -0
  9. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_inquire_must_support_test.rb +51 -0
  10. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_pended_inquire_response_attest.rb +39 -0
  11. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_pended_inquire_test.rb +35 -0
  12. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_pended_submit_response_attest.rb +39 -0
  13. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_pended_submit_test.rb +43 -0
  14. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_submit_must_support_test.rb +57 -0
  15. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_token_request_test.rb +31 -0
  16. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_token_validation_test.rb +18 -0
  17. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/error_tests/nonconformant_pas_bundle.json +16 -0
  18. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/error_tests/pas_inquiry_error_test.rb +38 -0
  19. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/error_tests/pas_submission_error_test.rb +56 -0
  20. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/device_request_metadata.yml +112 -0
  21. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/medication_request_metadata.yml +183 -0
  22. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/nutrition_order_metadata.yml +109 -0
  23. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_client_must_support_requirement_test.rb +117 -0
  24. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_server_must_support_requirement_test.rb +116 -0
  25. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/service_request_metadata.yml +148 -0
  26. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_approval_group.rb +26 -0
  27. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_authentication_group.rb +49 -0
  28. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_denial_group.rb +41 -0
  29. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_pended_group.rb +56 -0
  30. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_error_group.rb +20 -0
  31. data/lib/davinci_pas_test_kit/ext/inferno_core/record_response_route.rb +98 -0
  32. data/lib/davinci_pas_test_kit/ext/inferno_core/request.rb +19 -0
  33. data/lib/davinci_pas_test_kit/ext/inferno_core/runnable.rb +18 -0
  34. data/lib/davinci_pas_test_kit/fhir_resource_navigation.rb +72 -0
  35. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_inquiry_request_beneficiary_must_support_test.rb +75 -0
  36. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_submit_request_beneficiary_must_support_test.rb +75 -0
  37. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/metadata.yml +162 -0
  38. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_inquiry_request_beneficiary_must_support_test.rb +75 -0
  39. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_inquiry_response_beneficiary_must_support_test.rb +75 -0
  40. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_submit_request_beneficiary_must_support_test.rb +75 -0
  41. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_submit_response_beneficiary_must_support_test.rb +75 -0
  42. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb +67 -0
  43. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim/metadata.yml +577 -0
  44. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/claim_inquiry_operation_test.rb +57 -0
  45. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/client_inquiry_request_claim_inquiry_must_support_test.rb +95 -0
  46. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/metadata.yml +516 -0
  47. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/server_inquiry_request_claim_inquiry_must_support_test.rb +95 -0
  48. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_update/client_submit_request_claim_update_must_support_test.rb +102 -0
  49. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_update/metadata.yml +591 -0
  50. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_update/server_submit_request_claim_update_must_support_test.rb +102 -0
  51. data/lib/davinci_pas_test_kit/generated/v2.0.1/claiminquiryresponse/metadata.yml +311 -0
  52. data/lib/davinci_pas_test_kit/generated/v2.0.1/claiminquiryresponse/server_inquiry_response_claiminquiryresponse_must_support_test.rb +73 -0
  53. data/lib/davinci_pas_test_kit/generated/v2.0.1/claimresponse/metadata.yml +318 -0
  54. data/lib/davinci_pas_test_kit/generated/v2.0.1/claimresponse/server_submit_response_claimresponse_must_support_test.rb +75 -0
  55. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_denial_pas_response_bundle_validation_test.rb +53 -0
  56. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_pas_request_bundle_validation_test.rb +55 -0
  57. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_pended_pas_inquiry_request_bundle_validation_test.rb +55 -0
  58. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_pended_pas_response_bundle_validation_test.rb +53 -0
  59. data/lib/davinci_pas_test_kit/generated/v2.0.1/communication_request/metadata.yml +130 -0
  60. data/lib/davinci_pas_test_kit/generated/v2.0.1/communication_request/server_submit_response_communication_request_must_support_test.rb +58 -0
  61. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/client_inquiry_request_coverage_must_support_test.rb +55 -0
  62. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/client_submit_request_coverage_must_support_test.rb +55 -0
  63. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/metadata.yml +111 -0
  64. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/server_inquiry_request_coverage_must_support_test.rb +55 -0
  65. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/server_submit_request_coverage_must_support_test.rb +55 -0
  66. data/lib/davinci_pas_test_kit/generated/v2.0.1/device_request/client_submit_request_device_request_must_support_test.rb +51 -0
  67. data/lib/davinci_pas_test_kit/generated/v2.0.1/device_request/metadata.yml +112 -0
  68. data/lib/davinci_pas_test_kit/generated/v2.0.1/device_request/server_submit_request_device_request_must_support_test.rb +51 -0
  69. data/lib/davinci_pas_test_kit/generated/v2.0.1/encounter/client_submit_request_encounter_must_support_test.rb +67 -0
  70. data/lib/davinci_pas_test_kit/generated/v2.0.1/encounter/metadata.yml +213 -0
  71. data/lib/davinci_pas_test_kit/generated/v2.0.1/encounter/server_submit_request_encounter_must_support_test.rb +67 -0
  72. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/client_inquiry_request_insurer_must_support_test.rb +60 -0
  73. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/client_submit_request_insurer_must_support_test.rb +60 -0
  74. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/metadata.yml +104 -0
  75. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_inquiry_request_insurer_must_support_test.rb +60 -0
  76. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_inquiry_response_insurer_must_support_test.rb +60 -0
  77. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_submit_request_insurer_must_support_test.rb +60 -0
  78. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_submit_response_insurer_must_support_test.rb +60 -0
  79. data/lib/davinci_pas_test_kit/generated/v2.0.1/medication_request/client_submit_request_medication_request_must_support_test.rb +61 -0
  80. data/lib/davinci_pas_test_kit/generated/v2.0.1/medication_request/metadata.yml +183 -0
  81. data/lib/davinci_pas_test_kit/generated/v2.0.1/medication_request/server_submit_request_medication_request_must_support_test.rb +61 -0
  82. data/lib/davinci_pas_test_kit/generated/v2.0.1/metadata.yml +5253 -0
  83. data/lib/davinci_pas_test_kit/generated/v2.0.1/nutrition_order/client_submit_request_nutrition_order_must_support_test.rb +53 -0
  84. data/lib/davinci_pas_test_kit/generated/v2.0.1/nutrition_order/metadata.yml +109 -0
  85. data/lib/davinci_pas_test_kit/generated/v2.0.1/nutrition_order/server_submit_request_nutrition_order_must_support_test.rb +53 -0
  86. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_client_inquiry_must_support_use_case_group.rb +51 -0
  87. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_client_submit_must_support_use_case_group.rb +61 -0
  88. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/client_inquiry_request_pas_inquiry_request_bundle_must_support_test.rb +53 -0
  89. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/metadata.yml +77 -0
  90. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/server_inquiry_request_pas_inquiry_request_bundle_must_support_test.rb +53 -0
  91. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/server_pas_inquiry_request_bundle_validation_test.rb +83 -0
  92. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_response_bundle/metadata.yml +67 -0
  93. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_response_bundle/server_inquiry_response_pas_inquiry_response_bundle_must_support_test.rb +52 -0
  94. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_response_bundle/server_pas_inquiry_response_bundle_validation_test.rb +80 -0
  95. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/client_submit_request_pas_request_bundle_must_support_test.rb +53 -0
  96. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/metadata.yml +77 -0
  97. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/server_pas_request_bundle_validation_test.rb +83 -0
  98. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/server_submit_request_pas_request_bundle_must_support_test.rb +53 -0
  99. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_response_bundle/metadata.yml +71 -0
  100. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_response_bundle/server_pas_response_bundle_validation_test.rb +80 -0
  101. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_response_bundle/server_submit_response_pas_response_bundle_must_support_test.rb +52 -0
  102. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_approval_use_case_group.rb +59 -0
  103. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_denial_use_case_group.rb +59 -0
  104. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_must_support_use_case_group.rb +265 -0
  105. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_pended_use_case_group.rb +84 -0
  106. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/client_inquiry_request_practitioner_must_support_test.rb +53 -0
  107. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/client_submit_request_practitioner_must_support_test.rb +53 -0
  108. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/metadata.yml +74 -0
  109. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_inquiry_request_practitioner_must_support_test.rb +53 -0
  110. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_inquiry_response_practitioner_must_support_test.rb +53 -0
  111. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_submit_request_practitioner_must_support_test.rb +53 -0
  112. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_submit_response_practitioner_must_support_test.rb +53 -0
  113. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/client_inquiry_request_practitioner_role_must_support_test.rb +49 -0
  114. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/client_submit_request_practitioner_role_must_support_test.rb +49 -0
  115. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/metadata.yml +81 -0
  116. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_inquiry_request_practitioner_role_must_support_test.rb +49 -0
  117. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_inquiry_response_practitioner_role_must_support_test.rb +49 -0
  118. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_submit_request_practitioner_role_must_support_test.rb +49 -0
  119. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_submit_response_practitioner_role_must_support_test.rb +49 -0
  120. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/client_inquiry_request_requestor_must_support_test.rb +63 -0
  121. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/client_submit_request_requestor_must_support_test.rb +63 -0
  122. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/metadata.yml +107 -0
  123. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_inquiry_request_requestor_must_support_test.rb +63 -0
  124. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_inquiry_response_requestor_must_support_test.rb +63 -0
  125. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_submit_request_requestor_must_support_test.rb +63 -0
  126. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_submit_response_requestor_must_support_test.rb +63 -0
  127. data/lib/davinci_pas_test_kit/generated/v2.0.1/resource_list.rb +54 -0
  128. data/lib/davinci_pas_test_kit/generated/v2.0.1/server_suite.rb +236 -0
  129. data/lib/davinci_pas_test_kit/generated/v2.0.1/service_request/client_submit_request_service_request_must_support_test.rb +53 -0
  130. data/lib/davinci_pas_test_kit/generated/v2.0.1/service_request/metadata.yml +148 -0
  131. data/lib/davinci_pas_test_kit/generated/v2.0.1/service_request/server_submit_request_service_request_must_support_test.rb +53 -0
  132. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/client_inquiry_request_subscriber_must_support_test.rb +74 -0
  133. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/client_submit_request_subscriber_must_support_test.rb +74 -0
  134. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/metadata.yml +159 -0
  135. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/server_inquiry_request_subscriber_must_support_test.rb +74 -0
  136. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/server_submit_request_subscriber_must_support_test.rb +74 -0
  137. data/lib/davinci_pas_test_kit/generated/v2.0.1/task/metadata.yml +192 -0
  138. data/lib/davinci_pas_test_kit/generated/v2.0.1/task/server_inquiry_response_task_must_support_test.rb +61 -0
  139. data/lib/davinci_pas_test_kit/generated/v2.0.1/task/server_submit_response_task_must_support_test.rb +61 -0
  140. data/lib/davinci_pas_test_kit/generator/group_generator.rb +440 -0
  141. data/lib/davinci_pas_test_kit/generator/group_metadata.rb +73 -0
  142. data/lib/davinci_pas_test_kit/generator/group_metadata_extractor.rb +244 -0
  143. data/lib/davinci_pas_test_kit/generator/ig_loader.rb +78 -0
  144. data/lib/davinci_pas_test_kit/generator/ig_metadata.rb +66 -0
  145. data/lib/davinci_pas_test_kit/generator/ig_metadata_extractor.rb +54 -0
  146. data/lib/davinci_pas_test_kit/generator/ig_resources.rb +74 -0
  147. data/lib/davinci_pas_test_kit/generator/must_support_check_profiles.rb +86 -0
  148. data/lib/davinci_pas_test_kit/generator/must_support_metadata_extractor.rb +327 -0
  149. data/lib/davinci_pas_test_kit/generator/must_support_test_generator.rb +155 -0
  150. data/lib/davinci_pas_test_kit/generator/naming.rb +50 -0
  151. data/lib/davinci_pas_test_kit/generator/operation_test_generator.rb +136 -0
  152. data/lib/davinci_pas_test_kit/generator/resource_list_generator.rb +59 -0
  153. data/lib/davinci_pas_test_kit/generator/suite_generator.rb +94 -0
  154. data/lib/davinci_pas_test_kit/generator/terminology_binding_metadata_extractor.rb +108 -0
  155. data/lib/davinci_pas_test_kit/generator/validation_test_generator.rb +181 -0
  156. data/lib/davinci_pas_test_kit/generator/value_extractor.rb +48 -0
  157. data/lib/davinci_pas_test_kit/generator.rb +80 -0
  158. data/lib/davinci_pas_test_kit/mock_server.rb +189 -0
  159. data/lib/davinci_pas_test_kit/must_support_test.rb +267 -0
  160. data/lib/davinci_pas_test_kit/pas_bundle_validation.rb +568 -0
  161. data/lib/davinci_pas_test_kit/tags.rb +7 -0
  162. data/lib/davinci_pas_test_kit/urls.rb +39 -0
  163. data/lib/davinci_pas_test_kit/user_input_response.rb +32 -0
  164. data/lib/davinci_pas_test_kit/validation_test.rb +58 -0
  165. data/lib/davinci_pas_test_kit/validator_suppressions.rb +143 -0
  166. data/lib/davinci_pas_test_kit/version.rb +5 -0
  167. data/lib/davinci_pas_test_kit.rb +2 -0
  168. metadata +281 -0
@@ -0,0 +1,440 @@
1
+ require_relative 'naming'
2
+
3
+ module DaVinciPASTestKit
4
+ class Generator
5
+ class GroupGenerator
6
+ class << self
7
+ def generate(ig_metadata, base_output_dir)
8
+ groups = ig_metadata.groups.select { |group| group.tests.present? }.reject do |group|
9
+ group.profile_name.include?('Base')
10
+ end
11
+ # Server Test Groups
12
+ ['approval', 'denial', 'pended', 'must_support'].each_with_index do |use_case, index|
13
+ new(ig_metadata, use_case, groups, base_output_dir, 'server', index.zero?).generate
14
+ end
15
+
16
+ # Client Test Groups
17
+ ['submit_must_support', 'inquiry_must_support'].each do |use_case|
18
+ new(ig_metadata, use_case, groups, base_output_dir, 'client', false).generate
19
+ end
20
+ end
21
+ end
22
+
23
+ attr_accessor :ig_metadata, :use_case, :groups, :base_output_dir, :first_generate, :system
24
+
25
+ def initialize(ig_metadata, use_case, groups, base_output_dir, system = 'server', first_generate = false)
26
+ self.ig_metadata = ig_metadata
27
+ self.use_case = use_case
28
+ self.groups = groups
29
+ self.base_output_dir = base_output_dir
30
+ self.system = system
31
+ self.first_generate = first_generate
32
+ end
33
+
34
+ def template
35
+ @template ||= File.read(File.join(__dir__, 'templates', 'group.rb.erb'))
36
+ end
37
+
38
+ def output
39
+ @output ||= ERB.new(template).result(binding)
40
+ end
41
+
42
+ def base_output_file_name
43
+ "#{class_name.underscore}.rb"
44
+ end
45
+
46
+ def base_metadata_file_name
47
+ 'metadata.yml'
48
+ end
49
+
50
+ def class_name
51
+ "PAS#{system.capitalize}#{use_case.camelize}UseCaseGroup"
52
+ end
53
+
54
+ def module_name
55
+ "DaVinciPAS#{groups.first.reformatted_version.upcase}"
56
+ end
57
+
58
+ def title
59
+ if use_case.include?('must_support')
60
+ return 'Submit Request Must Support' if system == 'client' && use_case.include?('submit')
61
+ return 'Inquiry Request Must Support' if system == 'client'
62
+
63
+ 'Demonstrate Element Support'
64
+ else
65
+ "Successful #{use_case.capitalize} Workflow"
66
+ end
67
+ end
68
+
69
+ def run_as_group
70
+ return false if use_case.include?('must_support') && system == 'server'
71
+
72
+ true
73
+ end
74
+
75
+ def output_file_name
76
+ File.join(base_output_dir, base_output_file_name)
77
+ end
78
+
79
+ def metadata_file_name(group)
80
+ File.join(base_output_dir, profile_identifier(group), base_metadata_file_name)
81
+ end
82
+
83
+ def profile_identifier(group_metadata)
84
+ Naming.snake_case_for_profile(group_metadata)
85
+ end
86
+
87
+ def group_id
88
+ "pas_#{system}_#{groups.first.reformatted_version}_#{use_case}_use_case"
89
+ end
90
+
91
+ def generate
92
+ File.write(output_file_name, output)
93
+ ig_metadata.add_use_case_groups(group_id, base_output_file_name)
94
+ return unless first_generate
95
+
96
+ groups.each do |group_metadata|
97
+ File.write(metadata_file_name(group_metadata), YAML.dump(group_metadata.to_hash))
98
+ end
99
+ end
100
+
101
+ def all_tests
102
+ @all_tests ||= groups.flat_map(&:tests).compact
103
+ end
104
+
105
+ def all_test_ids
106
+ @all_test_ids = all_tests.map { |test| test[:id] }.reject do |id|
107
+ id.include?('medication_request_must_support') || id.include?('service_request_must_support') ||
108
+ id.include?('device_request_must_support') || id.include?('nutrition_order_must_support')
109
+ end
110
+ end
111
+
112
+ def select_test_ids(include_patterns, exclude_patterns = [])
113
+ all_test_ids.select do |id|
114
+ include_conditions = include_patterns.all? { |pattern| id.include?(pattern) }
115
+ exclude_conditions = exclude_patterns.none? { |pattern| id.include?(pattern) }
116
+ include_conditions && exclude_conditions
117
+ end
118
+ end
119
+
120
+ def submit_request_validation_test_ids
121
+ @submit_request_validation_test_ids ||= select_test_ids(['request', 'validation_test'], ['inquiry', 'client'])
122
+ end
123
+
124
+ def inquiry_request_validation_test_ids
125
+ @inquiry_request_validation_test_ids ||= select_test_ids(['request', 'validation_test', 'inquiry'], ['client'])
126
+ end
127
+
128
+ def submit_response_validation_test_ids
129
+ @submit_response_validation_test_ids ||= select_test_ids(['response', 'validation_test'], ['inquiry', 'client'])
130
+ end
131
+
132
+ def inquiry_response_validation_test_ids
133
+ @inquiry_response_validation_test_ids ||= select_test_ids(['response', 'validation_test', 'inquiry'],
134
+ ['client'])
135
+ end
136
+
137
+ def submit_request_must_support_test_ids
138
+ @submit_request_must_support_test_ids ||= select_test_ids(['submit_request', 'must_support_test'], ['client'])
139
+ .unshift(pas_submit_must_support_requirement_test_id)
140
+ end
141
+
142
+ def client_submit_request_must_support_test_ids
143
+ @client_submit_request_must_support_test_ids ||= select_test_ids(
144
+ ['submit_request', 'must_support_test'],
145
+ ['server']
146
+ ).unshift(pas_client_must_support_test_id, pas_submit_must_support_requirement_test_id)
147
+ end
148
+
149
+ def inquiry_request_must_support_test_ids
150
+ @inquiry_request_must_support_test_ids ||= select_test_ids(['inquiry_request', 'must_support_test'], ['client'])
151
+ end
152
+
153
+ def client_inquiry_request_must_support_test_ids
154
+ @client_inquiry_request_must_support_test_ids ||= select_test_ids(
155
+ ['inquiry_request', 'must_support_test'],
156
+ ['server']
157
+ ).unshift(pas_client_must_support_test_id)
158
+ end
159
+
160
+ def submit_response_must_support_test_ids
161
+ @submit_response_must_support_test_ids ||= select_test_ids(['submit_response', 'must_support_test'])
162
+ end
163
+
164
+ def inquiry_response_must_support_test_ids
165
+ @inquiry_response_must_support_test_ids ||= select_test_ids(['inquiry_response', 'must_support_test'])
166
+ end
167
+
168
+ def submit_operation_test_ids
169
+ @submit_operation_test_ids ||= select_test_ids(['operation_test'], ['inquiry'])
170
+ end
171
+
172
+ def inquiry_operation_test_ids
173
+ @inquiry_operation_test_ids ||= select_test_ids(['operation_test', 'inquiry'])
174
+ end
175
+
176
+ def approval_denial_test_ids
177
+ submit_request_validation_test_ids + submit_operation_test_ids + submit_response_validation_test_ids
178
+ end
179
+
180
+ def grouped_approval_denial_test_ids
181
+ {
182
+ 'PAS Submit Operation' => approval_denial_test_ids,
183
+ 'PAS Status Check' => [claim_status_test_id]
184
+ }
185
+ end
186
+
187
+ def pended_test_ids
188
+ approval_denial_test_ids + inquiry_request_validation_test_ids +
189
+ inquiry_operation_test_ids + inquiry_response_validation_test_ids
190
+ end
191
+
192
+ def grouped_pended_test_ids
193
+ inquiry_operation = inquiry_request_validation_test_ids +
194
+ inquiry_operation_test_ids +
195
+ inquiry_response_validation_test_ids
196
+ inquiry_tests = {
197
+ 'PAS Inquiry Operation' => inquiry_operation
198
+ }
199
+
200
+ grouped_approval_denial_test_ids.merge(inquiry_tests)
201
+ end
202
+
203
+ def must_support_test_ids
204
+ pended_test_ids + submit_request_must_support_test_ids + submit_response_must_support_test_ids +
205
+ inquiry_request_must_support_test_ids + inquiry_response_must_support_test_ids
206
+ end
207
+
208
+ def grouped_must_support_test_ids
209
+ submit_tests = submit_request_validation_test_ids +
210
+ submit_operation_test_ids +
211
+ submit_response_validation_test_ids
212
+ inquiry_operation = inquiry_request_validation_test_ids +
213
+ inquiry_operation_test_ids +
214
+ inquiry_response_validation_test_ids
215
+ {
216
+ '$submit Element Support' => {
217
+ 'PAS Submit Operation' => submit_tests,
218
+ '[USER INPUT VALIDATION] Submit Request Must Support' => submit_request_must_support_test_ids,
219
+ 'Submit Response Must Support' => submit_response_must_support_test_ids
220
+ },
221
+ '$inquire Element Support' => {
222
+ 'PAS Inquiry Operation' => inquiry_operation,
223
+ '[USER INPUT VALIDATION] Inquiry Request Must Support' => inquiry_request_must_support_test_ids,
224
+ 'Inquiry Response Must Support' => inquiry_response_must_support_test_ids
225
+ }
226
+ }
227
+ end
228
+
229
+ def common_test_file_list(test_ids)
230
+ test_ids.map do |id|
231
+ test = all_tests.find { |t| t[:id] == id }
232
+ next unless test
233
+
234
+ group = groups.find { |grp| grp.tests.include?(test) }
235
+ name_without_suffix = test[:file_name].delete_suffix('.rb')
236
+ test_file = if name_without_suffix.start_with?('..')
237
+ name_without_suffix
238
+ else
239
+ "#{profile_identifier(group)}/#{name_without_suffix}"
240
+ end
241
+ test_file
242
+ end.compact
243
+ end
244
+
245
+ def approval_denial_test_file_list
246
+ common_test_file_list(approval_denial_test_ids) << claim_status_file_name
247
+ end
248
+
249
+ def pended_test_file_list
250
+ common_test_file_list(pended_test_ids) << claim_status_file_name
251
+ end
252
+
253
+ def must_support_test_file_list
254
+ common_test_file_list(must_support_test_ids).push(pas_submit_must_support_requirement_test_file)
255
+ end
256
+
257
+ def client_submit_request_must_support_test_file_list
258
+ common_test_file_list(client_submit_request_must_support_test_ids)
259
+ .push(pas_submit_must_support_requirement_test_file, pas_client_must_support_test_file)
260
+ end
261
+
262
+ def client_inquiry_request_must_support_test_file_list
263
+ common_test_file_list(client_inquiry_request_must_support_test_ids)
264
+ .push(pas_client_must_support_test_file)
265
+ end
266
+
267
+ def test_id_list
268
+ @test_id_list ||= if system == 'client'
269
+ if use_case == 'submit_must_support'
270
+ client_submit_request_must_support_test_ids
271
+ else
272
+ client_inquiry_request_must_support_test_ids
273
+ end
274
+ elsif use_case == 'approval' || use_case == 'denial'
275
+ grouped_approval_denial_test_ids
276
+ elsif use_case == 'pended'
277
+ grouped_pended_test_ids
278
+ else
279
+ grouped_must_support_test_ids
280
+ end
281
+ end
282
+
283
+ def test_file_list
284
+ @test_file_list ||= if system == 'client'
285
+ if use_case == 'submit_must_support'
286
+ client_submit_request_must_support_test_file_list
287
+ else
288
+ client_inquiry_request_must_support_test_file_list
289
+ end
290
+ elsif use_case == 'approval' || use_case == 'denial'
291
+ approval_denial_test_file_list
292
+ elsif use_case == 'pended'
293
+ pended_test_file_list
294
+ else
295
+ must_support_test_file_list
296
+ end
297
+ end
298
+
299
+ def claim_status_test_id
300
+ 'prior_auth_claim_status'
301
+ end
302
+
303
+ def claim_status_file_name
304
+ "../../custom_groups/#{ig_metadata.ig_version}/claim_status/pas_claim_status_test"
305
+ end
306
+
307
+ def rename_input?(test_id)
308
+ (test_id.include?('request') && test_id.include?('validation') && !test_id.include?('inquiry')) ||
309
+ test_id.include?('operation_test')
310
+ end
311
+
312
+ def must_support_rename_input?(test_id)
313
+ (test_id.include?('request') && test_id.include?('validation')) ||
314
+ test_id.include?('operation_test')
315
+ end
316
+
317
+ def alt_test_id(id, use_case)
318
+ "#{id}_#{use_case}"
319
+ end
320
+
321
+ def alt_request_input_name(use_case, request_type)
322
+ "#{use_case}_pa_#{request_type}_request_payload"
323
+ end
324
+
325
+ def alt_request_input_title(use_case, request_type)
326
+ if use_case == 'must_support'
327
+ "Additional PAS #{request_type.capitalize} Request Payloads"
328
+ else
329
+ "PAS #{request_type.capitalize} Request Payload for #{use_case.capitalize} Response"
330
+ end
331
+ end
332
+
333
+ def pas_submit_must_support_requirement_test_id
334
+ "pas_#{system}_submit_#{ig_metadata.reformatted_version}_must_support_requirement"
335
+ end
336
+
337
+ def pas_submit_must_support_requirement_test_file
338
+ "../../custom_groups/#{ig_metadata.ig_version}/must_support/pas_#{system}_must_support_requirement_test"
339
+ end
340
+
341
+ # Client tests initiation for must support: tests to allow the client to send $submit/$inquire requests in
342
+ # addition to any already sent in previous test groups for Inferno to evaluate coverage of must support elements.
343
+ def pas_client_must_support_test_id
344
+ request_type = use_case.include?('submit') ? 'submit' : 'inquire'
345
+ "pas_client_#{request_type}_#{ig_metadata.reformatted_version}_must_support_test"
346
+ end
347
+
348
+ def pas_client_must_support_test_file
349
+ request_type = use_case.include?('submit') ? 'submit' : 'inquire'
350
+ "../../custom_groups/#{ig_metadata.ig_version}/client_tests/pas_client_#{request_type}_must_support_test"
351
+ end
352
+
353
+ def description
354
+ case system
355
+ when 'server'
356
+ case use_case
357
+ when 'approval'
358
+ <<~DESCRIPTION
359
+ Demonstrate the ability of the server to respond to a prior
360
+ authorization request with an `approved` decision.
361
+ DESCRIPTION
362
+ when 'denial'
363
+ <<~DESCRIPTION
364
+ Demonstrate the ability of the server to respond to a prior
365
+ authorization request with an `denied` decision.
366
+ DESCRIPTION
367
+ when 'pended'
368
+ <<~DESCRIPTION
369
+ Demonstrate a complete prior authorization workflow including a period
370
+ during which the final decision is pending. This includes
371
+
372
+ - Demonstrating the ability of the server to respond to a prior
373
+ authorization request with an `pended` status.
374
+ - Demonstrating the ability of the server to respond to a subsequent
375
+ inquiry request with a final decision for the request
376
+ DESCRIPTION
377
+ else # must_support
378
+ <<~DESCRIPTION
379
+ Demonstrate the ability of the server to support all PAS-defined profiles
380
+ and the must support elements defined in them. This includes
381
+
382
+ - the ability to respond to prior authorization submission and inquiry
383
+ requests that contain all PAS-defined profiles and their must support
384
+ elements.
385
+ - the ability to include in those responses all PAS-defined profiles
386
+ and their must support elements.
387
+
388
+ In order to allow Inferno to observe and validate these criteria, testers
389
+ are required to provide a set of `$submit` and `$inquire` requests that
390
+ collectively both themselves contain and elicit server responses that contain
391
+ all PAS-defined profiles and their must support elements.
392
+ DESCRIPTION
393
+ end
394
+ when 'client'
395
+ if use_case.include?('submit')
396
+ <<~DESCRIPTION
397
+ Check that the client can demonstrate `$submit` requests that contain
398
+ all PAS-defined profiles and their must support elements.
399
+
400
+ For `$submit` requests, this includes the following profiles:
401
+
402
+ - [PAS Request Bundle](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-pas-request-bundle.html)
403
+ - [PAS Claim Update](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-claim-update.html)
404
+ - [PAS Coverage](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-coverage.html)
405
+ - [PAS Beneficiary Patient](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-beneficiary.html)
406
+ - [PAS Subscriber Patient](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-subscriber.html)
407
+ - [PAS Insurer Organization](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-insurer.html)
408
+ - [PAS Requestor Organization](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-requestor.html)
409
+ - [PAS Practitioner](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-practitioner.html)
410
+ - [PAS PractitionerRole](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-practitionerrole.html)
411
+ - [PAS Encounter](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-encounter.html)
412
+ - At least one of the following request profiles
413
+ - [PAS Device Request](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-devicerequest.html)
414
+ - [PAS Medication Request](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-medicationrequest.html)
415
+ - [PAS Nutrition Order](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-nutritionorder.html)
416
+ - [PAS Service Request](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-servicerequest.html)
417
+ DESCRIPTION
418
+ else # inquire
419
+ <<~DESCRIPTION
420
+ Check that the client can demonstrate `$inquire` requests that contain
421
+ all PAS-defined profiles and their must support elements.
422
+
423
+ For `$inquire` requests, this includes the following profiles:
424
+
425
+ - [PAS Inquiry Request Bundle](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-pas-inquiry-request-bundle.html)
426
+ - [PAS Claim Inquiry](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-claim-inquiry.html)
427
+ - [PAS Coverage](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-coverage.html)
428
+ - [PAS Beneficiary Patient](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-beneficiary.html)
429
+ - [PAS Subscriber Patient](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-subscriber.html)
430
+ - [PAS Insurer Organization](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-insurer.html)
431
+ - [PAS Requestor Organization](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-requestor.html)
432
+ - [PAS Practitioner](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-practitioner.html)
433
+ - [PAS PractitionerRole](https://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-practitionerrole.html)
434
+ DESCRIPTION
435
+ end
436
+ end
437
+ end
438
+ end
439
+ end
440
+ end
@@ -0,0 +1,73 @@
1
+ module DaVinciPASTestKit
2
+ class Generator
3
+ class GroupMetadata
4
+ ATTRIBUTES = %i[
5
+ name
6
+ class_name
7
+ version
8
+ reformatted_version
9
+ resource
10
+ conformance_expectation
11
+ profile_url
12
+ profile_name
13
+ profile_version
14
+ title
15
+ short_description
16
+ interactions
17
+ operations
18
+ required_concepts
19
+ must_supports
20
+ mandatory_elements
21
+ bindings
22
+ references
23
+ tests
24
+ id
25
+ file_name
26
+ delayed_references
27
+ ].freeze
28
+
29
+ ATTRIBUTES.each { |name| attr_accessor name }
30
+
31
+ def initialize(metadata)
32
+ metadata.each do |key, value|
33
+ raise "Unknown attribute #{key}" unless ATTRIBUTES.include? key
34
+
35
+ instance_variable_set(:"@#{key}", value)
36
+ end
37
+ end
38
+
39
+ def delayed?
40
+ !['Patient', 'Claim', 'ClaimResponse'].include?(resource)
41
+ end
42
+
43
+ def add_test(id:, file_name:)
44
+ self.tests ||= []
45
+
46
+ test_metadata = {
47
+ id:,
48
+ file_name:
49
+ }
50
+
51
+ self.tests << test_metadata
52
+ end
53
+
54
+ def to_hash
55
+ ATTRIBUTES.each_with_object({}) { |key, hash| hash[key] = send(key) unless send(key).nil? }
56
+ end
57
+
58
+ def add_delayed_references(delayed_profiles, ig_resources)
59
+ self.delayed_references =
60
+ references
61
+ .select { |reference| (reference[:profiles] & delayed_profiles).present? }
62
+ .map do |reference|
63
+ profile_urls = (reference[:profiles] & delayed_profiles)
64
+ delayed_resources = profile_urls.map { |url| ig_resources.resource_type_for_profile(url) }
65
+ {
66
+ path: reference[:path].gsub("#{resource}.", ''),
67
+ resources: delayed_resources
68
+ }
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end