FHIR Chat · Optional fields that seems to require default value in base · implementers

Stream: implementers

Topic: Optional fields that seems to require default value in base


view this post on Zulip Morten Ernebjerg (Sep 09 2020 at 11:17):

Hi :wave: Looking at Questionnaire, it seems that there are certain boolean elements that are optional, but for which processing systems and validators are de facto forced to assume a definitive element value if the element is absent. Examples are Questionnaire.experimental (even a modifier field) and Questionnaire.item.repeats. E.g. if the latter is missing, I must assume a value in order to judge whether a QuestionnaireResponse with multiple matching items is valid or not.

Accordingly, I expected there to be default values defined in the documentation (I thought I already knew the two examples above default to "false"). Failing to find them, I finally realized that there is a rule saying that base resource definition cannot have default values (sdf-22 on StructureDefinition). What is the reasoning behind this restrictions? And how is an implementations supposed to deal with (or just know) such apparently "tacit defaults"?

view this post on Zulip Lloyd McKenzie (Sep 09 2020 at 13:47):

FHIR doesn't support default values, but it does have a notion called "meaning if missing" (e.g. http://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.repeats). There probably should be a "meaning if missing" on experimental - can you submit a change request?

view this post on Zulip Morten Ernebjerg (Sep 09 2020 at 14:12):

Ah right, I missed that (given that it isn't there for experimental). I see ElementDefinition.meaningWhenMissing is MarkDown. Is there any way of accessing this information in a machine-readable way or are tools generally expected to have this information hand-coded into them?

Will open a JIRA ticket for experimental.

view this post on Zulip Morten Ernebjerg (Sep 09 2020 at 14:22):

Ticket FHIR-28454

view this post on Zulip Lloyd McKenzie (Sep 09 2020 at 14:42):

The information isn't necessarily going to be straightforward to interpret - e.g. Resource.language. So no, no expectation for computable processing. We actually used to have explicit default values, but that created its own challenges.


Last updated: Apr 12 2022 at 19:14 UTC