R6 Ballot (1st Draft)

This page is part of the FHIR Specification v6.0.0-ballot1: Release 6 Ballot (1st Draft) (see Ballot Notes). The current version is 5.0.0. For a full list of available versions, see the Directory of published versions

Questionnaire.shex

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

Raw ShEx

ShEx statement for questionnaire

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 <date.shex>
IMPORT <time.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <Period.shex>
IMPORT <boolean.shex>
IMPORT <decimal.shex>
IMPORT <integer.shex>
IMPORT <dateTime.shex>
IMPORT <markdown.shex>
IMPORT <Quantity.shex>
IMPORT <Resource.shex>
IMPORT <canonical.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <Attachment.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>


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

# A structured set of questions
<Questionnaire> EXTENDS @<DomainResource> CLOSED {   

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

    fhir:url @<uri>?;                       # Canonical identifier for this 
                                            # questionnaire, represented as an 
                                            # absolute URI (globally unique) 
    fhir:identifier @<OneOrMore_Identifier>?;  # Business identifier for 
                                            # questionnaire 
    fhir:version @<string>?;                # Business version of the 
                                            # questionnaire 
    fhir:versionAlgorithm @<string>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<string>?;                   # Name for this questionnaire 
                                            # (computer friendly) 
    fhir:title @<string>?;                  # Name for this questionnaire (human 
                                            # friendly) 
    fhir:derivedFrom @<OneOrMore_canonical>?;  # Based on Questionnaire
    fhir:status @<code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<boolean>?;          # For testing purposes, not real 
                                            # usage 
    fhir:subjectType @<OneOrMore_code> AND
    	{fhir:v @fhirvs:resource-types}?;  # Resource that can be subject of 
                                            # QuestionnaireResponse 
    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 questionnaire 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Intended jurisdiction for 
                                            # questionnaire (if applicable) 
    fhir:purpose @<markdown>?;              # Why this questionnaire is defined
    fhir:copyright @<markdown>?;            # Use and/or publishing restrictions
    fhir:copyrightLabel @<string>?;         # Copyright holder and year(s)
    fhir:approvalDate @<date>?;             # When the questionnaire was 
                                            # approved by publisher 
    fhir:lastReviewDate @<date>?;           # When the questionnaire was last 
                                            # reviewed by the publisher 
    fhir:effectivePeriod @<Period>?;        # When the questionnaire is expected 
                                            # to be used 
    fhir:code @<OneOrMore_Coding>?;         # Concept that represents the 
                                            # overall questionnaire 
    fhir:item @<OneOrMore_Questionnaire.item>?;  # Questions and sections within the 
                                            # Questionnaire 
}  

# Nested questionnaire items
<Questionnaire.item.itemnull> CLOSED {   
}  

# Initial value(s) when item is first rendered
<Questionnaire.item.initial> EXTENDS @<BackboneElement> CLOSED {   
    fhir:value @<boolean>  OR 
    			@<decimal>  OR 
    			@<integer>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<time>  OR 
    			@<string>  OR 
    			@<uri>  OR 
    			@<Attachment>  OR 
    			@<Coding>  OR 
    			@<Quantity>  OR 
    			(@<Reference>  AND {fhir:link @<Resource> })  ;  # Actual value for initializing the 
                                            # question 
}  

# Permitted answer
<Questionnaire.item.answerOption> EXTENDS @<BackboneElement> CLOSED {   
    fhir:value @<integer>  OR 
    			@<date>  OR 
    			@<time>  OR 
    			@<string>  OR 
    			@<Coding>  OR 
    			(@<Reference>  AND {fhir:link @<Resource> })  ;  # Answer value
    fhir:initialSelected @<boolean>?;       # Whether option is selected by 
                                            # default 
}  

