From b9da540d4593a1773e53b5371ec47b33e7595449 Mon Sep 17 00:00:00 2001 From: Shaumik-Ashraf Date: Sun, 22 Sep 2024 11:22:54 -0400 Subject: [PATCH 1/2] patch undefined method for nil on validator 500 response --- lib/inferno/dsl/fhir_resource_validation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/inferno/dsl/fhir_resource_validation.rb b/lib/inferno/dsl/fhir_resource_validation.rb index 540e50d5d..feff50860 100644 --- a/lib/inferno/dsl/fhir_resource_validation.rb +++ b/lib/inferno/dsl/fhir_resource_validation.rb @@ -285,9 +285,10 @@ def operation_outcome_from_hl7_wrapped_response(response_hash) end # assume for now that one resource -> one request - issues = response_hash['outcomes'][0]['issues']&.map do |i| + issues = response_hash.dig('outcomes', 0, 'issues')&.map do |i| { severity: i['level'].downcase, expression: i['location'], details: { text: i['message'] } } end + issues ||= [] # this is circuitous, ideally we would map this response directly to message_hashes FHIR::OperationOutcome.new(issue: issues) end From e1000a4eb6df0049d118dab55cf904a80c722d55 Mon Sep 17 00:00:00 2001 From: Shaumik-Ashraf Date: Sun, 22 Sep 2024 11:43:39 -0400 Subject: [PATCH 2/2] better code --- lib/inferno/dsl/fhir_resource_validation.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/inferno/dsl/fhir_resource_validation.rb b/lib/inferno/dsl/fhir_resource_validation.rb index feff50860..85429087d 100644 --- a/lib/inferno/dsl/fhir_resource_validation.rb +++ b/lib/inferno/dsl/fhir_resource_validation.rb @@ -285,10 +285,9 @@ def operation_outcome_from_hl7_wrapped_response(response_hash) end # assume for now that one resource -> one request - issues = response_hash.dig('outcomes', 0, 'issues')&.map do |i| + issues = (response_hash.dig('outcomes', 0, 'issues') || []).map do |i| { severity: i['level'].downcase, expression: i['location'], details: { text: i['message'] } } end - issues ||= [] # this is circuitous, ideally we would map this response directly to message_hashes FHIR::OperationOutcome.new(issue: issues) end