Stream: fhirpath
Topic: this vs $this
Josh Mandel (May 02 2019 at 17:35):
In this example we see the following expression:
(this | %previous).location.where(location = 'Location/emergency' and status in {'active', 'completed'}).exists()
Should this
actually be $this
, or are both valid?
Josh Mandel (May 02 2019 at 17:35):
(Related: how are fhirpath expressions in the spec validated?)
Bryn Rhodes (May 02 2019 at 18:05):
Should be $this
, it's a special-purpose identifier in the grammar.
Bryn Rhodes (May 02 2019 at 18:06):
The expressions in the spec are validated with the engine running
Bryn Rhodes (May 02 2019 at 18:06):
in the build
Bryn Rhodes (May 02 2019 at 18:06):
But since that particular example doesn't actually run as part of the build, it's not validated.
Grahame Grieve (May 02 2019 at 18:07):
that expression is not validated - it's not in a place the validator knows to look and validate. And I think it should actually be
(%current | %previous).location.where(location = 'Location/emergency' and status in {'active', 'completed'}).exists()
Paul Lynch (May 02 2019 at 18:09):
Where is %current defined?
Bryn Rhodes (May 02 2019 at 18:10):
%current
is a context variable so it's defined by whatever the context specifies. In this case, a trigger condition, so it's specified as part of the condition element as an expectation of the implementation.
Paul Lynch (May 02 2019 at 18:17):
That makes sense. FYI, at http://build.fhir.org/metadatatypes-definitions.html#TriggerDefinition.condition, I saw %previous mentioned, but not %current defined as a variable name. Although it says you should be able to get to the current resource, it does not say what variable name it is in.
Grahame Grieve (May 02 2019 at 18:23):
right. that work is incomplete for that reason
Josh Mandel (May 02 2019 at 19:21):
Added GF#21233
Last updated: Apr 12 2022 at 19:14 UTC