R6 Ballot (2nd Draft)

Publish-box (todo)

Messagedefinition.shex

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

Raw ShEx

ShEx statement for messagedefinition

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 <string.shex>
IMPORT <Coding.shex>
IMPORT <boolean.shex>
IMPORT <dateTime.shex>
IMPORT <markdown.shex>
IMPORT <canonical.shex>
IMPORT <Identifier.shex>
IMPORT <unsignedInt.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>


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

# A resource that defines a type of message that can be exchanged between systems
<MessageDefinition> EXTENDS @<DomainResource> CLOSED {   

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

    fhir:url @<uri>?;                       # The cannonical URL for a given 
                                            # MessageDefinition 
    fhir:identifier @<OneOrMore_Identifier>?;  # Business Identifier for a given 
                                            # MessageDefinition 
    fhir:version @<string>?;                # Business version of the message 
                                            # definition 
    fhir:versionAlgorithm @<string>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<string>?;                   # Name for this message definition 
                                            # (computer friendly) 
    fhir:title @<string>?;                  # Name for this message definition 
                                            # (human friendly) 
    fhir:replaces @<OneOrMore_canonical>?;  # Takes the place of
    fhir:status @<code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<boolean>?;          # For testing purposes, not real 
                                            # usage 
    fhir:date @<dateTime>;                  # Date last changed
    fhir:publisher @<string>?;              # Name of the publisher/steward 
                                            # (organization or individual) 
    fhir:contact @<OneOrMore_ContactDetail>?;  # Contact details for the publisher
    fhir:description @<markdown>?;          # Natural language description of 
                                            # the message definition 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Intended jurisdiction for message 
                                            # definition (if applicable) 
    fhir:purpose @<markdown>?;              # Why this message definition is 
                                            # defined 
    fhir:copyright @<markdown>?;            # Use and/or publishing restrictions
    fhir:copyrightLabel @<string>?;         # Copyright holder and year(s)
    fhir:base @<canonical>?;                # Definition this one is based on
    fhir:parent @<OneOrMore_canonical>?;    # Protocol/workflow this is part of
    fhir:event @<Coding>  OR 
    			@<uri>  ;  # Event code  or link to the 
                                            # EventDefinition 
    fhir:category @<code> AND
    	{fhir:v @fhirvs:message-significance-category}?;  # consequence | currency | 
                                            # notification 
    fhir:focus @<OneOrMore_MessageDefinition.focus>?;  # Resource(s) that are the subject 
                                            # of the event 
    fhir:responseRequired @<code> AND
    	{fhir:v @fhirvs:messageheader-response-request}?;  # always | on-error | never | 
                                            # on-success 
    fhir:allowedResponse @<OneOrMore_MessageDefinition.allowedResponse>?;  # Responses to this message
    fhir:graph @<canonical>?;               # Canonical reference to a 
                                            # GraphDefinition 
}  

# Resource(s) that are the subject of the event
<MessageDefinition.focus> EXTENDS @<BackboneElement> CLOSED {   
    fhir:code @<code> AND
    	{fhir:v @fhirvs:resource-types};  # Type of resource
    fhir:profile @<canonical>?;             # Profile that must be adhered to by 
                                            # focus 
    fhir:min @<unsignedInt>;                # Minimum number of focuses of this 
                                            # type 
    fhir:max @<string>?;                    # Maximum number of focuses of this 
                                            # type 
}  

# Responses to this message
<MessageDefinition.allowedResponse> EXTENDS @<BackboneElement> CLOSED {   
    fhir:message @<canonical>;              # Reference to allowed message 
                                            # definition response 
    fhir:situation @<markdown>?;            # When should this response be used
}  

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

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

<OneOrMore_canonical> CLOSED {
    rdf:first @<canonical>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_canonical> 
}

<OneOrMore_ContactDetail> CLOSED {
    rdf:first @<ContactDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactDetail> 
}

<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}

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

<OneOrMore_MessageDefinition.focus> CLOSED {
    rdf:first @<MessageDefinition.focus>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MessageDefinition.focus> 
}

