FHIR Chat · Sushi slicing an extension when there's no need. · shorthand

Stream: shorthand

Topic: Sushi slicing an extension when there's no need.


view this post on Zulip David Pyke (Aug 30 2021 at 17:39):

I have a compound extension and when one of the sub-extensions is hit with an invariant, sushi is slicing that extension. That's a problem as that causes the invariant to fail and renders the actual json version invalid.

view this post on Zulip David Pyke (Aug 30 2021 at 17:41):

Source code is here: https://github.com/Carequality/CEQSubscription/

view this post on Zulip David Pyke (Aug 30 2021 at 17:52):

@Chris Moesel ?

view this post on Zulip Chris Moesel (Aug 30 2021 at 18:08):

I don't have a moment to look at this right now, but I can see if someone else on the SUSHI team has time. Can you be more specific about where we should be looking in that IG? Like what extension and where?

view this post on Zulip David Pyke (Aug 30 2021 at 18:11):

The error from Forge is in this image.png

view this post on Zulip David Pyke (Aug 30 2021 at 18:13):

Having the slice in place prevents the invariant. and we don't want it sliced, just forced valueString

view this post on Zulip Chris Moesel (Aug 30 2021 at 18:25):

So you are putting an invariant on valueString? If you specify a choice path in SUSHI using the specific type-based path (e.g., valueString), then SUSHI automatically applies type-slicing in order to create an element for that specific path. This is necessary for choices that have not been constrained to a single type -- but not so necessary if the choice has been constrained to a single type already. Still, SUSHI does it as a general rule whenever you access a specific choice type like that. To get around it, apply your invariant directly to value[x] rather than valueString.

view this post on Zulip Chris Moesel (Aug 30 2021 at 18:26):

(Quickly guessing based on screenshot above. Let me know if I misunderstood it or assumed something I should not have assumed).

EDIT: This wasn't the issue at all. Ignore above.

view this post on Zulip David Pyke (Aug 30 2021 at 18:47):

I had it on value, but not value[x], but the issue remained. Having it on valueString, didnt' help.

view this post on Zulip David Pyke (Aug 30 2021 at 18:47):

If there's someone I can work with, I'd be glad too.

view this post on Zulip Jean Duteau (Aug 30 2021 at 18:51):

i think it's your invariant - extension('ceqPushExtension') is asserting the URL of the extension is ceqPushExtension when it's actually 'https://sequoiaproject.org/fhir/push-r4/StructureDefinition/CEQextension'

view this post on Zulip David Pyke (Aug 30 2021 at 18:52):

I've tried both, ceqPushExtension and CEQextension, still get the problem.

view this post on Zulip David Pyke (Aug 30 2021 at 18:52):

It's only the Forge warning that's giving me any idea of what might be wrong.

view this post on Zulip Jean Duteau (Aug 30 2021 at 18:55):

well, when I changed it as above, I don't get the error anymore:

Invariant:  CEQ-Param-Name
Description: "searchParamName shall be Patient or PatientID"
Expression: "extension('https://sequoiaproject.org/fhir/push-r4/StructureDefinition/CEQextension').extension('searchParamName').value in ( 'Patient' | 'PatientID' )"
Severity:   #error

view this post on Zulip David Pyke (Aug 30 2021 at 18:59):

I hadn't tried it with using the full URL.

view this post on Zulip David Pyke (Aug 30 2021 at 19:00):

I'll pass that on to the people implementing and see if it makes their lives better! Thanks!


Last updated: Apr 12 2022 at 19:14 UTC