FHIR CI-Build

This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions

Questionnaire.shex

Responsible Owner: FHIR Infrastructure Work GroupStandards 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#> 

# ShEx Version 2.2
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 <Resource.shex>
IMPORT <Canonical.shex>
IMPORT <Reference.shex>
IMPORT <Identifier.shex>
IMPORT <Attachment.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <SimpleQuantity.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 only - never for 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>?;  # Jurisdiction of the authority that 
                                            # maintains the questionnaire (if 
                                            # applicable) 
    fhir:purpose @<Markdown>?;              # Why this questionnaire is defined
    fhir:copyright @<Markdown>?;            # Notice about intellectual property 
                                            # ownership, can include 
                                            # restrictions on use 
    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 
}  

# 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 
    			@<SimpleQuantity>  OR 
    			(@<Reference>  AND {fhir:l @<Resource> })  ;  # Actual value for initializing the 
                                            # question 
}  

# Questions and sections within the Questionnaire
<Questionnaire.item> EXTENDS @<BackboneElement> CLOSED {   
    fhir:linkId @<String>;                  # Unique id for item in questionnaire
    fhir:definition @<OneOrMore_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-useable};  # 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
}  

# 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 
    			@<SimpleQuantity>  OR 
    			(@<Reference>  AND {fhir:l @<Resource> })  OR 
    			@<Uri>  OR 
    			@<Attachment>  ;  # Value for question comparison 
                                            # based on operator 
}  

# Permitted answer
<Questionnaire.item.answerOption> EXTENDS @<BackboneElement> CLOSED {   
    fhir:value @<Decimal>  OR 
    			@<Integer>  OR 
    			@<Date>  OR 
    			@<DateTime>  OR 
    			@<Time>  OR 
    			@<String>  OR 
    			@<Uri>  OR 
    			@<Coding>  OR 
    			@<SimpleQuantity>  OR 
    			(@<Reference>  AND {fhir:l @<Resource> })  ;  # Answer value
    fhir:initialSelected @<Boolean>?;       # Whether option is selected by 
                                            # default 
}  

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

#---------------------- 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_Uri> CLOSED {
    rdf:first @<Uri>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Uri> 
}
<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 ------------------------

# Item types allowed to appear on Questionnaire.type (excludes the abstract 'questionnaire' code.
fhirvs:item-type-useable ["group" "display" "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" "BodyStructure" "Bundle" "CapabilityStatement" "CarePlan" "CareTeam" "Claim" "ClaimResponse" "ClinicalAssessment" "ClinicalUseDefinition" "CodeSystem" "Communication" "CommunicationRequest" "CompartmentDefinition" "Composition" "ConceptMap" "Condition" "ConditionDefinition" "Consent" "Contract" "Coverage" "CoverageEligibilityRequest" "CoverageEligibilityResponse" "DetectedIssue" "Device" "DeviceAlert" "DeviceAssociation" "DeviceDefinition" "DeviceMetric" "DeviceRequest" "DiagnosticReport" "DocumentReference" "Encounter" "Endpoint" "EnrollmentRequest" "EnrollmentResponse" "EpisodeOfCare" "EventDefinition" "Evidence" "EvidenceVariable" "ExampleScenario" "ExplanationOfBenefit" "FamilyMemberHistory" "Flag" "FormularyItem" "GenomicStudy" "Goal" "Group" "GuidanceResponse" "HealthcareService" "ImagingSelection" "ImagingStudy" "Immunization" "ImplementationGuide" "Ingredient" "InsurancePlan" "InsuranceProduct" "Invoice" "Library" "Linkage" "List" "Location" "ManufacturedItemDefinition" "Measure" "MeasureReport" "Medication" "MedicationAdministration" "MedicationDispense" "MedicationKnowledge" "MedicationRequest" "MedicationStatement" "MedicinalProductDefinition" "MessageDefinition" "MessageHeader" "MolecularDefinition" "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" "Task" "TerminologyCapabilities" "ValueSet" "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.