<OneOrMore_MessageDefinition.allowedResponse> CLOSED {
    rdf:first @<MessageDefinition.allowedResponse>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_MessageDefinition.allowedResponse> 
}

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

# The impact of the content of a message.
fhirvs:message-significance-category ["consequence" "currency" "notification"]

# HL7-defined table of codes which identify conditions under which acknowledgments are required to be returned in response to a message.
fhirvs:messageheader-response-request ["always" "on-error" "never" "on-success"]

# The lifecycle status of an artifact.
fhirvs:publication-status ["draft" "active" "retired" "unknown"]

# Concrete FHIR Resource Types
fhirvs:resource-types ["Account" "ActivityDefinition" "ActorDefinition" "AdministrableProductDefinition" "AdverseEvent" "AllergyIntolerance" "Appointment" "AppointmentResponse" "ArtifactAssessment" "AuditEvent" "Basic" "Binary" "BiologicallyDerivedProduct" "BiologicallyDerivedProductDispense" "BodyStructure" "Bundle" "CapabilityStatement" "CarePlan" "CareTeam" "ChargeItem" "ChargeItemDefinition" "Citation" "Claim" "ClaimResponse" "ClinicalImpression" "ClinicalUseDefinition" "CodeSystem" "Communication" "CommunicationRequest" "CompartmentDefinition" "Composition" "ConceptMap" "Condition" "ConditionDefinition" "Consent" "Contract" "Coverage" "CoverageEligibilityRequest" "CoverageEligibilityResponse" "DetectedIssue" "Device" "DeviceAlert" "DeviceAssociation" "DeviceDefinition" "DeviceDispense" "DeviceMetric" "DeviceRequest" "DeviceUsage" "DiagnosticReport" "DocumentReference" "Encounter" "EncounterHistory" "Endpoint" "EnrollmentRequest" "EnrollmentResponse" "EpisodeOfCare" "EventDefinition" "Evidence" "EvidenceReport" "EvidenceVariable" "ExampleScenario" "ExplanationOfBenefit" "FamilyMemberHistory" "Flag" "FormularyItem" "GenomicStudy" "Goal" "GraphDefinition" "Group" "GuidanceResponse" "HealthcareService" "ImagingSelection" "ImagingStudy" "Immunization" "ImmunizationEvaluation" "ImmunizationRecommendation" "ImplementationGuide" "Ingredient" "InsurancePlan" "InsuranceProduct" "InventoryItem" "InventoryReport" "Invoice" "Library" "Linkage" "List" "Location" "ManufacturedItemDefinition" "Measure" "MeasureReport" "Medication" "MedicationAdministration" "MedicationDispense" "MedicationKnowledge" "MedicationRequest" "MedicationStatement" "MedicinalProductDefinition" "MessageDefinition" "MessageHeader" "MolecularDefinition" "MolecularSequence" "NamingSystem" "NutritionIntake" "NutritionOrder" "NutritionProduct" "Observation" "ObservationDefinition" "OperationDefinition" "OperationOutcome" "Organization" "OrganizationAffiliation" "PackagedProductDefinition" "Parameters" "Patient" "PaymentNotice" "PaymentReconciliation" "Permission" "Person" "PlanDefinition" "Practitioner" "PractitionerRole" "Procedure" "Provenance" "Questionnaire" "QuestionnaireResponse" "RegulatedAuthorization" "RelatedPerson" "RequestOrchestration" "Requirements" "ResearchStudy" "ResearchSubject" "RiskAssessment" "Schedule" "SearchParameter" "ServiceRequest" "Slot" "Specimen" "SpecimenDefinition" "StructureDefinition" "StructureMap" "Subscription" "SubscriptionStatus" "SubscriptionTopic" "Substance" "SubstanceDefinition" "SubstanceNucleicAcid" "SubstancePolymer" "SubstanceProtein" "SubstanceReferenceInformation" "SubstanceSourceMaterial" "SupplyDelivery" "SupplyRequest" "Task" "TerminologyCapabilities" "TestPlan" "TestReport" "TestScript" "Transport" "ValueSet" "VerificationResult" "VisionPrescription"]


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.