Skip to content

Instantly share code, notes, and snippets.

@brianpos
Last active October 27, 2023 21:04
Show Gist options
  • Save brianpos/f7e27dc0e9a929175550fcd5a26116ed to your computer and use it in GitHub Desktop.
Save brianpos/f7e27dc0e9a929175550fcd5a26116ed to your computer and use it in GitHub Desktop.
FHIR Questionnaire Definition Validation

Questionnaire top level validation should consider:

  • Check the canonical versioning algorithm and version don't contradict each other
  • Add a warning that the canonical URL is highly recommended
  • if status = published, ensure that has a canonical URL
  • information/warning if derivedFRom isn't a versioned canonical URL
  • Should subjectType and launch context be the same?
  • Check the copyright label is from the set of approved licenses?
  • Should there be some date checks on the approved, review and date etc?
  • definitionBased flag
  • anything needed for the replaces extension?
  • Validate libraries? (from behaviour profile)
  • validate all the root level expressions
  • Check for any cqf-calculatedValue extensions - these must produce the same datatype as the property that they are attached to
  • Check other fhirpath expressions
    • itemExtractionContext
    • itemPopulationContext
    • SourceQueries
    • assembleContext - I need to dig into this one more - will need to resolve the subQuestionnaire to check what names are needed

When proceeding to the item level validations the fhirpath symbol table should include:

  • questionnaire - access to the definition
  • launchContexts
  • variables
  • assembleContext if appropriate

Item level validations

  • definition is a real thing (reference to a real structuredefinition, and element within that snapshot too)
  • enableWhen refers to existing linkIds & datatypes match
  • enableWhenExpression valid and output datatypes match?
  • minValue/maxValue/minLength/maxLength only on appriopriate datatypes
  • minQuantity/maxQuantity only on quantity types
  • answerOptions match the datatype of the item
  • intialValue matches the datatype of the item
  • initialExpression matches the datatype of the item
  • valid regex
  • fhirpath expressions are valid
    • variable
    • initialExpression
  • Check that properties are only entered where they are valid for the item's datatype
  • Check that the item control is appropriate for the datatype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment