Skip to content

FunctionRef Signatures in Nested Function Queries #442

@bdrillard

Description

@bdrillard

Even when signatures are enabled, it appears that for Queries that are nested in a Function implementation, a FunctionRef node does not have signature annotations applied. This makes it difficult to parse a FunctionDef implementation if that implementation contains a Query referencing another Function.

See, ToConcept:

define function ToConcept(concept FHIR.CodeableConcept):
    System.Concept {
        codes: concept.coding C return ToCode(C),
        display: concept.text.value
    }

And the functions' ELM:

      <def name="ToConcept" context="Patient" accessLevel="Public" xsi:type="FunctionDef">
         <expression xsi:type="If">
            <condition asType="t:Boolean" xsi:type="As">
               <operand xsi:type="IsNull">
                  <operand name="concept" xsi:type="OperandRef"/>
               </operand>
            </condition>
            <then asType="t:Concept" xsi:type="As">
               <operand xsi:type="Null"/>
            </then>
            <else classType="t:Concept" xsi:type="Instance">
               <element name="codes">
                  <value xsi:type="Query">
                     <source alias="C">
                        <expression path="coding" xsi:type="Property">
                           <source name="concept" xsi:type="OperandRef"/>
                        </expression>
                     </source>
                     <return>
                        <expression name="ToCode" xsi:type="FunctionRef">
                           <operand name="C" xsi:type="AliasRef"/>
                        </expression>
                     </return>
                  </value>
               </element>
               <element name="display">
                  <value path="value" xsi:type="Property">
                     <source path="text" xsi:type="Property">
                        <source name="concept" xsi:type="OperandRef"/>
                     </source>
                  </value>
               </element>
            </else>
         </expression>
         <operand name="concept">
            <operandTypeSpecifier name="fhir:CodeableConcept" xsi:type="NamedTypeSpecifier"/>
         </operand>
      </def>

Note that in the return clause, where ToCode is applied, no signature is given towards the type of the aliased query item, 'C', nor is any type information given where the alias name is declared. Though we know from the implementation of ToCode that the argument must have type fhir:Coding, this information isn't available in the tree anywhere in the AST for ToConcept where the Function ToCode is referenced, which makes straightforward parsing of function application difficult.

Is it that Signature applications are just currently not being applied in these instances when a Function is invoked in another function's nested Query?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions