Class: Crucible::Tests::ConnectathonFetchPatientRecordTest
Constant Summary
Constants inherited from BaseSuite
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
-
#create_patient_record ⇒ Object
[‘GET’,‘POST’].
- #description ⇒ Object
- #id ⇒ Object
-
#initialize(client1, client2 = nil) ⇒ ConnectathonFetchPatientRecordTest
constructor
A new instance of ConnectathonFetchPatientRecordTest.
- #setup ⇒ Object
- #teardown ⇒ Object
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) ⇒ ConnectathonFetchPatientRecordTest
Returns a new instance of ConnectathonFetchPatientRecordTest.
13 14 15 16 17 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 13 def initialize(client1, client2=nil) super(client1, client2) @tags.append('connectathon') @category = {id: 'connectathon', title: 'Connectathon'} end |
Instance Method Details
#create_patient_record ⇒ Object
- ‘GET’,‘POST’
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 316 def create_patient_record @ids_count = { 'FHIR::Organization' => [], 'FHIR::Practitioner' => [], 'FHIR::Patient' => [], 'FHIR::Condition' => [], 'FHIR::Observation' => [], 'FHIR::DiagnosticReport' => [], 'FHIR::Encounter' => [], 'FHIR::Procedure' => [] } @organization_1.id = nil @org1_reply = @client.create @organization_1 @org1_id = @org1_reply.id @organization_1.id = @org1_id @ids_count[FHIR::Organization.to_s] << @org1_id assert_response_ok(@org1_reply) @organization_2.id = nil @org2_reply = @client.create @organization_2 @org2_id = @org2_reply.id @organization_2.id = @org2_id @ids_count[FHIR::Organization.to_s] << @org2_id assert_response_ok(@org2_reply) @practitioner.id = nil @practitioner.role[0].organization.reference = "Organization/#{@org1_id}" @prac_reply = @client.create @practitioner @prac_id = @prac_reply.id @practitioner.id = @prac_id @ids_count[FHIR::Practitioner.to_s] << @prac_id assert_response_ok(@prac_reply) @patient.id = nil @patient.generalPractitioner = [ FHIR::Reference.new ] @patient.generalPractitioner[0].reference= "Practitioner/#{@prac_id}" @patient.managingOrganization.reference = "Organization/#{@org1_id}" @pat_reply = @client.create @patient @patient_id = @pat_reply.id @patient.id = @patient_id @ids_count[FHIR::Patient.to_s] << @patient_id assert_response_ok(@pat_reply) @condition_2.id = nil @condition_2.subject.reference = "Patient/#{@patient_id}" @condition_2.asserter.reference = "Practitioner/#{@prac_id}" @cond2_reply = @client.create @condition_2 @cond2_id = @cond2_reply.id @condition_2.id = @cond2_id @ids_count[FHIR::Condition.to_s] << @cond2_id assert_response_ok(@cond2_reply) @observation.id = nil @observation.subject.reference = "Patient/#{@patient_id}" @observation.performer[0].reference = "Practitioner/#{@prac_id}" @obs_reply = @client.create @observation @obs_id = @obs_reply.id @observation.id = @obs_id @ids_count[FHIR::Observation.to_s] << @obs_id assert_response_ok(@obs_reply) @diagnosticreport.id = nil @diagnosticreport.subject.reference = "Patient/#{@patient_id}" @diagnosticreport.performer[0].reference = "Organization/#{@org2_id}" @dr_reply = @client.create @diagnosticreport @dr_id = @dr_reply.id @diagnosticreport.id = @dr_id @ids_count[FHIR::DiagnosticReport.to_s] << @dr_id assert_response_ok(@dr_reply) @encounter_1.id = nil @encounter_1.patient.reference = "Patient/#{@patient_id}" @encounter_1.participant[0].individual.reference = "Practitioner/#{@prac_id}" @encounter_1.serviceProvider.reference = "Organization/#{@org1_id}" @enc1_reply = @client.create @encounter_1 @enc1_id = @enc1_reply.id @encounter_1.id = @enc1_id @ids_count[FHIR::Encounter.to_s] << @enc1_id assert_response_ok(@enc1_reply) @encounter_2.id = nil @encounter_2.patient.reference = "Patient/#{@patient_id}" @encounter_2.participant[0].individual.reference = "Practitioner/#{@prac_id}" @encounter_2.serviceProvider.reference = "Organization/#{@org1_id}" @encounter_2.indication[0].reference = nil @enc2_reply = @client.create @encounter_2 @enc2_id = @enc2_reply.id @encounter_2.id = @enc2_id @ids_count[FHIR::Encounter.to_s] << @enc2_id assert_response_ok(@enc2_reply) @procedure.id = nil @procedure.subject.reference = "Patient/#{@patient_id}" # @procedure.report[0].reference = "DiagnosticReport/#{@dr_id}" @procedure.performer[0].actor.reference = "Practitioner/#{@prac_id}" @procedure.encounter.reference = "Encounter/#{@enc2_id}" @prc_reply = @client.create @procedure @prc_id = @prc_reply.id @procedure.id = @prc_id @ids_count[FHIR::Procedure.to_s] << @prc_id assert_response_ok(@prc_reply) # @encounter_2.indication = [ FHIR::Reference.new ] @encounter_2.indication[0].reference = "Procedure/#{@prc_id}" @enc2_reply = @client.update @encounter_2, @enc2_id assert_response_ok(@enc2_reply) @condition_1.id = nil @condition_1.subject.reference = "Patient/#{@patient_id}" @condition_1.context.reference = "Encounter/#{@enc1_id}" @condition_1.asserter.reference = "Practitioner/#{@prac_id}" @condition_1.evidence[0].detail[0].reference = "Observation/#{@obs_id}" ref = FHIR::Reference.new ref.reference = "Procedure/#{@prc_id}" @condition_1.evidence[0].detail << ref ref = FHIR::Reference.new ref.reference = "Condition/#{@cond2_id}" @condition_1.evidence[0].detail << ref @cond1_reply = @client.create @condition_1 @cond1_id = @cond1_reply.id @condition_1.id = @cond1_id @ids_count[FHIR::Condition.to_s] << @cond1_id assert_response_ok(@cond1_reply) end |
#description ⇒ Object
9 10 11 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 9 def description 'Connectathon Fetch Patient Record Tests focusing on the $everything operation.' end |
#id ⇒ Object
5 6 7 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 5 def id 'ConnectathonFetchPatientRecordTest' end |
#setup ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 19 def setup @resources = Crucible::Generator::Resources.new @patient = @resources.example_patient_record_201 @condition_1 = @resources.example_patient_record_condition_201 @condition_2 = @resources.example_patient_record_condition_205 @diagnosticreport = @resources.example_patient_record_diagnosticreport_201 @encounter_1 = @resources.example_patient_record_encounter_201 @encounter_2 = @resources.example_patient_record_encounter_202 @observation = @resources.example_patient_record_observation_202 @organization_1 = @resources.example_patient_record_organization_201 @organization_2 = @resources.example_patient_record_organization_203 @practitioner = @resources.example_patient_record_practitioner_201 @procedure = @resources.example_patient_record_procedure_201 @patient_ids = [] @created_patient_record = false begin create_patient_record @created_patient_record = true rescue Exception => e @created_patient_record = false end end |
#teardown ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tests/suites/connectathon_fetch_patient_record.rb', line 42 def teardown @client.destroy(FHIR::Condition, @cond1_reply.id) if !@cond1_id.nil? @client.destroy(FHIR::Procedure, @prc_reply.id) if !@prc_id.nil? @client.destroy(FHIR::Encounter, @enc2_reply.id) if !@enc2_id.nil? @client.destroy(FHIR::Encounter, @enc1_reply.id) if !@enc1_id.nil? @client.destroy(FHIR::DiagnosticReport, @dr_reply.id) if !@dr_id.nil? @client.destroy(FHIR::Observation, @obs_reply.id) if !@obs_id.nil? @client.destroy(FHIR::Condition, @cond2_reply.id) if !@cond2_id.nil? @client.destroy(FHIR::Patient, @pat_reply.id) if !@patient_id.nil? @patient_ids.each do |id| @client.destroy(FHIR::Patient, id) end @client.destroy(FHIR::Practitioner, @prac_reply.id) if !@prac_id.nil? @client.destroy(FHIR::Organization, @org2_reply.id) if !@org2_id.nil? @client.destroy(FHIR::Organization, @org1_reply.id) if !@org1_id.nil? end |