Stream: fhirpath
Topic: Literal syntax for Concept
Chris Moesel (Dec 14 2020 at 18:00):
Someone recently asked me how you would use FHIRPath to describe an invariant that says "for a given coding, if the coding contains a certain code A, it has to also contain a second code B, where B is not in a certain valueset S." My attempt at this was:
x.coding.where(system = 'http://loinc.org' and code = '12345').exists() implies x.coding.where(system != 'http://loinc.org' and code != '12345' and $this.memberOf('http://myvaluesets.org/ABC').not()).exists()
I think that's right, but correct me if I'm wrong! Anyway, that's not the point. The thing I realized is that it could be cleaned up if FHIRPath had a literal syntax for a concept (system, code, optional display). FHIR Shorthand has one that might work out really well here. If it was employed, then the above would be rewritten as:
x.coding.where($this ~ http://loinc.org#12345).exists() implies x.coding.where($this !~ http://loinc.org#12345 and $this.memberOf('http://myvaluesets.org/ABC').not()).exists()
Have we given any thought to supporting a literal representation of CQL's Concept
?
Chris Moesel (Dec 31 2020 at 00:51):
So... I guess that's a no. ;-). Well then, maybe we should consider it?
Josh Mandel (Jan 04 2021 at 16:28):
Might suggest the pipe convention for concatenating a system + code, since FHIR uses that elsewhere.
Chris Moesel (Jan 04 2021 at 17:44):
I hadn't thought of this before, but FHIR also uses |
for canonical
. So http://foo.org|bar
means different things depending on the context of its use. I don't love that. (But I guess the same might be said for http://foo.org#bar
).
Bryn Rhodes (Jan 09 2021 at 19:56):
Regardless of whether it's a |
or a #
, it seems like it would need delimiters in order to be added to FHIRPath, since many of the symbols allowed in URLs are already part of other production rules in the grammar. Maybe it's a #
followed by the FHIR URL syntax for a code? So #http://foo.org|bar
? And you could potentially generalize that to a "uri" literal and use it for both codes and canonicals...
Grahame Grieve (Jan 14 2021 at 17:49):
it does have many problems
Last updated: Apr 12 2022 at 19:14 UTC