R6 Ballot (2nd Draft)

Publish-box (todo)

Subscription.shex

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for subscription

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 <url.shex>
IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <instant.shex>
IMPORT <Patient.shex>
IMPORT <CareTeam.shex>
IMPORT <canonical.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <unsignedInt.shex>
IMPORT <positiveInt.shex>
IMPORT <ContactPoint.shex>
IMPORT <Organization.shex>
IMPORT <Practitioner.shex>
IMPORT <RelatedPerson.shex>
IMPORT <DomainResource.shex>
IMPORT <BackboneElement.shex>
IMPORT <CodeableConcept.shex>
IMPORT <PractitionerRole.shex>
IMPORT <HealthcareService.shex>


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

# Notification about a SubscriptionTopic
<Subscription> EXTENDS @<DomainResource> CLOSED {   

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

    fhir:identifier @<OneOrMore_Identifier>?;  # Additional identifiers (business 
                                            # identifier) 
    fhir:name @<string>?;                   # Human readable name for this 
                                            # subscription 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:subscription-status};  # requested | active | error | off | 
                                            # entered-in-error 
    fhir:topic @<canonical>;                # Reference to the subscription 
                                            # topic being subscribed to 
    fhir:contact @<OneOrMore_ContactPoint>?;  # Contact details for source (e.g. 
                                            # troubleshooting) 
    fhir:end @<instant>?;                   # When to automatically delete the 
                                            # subscription 
    fhir:managingEntity @<Reference> AND {fhir:link 
    			@<CareTeam> OR 
    			@<HealthcareService> OR 
    			@<Organization> OR 
    			@<Patient> OR 
    			@<Practitioner> OR 
    			@<PractitionerRole> OR 
    			@<RelatedPerson> ? }?;  # Entity responsible for 
                                            # Subscription changes 
    fhir:reason @<string>?;                 # Description of why this 
                                            # subscription was created 
    fhir:filterBy @<OneOrMore_Subscription.filterBy>?;  # Criteria for narrowing the 
                                            # subscription topic stream 
    fhir:channelType @<Coding>;             # Channel type for notifications
    fhir:endpoint @<url>?;                  # Where the channel points to
    fhir:parameter @<OneOrMore_Subscription.parameter>?;  # Channel type
    fhir:heartbeatPeriod @<unsignedInt>?;   # Interval in seconds to send 
                                            # 'heartbeat' notification 
    fhir:timeout @<unsignedInt>?;           # Timeout in seconds to attempt 
                                            # notification delivery 
    fhir:contentType @<code> AND
    	{fhir:v @fhirvs:mimetypes}?;  # MIME type to send, or omit for no 
                                            # payload 
    fhir:content @<code> AND
    	{fhir:v @fhirvs:subscription-payload-content}?;  # empty | id-only | full-resource
    fhir:maxCount @<positiveInt>?;          # Maximum number of events that can 
                                            # be combined in a single 
                                            # notification 
}  

# Channel type
<Subscription.parameter> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<string>;                    # Name (key) of the parameter
    fhir:value @<string>;                   # Value of the parameter to use or 
                                            # pass through 
}  

# Criteria for narrowing the subscription topic stream
<Subscription.filterBy> EXTENDS @<BackboneElement> CLOSED {   
    fhir:resource @<uri>?;                  # Allowed Resource (reference to 
                                            # definition) for this Subscription 
                                            # filter 
    fhir:filterParameter @<string>;         # Filter label defined in 
                                            # SubscriptionTopic 
    fhir:comparator @<code> AND
    	{fhir:v @fhirvs:search-comparator}?;  # eq | ne | gt | lt | ge | le | sa | 
                                            # eb | ap 
    fhir:modifier @<code> AND
    	{fhir:v @fhirvs:search-modifier-code}?;  # missing | exact | contains | not | 
                                            # text | in | not-in | below | above 
                                            # | type | identifier | of-type | 
                                            # code-text | text-advanced | 
                                            # iterate 
    fhir:value @<string>;                   # Literal value or resource path
    fhir:event @<OneOrMore_CodeableConcept>?;  # Event to filter by
}  

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

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

<OneOrMore_ContactPoint> CLOSED {
    rdf:first @<ContactPoint>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactPoint> 
}

<OneOrMore_Subscription.filterBy> CLOSED {
    rdf:first @<Subscription.filterBy>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Subscription.filterBy> 
}

<OneOrMore_Subscription.parameter> CLOSED {
    rdf:first @<Subscription.parameter>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Subscription.parameter> 
}

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

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

# This value set includes all possible codes from BCP-13 (see http://tools.ietf.org/html/bcp13)
fhirvs:mimetypes xsd:string #EXTERNAL

# What Search Comparator Codes are supported in search.
fhirvs:search-comparator ["eq" "ne" "gt" "lt" "ge" "le" "sa" "eb" "ap"]

# A supported modifier for a search parameter.
fhirvs:search-modifier-code ["missing" "exact" "contains" "not" "text" "in" "not-in" "below" "above" "type" "identifier" "of-type" "code-text" "text-advanced" "iterate"]

# Codes to represent how much resource content to send in the notification payload.
fhirvs:subscription-payload-content ["empty" "id-only" "full-resource"]

# State values for FHIR Subscriptions.
fhirvs:subscription-status ["requested" "active" "error" "off" "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.