R6 Ballot (2nd Draft)

Publish-box (todo)

Appointment.shex

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

Raw ShEx

ShEx statement for appointment

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 <code.shex>
IMPORT <date.shex>
IMPORT <Slot.shex>
IMPORT <Group.shex>
IMPORT <string.shex>
IMPORT <Period.shex>
IMPORT <Coding.shex>
IMPORT <Device.shex>
IMPORT <instant.shex>
IMPORT <Patient.shex>
IMPORT <boolean.shex>
IMPORT <Account.shex>
IMPORT <dateTime.shex>
IMPORT <CareTeam.shex>
IMPORT <Location.shex>
IMPORT <Resource.shex>
IMPORT <CarePlan.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <Annotation.shex>
IMPORT <positiveInt.shex>
IMPORT <Practitioner.shex>
IMPORT <RelatedPerson.shex>
IMPORT <DeviceRequest.shex>
IMPORT <DomainResource.shex>
IMPORT <NutritionOrder.shex>
IMPORT <ServiceRequest.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>
IMPORT <PractitionerRole.shex>
IMPORT <CodeableReference.shex>
IMPORT <HealthcareService.shex>
IMPORT <MedicationRequest.shex>
IMPORT <VisionPrescription.shex>
IMPORT <VirtualServiceDetail.shex>
IMPORT <RequestOrchestration.shex>
IMPORT <ImmunizationRecommendation.shex>


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

# A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s)
<Appointment> EXTENDS @<DomainResource> CLOSED {   

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

    fhir:identifier @<OneOrMore_Identifier>?;  # External Ids for this item
    fhir:status @<code> AND
    	{fhir:v @fhirvs:appointmentstatus};  # proposed | pending | booked | 
                                            # arrived | fulfilled | cancelled | 
                                            # noshow | entered-in-error | 
                                            # checked-in | waitlist 
    fhir:cancellationReason @<CodeableConcept>?;  # The coded reason for the 
                                            # appointment being cancelled 
    fhir:class @<OneOrMore_CodeableConcept>?;  # Classification when becoming an 
                                            # encounter 
    fhir:serviceCategory @<OneOrMore_CodeableConcept>?;  # A broad categorization of the 
                                            # service that is to be performed 
                                            # during this appointment 
    fhir:serviceType @<OneOrMore_CodeableReference>?;  # The specific service that is to be 
                                            # performed during this appointment 
    fhir:specialty @<OneOrMore_CodeableConcept>?;  # The specialty of a practitioner 
                                            # that would be required to perform 
                                            # the service requested in this 
                                            # appointment 
    fhir:appointmentType @<CodeableConcept>?;  # The style of appointment or 
                                            # patient that has been booked in 
                                            # the slot (not service type) 
    fhir:reason @<OneOrMore_CodeableReference>?;  # Reason this appointment is 
                                            # scheduled 
    fhir:priority @<CodeableConcept>?;      # Used to make informed decisions if 
                                            # needing to re-prioritize 
    fhir:description @<string>?;            # Shown on a subject line in a 
                                            # meeting request, or appointment 
                                            # list 
    fhir:replaces @<OneOrMore_Reference_Appointment>?;  # Appointment replaced by this 
                                            # Appointment 
    fhir:virtualService @<OneOrMore_VirtualServiceDetail>?;  # Connection details of a virtual 
                                            # service (e.g. conference call) 
    fhir:supportingInformation @<OneOrMore_Reference_Resource>?;  # Additional information to support 
                                            # the appointment 
    fhir:previousAppointment @<Reference> AND {fhir:link 
    			@<Appointment> ? }?;  # The previous appointment in a 
                                            # series 
    fhir:originatingAppointment @<Reference> AND {fhir:link 
    			@<Appointment> ? }?;  # The originating appointment in a 
                                            # recurring set of appointments 
    fhir:start @<instant>?;                 # When appointment is to take place
    fhir:end @<instant>?;                   # When appointment is to conclude
    fhir:minutesDuration @<positiveInt>?;   # Can be less than start/end (e.g. 
                                            # estimate) 
    fhir:requestedPeriod @<OneOrMore_Period>?;  # Potential date/time interval(s) 
                                            # requested to allocate the 
                                            # appointment within 
    fhir:slot @<OneOrMore_Reference_Slot>?;  # The slots that this appointment is 
                                            # filling 
    fhir:account @<OneOrMore_Reference_Account>?;  # The set of accounts that may be 
                                            # used for billing for this 
                                            # Appointment 
    fhir:created @<dateTime>?;              # The date that this appointment was 
                                            # initially created 
    fhir:cancellationDate @<dateTime>?;     # When the appointment was cancelled
    fhir:note @<OneOrMore_Annotation>?;     # Additional comments
    fhir:patientInstruction @<OneOrMore_CodeableReference>?;  # Detailed information and 
                                            # instructions for the patient 
    fhir:basedOn @<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription>?;  # The request this appointment is 
                                            # allocated to assess 
    fhir:subject @<Reference> AND {fhir:link 
    			@<Group> OR 
    			@<Patient> ? }?;  # The patient or group associated 
                                            # with the appointment 
    fhir:participant @<OneOrMore_Appointment.participant>;  # Participants involved in 
                                            # appointment 
    fhir:recurrenceId @<positiveInt>?;      # The sequence number in the 
                                            # recurrence 
    fhir:occurrenceChanged @<boolean>?;     # Indicates that this appointment 
                                            # varies from a recurrence pattern 
    fhir:recurrenceTemplate @<OneOrMore_Appointment.recurrenceTemplate>?;  # Details of the recurrence 
                                            # pattern/template used to generate 
                                            # occurrences 
}  

