Class: Crucible::Tests::ConnectathonCarePlanTrackTest

Inherits:
BaseSuite show all
Defined in:
lib/tests/suites/connectathon_care_plan_track.rb

Constant Summary

Constants inherited from BaseSuite

BaseSuite::EXCLUDED_RESOURCES

Constants inherited from BaseTest

BaseTest::BASE_SPEC_LINK, BaseTest::JSON_FIELDS, BaseTest::METADATA_FIELDS, BaseTest::REST_SPEC_LINK, BaseTest::STATUS

Instance Attribute Summary

Attributes inherited from BaseTest

#category, #tags, #tests_subset, #warnings

Instance Method Summary collapse

Methods inherited from BaseSuite

#build_messages, #collect_metadata, fhir_resources, #links, #metadata, #parse_operation_outcome, #requires, #resource_category, test, #title, #validates

Methods inherited from BaseTest

#author, #details, #execute, #execute_test_method, #execute_test_methods, #ignore_client_exception, #multiserver, #requires_authorization, #tests, #warning

Methods included from Assertions

#assert, #assert_bundle_entry_count, #assert_bundle_response, #assert_bundle_transactions_okay, #assert_equal, #assert_etag_present, #assert_last_modified_present, #assert_minimum, #assert_navigation_links, #assert_operator, #assert_resource_content_type, #assert_resource_type, #assert_response_bad, #assert_response_code, #assert_response_conflict, #assert_response_created, #assert_response_gone, #assert_response_not_found, #assert_response_ok, #assert_valid_content_location_present, #assert_valid_profile, #assert_valid_resource_content_type_present, #assertion_negated, #skip

Constructor Details

#initialize(client1, client2 = nil) ⇒ ConnectathonCarePlanTrackTest

Returns a new instance of ConnectathonCarePlanTrackTest.



69
70
71
72
73
# File 'lib/tests/suites/connectathon_care_plan_track.rb', line 69

def initialize(client1, client2=nil)
  super(client1, client2)
  @tags.append('connectathon')
  @category = {id: 'connectathon', title: 'Connectathon'}
end

Instance Method Details

#description ⇒ Object



9
10
11
# File 'lib/tests/suites/connectathon_care_plan_track.rb', line 9

def description
  'This track is intended to advance the maturity of FHIR resources for care planning: CarePlan, CareTeam, Goal, Condition, and others'
end

#id ⇒ Object



5
6
7
# File 'lib/tests/suites/connectathon_care_plan_track.rb', line 5

def id
  'Connectathon Care Plan Track'
end

#setup ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/tests/suites/connectathon_care_plan_track.rb', line 13

def setup
  @resources = Crucible::Tests::ResourceGenerator
  @records = {}

  patient = @resources.generate(FHIR::Patient, 3)
  create_object(patient, "patient")

  @num_care_plans = rand(2..5)

  # Create some generic care plans, with a subject and no categories
  @num_care_plans.times do |t|
    care_plan = @resources.generate(FHIR::CarePlan, 3)
    care_plan.subject = patient.to_reference
    care_plan.category = []
    create_object(care_plan, "care_plan_#{t}")
  end

  # Create some cancer-category care plans
  @num_cancer_care_plans = rand(1..3)
  @cancer_care_plan_category = FHIR::CodeableConcept.new(text: "Cancer care plan")
  @cancer_care_plan_category.coding = FHIR::Coding.new(code: "395082007", system: "http://snomed.info/sct", display: "Cancer care plan")
  @num_cancer_care_plans.times do |t|
    care_plan = @resources.generate(FHIR::CarePlan, 3)
    care_plan.subject = patient.to_reference
    care_plan.category = [@cancer_care_plan_category]
    create_object(care_plan, "cancer_care_plan_#{t}")
  end

  # Create some care teams for a patient
  @num_care_teams = rand(1..3)
  @num_care_teams.times do |t|
    care_team = @resources.generate(FHIR::CareTeam, 3)
    care_team.subject = patient.to_reference
    create_object(care_team, "care_team_#{t}")
  end

  # Create some care teams with a specific Practitioner
  @num_practitioner_care_teams = rand(2..4)
  care_team_practitioner = @resources.generate(FHIR::Practitioner, 3)
  create_object(care_team_practitioner, "care_team_practitioner")
  @num_practitioner_care_teams.times do |t|
    care_team = @resources.generate(FHIR::CareTeam, 3)
    care_team.subject = patient.to_reference
    participant = FHIR::CareTeam::Participant.new
    participant.member = @records['care_team_practitioner'].to_reference
    care_team.participant = [participant]
    create_object(care_team, "practitioner_care_team_#{t}")
  end
end

#teardown ⇒ Object



63
64
65
66
67
# File 'lib/tests/suites/connectathon_care_plan_track.rb', line 63

def teardown
  @records.each_value do |value|
    @client.destroy(value.class, value.id)
  end
end