FHIR Chat · PlantUML integration documentation · IG creation

Stream: IG creation

Topic: PlantUML integration documentation


view this post on Zulip Max Masnick (Sep 22 2021 at 13:55):

Is there documentation for the PlantUML integration with the IG Publisher? I didn't see anything at https://confluence.hl7.org/display/FHIR/IG+Publisher+Documentation or elsewhere on Confluence.

I'm looking for a resource that describes how to get PlantUML to run locally (I believe you need to install graphviz...not sure if there are other dependencies), where to put the UML files, etc.

If this doesn't exist I can take a pass at writing it...just want to make sure I'm not duplicating effort first.

view this post on Zulip Josh Mandel (Sep 22 2021 at 13:58):

This came up yesterday in an out-of-band discussion with @Carl Anderson and @Eric Haas -- we didn't find anything on confluence.

view this post on Zulip Carl Anderson (Sep 22 2021 at 13:59):

I'm interested in helping with this effort, too

view this post on Zulip Gino Canessa (Sep 22 2021 at 14:00):

Hi Max, I just ran through a test (yesterday), this worked locally for a FSH-based IG (subscriptions backport):

  • Install PlantUML: gem install jekyll-plantuml (after Jekyll is already installed)
  • Create the <root>/input/images-source directory
  • Add a new file: <root>/input/images-source/diagram.plantuml
  • In a markdown file (in /input/pages), insert the result file: {%include diagram.svg%}

After running _genonce.bat everything looks right, except for an extra line of XML that I need to track down.

view this post on Zulip Josh Mandel (Sep 22 2021 at 14:06):

Hmm, does this work in the auto build environment? And if not... (how) are IGs using it in real life? I ask because our docker config doesn't appear to install jekyll-plantuml, but maybe it's pulled in from elsewhere.

view this post on Zulip Max Masnick (Sep 22 2021 at 14:09):

When I set this up in docker, I just had to apt-get install graphviz and it worked. I assume I did some homebrew thing to get graphviz on my local system. No idea how to do this on Windows

view this post on Zulip Gino Canessa (Sep 22 2021 at 14:10):

No idea - didn't get that far =). Unfortunately, I don't remember which IGs I looked at to figure out the steps to see if they have CI builds.

view this post on Zulip Max Masnick (Sep 22 2021 at 14:11):

@Gino Canessa what happens if you don't install jekyll-plantuml?

view this post on Zulip Josh Mandel (Sep 22 2021 at 14:11):

Cool Max -- @Jean Duteau gave us graphviz in the auto-build env back in Feb, so that must be why :-)

view this post on Zulip Gino Canessa (Sep 22 2021 at 14:12):

I was testing on Windows, so that process worked there.
I didn't actually test without installing it, one sec.

view this post on Zulip Max Masnick (Sep 22 2021 at 14:14):

I don't think the Jekyll plugin is actually necessary for the integration I was thinking of -- the IG Publisher handles the conversion of .plantuml to .svg, and all Jekyll does is include the .svg with its generic support for including files in other files.

view this post on Zulip Gino Canessa (Sep 22 2021 at 14:17):

Yep - it actually isn't necessary. Still has the extra XML literal above the SVG though (<?xml version=”1.0” encoding=”UTF-8” standalone=”no”?>).
This is on windows without graphviz.

(edit: as a note, I initially installed it due to following steps I found somewhere... would have to go back and try to figure out where)

view this post on Zulip Lloyd McKenzie (Sep 22 2021 at 15:29):

Yes, the XML declaration is on my list of things to fix. But no installation necessary. Agree that we need to add the documentation of the 'how'.

view this post on Zulip David Pyke (Sep 22 2021 at 16:16):

YOu can get rid of the XML declaration by putting <div></div> tags around the include line

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:24):

PlantUML does not require graphviz for all diagram types

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:24):

For sequence diagrams for example

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:25):

I don't know if there are still issues with needing graphviz, but PlantUML also has another trick to avoid it

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:28):

There is a directive that uses its own rendering engine (called smetana) instead of graphviz

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:28):

Here's an example of that :
https://github.com/openhie/case-reporting-hiv-vn/blob/main/input/images-source/actors_transactions.plantuml

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:33):

Another trick: after the image it may be best to add <br clear="all"> otherwise the text may be wrapped around the diagram

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:34):

@Max Masnick I use the vscode extension for PlantUML. Alt+D and I get my diagram preview

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:37):

On the extra XML: https://forum.plantuml.net/12443/remove-xml-declaration-from-svg?show=12443#q12443

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:41):

I don't know what is the current plantuml version we're using, perhaps we should update

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:45):

(apologies for only catching up late)
Jekyll-plantuml is not needed IMO.

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:46):

@Chris Moesel I have the images-source in the empty templates I always use. Does sushi --init also create this folder?

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:51):

@Lloyd McKenzie is this on sample-ig or ig-guidance?

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:51):

(the examples and how-to, I mean)

view this post on Zulip Lloyd McKenzie (Sep 22 2021 at 19:51):

Examples in sample-ig and explanation of how-to in ig-guidance

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:52):

Hmmmm... What if I had a cool idea of using a few PlantUML diagrams to describe the how?

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 19:54):

Then this how-to would also use examples. I'll do this on guidance IG

view this post on Zulip Lloyd McKenzie (Sep 22 2021 at 19:58):

At the moment, I'll happily settle for documentation somewhere :)

view this post on Zulip Jose Costa Teixeira (Sep 22 2021 at 20:21):

:)

view this post on Zulip Chris Moesel (Sep 22 2021 at 20:31):

Jose Costa Teixeira said:

Chris Moesel I have the images-source in the empty templates I always use. Does sushi --init also create this folder?

Nope. sushi --init only creates input/fsh and input/pagecontent. Authors need to add the other folders themselves if they want them.

view this post on Zulip Jose Costa Teixeira (Sep 25 2021 at 08:29):

I created this page to start. Please provide feedback before the PR with the Guidance-ig
http://build.fhir.org/ig/FHIR/ig-guidance/branches/plantuml/diagrams.html

view this post on Zulip Jose Costa Teixeira (Sep 25 2021 at 08:30):

@Lloyd McKenzie, @Grahame Grieve please merge or let me know if I should create the PR

view this post on Zulip Jose Costa Teixeira (Sep 25 2021 at 08:30):

(deleted)

view this post on Zulip Jose Costa Teixeira (Sep 29 2021 at 21:14):

https://github.com/FHIR/ig-guidance/pull/15


Last updated: Apr 12 2022 at 19:14 UTC