FHIR Chat · IG Publisher · pascal

Stream: pascal

Topic: IG Publisher


view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 05:40):

I gave up on calling the IG publisher in the code. I just run a shellexec and that should take care of it.

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 05:40):

question:

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 05:41):

where should we store the location to the IGPublisher.exe?
where is that executable?
1 Same folder as toolkit?
2 the location is stored in the ini file?
3...?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 05:42):

let the user choose the location if it's not known, and then store it in the settings once they choose?

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 05:47):

...let the user choose the location if it's not in the same folder as toolkit.exe, and then store it in the settings once they choose?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 05:48):

sure

view this post on Zulip Grahame Grieve (Oct 03 2019 at 05:49):

you could check the same code in the publisher, and we could move it into a shared class that can find/fetch/update/run the jar file.

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 05:57):

you lost me. check which same code?
or do you mean that what we do for the publisher exe, we can do the same for the jar?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:04):

we should create a class like this:

type
  TFHIRIGPublisher = class (TFsObject)
  private
  public
    constructor Create(ini : TIniFile);
    destructor Destroy;

    // check that the jar location is known, and if it's not, ask the user how to set it up
    function Configure : boolean;

    // check that the jar is up to date, and it's not, return an error
    // message to the user to help choose whether to update it
    function needsUpgrade(var msg: String) : boolean;

    // actually upgrade the jarl; call progressProc during the download
    procedure upgrade(progressProc : TProgressProc);

    // execute the pulisher, return true if it succeeds, and send output
    // from the publisher to logProc
    function execute(params : array of String; logProc : TLogProcedure) : boolean;
  end;

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:04):

use it anywhere we want to run the IG publisher

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:10):

in a separate file? not in publisherhome.pas, right?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:11):

right. in a separate file where we can use it from multiple places

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:11):

and logProc would be updated in realtime, not only once after the jar is finished, right?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:12):

yes

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:15):

ok.
this actually seems a bit closer to my early implementation, where I had a "where can we find the jar and template" and then a "publish" button. So i can see it working.

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:16):

on the jar location, I checked with Lloyd who agreed that the jar could be
a) in the input-cache folder
b) in the parent folder to an IG (because I don't want to download 20 times 100 mb every time there is a new jar version)

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:17):

so this adds an option
c) the jar location is stored in an ini file

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:17):

right?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:17):

yes

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:18):

I don't like having the jar in the folder. It's a recipe for trouble

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:21):

"in the folder" = in the ig content folders?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:23):

yes

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:26):

yippeee!
I remember being barely awake at 3 am to join a call to mention that - separation between the ig content and the jar location...

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:26):

:)

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:30):

got it.
I may look at this later today, otherwise, lordy I hope it rains during the weekend.
I'll finish the examplescenario and this.

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:31):

If you look at the code, feel free to create the empty shell for that class - best you decide where this should be and how it should be named.

view this post on Zulip Jose Costa Teixeira (Oct 03 2019 at 06:39):

BTW, we had a question from the audience in Atlanta: How would this this toolkit run on a Mac?
My answer was that while it does compile, I'm not sure it works. Correct?

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:44):

it runs on a mac

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:44):

I

view this post on Zulip Grahame Grieve (Oct 03 2019 at 06:44):

I'm not sure about the java bit though

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 07:42):

I saw the changes - cool stuff. Now it asks for a JAR location.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 07:45):

A few ideas:

  1. before opening the dialog to look for a jar, I check if the jar is either in .\input-cache\, or in ..\
    (those are the locations i checked with Lloyd. the reason for the ..\ was that if we are working on 10 IGs, we may want to have only one jar.)

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 07:46):

  1. I was trying to get the publisher called from the code in the toolkit main form, but I think there is one too many forms/threads doing Application.ProcessMessages, and the focus gets a bit crazy.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 07:48):

I had the check for the jar not in form.create but in form.show (in preparation for item 2 above). Does this make sense? (I created a var FirstShow to avoid running that every time we lose and gain focus)

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 08:02):

@Grahame Grieve I committed these changes, just discard if you disagree

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:17):

oh. The toolkit. that's FMX. No wonder it went a bit crazy.

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:17):

I'll have to think about that

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:20):

(just now realizing the publisher is VCL... that's why it looked a bit different) :embarrassed:

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:21):

yeah. I forgot to allow for that

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:21):

The code for calling the publisher via code is there (commented out), in case you want to see what to make of it.

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:22):

but in principle, the way it works is that the publisher has it's own copy of the jar, which it will prompt the user to keep up to date, but it will use an IG specific copy if it finds it

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:28):

ok my code does not start with the publisher's own jar - it always tries to get one from the IG content folder

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:29):

and if that fails, then it asks for a jar

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:32):

so we can have 3 jar locations right?
if I have a folder IGs and subfolders IG1 and IG2, then the jar can be in
a) IGs\IG1\input-cache
b) IGs
c) wherever the publisher says it is.
I like this idea. let me see if I can switch the code for that.

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:32):

I was going to make sure that the app always had it's own copy (there's things I would use the IGPublisher for directly)

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:32):

what is IGs?

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:32):

it is the folder of all IGs

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:33):

is that a thing is it?

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:33):

in my case I have c:\HL7\IGs\be-core, c:\HL7\IGs\ihe-mma, c:\HL7\IGS\pml...

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:34):

well, I asked Lloyd that I did not want to have 20 copies of the jar, and he agreed, so I was happy with it. We thought to keep that jar in the parent folder, but we can change that decision.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:35):

so keeping one jar in the parent folder would work well for people in *nix machines, who do not have this publisher, and they can save a few gigabytes

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:36):

one alternative is to have a "jarFile" in the ig.ini file.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:37):

i'm trying to make this so that it does not conflict with mac users

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:46):

well, we haven't formally defined 'one single directory' for all IGs. But if you do have one, and you already use the jar there, then you'd select that as the place for the FHIR tool to use for it's copy of the jar. If you don't, you can pick somewhere else..?

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:46):

so what do you think? where do we find the jar file ?

  1. explicitly named in IG's ini file, otherwise in the ig's input-cache, otherwise the publisher knows
  2. in the IG's input cache, otherwise in the IG's parent folder, otherwise the publisher knows
  3. only in the ig's input-cache, otherwise the publisher knows

3 may require *nix users to have lots of IG jars
1 and 2 i can code, but 1 (which I prefer) should be aligned with Lloyd - I did the updates to the batch file myself, so i don't mind throwing all that powershell knowledge out...

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 09:51):

ah wait, option 1 may cover option 2... if the new template includes a line in the ig.ini
jarFile = ".\input-cache\org.hl7.fhir.publisher.jar"

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:52):

option 1 is option 2 if the user sets it up that way

view this post on Zulip Grahame Grieve (Oct 06 2019 at 09:53):

user only gets jar in their IG folder if they already set it up that way

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:01):

true, the batch file runs that.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:07):

let me know if we should change the jar location from being hardcoded in a .bat /.sh to something else

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:07):

meanwhile, safe landings if that is the case.

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:09):

I think there's no reason to change the bat/sh files

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:12):

so
if we run the bat, we get the default behaviour (input-cache, eventually in parent IG folder) ;
if we run the publisher, we use the input-cache if available; if not, we use the publisher's own jar

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:12):

?

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:15):

yes

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:18):

ok, easy, just removed these lines of mine
if fileExists(ExtractFileDir(ExcludeTrailingBackslash(IGtoPublish))+'\org.hl7.fhir.publisher.jar')
then FjarFile:= ExtractFileDir(ExcludeTrailingBackslash(IGtoPublish))+'\org.hl7.fhir.publisher.jar';

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:19):

which it will prompt the user to keep up to date, but it will use an IG specific copy if it finds it

now i am thinking about what this "prompt the user".
want to inform the user that a new version is available?

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:20):

yes that's on my todo list.

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:21):

ok thanks

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:21):

to find out the current release: https://fhir.github.io/latest-ig-publisher/tools.json

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:21):

to find out the local copy: open the jar as a zip, find the version file, read the contents (that's the bit I have to do)

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:25):

function checkJarUpToDate (jarfilename:string):boolean ?

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:27):

i could have some fun with such a function later today. i can unzip

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:27):

what is the version file?

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:28):

that's the bit I'm not sure about. And I'm not on my dev PC in the air here so I can't look quickly

view this post on Zulip Jose Costa Teixeira (Oct 06 2019 at 10:30):

there used to be a version.info in the jar, but i can't see one in the latest release

view this post on Zulip Grahame Grieve (Oct 06 2019 at 10:42):

no it's moved to a maven thing now.

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:29):

first thoughts:
image.png

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:30):

  1. first, setup dependencies and point to IG

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:30):

  1. check the releases, add a new if needed
    image.png

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:32):

  1. Do it:
    3.1. make sure original IG builds OK;
    3.2 build for publication
    3.3. build for web (deciding whether it's a milestone)
    Before building, would be nice to check for common issues and dependencies

image.png

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:32):

comments welcome

view this post on Zulip Jose Costa Teixeira (Sep 24 2020 at 11:34):

I think this is the same functionality documented in confluence, only the whole "copy files, replace this file, don't replace that,..." would be behind the scenes

view this post on Zulip Grahame Grieve (Sep 28 2020 at 22:59):

well, I've just moved a whole lot of that functionality behind the scenes anyway. I'm rewriting the publication documentation today or tomorrow

view this post on Zulip Jose Costa Teixeira (Oct 02 2020 at 06:58):

Just to check - is this documentation updated? Just to know when I can work on GUI.

view this post on Zulip Grahame Grieve (Oct 02 2020 at 07:05):

yes I have finished rewriting the documetnation

view this post on Zulip Jose Costa Teixeira (Oct 06 2020 at 11:41):

I'm looking at this, and while I clean the canonical urls i get this:
canonical URL of http://hl7belgium.org/fhir/sample-ig does not match the required canonical of http://hl7.org/fhir/be/sample-ig

view this post on Zulip Jose Costa Teixeira (Oct 06 2020 at 11:43):

seems that the latter canonical is created from the ig's packageId. can i override that?
and if not, how can i make it work for non-hl7 IGs ?

view this post on Zulip Jose Costa Teixeira (Oct 06 2020 at 12:47):

(there seems to be a rule that the package id must have 4 parts, the first 2 being hl7.fhir.)

view this post on Zulip Grahame Grieve (Oct 06 2020 at 20:01):

there certainly isn't a rule like that.

view this post on Zulip Jose Costa Teixeira (Oct 06 2020 at 20:24):

https://github.com/HL7/fhir-ig-publisher/blob/e52766a50b4096879e75efa6896e36b9fbb83722/org.hl7.fhir.publisher.core/src/main/java/org/hl7/fhir/igtools/publisher/utils/PublicationProcess.java#L98

view this post on Zulip Jose Costa Teixeira (Oct 06 2020 at 20:24):

(this is the error I got, not sure what it means)

view this post on Zulip Grahame Grieve (Oct 07 2020 at 05:21):

the rules is that if the package id starts with hl7, then I decide on it's structure and content. And I define that that for fhir IGs the package id must be hl7.fhir.[realm].[code]

view this post on Zulip Jose Costa Teixeira (Oct 07 2020 at 06:37):

I had hl7.be.fhir, but I did change to hl7.fhir.be to get over that. But then I got the error above if I want to publish this under the hl7belgium.org site

view this post on Zulip Jose Costa Teixeira (Oct 07 2020 at 07:01):

how can I get around that and publish an IG that starts with hl7. to the url hl7belgium.org/...?

view this post on Zulip Grahame Grieve (Oct 07 2020 at 09:44):

can I reproduce this? The package name is limited, but the web site shouldn't be

view this post on Zulip Jose Costa Teixeira (Oct 09 2020 at 05:55):

yes. I tried this with the sample ig, adapting the package name and site:

view this post on Zulip Jose Costa Teixeira (Oct 09 2020 at 05:55):

The package-list was changed to

{
 "package-id" : "hl7.be.fhir.sample-ig",
 "title" : "Your User Friendly Name for MyIG Here",
 "canonical" : "http://hl7belgium.org/fhir/sample-ig",
 "introduction" : "The introduction that should appear in the FHIR IG registry",
 "list" : [{
  "version" : "current",
  "desc" : "Continuous Integration Build (latest in version control)",
  "path" : "http://build.fhir.org/ig/hl7-be/sample-ig",
  "status" : "ci-build",
  "current" : true
 },{
  "version" : "0.1.0",
  "date" : "2099-01-01",
  "desc" : "Initial STU ballot (Mmm yyyy Ballot)",
  "path" : "http://hl7belgium.org/fhir/sample-ig",
  "status" : "ballot",
  "sequence" : "DSTU 1"
 }]
}

view this post on Zulip Jose Costa Teixeira (Oct 09 2020 at 05:56):

the command lines i used:

  1. java -jar .\publisher.jar -ig sample-ig#0.0.1 -resetTx -publish http://hl7belgium.org/fhir/sample-ig

view this post on Zulip Jose Costa Teixeira (Oct 09 2020 at 05:56):

  1. java -jar .\publisher.jar -go-publish -source sample-ig#0.0.1 -destination hl7belgium.org -registry ig-registry\fhir-ig-list.json -history fhir-ig-history-template

view this post on Zulip Jose Costa Teixeira (Oct 09 2020 at 09:31):

any ideas?

view this post on Zulip Jose Costa Teixeira (Oct 13 2020 at 06:49):

Grahame, do you have any suggestion on this?


Last updated: Apr 12 2022 at 19:14 UTC