# Only allow data when
<Questionnaire.item.enableWhen> EXTENDS @<BackboneElement> CLOSED {   
    fhir:question @<string>;                # The linkId of question that 
                                            # determines whether item is 
                                            # enabled/disabled 
    fhir:operator @<code> AND
    	{fhir:v @fhirvs:questionnaire-enable-operator};  # exists | = | != | > | < | >= | <=
    fhir:answer @<boolean>  OR 
    			@<decimal>  OR 
    			@<integer>  OR 
    			@<date>  OR 
    			@<dateTime>  OR 
    			@<time>  OR 
    			@<string>  OR 
    			@<Coding>  OR 
    			@<Quantity>  OR 
    			(@<Reference>  AND {fhir:link @<Resource> })  ;  # Value for question comparison 
                                            # based on operator 
}  

# Questions and sections within the Questionnaire
<Questionnaire.item> EXTENDS @<BackboneElement> CLOSED {   
    fhir:linkId @<string>;                  # Unique id for item in questionnaire
    fhir:definition @<uri>?;                # ElementDefinition - details for 
                                            # the item 
    fhir:code @<OneOrMore_Coding>?;         # Corresponding concept for this 
                                            # item in a terminology 
    fhir:prefix @<string>?;                 # E.g. "1(a)", "2.5.3"
    fhir:text @<string>?;                   # Primary text for the item
    fhir:type @<code> AND
    	{fhir:v @fhirvs:item-type};  # group | display | boolean | 
                                            # decimal | integer | date | 
                                            # dateTime + 
    fhir:enableWhen @<OneOrMore_Questionnaire.item.enableWhen>?;  # Only allow data when
    fhir:enableBehavior @<code> AND
    	{fhir:v @fhirvs:questionnaire-enable-behavior}?;  # all | any
    fhir:disabledDisplay @<code> AND
    	{fhir:v @fhirvs:questionnaire-disabled-display}?;  # hidden | protected
    fhir:required @<boolean>?;              # Whether the item must be included 
                                            # in data results 
    fhir:repeats @<boolean>?;               # Whether the item may repeat
    fhir:readOnly @<boolean>?;              # Don't allow human editing
    fhir:maxLength @<integer>?;             # No more than these many characters
    fhir:answerConstraint @<code> AND
    	{fhir:v @fhirvs:questionnaire-answer-constraint}?;  # optionsOnly | optionsOrType | 
                                            # optionsOrString 
    fhir:answerValueSet @<canonical>?;      # ValueSet containing permitted 
                                            # answers 
    fhir:answerOption @<OneOrMore_Questionnaire.item.answerOption>?;  # Permitted answer
    fhir:initial @<OneOrMore_Questionnaire.item.initial>?;  # Initial value(s) when item is 
                                            # first rendered 
    fhir:item @<OneOrMore_Questionnaire.item>?;  # Nested questionnaire items
}  

#---------------------- 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_code> CLOSED {
    rdf:first @<code>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_code> 
}

<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_Coding> CLOSED {
    rdf:first @<Coding>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Coding> 
}

<OneOrMore_Questionnaire.item> CLOSED {
    rdf:first @<Questionnaire.item>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Questionnaire.item> 
}

<OneOrMore_Questionnaire.item.enableWhen> CLOSED {
    rdf:first @<Questionnaire.item.enableWhen>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Questionnaire.item.enableWhen> 
}

<OneOrMore_Questionnaire.item.answerOption> CLOSED {
    rdf:first @<Questionnaire.item.answerOption>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Questionnaire.item.answerOption> 
}

<OneOrMore_Questionnaire.item.initial> CLOSED {
    rdf:first @<Questionnaire.item.initial>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Questionnaire.item.initial> 
}

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

# Distinguishes groups from questions and display text and indicates data type for questions.
fhirvs:item-type ["group" "display" "question" "boolean" "decimal" "integer" "date" "dateTime" "time" "string" "text" "url" "coding" "attachment" "reference" "quantity"]

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

# Codes that describe the types of constraints possible on a question item that has a list of permitted answers
fhirvs:questionnaire-answer-constraint ["optionsOnly" "optionsOrType" "optionsOrString"]

# Codes that guide the display of disabled questionnaire items
fhirvs:questionnaire-disabled-display ["hidden" "protected"]

# Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
fhirvs:questionnaire-enable-behavior ["all" "any"]

# The criteria by which a question is enabled.
fhirvs:questionnaire-enable-operator ["exists" "=" "!=" ">" "<" ">=" "<="]

# 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" "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" "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.