FHIR Chat · Local IG Building against R4B · IG creation

Stream: IG creation

Topic: Local IG Building against R4B


view this post on Zulip Gino Canessa (Jul 30 2021 at 19:55):

Hi all, I'm trying to sort out how to build an IG locally against an R4B build. I've been moving files around in .fhir/packages but haven't found any magic way of getting it to go through. Any help / direction would be appreciated, thanks!

view this post on Zulip Lloyd McKenzie (Jul 30 2021 at 20:40):

@Mark Iantorno What's the version id to use to build against the R4B CI-build?

view this post on Zulip Mark Iantorno (Jul 30 2021 at 20:41):

Are you talking release number?

view this post on Zulip Mark Iantorno (Jul 30 2021 at 20:41):

On github?

view this post on Zulip Lloyd McKenzie (Jul 30 2021 at 20:42):

FHIR release version number

view this post on Zulip Mark Iantorno (Jul 30 2021 at 20:46):

I do not know that, sorry.

view this post on Zulip Gino Canessa (Aug 02 2021 at 15:26):

Post-weekend bump - if anyone knows how to build an IG against R4B, I'd appreciate it. Thanks!

view this post on Zulip Jose Costa Teixeira (Aug 02 2021 at 15:52):

@Giorgio Cangioli ?

view this post on Zulip Giorgio Cangioli (Aug 02 2021 at 16:12):

I've not rebuilt recently the guide, but last time I did I had to copy the hl7.fhir.r4b.core#4.1.0 package into hl7.fhir.r5.core#4.1.0 to make sushi happy ..... but maybe this was not the question

view this post on Zulip Giorgio Cangioli (Aug 02 2021 at 16:13):

..and I had a lot of broken links errors...

view this post on Zulip Gino Canessa (Aug 02 2021 at 16:17):

Thanks Giorgio, that's similar to what I'm tinkering with now - manually putting the package into .fhir/packages and adding dev dependencies. If I manage a working setup I'll be sure to comment here.

view this post on Zulip Chris Moesel (Aug 02 2021 at 16:18):

We've updated support in SUSHI (in the SUSHI 2.0.0 betas) to support FHIR R4B Ballot #1 edition. To use that, you set fhirVersion: 4.1.0 in sushi-config.yaml. IIRC, that works out to hl7.fhir.r4b.core#4.1.0. If you want a more current build than ballot #1, however, I'm not sure that's possible without a lot of hacking.

view this post on Zulip Gino Canessa (Aug 02 2021 at 16:29):

Thanks Chris, but that's exactly what I need. I have a branch of R4B that hasn't been merged in yet, and I need to build the IG against it (modelling changes from ballot reconciliation of R4B and the IG - yuck). I am hesitantly hopeful that this process works:

  • Locally build R4B
  • Expand the R4B package into ~/.fhir/packages as hl7.fhir.r4b.code#dev
  • Add the hl7.fhir.r4b.core: dev dependency to sushi-config.yaml

There were a lot of changes to the IG to support this change, so I am working through all of the errors right now, but it looks like it may work.

view this post on Zulip Chris Moesel (Aug 02 2021 at 16:40):

Hmmm... Yeah, I don't know for sure if that will work. It might? The problem is that SUSHI does not treat FHIR Core exactly the same as a dependency. You will still need to declare a fhirVersion in your sushi-config.yaml -- and whatever your declare there (4.0.1, 4.1.0, etc) will be available in addition to whatever gets pulled in via the dependencies.

I think that the approach that is more likely to work (with SUSHI, anyway) would be to expand your local build package into ~/.fhir/packages/hl7.fhir.r4b.core#4.1.0 (replacing the real 4.1.0). Then SUSHI is not loading multiple builds of FHIR Core. BUT... I don't know how the IG Publisher would deal with that (might be fine?). And, of course, you're setting yourself up for all kinds of trouble if you forget that you did this and leave it like that in your package cache. AND (while I'm at it), this will of course fail pretty miserably in the Auto Build CI.

view this post on Zulip Gino Canessa (Aug 02 2021 at 17:44):

Thanks Chris, testing through that now. Yes, this is frustrating, and hopefully not common... For the subscriptions backport IG, there are two new resources we added in R4B, so it has a dependency on that. But, I can't build the IG so we can't evaluate the changes.

Even when the resources are merged into R4B (soon), it will only be on the CI build so that's another issue. But I'm not worrying about that today =).

view this post on Zulip Gino Canessa (Aug 02 2021 at 18:47):

Ok, for posterity I'll document the steps here:

  • Build local R4B
  • Extract .../publish/hl7.fhir.r4b.core.tgz to ~/.fhir/packages/hl7.fhir.r4b.core#4.1.0
  • Extract .../publish/hl7.fhir.r4b.expansions.tgz to ~/.fhir/packages/hl7.fhir.r4b.expansions#4.1.0
  • Set the fhirVersion in sushi-config.yaml to 4.1.0
  • Set the version in ig.ini to hl7.fhir.r4b.core#4.1.0

As a note, the branch I have had an error in an example (Questionnaire-qs1.json) that prevented the build from working. I deleted that file and removed it from ~/.fhir/packages/hl7.fhir.r4b.core#4.1.0/package/.index.json. I'd assume nothing like that should be needed, but since I'm not working on Questionnaire at all, I assume anyone doing a local build will run into the same error.

Thanks everyone for all the assistance!

view this post on Zulip Giorgio Cangioli (Aug 02 2021 at 19:32):

Thanks a lot Gino and Chris, very useful information for my next steps :-)

view this post on Zulip Gino Canessa (Aug 02 2021 at 19:50):

Blah. As a note, this no longer works for sushi (e.g., some earlier step worked, then manually running the ig builder worked), so I don't have a single config that works for both..

edit: it does, I'm just doing too many things at once :face_palm:

view this post on Zulip Jens Villadsen (Aug 16 2021 at 07:27):

So ... I also got it working locally ... - but what voodoo is needed for R4B to be supported in the CI build pipeline? Log can be seen here: https://build.fhir.org/ig/hl7-eu/gravitate-health/branches/master/failure/build.log

The essential part is this: Sushi: error Failed to load hl7.fhir.r4b.core#4.1.0: connect ETIMEDOUT 35.184.92.126:80 (02:11.0167)

view this post on Zulip Jens Villadsen (Aug 16 2021 at 07:28):

Is it @Josh Mandel I need to send some flowers and chocolates to?

view this post on Zulip Josh Mandel (Aug 16 2021 at 14:26):

No, I don't really know how this works. From your log, looks like sushi is trying to connect to a server called 35.184.92.126 which is a (non-tls-protected?!) connection to the VM running a service called packages2-fhir-org in our GCP console. And neither http://packages2.fhir.org/ and https://packages2.fhir.org/ seems to be working.

view this post on Zulip Gino Canessa (Aug 16 2021 at 15:16):

@Jens Villadsen FWIW, I'm grabbing the output folder and putting it on a github.io (edit: GitHub Pages) for the near term. Not as good as CI, but it gives a public endpoint for review for now.

view this post on Zulip Jens Villadsen (Aug 16 2021 at 16:52):

@Josh Mandel Im 'just' using the CI stuff here. @Chris Moesel who's sushi trying to dial up here?

view this post on Zulip Josh Mandel (Aug 16 2021 at 17:41):

Makes sense; in turn, the CI infrastructure is "just" executing the same tools you run locally (sushi + IG publisher), albeit from a "blank slate" (no saved prior build state, empty FHIR cache, etc).

view this post on Zulip Josh Mandel (Aug 16 2021 at 17:41):

The issue seems to be that packages2.fhir.org is down.

view this post on Zulip Jens Villadsen (Aug 16 2021 at 18:04):

Right - ephemeral containers all the way. - and I could have done the reverse IP lookup myself :face_palm:

view this post on Zulip Grahame Grieve (Aug 17 2021 at 04:53):

I don't think that the IG publisher supports building against your local dev branch of a FHIR base specification. At least, it's never been on my roadmap for it to do so

view this post on Zulip Gino Canessa (Aug 17 2021 at 12:14):

It does, in a way. Since it checks the local cache, you can set your version (e.g., 4.1.0) and manually put your local build there. It complains because various URLs don’t resolve, but the build works.

view this post on Zulip Chris Moesel (Aug 17 2021 at 16:11):

@Jens Villadsen -- R4B and R5 ballot editions are only available on packages2.fhir.org (as opposed to official R4 that is available on packages.fhir.org). So SUSHI is trying to dial up packages2.fhir.org.

view this post on Zulip Jens Villadsen (Aug 17 2021 at 18:19):

Hmmm ... @Gino Canessa I tried to follow your steps but it doesn't seem to work. I've added the R4B to the locale package registry and it looks like it resolves ok, but Sushi chokes on the example resource I have present with the message:

warn  SUSHI support for pre-release versions of FHIR is experimental. Use at your own risk!
info  Checking local cache for hl7.fhir.uv.ips#current...
info  Found hl7.fhir.uv.ips#current in local cache.
info  Checking local cache for hl7.fhir.r4b.core#4.1.0...
info  Found hl7.fhir.r4b.core#4.1.0 in local cache.
info  Loaded package hl7.fhir.r4b.core#4.1.0
...
Unknown resource type: MedicinalProductDefinition

view this post on Zulip Jens Villadsen (Aug 17 2021 at 18:22):

That might be more down @Chris Moesel 's alley. - and @Gino Canessa the following is also logged

warn  Your gravitate-health/ig.ini file contains the following unsupported properties: version. These are no longer supported in ig.ini and should be removed.  See the following link for details: https://github.com/HL7/ig-template-base/releases/tag/0.0.2

view this post on Zulip Jens Villadsen (Aug 17 2021 at 18:23):

Meaning that setting the version in ig.ini probably don't do much

view this post on Zulip Gino Canessa (Aug 17 2021 at 18:24):

Yes, it needs to be set as fhirVersion in sushi-config.yaml now. I assume yours is correct since it looks like it is finding the package.

If you look in your ~/.fhir/pacakges/hl7.fhir.r4b.core#4.1.0/package folder, is the StructureDefinition-MedicinalProductDefinition.json file there?

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

yep

view this post on Zulip Gino Canessa (Aug 17 2021 at 18:27):

Is there a repo I can pull to see if I can build it here? Those steps have worked for me to access SubscriptionTopic and SubscriptionStatus, so I assume they should work for MedicinalProductDefinition as well.

view this post on Zulip Jens Villadsen (Aug 17 2021 at 18:28):

That would be https://github.com/hl7-eu/gravitate-health

view this post on Zulip Chris Moesel (Aug 17 2021 at 18:53):

Ohhhhhhh... I think I know what is happening here. Your example is an XML file (not FSH) -- medicinalproductdefinition-example.xml. SUSHI tries to read in all of the other files in input -- but since it uses JSON internally, it attempts to translate the XML into JSON using the FHIR.js library. BUT... by default, that library only supports FHIR 4.0. There are instructions in its README for supporting other FHIR versions (which requires loading the fhir-definitions package) -- but SUSHI is not doing that. So... in order to make this error go away, either (a) you need to store that example in your project as JSON instead of XML (or even better, as FSH) or (b) we need to update SUSHI to load up FHIR.js w/ other versions of FHIR. If you're trying to get this done soon, then (a) would be your better option.

view this post on Zulip Gino Canessa (Aug 17 2021 at 18:57):

Yep, was just typing that up. I didn't port the complete example, but making it a FSH instance gets past that hurdle of the build:

Instance:     GravitateHealthMedicinalProductDefinitionAuthorized
InstanceOf:   MedicinalProductDefinition
Usage:        #example
Title:        "Authorized"
Description:  "Example of an Authorized Medicinal Product Definition"
* id        = "medicinalproductdefinition-authorized"

So, the above works (though is obviously not equivalent). Once that was fixed, it came across another error:

Sushi couldn't be run. Complete output from running Sushi : warn  The name "Example-sections-PL" may not be suitable for machine processing applications such as code generation. Valid names start with an upper-case ASCII letter ('A'..'Z') followed by any combination of upper- or lower-case ASCII letters ('A'..'Z',  (01:17.0104)
Note: Check that Sushi is installed correctly ("npm install -g fsh-sushi". On windows, get npm from https://www.npmjs.com/get-npm) (01:17.0107)
Exception: Process exited with an error: 1 (Exit value: 1)                       (01:17.0109)
Publishing Content Failed: Process exited with an error: 1 (Exit value: 1)       (01:17.0110)

Which I believe shouldn't actually exit, but having seen things like this in the past I assume correcting the warnings will get everything through.

view this post on Zulip Jens Villadsen (Aug 17 2021 at 19:09):

I had a suspicion about that ... Thanks for clarifying - both of you :)

view this post on Zulip Jens Villadsen (Aug 17 2021 at 20:14):

@Gino Canessa FWIW - I've thrown a docker image up on https://hub.docker.com/r/trifork/ig-publisher-base/tags?page=1&ordering=last_updated

view this post on Zulip Jens Villadsen (Aug 17 2021 at 20:14):

the source is at https://github.com/hl7-eu/gravitate-health/tree/master/docker

view this post on Zulip Jens Villadsen (Aug 17 2021 at 20:15):

and I've added the workflow (https://github.com/hl7-eu/gravitate-health/blob/master/.github/workflows/main.yml) so that it renders on (https://hl7-eu.github.io/gravitate-health/)

view this post on Zulip Jens Villadsen (Aug 18 2021 at 08:58):

Ooops ... looks like I forgot to push the changes ... that will be done later today

view this post on Zulip Jens Villadsen (Aug 18 2021 at 08:59):

:face_palm:


Last updated: Apr 12 2022 at 19:14 UTC