Stream: implementers
Topic: SDC deleting values
Gabriela Brown (May 26 2020 at 18:44):
Are there any thoughts/specifications on SDC that can capture when a user wants to remove a value? For example, we have a Questionnaire that that captures a Practitioner's certifications/licenses (and maps to Practitioner.qualification
). On a previous iteration, a user added a qualification incorrectly. The user realizes their mistake, goes and opens the form again, with a newly populated QuestionnaireResponse, including the incorrect qualification. How would you indicate in SDC logic that this element needs to be removed?
Lloyd McKenzie (May 26 2020 at 20:03):
Questionnaires aren't really about adding or removing. I guess there's too options:
- the data from the new QuestionnaireResponse is treated as a complete replacement of whatever was there previously. If you don't include the license when you fill out the form again, it'll be yanked
- you ask specific questions about what should be removed and your extract should turn into a Bundle with 'patch' instructions to add stuff, remove stuff, change stuff, etc.
Gabriela Brown (May 26 2020 at 20:25):
Ok, that makes sense. For the second option, the approach I'm thinking of is:
- whenever extract sees that the target resource has a value, but the source item doesn't have an answer, it removes the value in the 'patch'
enableWhen => false
answers are also considered "values to be removed"
I'm not certain about this second point about enableWhen, because there are some places in the specification that say non-enabled items should be ignored entirely, e.g. when validating required answers on a QuestionnaireResponse.
I'm also uncertain about the extent to which business logic data modeling should happen within the Questionnaire (with hidden + enableWhen items), versus the extent to which Questionnaires should _only_ capture user-entered data and all other logic (e.g. creating additional resources, changing values in a way that's hidden to the user but consistent with how you want the data to be shaped) happens somewhere else.
Lloyd McKenzie (May 26 2020 at 21:45):
enableWhens shouldn't much matter in the extraction process, that's more about validation of the instance. If you have a required element that's not enabled, then it's not treated as being 'in' the Questionnaire from a validation perspective. The extraction process will be driven by what data actually appears in the QuestionnaireResponse. You'll have no idea what was pre-populated or what the user changed, you'll only see the final set of answers
Last updated: Apr 12 2022 at 19:14 UTC