Document behavior of answerExpression

XMLWordPrintableJSON

    • Type: Change Request
    • Resolution: Persuasive with Modification
    • Priority: Medium
    • Structured Data Capture (SDC) (FHIR)
    • current
    • FHIR Infrastructure
    • Form Behavior and Calculation
    • Hide

      Provide the following guidance:

      • if the allowed set of answers for a question changes after an answer has been specified (whether via population or user entry), the prior answer SHOULD be retained in the user interface until such time as the questionaire is marked as 'complete', even if invalid.  This is to minimize impact on users if they accidentally toggle elements within the form that govern the answerExpression.  However, in some cases, this will not be possible depending on the data entry controls.  Systems MAY wipe the answer on the grounds that a change to the list of possible answers might result in different answers. 
      • If an answer becomes invalid based on evaluation of answerExpression, calculated values falling out of range, etc., the form SHALL flag the answer as invalid and prevent the QuestionnaireResponse from being marked as 'complete'.
      • In answerExpression, note that if the answerExpression relies on content outside the QuestionnaireResponse (e.g. launch context or query results), the ability to consistently check the validity of the QuestionnaireResponse - particularly for downstream systems - may be difficult.  One potential solution is to populate internal (and potentially hidden questions) with information passed in by context or found through query such that validation of answers can be based entirely on information stored within the QuestionnaireResponse, though privacy and/or storage considerations may make this impractical in some cases.
      • On 'hidden', highlight that hiding data from the enterer is not a solution to data privacy/security concerns as any questionnaire answer must be presumed to be potentially available to any consumer of the questionnaire in some manner.
      • Note that it is possible that answerExpression and initialExpression can both exist.  InitialExpression runs on launch and answerExpression should run whenever the user interface needs to render the question, the user interacts with the question or during validation.
      • Also note that answerExpresssion and calculatedExpression can both exist and are re-calculated when the source for their expressions change.  If the calculatedExpression is not valid according to the results of the current answerExpression, the QuestionnaireResponse will fail validation and be unable to be marked as 'completed' until corrected.
      • Will also ensure that there's language that indicates that the result of initialExpression, calculatedExpression and answerExpression must all align with the 'type' of the item they appear on - e.g. can't have an expression that returns a string if the type is Choice/Coding.
      Show
      Provide the following guidance: if the allowed set of answers for a question changes after an answer has been specified (whether via population or user entry), the prior answer SHOULD be retained in the user interface until such time as the questionaire is marked as 'complete', even if invalid.  This is to minimize impact on users if they accidentally toggle elements within the form that govern the answerExpression.  However, in some cases, this will not be possible depending on the data entry controls.  Systems MAY wipe the answer on the grounds that a change to the list of possible answers might result in different answers.  If an answer becomes invalid based on evaluation of answerExpression, calculated values falling out of range, etc., the form SHALL flag the answer as invalid and prevent the QuestionnaireResponse from being marked as 'complete'. In answerExpression, note that if the answerExpression relies on content outside the QuestionnaireResponse (e.g. launch context or query results), the ability to consistently check the validity of the QuestionnaireResponse - particularly for downstream systems - may be difficult.  One potential solution is to populate internal (and potentially hidden questions) with information passed in by context or found through query such that validation of answers can be based entirely on information stored within the QuestionnaireResponse, though privacy and/or storage considerations may make this impractical in some cases. On 'hidden', highlight that hiding data from the enterer is not a solution to data privacy/security concerns as any questionnaire answer must be presumed to be potentially available to any consumer of the questionnaire in some manner. Note that it is possible that answerExpression and initialExpression can both exist.  InitialExpression runs on launch and answerExpression should run whenever the user interface needs to render the question, the user interacts with the question or during validation. Also note that answerExpresssion and calculatedExpression can both exist and are re-calculated when the source for their expressions change.  If the calculatedExpression is not valid according to the results of the current answerExpression, the QuestionnaireResponse will fail validation and be unable to be marked as 'completed' until corrected. Will also ensure that there's language that indicates that the result of initialExpression, calculatedExpression and answerExpression must all align with the 'type' of the item they appear on - e.g. can't have an expression that returns a string if the type is Choice/Coding.
    • Brian Postlethwaite/Paul Lynch: 5-0-0
    • Clarification
    • Compatible, substantive

      Some questions need to be answered for the newly created answerExpression extension (J#25960),
      1) If the answer list generated by the expression changes at all, should the field value be erased? (I vote yes. Even if the answer is in the new list, the user might have picked a different answer if the other answers were different.)

      2) Can an item with answerExpression also have initialExpression?

      3) If (2) is Yes, then in what order should they be run, and what should be done if the initialExpression does not resolve to an item from the list answerExpression generates, and the item does not allow off-list answers?  (Suggestion: Run answerExpression first, so that if the field does not allow off-list answers, the value produced by initialExpression can be checked against the list (and possibly ignored with some warning).

      4) Can an item with answerExpression also have calculatedExpression? (I think the same approach for (2) could work here.)

            Assignee:
            Unassigned
            Reporter:
            Paul Lynch
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: