inferno_core 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e77b2567061750720f73082094abe8f2906e060f362842640725481824dea6f3
4
- data.tar.gz: 7b7ba8fa843ab58166f725b7939a74311825f959158b5eea06d954dbf1c9fe50
3
+ metadata.gz: ebcc6f348889f26a45097656da0a40a89b233bc7a216f06c8d538092362419a1
4
+ data.tar.gz: dfddeba814ef81eaddbc3b54635903cc01b9a7016a00a06eb6c723a01af2adf7
5
5
  SHA512:
6
- metadata.gz: 19f220a5663640cc07eb0182321aad839126f89e0e85b3c7c9d98971c4cde72b591fc5c86013c3cd8db3fc07f01bd08847b5b98ed82213c4819d75ddcf46a1e5
7
- data.tar.gz: c0b1ba31490d081c3e4d351efa9ac182996952366e20b96fa75ec9e7fb816c01dbdba3c7d857746b45455181a098ee2b78fd2b389b65d1b2d0ec7179504d4482
6
+ metadata.gz: b97797a253c6d9419ce3a715e56a97464a4ce04f0e48944067c9fbe72b1c645c907d11c33cca7cbe5bfa2771f25908dfdd7ead1f59d63ef5f0850755d2733ce4
7
+ data.tar.gz: '0184d977bbb3e25ef6ef3d9b02ec69e7f17f90cec4f00b54b19e3eab87a5621bec611d3fd2b9a20079503e873ec1141999c1df357d4cb0937da48c36d5a05814'
@@ -23,6 +23,7 @@ module Inferno
23
23
  field :optional?, name: :optional
24
24
  field :simulation_verification?, name: :is_simulation_verification
25
25
  field :attestation?, name: :is_attestation
26
+ field :tester_initiated_exchange?, name: :is_tester_initiated_exchange
26
27
  field :verifies_requirements, if: :field_present?, extractor: RequirementsFilteringExtractor
27
28
  end
28
29
  end
@@ -18,6 +18,7 @@ module Inferno
18
18
  field :user_runnable?, name: :user_runnable
19
19
  field :optional?, name: :optional
20
20
  field :simulation_verification?, name: :is_simulation_verification
21
+ field :tester_initiated_exchange?, name: :is_tester_initiated_exchange
21
22
 
22
23
  field :test_count do |group, options|
23
24
  group.test_count(options[:suite_options])
@@ -145,11 +145,15 @@
145
145
  </div>
146
146
  <div class="modal-body">
147
147
  <p>
148
- Test Kits are broadly grouped into three levels of maturity:
149
- <strong>High</strong>, <strong>Moderate</strong>, and
150
- <strong>Low</strong>. This is intended to provide guidance to users
151
- on the level of confidence they should place in the accuracy and
152
- completeness of these tests.
148
+ Test Kits are broadly grouped into four levels of maturity:
149
+ <strong>Certification</strong>, <strong>High</strong>,
150
+ <strong>Medium</strong>, and <strong>Low</strong>. This is intended
151
+ to provide guidance to users on the level of confidence they should
152
+ place in the accuracy and completeness of these tests.
153
+ </p>
154
+ <p>
155
+ <strong>Certification</strong> maturity Test Kits are used as part
156
+ of a formal certification program.
153
157
  </p>
154
158
  <p>
155
159
  <strong>High</strong> maturity Test Kits typically have been
@@ -157,7 +161,7 @@
157
161
  that has limited ambiguity.
158
162
  </p>
159
163
  <p>
160
- <strong>Moderate</strong> and <strong>Low</strong> maturity Test Kits typically have
164
+ <strong>Medium</strong> and <strong>Low</strong> maturity Test Kits typically have
161
165
  not had widespread usage and/or are targeting less mature
162
166
  specifications that contain ambiguous or conflicting information.
163
167
  These Test Kits are still of value to implementers, but they should be
@@ -75,6 +75,17 @@ module Inferno
75
75
  test_run.test_suite_id || test_run.test_group_id || test.parent&.id || test.id
76
76
  end
77
77
 
78
+ # @private
79
+ def no_test_run_message(test_run_identifier, url)
80
+ base_message = "Inferno could not find an active test run for this request to '#{url}'"
81
+
82
+ if test_run_identifier.blank?
83
+ "#{base_message}: no identifier found."
84
+ else
85
+ "#{base_message}: identifier '#{test_run_identifier}' is not associated with a waiting session."
86
+ end
87
+ end
88
+
78
89
  # @private
79
90
  def handle(req, res)
80
91
  request = Inferno::Entities::Request.from_hanami_request(req)
@@ -84,10 +95,7 @@ module Inferno
84
95
 
85
96
  test_run = find_test_run(test_run_identifier)
86
97
 
87
- if test_run.nil?
88
- halt 500, "Unable to find test run with identifier '#{test_run_identifier}' " \
89
- "on request to '#{request.url}'."
90
- end
98
+ halt 500, no_test_run_message(test_run_identifier, request.url) if test_run.nil?
91
99
 
92
100
  test_runs_repo.mark_as_no_longer_waiting(test_run.id)
93
101
 
@@ -309,14 +309,17 @@ module Inferno
309
309
  !optional?
310
310
  end
311
311
 
312
- # Mark as simulation verification. Tests are not simulation verification by default.
312
+ # Flag as simulation verification. Tests are not simulation verification by default.
313
313
  #
314
314
  # @param simulation_verification [Boolean]
315
315
  # @return [void]
316
- def simulation_verification(simulation_verification = true) # rubocop:disable Style/OptionalBooleanParameter
316
+ def flag_as_simulation_verification(simulation_verification = true) # rubocop:disable Style/OptionalBooleanParameter
317
317
  @is_simulation_verification = simulation_verification
318
318
  end
319
319
 
320
+ # Alias for {#flag_as_simulation_verification}
321
+ alias simulation_verification flag_as_simulation_verification
322
+
320
323
  # The test is simulation verification if true
321
324
  #
322
325
  # @return [Boolean]
@@ -324,14 +327,17 @@ module Inferno
324
327
  !!@is_simulation_verification
325
328
  end
326
329
 
327
- # Mark as attestation. Tests are not attestation by default.
330
+ # Flag as attestation. Tests are not attestation by default.
328
331
  #
329
332
  # @param attestation [Boolean]
330
333
  # @return [void]
331
- def attestation(attestation = true) # rubocop:disable Style/OptionalBooleanParameter
334
+ def flag_as_attestation(attestation = true) # rubocop:disable Style/OptionalBooleanParameter
332
335
  @is_attestation = attestation
333
336
  end
334
337
 
338
+ # Alias for {#flag_as_attestation}
339
+ alias attestation flag_as_attestation
340
+
335
341
  # The test is attestation if true
336
342
  #
337
343
  # @return [Boolean]
@@ -339,6 +345,21 @@ module Inferno
339
345
  !!@is_attestation
340
346
  end
341
347
 
348
+ # Flag as tester-initiated exchange. Tests are not tester-initiated exchanges by default.
349
+ #
350
+ # @param tester_initiated_exchange [Boolean]
351
+ # @return [void]
352
+ def flag_as_tester_initiated_exchange(tester_initiated_exchange = true) # rubocop:disable Style/OptionalBooleanParameter
353
+ @is_tester_initiated_exchange = tester_initiated_exchange
354
+ end
355
+
356
+ # The test is a tester-initiated exchange if true
357
+ #
358
+ # @return [Boolean]
359
+ def tester_initiated_exchange?
360
+ !!@is_tester_initiated_exchange
361
+ end
362
+
342
363
  # @private
343
364
  def default_id
344
365
  to_s
@@ -97,7 +97,9 @@ module Inferno
97
97
 
98
98
  # @private
99
99
  def error_response_format_value
100
- @error_response_format_value ||= :text
100
+ return @error_response_format_value if @error_response_format_value.present?
101
+
102
+ superclass.respond_to?(:error_response_format_value) ? superclass.error_response_format_value : :text
101
103
  end
102
104
  end
103
105
 
@@ -308,7 +310,8 @@ module Inferno
308
310
  log_error(e)
309
311
  render_error_and_halt do
310
312
  error_response(
311
- 'An error occurred while determining the test run identifier for this request.',
313
+ "Inferno could not find an active test run for this request to '#{request.url}': " \
314
+ 'error encountered while determining the test run identifier.',
312
315
  code: 'exception',
313
316
  diagnostics: e.full_message
314
317
  )
@@ -317,7 +320,7 @@ module Inferno
317
320
 
318
321
  # @private
319
322
  def no_session_message
320
- base_message = "Unable to find test run for request to '#{request.url}'"
323
+ base_message = "Inferno could not find an active test run for this request to '#{request.url}'"
321
324
  location = test_run_identifier_location_description
322
325
  identifier = find_test_run_identifier
323
326
 
@@ -369,10 +372,11 @@ module Inferno
369
372
  details: FHIR::CodeableConcept.new(text: message)
370
373
  )
371
374
  issue.diagnostics = diagnostics if diagnostics
375
+ meta = FHIR::Meta.new(source: Application['base_url'])
372
376
 
373
377
  response.status = 500
374
378
  response.content_type = 'application/fhir+json'
375
- response.body = FHIR::OperationOutcome.new(issue: [issue]).to_json
379
+ response.body = FHIR::OperationOutcome.new(meta:, issue: [issue]).to_json
376
380
  end
377
381
 
378
382
  # @private
@@ -427,7 +431,7 @@ module Inferno
427
431
  log_error(e)
428
432
  render_error_and_halt do
429
433
  error_response(
430
- 'An error occurred while processing this request.',
434
+ "Inferno encountered an error while processing this request to '#{request.url}'.",
431
435
  code: 'exception',
432
436
  diagnostics: e.full_message
433
437
  )
@@ -459,7 +463,7 @@ module Inferno
459
463
 
460
464
  response_headers = response_headers.map { |name, value| { name:, value: } }
461
465
 
462
- repo.create(
466
+ persisted_request = repo.create(
463
467
  verb:,
464
468
  url:,
465
469
  direction: 'incoming',
@@ -474,6 +478,15 @@ module Inferno
474
478
  tags: env['inferno.tags']
475
479
  )
476
480
 
481
+ # Display the request with the waiting test's result. Failures are
482
+ # logged rather than raised so that they cannot prevent the test run
483
+ # from resuming.
484
+ begin
485
+ results_repo.add_request(env['inferno.result_id'], persisted_request.id)
486
+ rescue StandardError => e
487
+ log_error(e, url:)
488
+ end
489
+
477
490
  if env['inferno.resume_test_run']
478
491
  test_run_id = env['inferno.test_run_id']
479
492
  Inferno::Repositories::TestRuns.new.mark_as_no_longer_waiting(test_run_id)
@@ -92,7 +92,8 @@ module Inferno
92
92
 
93
93
  # Set/get the maturity level for the test kit
94
94
  #
95
- # @param new_maturity [String]
95
+ # @param new_maturity [String] one of 'Low', 'Medium', 'High', or
96
+ # 'Certification'
96
97
  # @return [String]
97
98
  def maturity(new_maturity = nil)
98
99
  return @maturity if new_maturity.nil?