Class: DaVinciPASTestKit::PasClaimResponseDecisionTest
- Inherits:
-
Inferno::Test
- Object
- Inferno::Test
- DaVinciPASTestKit::PasClaimResponseDecisionTest
- Defined in:
- lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb
Instance Method Summary collapse
- #load_response_bundles ⇒ Object
- #operation ⇒ Object
- #response_has_expected_adjudication_code?(response_bundle) ⇒ Boolean
- #target_adjudication_code ⇒ Object
- #use_case ⇒ Object
Instance Method Details
#load_response_bundles ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb', line 46 def load_response_bundles requests = load_tagged_requests(DaVinciPASTestKit.use_case_tag(use_case), DaVinciPASTestKit.operation_tag(operation)) resources = requests.map(&:response_body).uniq.map do |response_body| FHIR.from_contents(response_body) rescue StandardError nil end.compact resources.select { |response| response.is_a?(FHIR::Bundle) } # rubocop:disable Style/SelectByKind end |
#operation ⇒ Object
17 18 19 |
# File 'lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb', line 17 def operation config.[:operation] end |
#response_has_expected_adjudication_code?(response_bundle) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb', line 25 def response_has_expected_adjudication_code?(response_bundle) response_bundle.resourceType == 'Bundle' && response_bundle.entry.any? do |entry| entry.resource&.resourceType == 'ClaimResponse' && entry.resource.item.any? do |item| item.adjudication.any? do |adjudication| adjudication.extension.any? do |adjudication_ext| next unless adjudication_ext.url == 'http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-reviewAction' adjudication_ext.extension.any? do |review_action_ext| next unless review_action_ext.url == 'http://hl7.org/fhir/us/davinci-pas/StructureDefinition/extension-reviewActionCode' review_action_ext.valueCodeableConcept&.coding&.any? do |coding| coding.system == 'https://codesystem.x12.org/005010/306' && coding.code == target_adjudication_code end end end end end end end |
#target_adjudication_code ⇒ Object
21 22 23 |
# File 'lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb', line 21 def target_adjudication_code @target_adjudication_code ||= PASConstants::X12_ADJUDICATION_CODES[use_case.to_sym] end |
#use_case ⇒ Object
13 14 15 |
# File 'lib/davinci_pas_test_kit/server/pas_claim_response_decision_test.rb', line 13 def use_case config.[:use_case] end |