FHIR Chat · Presets for locally-deployed Program Edition · inferno

Stream: inferno

Topic: Presets for locally-deployed Program Edition


view this post on Zulip Cooper Thompson (Aug 12 2020 at 17:33):

I've been looking at config.yml, trying to set up preset endpoints and client info like the public Inferno PE site has for the Inferno Reference Server. However the web UI isn't loading my presets. Is there something I need to flip to enable the presets? I skimmed config.yml but nothing jumped out at me. Can someone post a working presets file (maybe the one in use by https://inferno.healthit.gov/inferno)? I skimmed index_onc_program.erb, and it looks like it should just be checking preset.present. I don't know ruby well, but is "present" an existence check, or a property I need to set on the preset config?

view this post on Zulip Reece Adamson (Aug 12 2020 at 17:44):

You should just be able to define it in the config.yml.

e.g. this part of the config.yml for inferno-program

Copied here for convenience:

# preset fhir servers: optional. Minimally requires name, uri, module, optional inferno_uri, client_id, client_secret, scopes, instructions link
presets:
  localhost_reference_server:
    inferno_uri: http://localhost:4567
    name: Inferno Reference Server
    uri: https://inferno.healthit.gov/reference-server/r4
    module: onc_program
    client_id: SAMPLE_CONFIDENTIAL_CLIENT_ID
    confidential_client: true
    client_secret: SAMPLE_CONFIDENTIAL_CLIENT_SECRET
    onc_sl_url: https://inferno.healthit.gov/reference-server/r4
    onc_sl_client_id: SAMPLE_CONFIDENTIAL_CLIENT_ID
    onc_sl_confidential_client: true
    onc_sl_client_secret: SAMPLE_CONFIDENTIAL_CLIENT_SECRET
    onc_public_client_id: SAMPLE_PUBLIC_CLIENT_ID
    patient_ids: "76,185"

Note that the appropriate module must be enabled for the preset to appear. So for the above example onc_program would need to be listed as a module. (See here in the same config.yml)

# module options: one or more must be set.  The first option in the list will be checked by default
modules:
  - onc_program

Hopefully that helps! We'll go back and update the wiki to add this information and make it more clear.

Also yes #present? is an existence check (i.e. not nil, false, empty string, empty array, etc.). You don't need to explicitly set it anywhere.

view this post on Zulip Cooper Thompson (Aug 12 2020 at 17:51):

Hmm... I do have the onc_program module. I'm basically just running the vanilla docker containers from the 1.1.0 release (d1c791e). With no changes at all to config.yml, I don't get the UI widge for the preset selection at all (i.e. not even the Inferno Reference Server is an option). I tried adding my own preset, but that that wasn't picked up either (unsurprisingly).

view this post on Zulip Cooper Thompson (Aug 12 2020 at 17:55):

I do know the config.yml is getting picked up - I updated the app_name and that change did get applied to the site. I'll keep digging.

view this post on Zulip Reece Adamson (Aug 12 2020 at 18:38):

hmmm. Is it the only module you have set? The preset selection looks a little different on program than community. Look for "Or test Inferno against a public sandbox" under the URL input field.

I just tried 1.1.0 (d1c791e) locally without any changes using docker-compose up --build

And I see:
Inferno-Preset.gif

view this post on Zulip Cooper Thompson (Aug 12 2020 at 19:21):

Very strange. I just did the following, and I don't get the preset selection:

curl -s -L https://api.github.com/repos/onc-healthit/inferno-program/releases/latest | jq -r '.tarball_url' | wget -O latest.tar.gz -i -
tar -xzf latest.tar.gz
cd onc-healthit-inferno-program-d1c791e/
# I updated docker-compose.yml to bind to port 44567 instead of 4567 to avoid a port conflict, but that shouldn't affect anything.
docker-compose up --build

I then also updated the config.yml to change app_name to be 100% sure I was hitting the correct folder.

config.yml docker-compose.yml inferno-pe-no-presets.png

view this post on Zulip Cooper Thompson (Aug 12 2020 at 20:21):

I think I've narrowed it down to this bit in endpoint.rb:

          presets = settings.presets.select do |_, v|
            inferno_uri = v['inferno_uri']&.chomp('/')
            inferno_uri.nil? || inferno_uri == base_url || inferno_uri == base_url + base_path

Since I don't know Ruby or this syntax, I'm hoping you can help identify with what is going on. After this line, the presets variable is null, and it then gets passed to index_onc_program as null. However if I make an update to basically reset the presets to the raw settings.presets, the widget shows up:

          presets = settings.presets.select do |_, v|
            inferno_uri = v['inferno_uri']&.chomp('/')
            inferno_uri.nil? || inferno_uri == base_url || inferno_uri == base_url + base_path
          presets = settings.presets

view this post on Zulip Reece Adamson (Aug 12 2020 at 20:22):

Aha! Ok I think I found the issue.

To Fix It:

Go to the preset in your config.yml and change inferno_uri on line 98:

-inferno_uri: http://localhost:4567
+inferno_uri: http://localhost:44567

view this post on Zulip Reece Adamson (Aug 12 2020 at 20:24):

What is going on here is that the config.yml is not documented well :smile: and there is no way you'd know this otherwise. I created a ticket for us to update the docs for this.

Really though the config lets you define different prefixes based on where Inferno is deployed. You can see an example of that in this config where we have different presets set up based on whether or not its hosted at localhost or inferno.healthit.gov.

view this post on Zulip Cooper Thompson (Aug 12 2020 at 20:24):

Ah - maybe we kinda got to the same place. You only show presets that have the inferno_uri that matches the URL hosting the Inferno site?

view this post on Zulip Reece Adamson (Aug 12 2020 at 20:29):

Yup exactly and you were looking in the right place! Looks like it can also be left blank to apply for all situations.

view this post on Zulip Cooper Thompson (Aug 12 2020 at 20:32):

Excellent! Got it working. Thanks for the help!

view this post on Zulip Robert Scanlon (Aug 12 2020 at 21:19):

The reason for this is that often times you have different client registrations depending on deployment URL. This certainly could be made more clear.


Last updated: Apr 12 2022 at 19:14 UTC