answers() function used in Questionnaire example

XMLWordPrintableJSON

    • Type: Change Request
    • Resolution: Persuasive
    • Priority: High
    • Structured Data Capture (SDC) (FHIR)
    • current
    • FHIR Infrastructure
    • (NA)
    • 12.62.9
    • Hide

      sum() is a candidate as a simplification of aggregate and should be in FHIRPath directly.

      answers() and ordinal should be in the FHIR-specific FHIRPath page as they're not generic.

      Will submit proposals as follows:

      sum() as a shortcut for an equivalent aggregate.  It will operate on a collection and will not take an argument.

      answers() as - default context is %item.  If you don't want that, must define context.  It will return all answers on descendants of the context node (but not on the context node itself).  If an item has multiple answers, they will all be added to the collection.  Answers for disabled items will not be added.

      ordinal() as

      • find the ordinal value extension for the item, first by looking at the value in the QuestionnaireResponse, then checking the selected item in the value set or Questionnaire.options, then checking the selected item in the underlying code system.
      • SDC will indicate that systems SHOULD propagate the ordinal into the answer.
      • if item isn't one of the types that allow ordinals or no options are defined, then empty set
      • if it doesn't have one (checked value, value set & code system), then 'empty set'.
      • if FHIRPath engine can't check all of those things (e.g. nothing on value, not able to check value set or code system) then fail

      Will correct example to be %resource.answers().value.ordinal().sum()

      Will document these capabilities as pre-adoptions in SDC, noting that they're proposed in their relevant specs and can be used in the meantime as local functions.

       

      @grahame Grieve will write up a proposal for vocab that would allow an expand call to mandate inclusion of ordinals where they exist (and fail if it can't).

      Show
      sum() is a candidate as a simplification of aggregate and should be in FHIRPath directly. answers() and ordinal should be in the FHIR-specific FHIRPath page as they're not generic. Will submit proposals as follows: sum() as a shortcut for an equivalent aggregate.  It will operate on a collection and will not take an argument. answers() as - default context is %item.  If you don't want that, must define context.  It will return all answers on descendants of the context node (but not on the context node itself).  If an item has multiple answers, they will all be added to the collection.  Answers for disabled items will not be added. ordinal() as find the ordinal value extension for the item, first by looking at the value in the QuestionnaireResponse, then checking the selected item in the value set or Questionnaire.options, then checking the selected item in the underlying code system. SDC will indicate that systems SHOULD propagate the ordinal into the answer. if item isn't one of the types that allow ordinals or no options are defined, then empty set if it doesn't have one (checked value, value set & code system), then 'empty set'. if FHIRPath engine can't check all of those things (e.g. nothing on value, not able to check value set or code system) then fail Will correct example to be %resource.answers().value.ordinal().sum() Will document these capabilities as pre-adoptions in SDC, noting that they're proposed in their relevant specs and can be used in the meantime as local functions.   @grahame Grieve will write up a proposal for vocab that would allow an expand call to mandate inclusion of ordinals where they exist (and fail if it can't).
    • Bryn Rhodes/Paul Lynch: 5-0-0
    • Enhancement
    • Compatible, substantive

      The PHQ-9 example (https://build.fhir.org/ig/HL7/sdc/Questionnaire-questionnaire-sdc-profile-example-PHQ9.json.html) includes the FHIRPath expression "answers().sum(value.ordinal())". This was proposed in June 2018 (Boston DevDays) by Grahame (see http://www.healthintersections.com.au/?p=2835), but the functions answers(), sum(), and ordinal() are not defined in the current FHIRPath (N1) release, nor in the FHIR extensions to FHIRPath (https://hl7.org/fhir/fhirpath.html).

      Do we want to add:
      1) answers()
      2) sum()
      3) ordinal()

      If the answer is not yes to all three, the example needs to be revised.

            Assignee:
            Lloyd McKenzie
            Reporter:
            Paul Lynch
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: