Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IG not installed when using POST /ImplementationGuide/$install #727

Open
rmrlangford opened this issue Aug 25, 2024 · 15 comments
Open

IG not installed when using POST /ImplementationGuide/$install #727

rmrlangford opened this issue Aug 25, 2024 · 15 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@rmrlangford
Copy link

rmrlangford commented Aug 25, 2024

Steps:

  1. In hapi.application.yaml, add the config provided at the bottom of the steps.
  2. After running docker compose up, execute GET /StructureDefinition to verify that the IG in step 1 is installed.
  3. Using the script provided: https://chat.fhir.org/#narrow/stream/179167-hapi/topic/Installing.20implementation.20guide/near/429068829, download a package into Base64 binary.
  4. Copy the contents in the file created by the aforementioned script to the body of the request for POST /ImplementationGuide/$install
  5. Execute the request POST /ImplementationGuide/$install

Actual Behaviour: When executing GET /StructureDefinition, I still see the previously installed IG from steps 1 - 2.
Expected Behaviour: When executing GET /StructureDefinition, I should see the newly installed IG from step 5.

image
@jkiddo jkiddo self-assigned this Aug 31, 2024
@jkiddo
Copy link
Collaborator

jkiddo commented Aug 31, 2024

I'm unable to reproduce.

I made a slight adjustment to the generation script. It is as follows:

#!/bin/bash

# URL of the file to download
file_url="https://build.fhir.org/ig/jembi/ethiopia-hiv/package.tgz"

# File name after downloading
file_name="downloaded_file"

# Download the file using curl
curl -o "$file_name" "$file_url"

# Base64 encode the file content saving it to a temp file
base64 --input="$file_name" > base64_content.txt

# Generate JSON data using jq with input from the file
json_data=$(jq -n --rawfile base64_content base64_content.txt \
            '{ "resourceType": "Parameters", "parameter": [ { "name": "npmContent", "valueBase64Binary": $base64_content }]}')


echo "$json_data" > parameters.json
  • now, I set up the server as follows:
    docker run -p 8080:8080 -e "hapi.fhir.ig_runtime_upload_enabled=true" hapiproject/hapi:v7.4.0

  • then I run the script above and afterwards execute curl -X POST -H "Content-Type: application/json" -d @"parameters.json" "http://localhost:8080/fhir/ImplementationGuide/\$install"

after that, then I can inspect the structuredefinitions without any problem on /fhir/StructureDefinition. @rmrlangford please try the steps above.

@jkiddo jkiddo added the help wanted Extra attention is needed label Aug 31, 2024
@rmrlangford
Copy link
Author

rmrlangford commented Sep 1, 2024

Thanks @jkiddo , the script and process as laid out above works as expected (previous process did also when only using the $install operation).

If there is an IG already installed where after executing the curl request above, what is the expected behaviour on HAPI?

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 1, 2024

That both IGs are installed

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 1, 2024

All saved here for future runs: https://github.com/jkiddo/ig-install-parameters-generator

@rmrlangford
Copy link
Author

rmrlangford commented Sep 2, 2024

That both IGs are installed

Thanks @jkiddo . The reason why I ask is that if I install more than 1 IG, it only shows one IG when querying StructureDefinition and zero IG's when querying ImplementationGuide.

I did two tests:

  1. Install two IG's using application.yaml (see below) then queried the two aforementioned Resources.
  2. Installed one IG (Ethiopia HIV) using a new application.yaml and used the new script to install a Botswana Lab IG. After that, queried the two aforementioned Resources.

Both tests give me the same findings.

And thanks for creating the repo for the new scripts!

image

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 2, 2024

I can't reproduce. I tried issuing an $install twice with the two different IG's on the server. Both IG's are installed

@rmrlangford
Copy link
Author

Thanks @jkiddo , will test in a few hours and get back to you.

@joofio
Copy link

joofio commented Sep 25, 2024

@rmrlangford did this work?

@rmrlangford
Copy link
Author

Hi @joofio , apologies for the late follow-up, I admit that I totally forgot about this due to other distractions. I was in the process of testing this but getting some weird issues and not sure why. Please see below.

Note: this first one is encountered when using the $install operation or when using a the implementation guides config in hapi.fhir.implementationguides

image

When using the $install operation, it doesnt seem to work and likely related to the above issue. I am starting to wonder if this is perhaps an issue local to my machine but I have deleted existing HAPI images, started the process from the beginning again yet when calling StructureDefinition to ensure that my IG is installed, I get nothing back.

image image

Commented out existing IGs to be sure that if the $install operation is used that the IG is installed when calling StructureDefinition.
image

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 26, 2024

@rmrlangford I looked at your sample IG. Your Extensions (StructureDefs) has the status https://github.com/jembi/Starter-FHIR-IG/blob/33fe1b767fd1d42301c1fe290e09bbdd543466d1/input/fsh/extension.fsh#L10 draft. Flip them to active and try again. RuleSet for what is being installed and deemed 'valid' can be found here: https://github.com/hapifhir/hapi-fhir/blob/3f6d1eb29beb44232e56d5974e78d29ec1c83506/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java#L581

@rmrlangford
Copy link
Author

Thanks @jkiddo , that was helpful! So the new script for the $install operation works perfectly and have verified its installation by calling StructureDefinition.

Possibly something unrelated and dont want to postpone the closure of this ticket intentionally but when installing two IG's it seems to always only return the StructureDefinitions for the very last IG installed.

image

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 26, 2024

Have you trawled through all pages in the response from the server?

@rmrlangford
Copy link
Author

rmrlangford commented Sep 26, 2024

Ahh right, yes...I know what the issue is...will confirm in a second.

@rmrlangford
Copy link
Author

rmrlangford commented Sep 26, 2024

So the issue with the IG was that it's artifacts also had a status of draft so changed to active. Still, after doing that, only one IG's StructureDefinition is shown and this time, for the first IG. I think it will be best for me to do a screen recoding and narrative and then share that? So not sure if you prefer to resolve this issue given that the $install operation is working and then based on the findings from my screen recoding, we can open a new issue (if applicable)?

No errors on server.

@jkiddo
Copy link
Collaborator

jkiddo commented Sep 27, 2024

@rmrlangford can I ask you to be more specific. I only identified that you were referring to you sample IG because it was stated in the logs. Which IG's are you exactly referring to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants