Stream: shorthand
Topic: sushi exporting less resources than it converted
Richard Stanley (Jul 01 2021 at 19:22):
Hi. I have an FSH file that contains 11 Measures but sushi exports only 5 Measures in JSON. Sushi reports successful processing of all of the resources (0 Errors) but it says it exported less resources than it converted. Also, there's an error '(node:76987) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency'. A quick Google search suggests is has something to do with Node and ANTLR. The Node version is v16.4.0.
The FSH file is here: https://pastebin.com/crcDJX1Q Any thoughts on what may be happening?
Chris Moesel (Jul 01 2021 at 19:33):
We've seen INVALID_ALT_NUMBER
before. As you found, it is related to ANTLR and happens for Node version 14 and up. Our understanding (and experience) so far, however, is that it is a harmless error. I would guess it is not related to what you have found, but I have not had a chance to review your FSH yet -- so I guess I can't say for sure!
Richard Stanley (Jul 01 2021 at 19:46):
Thanks @Chris Moesel So, I downgraded to node@12 and reinstalled and reran sushi. The issue persists - meaning exporting less resources than it is converting. The FSH resources were converted by gosushi from existing resources if that matters.
Chris Moesel (Jul 01 2021 at 19:48):
OK. I'll try to take a look at your FSH soon. It's a little difficult because my company blocks pastebin and dropbox and other things like that. So I have to jump through a few hoops to get at it. If you have GitHub and can put it in a gist, that might be easier for me to access.
Richard Stanley (Jul 01 2021 at 19:51):
Will do, one min.
Here you go: https://gist.github.com/citizenrich/f89a2062172a1530a8781b85e7b9a07f
Chris Moesel (Jul 01 2021 at 20:32):
Thanks, @Richard Stanley. I can't reproduce this. I've used SUSHI 2.0.0 Beta 1, SUSHI 1.3.2, and FSH Online, and in all cases, I am getting 11 measures back (counting the actual JSON documents that are output). For example, here is a permalink to this on FSH Online: https://fshschool.org/FSHOnline/#/share/3hcybDE
I'm not sure why you would see different results. Are you sure you're looking in the right folder (fsh-generated/resources
)?
Richard Stanley (Jul 01 2021 at 20:48):
Thanks for having a look @Chris Moesel Yes, I'm looking in the correct folder. I'm doing FSHOnly generation in an IG which is here: https://github.com/intrahealth/simple-hiv-ig It's very strange.
Chris Moesel (Jul 01 2021 at 20:59):
Oh! I see it now... Hmmm... Here is an example of what is going on. In library.fsh
you have:
Instance: HIVSimpleAgeGroup
InstanceOf: Library
Usage: #example
// etc.
and in measure.fsh
you have:
Instance: HIVSimpleAgeGroup
InstanceOf: Measure
Usage: #example
// etc.
So... you have two instances w/ the same name here. Since you can refer to instances by their name, SUSHI really prefers (and expects) unique names. IIRC SUSHI keeps a dictionary of instances keyed by name, so if there are two w/ the same name, the last one in wins. I think that's what is happening here. If you avoid duplicate names, it should work as expected. If you want the ids to be the same (between the library and the measure) then you'll just need to set the id
using an assignment rule. E.g.:
Instance: HIVSimpleAgeGroupLibrary
InstanceOf: Library
Usage: #example
* id = "HIVSimpleAgeGroup"
// etc.
and
Instance: HIVSimpleAgeGroupMeasure
InstanceOf: Measure
Usage: #example
* id = "HIVSimpleAgeGroup"
// etc.
Chris Moesel (Jul 01 2021 at 21:00):
It's unfortunate that SUSHI did not log an error for this case. It really should, so I'll log a bug for that.
Chris Moesel (Jul 01 2021 at 21:02):
(Also, sorry that SUSHI wasted your time by not logging an error telling you what was wrong).
Richard Stanley (Jul 01 2021 at 21:09):
Thanks so much, @Chris Moesel Yeah, ok, you mentioned that in another GitHub issue and I should have noticed it. Thanks!
Last updated: Apr 12 2022 at 19:14 UTC