R6 Ballot (2nd Draft)

Publish-box (todo)

Task.shex

Orders and Observations Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Patient

Raw ShEx

ShEx statement for task

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 <id.shex>
IMPORT <uri.shex>
IMPORT <oid.shex>
IMPORT <url.shex>
IMPORT <Age.shex>
IMPORT <code.shex>
IMPORT <date.shex>
IMPORT <time.shex>
IMPORT <uuid.shex>
IMPORT <Meta.shex>
IMPORT <Count.shex>
IMPORT <Money.shex>
IMPORT <Range.shex>
IMPORT <Ratio.shex>
IMPORT <Group.shex>
IMPORT <Period.shex>
IMPORT <Device.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <Timing.shex>
IMPORT <Dosage.shex>
IMPORT <boolean.shex>
IMPORT <Patient.shex>
IMPORT <decimal.shex>
IMPORT <instant.shex>
IMPORT <integer.shex>
IMPORT <Address.shex>
IMPORT <markdown.shex>
IMPORT <Resource.shex>
IMPORT <dateTime.shex>
IMPORT <CareTeam.shex>
IMPORT <Location.shex>
IMPORT <Distance.shex>
IMPORT <Duration.shex>
IMPORT <Quantity.shex>
IMPORT <Coverage.shex>
IMPORT <canonical.shex>
IMPORT <Reference.shex>
IMPORT <Encounter.shex>
IMPORT <integer64.shex>
IMPORT <HumanName.shex>
IMPORT <Signature.shex>
IMPORT <Identifier.shex>
IMPORT <Annotation.shex>
IMPORT <Attachment.shex>
IMPORT <RatioRange.shex>
IMPORT <Expression.shex>
IMPORT <Provenance.shex>
IMPORT <positiveInt.shex>
IMPORT <unsignedInt.shex>
IMPORT <SampledData.shex>
IMPORT <Organization.shex>
IMPORT <Practitioner.shex>
IMPORT <base64Binary.shex>
IMPORT <ContactPoint.shex>
IMPORT <UsageContext.shex>
IMPORT <Availability.shex>
IMPORT <RelatedPerson.shex>
IMPORT <ContactDetail.shex>
IMPORT <ClaimResponse.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <DataRequirement.shex>
IMPORT <RelatedArtifact.shex>
IMPORT <PractitionerRole.shex>
IMPORT <CodeableReference.shex>
IMPORT <TriggerDefinition.shex>
IMPORT <ParameterDefinition.shex>
IMPORT <ExtendedContactDetail.shex>


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

# A task to be performed
<Task> EXTENDS @<DomainResource> CLOSED {   

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

    fhir:identifier @<OneOrMore_Identifier>?;  # Task Instance Identifier
    fhir:instantiatesCanonical @<canonical>?;  # Formal definition of task
    fhir:instantiatesUri @<uri>?;           # Formal definition of task
    fhir:basedOn @<OneOrMore_Reference_Resource>?;  # Request fulfilled by this task
    fhir:groupIdentifier @<Identifier>?;    # Requisition or grouper id
    fhir:partOf @<OneOrMore_Reference_Task>?;  # Composite task
    fhir:status @<code> AND
    	{fhir:v @fhirvs:task-status};  # draft | requested | received | 
                                            # accepted | + 
    fhir:statusReason @<CodeableReference>?;  # Reason for current status
    fhir:businessStatus @<CodeableConcept>?;  # E.g. "Specimen collected", "IV 
                                            # prepped" 
    fhir:intent @<code> AND
    	{fhir:v @fhirvs:task-intent};  # unknown | proposal | plan | order 
                                            # | original-order | reflex-order | 
                                            # filler-order | instance-order | 
                                            # option 
    fhir:priority @<code> AND
    	{fhir:v @fhirvs:request-priority}?;  # routine | urgent | asap | stat
    fhir:doNotPerform @<boolean>?;          # True if Task is prohibiting action
    fhir:code @<CodeableConcept>?;          # Task Type
    fhir:description @<markdown>?;          # Human-readable explanation of task
    fhir:focus @<Reference> AND {fhir:link 
    			@<Resource> ? }?;  # What task is acting on
    fhir:for @<Reference> AND {fhir:link 
    			@<Resource> ? }?;  # Beneficiary of the Task
    fhir:encounter @<Reference> AND {fhir:link 
    			@<Encounter> ? }?;  # Healthcare event during which this 
                                            # task originated 
    fhir:requestedPeriod @<Period>?;        # When the task should be performed
    fhir:executionPeriod @<Period>?;        # Start and end time of execution
    fhir:authoredOn @<dateTime>?;           # Task Creation Date
    fhir:lastModified @<dateTime>?;         # Task Last Modified Date
    fhir:requester @<Reference> AND {fhir:link 
    			@<Device> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # Who is asking for task to be done
    fhir:requestedPerformer @<OneOrMore_CodeableReference>?;  # Who should perform Task
    fhir:owner @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # Responsible individual
    fhir:performer @<OneOrMore_Task.performer>?;  # Who or what performed the task
    fhir:location @<Reference> AND {fhir:link 
    			@<Location> ? }?;  # Where task occurs
    fhir:reason @<OneOrMore_CodeableReference>?;  # Why task is needed
    fhir:insurance @<OneOrMore_Reference_ClaimResponse_OR_Coverage>?;  # Associated insurance coverage
    fhir:note @<OneOrMore_Annotation>?;     # Comments made about the task
    fhir:relevantHistory @<OneOrMore_Reference_Provenance>?;  # Key events in history of the Task
    fhir:restriction @<Task.restriction>?;  # Constraints on fulfillment tasks
    fhir:input @<OneOrMore_Task.input>?;    # Information used to perform task
    fhir:output @<OneOrMore_Task.output>?;  # Information produced as part of 
                                            # task 
}  

# Information used to perform task
<Task.input> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>;           # Label for the input
    fhir:value @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ;  # Content to use in performing the 
                                            # task 
}  

