Module: DaVinciDTRTestKit::Fixtures

Extended by:
Fixtures
Included in:
Fixtures
Defined in:
lib/davinci_dtr_test_kit/fixtures.rb

Constant Summary collapse

FIXTURE_CONFIG =

Ideally the groups and/or tests would define which fixtures they use and this module would simply be a provider of whatever fixture is requested. But the MockPayer needs to determine which questionnaire package belongs to each group, so this is a straighforward way to facilitate that.

[
  {
    group_ids: [
      'dtr_smart_app_resp_workflow',
      'dtr_full_ehr_questionnaire_workflow'
    ],
    questionnaire_package: File.join('respiratory_assist_device', 'questionnaire_package.json'),
    questionnaire_response: File.join('respiratory_assist_device', 'pre_populated_questionnaire_response.json')
  },
  {
    group_ids: [
      'dtr_smart_app_static_dinner_workflow',
      'dtr_full_ehr_static_dinner_workflow'
    ],
    questionnaire_package: File.join('dinner_static', 'questionnaire_dinner_order_static.json'),
    questionnaire_response: File.join('dinner_static', 'questionnaire_response_dinner_order_static.json')
  },
  {
    group_ids: [
      'dtr_full_ehr_adaptive_retrieval',
      'dtr_smart_app_adaptive_retrieval'
    ],
    questionnaire_package: File.join('dinner_adaptive', 'questionnaire_dinner_order_adaptive.json'),
    next_question: File.join('dinner_adaptive', 'dinner_order_adaptive_next_question_initial.json')
  },
  {
    group_ids: [
      'dtr_adaptive_followup_questions'
    ],
    next_question: {
      bean_burrito: File.join('dinner_adaptive', 'dinner_order_adaptive_next_question_burrito.json'),
      hamburger: File.join('dinner_adaptive', 'dinner_order_adaptive_next_question_hamburger.json')
    }
  }
].freeze

Instance Method Summary collapse

Instance Method Details

#next_question_for_test(full_test_id, option = nil) ⇒ Object

full_test_id needs to be the long inferno-generated ID that includes hyphenated ancestor IDs



52
53
54
# File 'lib/davinci_dtr_test_kit/fixtures.rb', line 52

def next_question_for_test(full_test_id, option = nil)
  get_fixture(full_test_id, :next_question, option)
end

#questionnaire_for_test(full_test_id) ⇒ Object

full_test_id needs to be the long inferno-generated ID that includes hyphenated ancestor IDs



62
63
64
# File 'lib/davinci_dtr_test_kit/fixtures.rb', line 62

def questionnaire_for_test(full_test_id)
  questionnaire_package_for_test(full_test_id)&.entry&.find { |e| e.resource.is_a?(FHIR::Questionnaire) }&.resource
end

#questionnaire_package_for_test(full_test_id) ⇒ Object

full_test_id needs to be the long inferno-generated ID that includes hyphenated ancestor IDs



47
48
49
# File 'lib/davinci_dtr_test_kit/fixtures.rb', line 47

def questionnaire_package_for_test(full_test_id)
  get_fixture(full_test_id, :questionnaire_package)
end

#questionnaire_response_for_test(full_test_id) ⇒ Object

full_test_id needs to be the long inferno-generated ID that includes hyphenated ancestor IDs



57
58
59
# File 'lib/davinci_dtr_test_kit/fixtures.rb', line 57

def questionnaire_response_for_test(full_test_id)
  get_fixture(full_test_id, :questionnaire_response)
end