R6 Ballot (2nd Draft)

Publish-box (todo)

Provenance.shex

Security Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Device, Patient, Practitioner, RelatedPerson

Raw ShEx

ShEx statement for provenance

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <Group.shex>
IMPORT <Period.shex>
IMPORT <Device.shex>
IMPORT <instant.shex>
IMPORT <Patient.shex>
IMPORT <dateTime.shex>
IMPORT <Location.shex>
IMPORT <markdown.shex>
IMPORT <Resource.shex>
IMPORT <CareTeam.shex>
IMPORT <Reference.shex>
IMPORT <Encounter.shex>
IMPORT <Signature.shex>
IMPORT <Organization.shex>
IMPORT <Practitioner.shex>
IMPORT <RelatedPerson.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <PractitionerRole.shex>
IMPORT <CodeableReference.shex>


start=@<Provenance> AND {fhir:nodeRole [fhir:treeRoot]}

# Who, What, When for a set of resources
<Provenance> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:Provenance]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:target @<OneOrMore_Reference_Resource>;  # Target Reference(s) (usually 
                                            # version specific) 
    fhir:occurred @<Period>  OR 
    			@<dateTime>  ?;  # When the activity occurred
    fhir:recorded @<instant>?;              # When the activity was recorded / 
                                            # updated 
    fhir:policy @<OneOrMore_uri>?;          # Policy or plan the activity was 
                                            # defined by 
    fhir:location @<Reference> AND {fhir:link 
    			@<Location> ? }?;  # Where the activity occurred
    fhir:authorization @<OneOrMore_CodeableReference>?;  # Authorization (purposeOfUse) 
                                            # related to the event 
    fhir:why @<markdown>?;                  # Why was the event performed?
    fhir:activity @<CodeableConcept>?;      # Activity that occurred
    fhir:basedOn @<OneOrMore_Reference_Resource>?;  # Workflow authorization within 
                                            # which this event occurred 
    fhir:patient @<Reference> AND {fhir:link 
    			@<Patient> ? }?;  # The patient is the subject of the 
                                            # data created/updated (.target) by 
                                            # the activity 
    fhir:encounter @<Reference> AND {fhir:link 
    			@<Encounter> ? }?;  # Encounter within which this event 
                                            # occurred or which the event is 
                                            # tightly associated 
    fhir:agent @<OneOrMore_Provenance.agent>;  # Actor involved
    fhir:entity @<OneOrMore_Provenance.entity>?;  # An entity used in this activity
    fhir:signature @<OneOrMore_Signature>?;  # Signature on target
}  

# An entity used in this activity
<Provenance.entity> EXTENDS @<BackboneElement> CLOSED {   
    fhir:role @<code> AND
    	{fhir:v @fhirvs:provenance-entity-role};  # revision | quotation | source | 
                                            # instantiates | removal 
    fhir:what @<Reference> AND {fhir:link 
    			@<Resource> ? };  # Identity of entity
    fhir:agent @<OneOrMore_Provenance.agent>?;  # Entity is attributed to this agent
}  

# Actor involved
<Provenance.agent> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # How the agent participated
    fhir:role @<OneOrMore_CodeableConcept>?;  # What the agents role was
    fhir:who @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Device> OR 
    			@<Group> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? };  # The agent that participated in the 
                                            # event 
    fhir:onBehalfOf @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Group> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> ? }?;  # The agent that delegated
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Reference_Resource> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Resource> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Resource> 
}

<OneOrMore_uri> CLOSED {
    rdf:first @<uri>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_uri> 
}

<OneOrMore_CodeableReference> CLOSED {
    rdf:first @<CodeableReference>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableReference> 
}

<OneOrMore_Provenance.agent> CLOSED {
    rdf:first @<Provenance.agent>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Provenance.agent> 
}

<OneOrMore_Provenance.entity> CLOSED {
    rdf:first @<Provenance.entity>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Provenance.entity> 
}

<OneOrMore_Signature> CLOSED {
    rdf:first @<Signature>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Signature> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

#---------------------- Value Sets ------------------------

# How an entity was used in an activity.
fhirvs:provenance-entity-role ["revision" "quotation" "source" "instantiates" "removal"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.