Sha256: d23bae8360097ffef73928d936d8cd8b3d1da0089899c0d96289a627aca20e23
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module DaVinciPlanNetTestKit class ProvenanceValidator include FHIRResourceNavigation def self.validate(...) new(...).validate end attr_reader :resource, :validation_messages def initialize(resource) @resource = resource @validation_messages = [] end def validate # Invariant provenance-1 in US Core 5 causes validation error. See FHIR-39518 return validation_messages unless resource.instance_of?(FHIR::Provenance) failed_provenance = find_a_value_at(resource, 'agent') do |agent| ['Practitioner', 'Device'].any? { |resource_type| agent.who.reference&.include?(resource_type) } && agent.onBehalfOf.nil? end if failed_provenance.present? validation_messages << { type: 'error', message: "#{resource.resourceType}/#{resource.id}: Rule provenance-1: 'onBehalfOf SHALL be present when Provenance.agent.who is a Practitioner or Device' Failed" } end validation_messages end end end
Version data entries
4 entries across 4 versions & 1 rubygems