# Details of the recurrence pattern/template used to generate occurrences
<Appointment.recurrenceTemplate> EXTENDS @<BackboneElement> CLOSED {   
    fhir:timezone @<CodeableConcept>?;      # The timezone of the occurrences
    fhir:recurrenceType @<CodeableConcept>;  # The frequency of the recurrence
    fhir:lastOccurrenceDate @<date>?;       # The date when the recurrence 
                                            # should end 
    fhir:occurrenceCount @<positiveInt>?;   # The number of planned occurrences
    fhir:occurrenceDate @<OneOrMore_date>?;  # Specific dates for a recurring set 
                                            # of appointments (no template) 
    fhir:weeklyTemplate @<Appointment.recurrenceTemplate.weeklyTemplate>?;  # Information about weekly recurring 
                                            # appointments 
    fhir:monthlyTemplate @<Appointment.recurrenceTemplate.monthlyTemplate>?;  # Information about monthly 
                                            # recurring appointments 
    fhir:yearlyTemplate @<Appointment.recurrenceTemplate.yearlyTemplate>?;  # Information about yearly recurring 
                                            # appointments 
    fhir:excludingDate @<OneOrMore_date>?;  # Any dates that should be excluded 
                                            # from the series 
    fhir:excludingRecurrenceId @<OneOrMore_positiveInt>?;  # Any recurrence IDs that should be 
                                            # excluded from the recurrence 
}  

# Information about monthly recurring appointments
<Appointment.recurrenceTemplate.monthlyTemplate> EXTENDS @<BackboneElement> CLOSED {   
    fhir:dayOfMonth @<positiveInt>?;        # Recurs on a specific day of the 
                                            # month 
    fhir:nthWeekOfMonth @<Coding>?;         # Indicates which week of the month 
                                            # the appointment should occur 
    fhir:dayOfWeek @<Coding>?;              # Indicates which day of the week 
                                            # the appointment should occur 
    fhir:monthInterval @<positiveInt>;      # Recurs every nth month
}  

# Information about yearly recurring appointments
<Appointment.recurrenceTemplate.yearlyTemplate> EXTENDS @<BackboneElement> CLOSED {   
    fhir:yearInterval @<positiveInt>;       # Recurs every nth year
}  

# Information about weekly recurring appointments
<Appointment.recurrenceTemplate.weeklyTemplate> EXTENDS @<BackboneElement> CLOSED {   
    fhir:monday @<boolean>?;                # Recurs on Mondays
    fhir:tuesday @<boolean>?;               # Recurs on Tuesday
    fhir:wednesday @<boolean>?;             # Recurs on Wednesday
    fhir:thursday @<boolean>?;              # Recurs on Thursday
    fhir:friday @<boolean>?;                # Recurs on Friday
    fhir:saturday @<boolean>?;              # Recurs on Saturday
    fhir:sunday @<boolean>?;                # Recurs on Sunday
    fhir:weekInterval @<positiveInt>?;      # Recurs every nth week
}  

# Participants involved in appointment
<Appointment.participant> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<OneOrMore_CodeableConcept>?;  # Role of participant in the 
                                            # appointment 
    fhir:period @<Period>?;                 # Participation period of the actor
    fhir:actor @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<Device> OR 
    			@<Group> OR 
    			@<HealthcareService> OR 
    			@<Location> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # The individual, device, location, 
                                            # or service participating in the 
                                            # appointment 
    fhir:required @<boolean>?;              # The participant is required to 
                                            # attend (optional when false) 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:participationstatus};  # accepted | declined | tentative | 
                                            # needs-action 
}  

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

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

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

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

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

<OneOrMore_VirtualServiceDetail> CLOSED {
    rdf:first @<VirtualServiceDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_VirtualServiceDetail> 
}

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

<OneOrMore_Period> CLOSED {
    rdf:first @<Period>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Period> 
}

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

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

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

<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription> CLOSED {
    rdf:first @<Reference> AND {fhir:link 
			@<CarePlan> OR 
			@<DeviceRequest> OR 
			@<ImmunizationRecommendation> OR 
			@<MedicationRequest> OR 
			@<NutritionOrder> OR 
			@<RequestOrchestration> OR 
			@<ServiceRequest> OR 
			@<VisionPrescription> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_CarePlan_OR_DeviceRequest_OR_ImmunizationRecommendation_OR_MedicationRequest_OR_NutritionOrder_OR_RequestOrchestration_OR_ServiceRequest_OR_VisionPrescription> 
}

<OneOrMore_Appointment.participant> CLOSED {
    rdf:first @<Appointment.participant>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Appointment.participant> 
}

<OneOrMore_Appointment.recurrenceTemplate> CLOSED {
    rdf:first @<Appointment.recurrenceTemplate>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Appointment.recurrenceTemplate> 
}

<OneOrMore_date> CLOSED {
    rdf:first @<date>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_date> 
}

<OneOrMore_positiveInt> CLOSED {
    rdf:first @<positiveInt>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_positiveInt> 
}

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

# The free/busy status of an appointment.
fhirvs:appointmentstatus ["proposed" "pending" "booked" "arrived" "fulfilled" "cancelled" "noshow" "entered-in-error" "checked-in" "waitlist"]

# The Participation status of an appointment.
fhirvs:participationstatus ["accepted" "declined" "tentative" "needs-action"]


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.