Class: DaVinciPDexTestKit::PDexPayerServer::MemberMatchRequestLocalReferencesValidation

Inherits:
Inferno::Test
  • Object
show all
Defined in:
lib/davinci_pdex_test_kit/pdex_payer_server/member_match_request_local_references_validation.rb

Overview

Factorized test for Member Match Request Profile local references on PDex v2.0.0 and HRex v1.0.0.

See hl7.org/fhir/us/davinci-hrex/STU1/OperationDefinition-member-match.html#resolving-parameter-references

Inputs

member_match_request - Optional: FHIR Parameters resource JSON text

Outputs

(none)

Required Config

(none)

Required Scratch

(none)

Notes

Skips if no input provided. This test does not validate all requirements of a Member Match Request resource.

Instance Method Summary collapse

Instance Method Details

#assert_local_patient_references(member_match_request_parameters) ⇒ Object

Parameters:

  • member_match_request_parameters (FHIR::Parameters)


44
45
46
47
48
49
50
51
52
# File 'lib/davinci_pdex_test_kit/pdex_payer_server/member_match_request_local_references_validation.rb', line 44

def assert_local_patient_references(member_match_request_parameters)
  # $member-match has references requirements on its Parameters profile not coded as FHIR constraints
  # see https://hl7.org/fhir/us/davinci-hrex/STU1/OperationDefinition-member-match.html#resolving-parameter-references
  parameter_patient_id = member_match_request_parameters.parameter.find{|p| p.name== 'MemberPatient'}.resource.id
  assert member_match_request_parameters.parameter.find{|p| p.name== 'Consent'}&.resource&.patient&.reference == "Patient/#{parameter_patient_id}",
    "The reference to Patient resource in Consent parameter must be a local reference referring to MemberPatient with matching id"
  assert member_match_request_parameters.parameter.find{|p| p.name== 'CoverageToMatch'}&.resource&.beneficiary&.reference == "Patient/#{parameter_patient_id}",
    "The reference to Patient resource in CoverageToMatch parameter must be a local reference referring to MemberPatient with matching id"
end