Stream: implementers
Topic: GoFSH gets stuck
Peter Robinson (May 25 2021 at 22:30):
Hi everybody, I am learning how to use FSH and GoFSH (https://github.com/FHIR/GoFSH) with the goal of continuing work on our Phenopackets IG using FSH tooling. However, when I use the gofsh tool on the current repository, gofsh states that one of the elements is duplicated (it is not, as far as I can see) but does not provide any further help at spotting the bug. Instead, gofsh gets stuck at this point:
error Encountered value set with a duplicate name, KaryotypicSex, which GoFSH cannot make unique. Fix the source file to resolve this error or update the resulting FSH definition.
info Processed 10 of 16 ValueSets...
info Processed 15 of 16 ValueSets...
info Processed 16 ValueSets
info Processing Instances...
(killed after 30 min of no progress).
Is there any way of making gofsh more verbose or debugging this kind of error? thanks! Peter
Grahame Grieve (May 25 2021 at 23:03):
you might ask on #shorthand
Chris Moesel (May 26 2021 at 12:48):
Hi @Peter Robinson. You can turn on debugging by passing the following arguments to GoFSH: -l debug
(or --log-level debug
), but I'm not sure it will provide much more information in this particular case. Is your IG available publicly on GitHub so that we can take a look?
Peter Robinson (May 26 2021 at 13:25):
Thanks -- gofsh is not outputting any log at all as far as I can see. Our IG is here https://github.com/phenopackets/core-ig
I will also join the shorthand channel -- didn't see that before!
Chris Moesel (May 26 2021 at 15:22):
@Peter Robinson -- I've looked into this and there are a few things going on here.
The most notable thing is that if you run GoFSH on the whole GitHub repo, it encounters many XML files that are not actually FHIR definitions -- and while it handles some of them correctly (by ignoring them), it appears it is trying to process some of them as if they are instances of FHIR data.
If you point GoFSH at just ig-root/input
, it does a lot better, but still trips up on things like the _attic
folder (which contains historic versions of resources), the base-spec
folder (which contains actual FHIR core resources), and the _templates
folder (which contains incomplete FHIR definitions that I think you must use to generate other definitions).
If you delete the _attic
, base-spec
, and _templates
folders in ig-root/input
, and then run GoFSH on ig-root/input
, it does much better. There are still a few issues, but it's pretty close. One issue that seems to be a problem is that one of your profiles contains differential elements with no id
properties. This is actually a violation of the FHIR R4 spec (as sdf-17 indicates that all differential elements must have an id and that id must be distinct).
So... I think that if you delete those problematic subfolders and fix up some of the issues in the actual XML definitions, you'll be in pretty good shape if you run GoFSH like this:
gofsh -t xml-only ./ig-root/input
Chris Moesel (May 26 2021 at 15:24):
Another approach, which actually might be better would be that if you can build your IG using the IG Publisher, then you can just run GoFSH on the output
folder that the IG Publisher creates. That would probably give you the best results. I would have done that myself, but I could not get the IG Publisher to successfully run on this IG.
Peter Robinson (May 26 2021 at 15:26):
Thanks so much, Chris, this is extremely helpful! I wish I will have an opportunity to invite you to a beer sometime, but for now THANKS!
Chris Moesel (May 26 2021 at 15:30):
Ha. No problem. Glad to see you are considering using FSH. We've found it to be very useful ourselves!
Peter Robinson (May 28 2021 at 00:29):
That solved my problem, thanks again. One thing that is not mentioned in the GoFSH documentation is whether it is recommended to essentially completely replace the current IG with the FSH version and if there are any best practices for doing so. There seems to be an obvious answer but since it is not even discussed in https://fshschool.org/ I wonder if I am misunderstanding something. It is the case that I should use gofsh just once and henceforth work with the FSH files, correct?
Chris Moesel (May 28 2021 at 12:49):
Yes, that's right -- we expect you would run GoFSH once and then maintain your definitions using FSH after that. Since GoFSH just creates the FSH files and a basic config, however, you'll need to do the work of integrating them back into your original IG (with the rest of the content).
At a minimum, you will need to remove the old XML resource definitions in input/*
and add the new FSH definitions to input/fsh
. If you do just this, and leave your input/pheno-core-ig.xml
in place, then you should be able to run SUSHI and it will extract the necessary config info from that input/pheno-core-ig.xml
file (so you don't need the sushi-config.yaml
file).
If you prefer, you also have the option to use a root-level sushi-config.yaml
file instead of input/pheno-core-ig.xml
. If you want to do this, however, you will need to make sure it reflects all the same config as the original input/pheno-core-ig.xml
(but you likely won't have to enumerate all the resources like you currently do in the IG XML file).
Peter Robinson (May 28 2021 at 21:19):
O-fish-ally error free!
It worked! Thanks so much, it is hard to state how happy I am! As a bioinformatician/clinician coming to FHIR, it was difficult going, but the SUSHI/FSH project will really empower us to achieve our goals. Plus, I love the fish jokes! Thanks again :smile:
Chris Moesel (Jun 01 2021 at 14:39):
Awesome. So glad to hear, this @Peter Robinson! You know where to find us if you need us!
Last updated: Apr 12 2022 at 19:14 UTC