# Information produced as part of task
<Task.output> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>;           # Label for output
    fhir:value @<base64Binary>  OR 
    			@<boolean>  OR 
    			@<canonical>  OR 
    			@<code>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<decimal>  OR 
    			@<id>  OR 
    			@<instant>  OR 
    			@<integer>  OR 
    			@<integer64>  OR 
    			@<markdown>  OR 
    			@<oid>  OR 
    			@<positiveInt>  OR 
    			@<string>  OR 
    			@<time>  OR 
    			@<unsignedInt>  OR 
    			@<uri>  OR 
    			@<url>  OR 
    			@<uuid>  OR 
    			@<Address>  OR 
    			@<Age>  OR 
    			@<Annotation>  OR 
    			@<Attachment>  OR 
    			@<CodeableConcept>  OR 
    			@<CodeableReference>  OR 
    			@<Coding>  OR 
    			@<ContactPoint>  OR 
    			@<Count>  OR 
    			@<Distance>  OR 
    			@<Duration>  OR 
    			@<HumanName>  OR 
    			@<Identifier>  OR 
    			@<Money>  OR 
    			@<Period>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Ratio>  OR 
    			@<RatioRange>  OR 
    			@<Reference>  OR 
    			@<SampledData>  OR 
    			@<Signature>  OR 
    			@<Timing>  OR 
    			@<ContactDetail>  OR 
    			@<DataRequirement>  OR 
    			@<Expression>  OR 
    			@<ParameterDefinition>  OR 
    			@<RelatedArtifact>  OR 
    			@<TriggerDefinition>  OR 
    			@<UsageContext>  OR 
    			@<Availability>  OR 
    			@<ExtendedContactDetail>  OR 
    			@<Dosage>  OR 
    			@<Meta>  ;  # Result of output
}  

# Who or what performed the task
<Task.performer> EXTENDS @<BackboneElement> CLOSED {   
    fhir:function @<CodeableConcept>?;      # Type of performance
    fhir:actor @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? };  # Who performed the task
}  

# Constraints on fulfillment tasks
<Task.restriction> EXTENDS @<BackboneElement> CLOSED {   
    fhir:repetitions @<positiveInt>?;       # How many times to repeat
    fhir:period @<Period>?;                 # When fulfillment is sought
    fhir:recipient @<OneOrMore_Reference_Group_OR_Organization_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson>?;  # For whom is fulfillment sought?
}  

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

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

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

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

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

<OneOrMore_Task.performer> CLOSED {
    rdf:first @<Task.performer>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Task.performer> 
}

<OneOrMore_Reference_ClaimResponse_OR_Coverage> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<ClaimResponse> OR 
			@<Coverage> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_ClaimResponse_OR_Coverage> 
}

<OneOrMore_Annotation> CLOSED {
    rdf:first @<Annotation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Annotation> 
}

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

<OneOrMore_Task.input> CLOSED {
    rdf:first @<Task.input>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Task.input> 
}

<OneOrMore_Task.output> CLOSED {
    rdf:first @<Task.output>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Task.output> 
}

<OneOrMore_Reference_Group_OR_Organization_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<Group> OR 
			@<Organization> OR 
			@<Patient> OR 
			@<Practitioner> OR 
			@<PractitionerRole> OR 
			@<RelatedPerson> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Group_OR_Organization_OR_Patient_OR_Practitioner_OR_PractitionerRole_OR_RelatedPerson> 
}

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

# Identifies the level of importance to be assigned to actioning the request.
fhirvs:request-priority ["routine" "urgent" "asap" "stat"]

# Distinguishes whether the task is a proposal, plan or full order.
fhirvs:task-intent ["unknown" "proposal" "plan" "order" "original-order" "reflex-order" "filler-order" "instance-order" "option"]

# The current status of the task.
fhirvs:task-status ["draft" "requested" "received" "accepted" "rejected" "ready" "cancelled" "in-progress" "on-hold" "failed" "completed" "entered-in-error"]


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.