Class: DaVinciCRDTestKit::V221::HookRequestCoverageVerificationTest
Constant Summary
Constants included
from ClientURLs
ClientURLs::SUITE_ID
Instance Method Summary
collapse
Methods included from ClientURLs
base_url, discovery_url, prefetch_subset_discovery_url, #suite_id
#appointment_book_prefetch_subset_url, #appointment_book_url, #discovery_url, #encounter_discharge_prefetch_subset_url, #encounter_discharge_url, #encounter_start_prefetch_subset_url, #encounter_start_url, #order_dispatch_prefetch_subset_url, #order_dispatch_url, #order_select_prefetch_subset_url, #order_select_url, #order_sign_prefetch_subset_url, #order_sign_url, #prefetch_subset_discovery_url
Methods included from BaseURLs
#inferno_base_url, #resume_fail_url, #resume_pass_url
#crd_interaction_group, #hook_name, #load_interaction_group_requests, #load_requests_for_cross_hook_analysis
#add_request_message, #parse_json_request_entity, #request_prefix, #requests_with_errors_prefix
Instance Method Details
#check_payer_request(request_body, request_index, expected_payer_org_id) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 75
def check_payer_request(request_body, request_index, expected_payer_org_id)
payer_request = load_payer_request_for_hook_request(request_body)
unless payer_request.present? && payer_request.status.to_s.starts_with?('2')
add_request_message('error',
"Inferno failed to retrieve the Coverage's payer during hook processing.",
request_index)
return
end
payer_resource = FHIR.from_contents(payer_request.response_body)
unless payer_resource.present?
add_request_message('error', 'Request for payer resource returned invalid FHIR data.', request_index)
return
end
if payer_resource.resourceType != 'Organization'
add_request_message('error', 'Payer for the Coverage is not an Organization: ' \
"got '#{payer_resource.resourceType}'", request_index)
end
if payer_resource.id != expected_payer_org_id
add_request_message('error', 'Payer for the Coverage has the wrong id: ' \
"expected '#{expected_payer_org_id}', got '#{payer_resource.id}'.",
request_index)
end
check_payer_resource_conformance(payer_resource, request_index)
end
|
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 103
def check_payer_resource_conformance(payer_resource, request_index)
validator_response_details = []
resource_is_valid?(resource: payer_resource, profile_url: 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-organization|2.2.1',
add_messages_to_runnable: false, validator_response_details:)
validator_response_details.each do |issue|
next if issue.filtered
add_request_message(issue.severity, issue.message, request_index)
end
end
|
#load_payer_request_for_hook_request(request_body) ⇒ Object
70
71
72
73
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 70
def load_payer_request_for_hook_request(request_body)
hook_data_fetch_tag = TagMethods.hook_instance_data_fetch_tag(request_body['hookInstance'])
load_tagged_requests(PAYER_ORG_FETCH_TAG, hook_data_fetch_tag, DATA_FETCH_TAG).first
end
|
#payer_org_id_for_request(request) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 62
def payer_org_id_for_request(request)
if prefetch_target(request) == :subset
subset_prefetch_service_organization_id
else
complete_prefetch_service_organization_id
end
end
|
#prefetch_target(request) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 54
def prefetch_target(request)
if request.url.include?(PREFETCH_SUBSET_PREFIX)
:subset
else
:complete
end
end
|
#prefetched_coverage(request_body) ⇒ Object
153
154
155
156
157
|
# File 'lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb', line 153
def prefetched_coverage(request_body)
coverage = request_body.dig('prefetch', 'coverage', 'entry', 0, 'resource')
coverage = request_body.dig('prefetch', 'cov', 'entry', 0, 'resource') unless coverage.present?
coverage
end
|