Stream: IG creation
Topic: illegal function name null() in discriminator
Jens Villadsen (Aug 25 2020 at 13:45):
What does "Internal error: illegal function name null() in discriminator" mean? I'm seeing it in my IG at https://build.fhir.org/ig/hl7dk/dk-medcom/branches/corrections/qa.html
As far as I can tell, my profile seems correct. Is this a bug I introduced in the discriminator expression or is it a bug in the publisher?
Jens Villadsen (Aug 25 2020 at 13:46):
my intention is that I would like to allow many destinations on my message header, but only a single one with the Extension value of 'primary'
Lloyd McKenzie (Aug 25 2020 at 13:50):
What's your discriminator?
Jens Villadsen (Aug 25 2020 at 15:09):
extension('http://medcom.dk/fhir/medcom-core/StructureDefinition/medcom-messaging-destinationUseExtension').value[x].code
Lloyd McKenzie (Aug 25 2020 at 15:16):
value[x] isn't legal in FHIRPath. just say value
Jens Villadsen (Aug 25 2020 at 15:16):
as in - just value, or valueCoding or alike
Jens Villadsen (Aug 25 2020 at 15:18):
?
Lloyd McKenzie (Aug 25 2020 at 15:18):
I'm not sure that valueCoding is allowed either. The element name is just value. If you want to constrain the type, that's a separate filter.
Jens Villadsen (Aug 25 2020 at 15:19):
but value.code is allowed?
Jens Villadsen (Aug 25 2020 at 15:20):
thats pretty bold
Lloyd McKenzie (Aug 25 2020 at 15:24):
value.code is fine. FHIRPath works with collections - it's not strongly typed. If value is a string then value.code will evaluate to an empty set.
Jens Villadsen (Aug 25 2020 at 16:07):
thx - worked like a charm
Jens Villadsen (Aug 25 2020 at 16:07):
(and someone maybe should do something about that error message .... :thinking: )
Jens Villadsen (Aug 25 2020 at 16:08):
you probably know who that would be. Does that require a Jira?
Jens Villadsen (Aug 25 2020 at 17:15):
@Grahame Grieve ?
Jose Costa Teixeira (Aug 25 2020 at 17:17):
Jira is for the FHIR spec. If it's for the tools (publisher or template), you'd enter a github issue
Jens Villadsen (Aug 25 2020 at 17:18):
ok then - should the spec then be fixed in order to give a specification specified error?
Jens Villadsen (Aug 25 2020 at 17:19):
or are the publisher errors purely a matter of how the author of the publisher likes the error messages to be presented?
Jose Costa Teixeira (Aug 25 2020 at 17:22):
I'm trying to follow the issue. Is it about this
https://www.hl7.org/fhir/fhirpath.html#polymorphism
?
Jens Villadsen (Aug 25 2020 at 17:29):
seems related
Jens Villadsen (Aug 25 2020 at 17:31):
it would be awesome if the error had said something like:
if you specify [x], you're doing it wrong. Look at https://www.hl7.org/fhir/fhirpath.html#polymorphism"
Jose Costa Teixeira (Aug 25 2020 at 17:31):
:)
Jose Costa Teixeira (Aug 25 2020 at 17:32):
Sounds like a publisher thing then.
Jens Villadsen (Aug 25 2020 at 17:32):
well ... I would believe it is in the FhirPathEngine ...
Jens Villadsen (Aug 25 2020 at 17:32):
which is embedded in the publisher
Jens Villadsen (Aug 25 2020 at 17:36):
so if I can find the time to reproduce it, I'll make an awesome PR so that I can get the awesome error message
Jose Costa Teixeira (Aug 25 2020 at 17:37):
Correct. I'm trying to look through the code .
Jose Costa Teixeira (Aug 25 2020 at 17:37):
Jose Costa Teixeira (Aug 25 2020 at 17:38):
Jose Costa Teixeira (Aug 25 2020 at 17:39):
from what I can understand from the code I don't think you can get to "if you're doing vaue[x], you're doing it wrong". Perhaps you need to stick to "you're just doing it wrong".
Jose Costa Teixeira (Aug 25 2020 at 17:40):
and then add the RTFM thing
Jens Villadsen (Aug 25 2020 at 19:10):
well ... I can refine the expression at https://github.com/hapifhir/org.hl7.fhir.core/blob/376e4f0ef15f81c559c05ddb2a3bc4e2342fa06f/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java#L4868 and check if [0] is part of the expression. If that is the case it could be a candidate
Grahame Grieve (Aug 25 2020 at 21:10):
this won't be easy. lexically, value[x] is perfectly valid
Grahame Grieve (Aug 25 2020 at 21:10):
the engine could only decide that this is invalid much later, when it actually evaluates it
Last updated: Apr 12 2022 at 19:14 UTC