Uploaded image for project: 'FHIR Specification Feedback'
  1. FHIR Specification Feedback
  2. FHIR-43083

Harmonize requirements on variable names

    XMLWordPrintableJSON

Details

    • Icon: Change Request Change Request
    • Resolution: Persuasive with Modification
    • Icon: Medium Medium
    • Structured Data Capture (SDC) (FHIR)
    • current
    • FHIR Infrastructure
    • Using Expressions
    • 5.1
    • Hide

      Will remove all language pointed to in this tracker or the associated Zulip thread that talks about overriding/colliding names and will instead point to a new section in using expressions called "Managing colliding variable declarations".

      Variable names SHOULD be unique in a context  (e.g. Questionnaire root or a specific item).  It is an error if the same variable name is assigned a value more than once in a single node.  It is also an error to define a variable name that has the same name as one of the standard FHIRPath names (e.g. %qitem).  If the same variable is assigned on both an element and a descendant element, a warning will be generated, however it is not an error.  The descendant declaration will be treated as overriding the higher-level declaration.

      Show
      Will remove all language pointed to in this tracker or the associated Zulip thread that talks about overriding/colliding names and will instead point to a new section in using expressions called "Managing colliding variable declarations". Variable names SHOULD be unique in a context  (e.g. Questionnaire root or a specific item).  It is an error if the same variable name is assigned a value more than once in a single node.  It is also an error to define a variable name that has the same name as one of the standard FHIRPath names (e.g. %qitem).  If the same variable is assigned on both an element and a descendant element, a warning will be generated, however it is not an error.  The descendant declaration will be treated as overriding the higher-level declaration.
    • Paul Lynch/Brian Postlethwaite: 5-0-0
    • Correction
    • Compatible, substantive

    Description

      https://build.fhir.org/ig/HL7/sdc/expressions.html#variable says, "It is not allowed to define variable names that are already reserved by the base specification or by other variables in the questionnaire."  This seems to say that a variable name cannot appear more than once in a Questionnaire.

      However, https://build.fhir.org/ig/HL7/sdc/expressions.html#use-of-the-expression-type, under "name", says, " However, overriding a name in a descendant element is NOT an error... and is in fact a common occurrence in modular forms."

      These two conflict, and should be harmonized.

      I am of the opinion that variables in a descendant element can override the value of ancestor element (for that descendant element and its descendants).  This has been implemented in LHC-Forms.

      I also agree with the wording on the same page that says, "If there is a 
      [launchContext|https://build.fhir.org/ig/HL7/sdc/expressions.html#launchContext] extension called 'patient' and then on the same item there's also a [variable|https://build.fhir.org/ig/HL7/sdc/expressions.html#variable] extension also named 'patient', that would be an error".  However, the sentence before that needs a small change:

      "Collisions between names that are defined more than once within the same containing element will be treated as an error."

      should become:

      "Collisions between names that are defined more than once on the same element will be treated as an error."

      Attachments

        Activity

          People

            Unassigned Unassigned
            plynch Paul Lynch
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: