onc-healthit / inferno-community

Archived source code for the Inferno Testing Tool and the Community Edition set of tests. No longer maintained.
https://inferno.healthit.gov/
Apache License 2.0
92 stars 35 forks source link

Cannot execute code directly from repository #508

Open stl-steve-moore opened 3 years ago

stl-steve-moore commented 3 years ago

This might be pilot error. I want to be able to run the code directly and not in Docker. My end goal is to add new test cases.

I cloned the code repo and ran the commands as documented bundle install bundle exec rake db:create db:schema:load bundle exec rackup

It complains about not being able to reach http:validator_service:4567 (see below for more complete dump)

I assumed that service was to run on my localhost host, so I updated by /etc/hosts file to map validator_service to 127.0.0.1. I still have the same error. I tried on both the master and develop branches and had the same issue.

Environment: macOS Catalina (10.15.7)

Steve Moore moore.stephen.m@wustl.edu

INFO | Inferno | Checking that validator is available at http://validator_service:4567 ERROR | Inferno | Unable to reach validator at http://validator_service:4567 INFO | Inferno | Checking that validator is available at http://validator_service:4567 ERROR | Inferno | Unable to reach validator at http://validator_service:4567 ^CTraceback (most recent call last): 47: from /usr/local/opt/ruby/bin/bundle:23:in <main>' 46: from /usr/local/opt/ruby/bin/bundle:23:inload' 45: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:34:in <top (required)>' 44: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:inwith_friendly_errors' 43: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:46:in block in <top (required)>' 42: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:instart' 41: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in start' 40: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:indispatch' 39: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in dispatch' 38: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:ininvoke_command' 37: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' 36: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:inexec' 35: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in run' 34: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:inkernel_load' 33: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in load' 32: from /usr/local/lib/ruby/gems/2.7.0/bin/rackup:23:in<top (required)>' 31: from /usr/local/lib/ruby/gems/2.7.0/bin/rackup:23:in load' 30: from /usr/local/lib/ruby/gems/2.7.0/gems/rack-2.2.3/bin/rackup:5:in<top (

radamson commented 3 years ago

TL;DR

Preferred Fix:

Alternate Fix:


More details on what's happening here... This is a gap in the documentation for running the service locally that probably came about when we changed how validation works by default. Let me try and explain what's going on here:

Inferno's FHIR resource validation capability is configurable. It can either use its internal validation capabilities or delegate validation to an external service. Here is the relevant part of the config:

https://github.com/onc-healthit/inferno/blob/d1e9b92b3283122c8862a99d94eeb1183df5196e/config.yml#L33-L42

The easiest option here would be to set resource_validator to "internal" and then running inferno. The external validator can handle doing more comprehensive validation and has features that help with test generation - which is why it is currently the new default.

In order to use the external validator you'll need to run an external FHIR validator service. This is what the dockerized version of inferno does and what the current config is set to (note the named container validator_service):

https://github.com/onc-healthit/inferno/blob/d1e9b92b3283122c8862a99d94eeb1183df5196e/docker-compose.yml#L12-L13

The validation server is available on DockerHub and can be run with: docker run -p 3000:4567 infernocommunity/fhir-validator-service:latest. You'll need to update the config appropriately too: external_resource_validator_url: http://localhost:3000. I choose port 3000, but it can be any of your choosing.

You could also provide your own validator service that conforms to this API, but I wouldn't recommend that to start 😉 .

Refer to the TL;DR up top for the recommended fix.

nathanloyer commented 3 years ago

It would be helpful for the repo to have the default configuration work when running locally. If not that, then having an error message that could hint us in the direction of the fix would be OK. Or even just having it in the readme to change the setting when running locally.

I ran into this problem last week and a colleague who had run this before was able to help me work around it by setting it to internal validation mode.