FHIR Chat · illegal function name null() in discriminator · IG creation

Stream: IG creation

Topic: illegal function name null() in discriminator


view this post on Zulip 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?

image.png

view this post on Zulip 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'

view this post on Zulip Lloyd McKenzie (Aug 25 2020 at 13:50):

What's your discriminator?

view this post on Zulip Jens Villadsen (Aug 25 2020 at 15:09):

extension('http://medcom.dk/fhir/medcom-core/StructureDefinition/medcom-messaging-destinationUseExtension').value[x].code

(from https://github.com/hl7dk/dk-medcom/blob/corrections/input/resources/MedcomMessagingMessageHeader.StructureDefinition.xml#L53)

view this post on Zulip Lloyd McKenzie (Aug 25 2020 at 15:16):

value[x] isn't legal in FHIRPath. just say value

view this post on Zulip Jens Villadsen (Aug 25 2020 at 15:16):

as in - just value, or valueCoding or alike

view this post on Zulip Jens Villadsen (Aug 25 2020 at 15:18):

?

view this post on Zulip 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.

view this post on Zulip Jens Villadsen (Aug 25 2020 at 15:19):

but value.code is allowed?

view this post on Zulip Jens Villadsen (Aug 25 2020 at 15:20):

thats pretty bold

view this post on Zulip 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.

view this post on Zulip Jens Villadsen (Aug 25 2020 at 16:07):

thx - worked like a charm

view this post on Zulip Jens Villadsen (Aug 25 2020 at 16:07):

(and someone maybe should do something about that error message .... :thinking: )

view this post on Zulip Jens Villadsen (Aug 25 2020 at 16:08):

you probably know who that would be. Does that require a Jira?

view this post on Zulip Jens Villadsen (Aug 25 2020 at 17:15):

@Grahame Grieve ?

view this post on Zulip 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

view this post on Zulip Jens Villadsen (Aug 25 2020 at 17:18):

ok then - should the spec then be fixed in order to give a specification specified error?

view this post on Zulip 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?

view this post on Zulip 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
?

view this post on Zulip Jens Villadsen (Aug 25 2020 at 17:29):

seems related

view this post on Zulip 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"

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:31):

:)

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:32):

Sounds like a publisher thing then.

view this post on Zulip Jens Villadsen (Aug 25 2020 at 17:32):

well ... I would believe it is in the FhirPathEngine ...

view this post on Zulip Jens Villadsen (Aug 25 2020 at 17:32):

which is embedded in the publisher

view this post on Zulip 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

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:37):

Correct. I'm trying to look through the code .

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:37):

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

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:38):

or this
https://github.com/hapifhir/org.hl7.fhir.core/blob/3ff241bcf89ba094b0e7bf1d850723f9f4a433c1/org.hl7.fhir.utilities/src/main/resources/Messages.properties#L563

view this post on Zulip 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".

view this post on Zulip Jose Costa Teixeira (Aug 25 2020 at 17:40):

and then add the RTFM thing

view this post on Zulip 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

view this post on Zulip Grahame Grieve (Aug 25 2020 at 21:10):

this won't be easy. lexically, value[x] is perfectly valid

view this post on Zulip 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