diff --git a/.env.development b/.env.development index e73118a..ef50048 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,2 @@ -VALIDATOR_URL=http://localhost/validatorapi +FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi REDIS_URL=redis://localhost:6379/0 diff --git a/.env.production b/.env.production index 0f832e3..719b168 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,2 @@ REDIS_URL=redis://redis:6379/0 -VALIDATOR_URL=http://validator_service:4567 \ No newline at end of file +FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 \ No newline at end of file diff --git a/.env.test b/.env.test index 9e95769..1545bfc 100644 --- a/.env.test +++ b/.env.test @@ -1,2 +1,2 @@ -VALIDATOR_URL=https://example.com/validatorapi +FHIR_RESOURCE_VALIDATOR_URL=https://example.com/validatorapi ASYNC_JOBS=false diff --git a/Gemfile.lock b/Gemfile.lock index ce28926..778195a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: shc_vaccination_test_kit (0.1.0) - health_cards - inferno_core (>= 0.4.2) + health_cards (= 0.0.2) + inferno_core (>= 0.4.37) GEM remote: https://rubygems.org/ @@ -20,7 +20,7 @@ GEM base64 (0.2.0) bcp47 (0.3.3) i18n - bigdecimal (3.1.7) + bigdecimal (3.1.8) blueprinter (0.25.2) byebug (11.1.3) chunky_png (1.4.0) @@ -41,40 +41,25 @@ GEM diff-lcs (1.5.1) domain_name (0.6.20240107) dotenv (2.8.1) - dry-auto_inject (0.9.0) - dry-container (>= 0.3.4) - dry-configurable (0.13.0) - concurrent-ruby (~> 1.0) - dry-core (~> 0.6) - dry-container (0.9.0) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.13, >= 0.13.0) - dry-core (0.8.1) - concurrent-ruby (~> 1.0) - dry-inflector (0.3.0) - dry-logic (1.2.0) + dry-auto_inject (1.0.1) + dry-core (~> 1.0) + zeitwerk (~> 2.6) + dry-configurable (1.0.0) + dry-core (~> 1.0, < 2) + zeitwerk (~> 2.6) + dry-container (0.10.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5) - dry-struct (1.4.0) - dry-core (~> 0.5, >= 0.5) - dry-types (~> 1.5) - ice_nine (~> 0.11) - dry-system (0.20.0) + dry-core (1.0.0) concurrent-ruby (~> 1.0) - dry-auto_inject (>= 0.4.0) - dry-configurable (~> 0.13, >= 0.13.0) - dry-container (~> 0.9, >= 0.9.0) - dry-core (~> 0.5, >= 0.5) - dry-inflector (~> 0.1, >= 0.1.2) - dry-struct (~> 1.0) + zeitwerk (~> 2.6) + dry-inflector (1.0.0) + dry-system (1.0.0) + dry-auto_inject (~> 1.0.0.rc1, < 2) + dry-configurable (~> 1.0, < 2) + dry-core (~> 1.0, < 2) + dry-inflector (~> 1.0, < 2) dry-transformer (1.0.1) zeitwerk (~> 2.6) - dry-types (1.5.1) - concurrent-ruby (~> 1.0) - dry-container (~> 0.3) - dry-core (~> 0.5, >= 0.5) - dry-inflector (~> 0.1, >= 0.1.2) - dry-logic (~> 1.0, >= 1.0.2) factory_bot (6.4.6) activesupport (>= 5.0.0) faraday (1.10.3) @@ -128,44 +113,45 @@ GEM date_time_precision (>= 0.8) mime-types (>= 3.0) nokogiri (>= 1.11.4) - hanami-controller (2.0.0.beta1) - dry-configurable (~> 0.13, >= 0.13.0) - hanami-utils (~> 2.0.beta) + hanami-controller (2.0.0) + dry-configurable (~> 1.0, < 2) + dry-core (~> 1.0) + hanami-utils (~> 2.0) rack (~> 2.0) + zeitwerk (~> 2.6) hanami-router (2.0.0) mustermann (~> 1.0) mustermann-contrib (~> 1.0) rack (~> 2.0) - hanami-utils (2.0.0) + hanami-utils (2.1.0) concurrent-ruby (~> 1.0) + dry-core (~> 1.0, < 2) dry-transformer (~> 1.0, < 2) hansi (0.2.1) hashdiff (1.1.0) - health_cards (1.1.0) + health_cards (0.0.2) fhir_models (>= 4.0.0) rqrcode - rqrcode_core (>= 1.2.0) http-accept (1.7.0) http-cookie (1.0.5) domain_name (~> 0.5) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) - ice_nine (0.11.2) - inferno_core (0.4.33) + inferno_core (0.4.37) activesupport (~> 6.1.7.5) base62-rb (= 0.3.1) blueprinter (= 0.25.2) dotenv (~> 2.7) - dry-configurable (= 0.13.0) - dry-container (= 0.9.0) - dry-core (= 0.8.1) - dry-inflector (= 0.3) - dry-system (= 0.20.0) + dry-configurable (= 1.0.0) + dry-container (= 0.10.0) + dry-core (= 1.0.0) + dry-inflector (= 1.0.0) + dry-system (= 1.0.0) faraday (~> 1.2) faraday_middleware (~> 1.2) fhir_client (>= 5.0.3) fhir_models (>= 4.2.2) - hanami-controller (= 2.0.0.beta1) + hanami-controller (= 2.0.0) hanami-router (= 2.0.0) oj (= 3.11.0) pry @@ -185,26 +171,27 @@ GEM base64 kramdown (2.4.0) rexml - method_source (1.0.0) + method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) - minitest (5.22.3) + mime-types-data (3.2024.0507) + minitest (5.23.1) multi_json (1.15.0) - multi_xml (0.6.0) - multipart-post (2.4.0) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + multipart-post (2.4.1) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) mustermann-contrib (1.1.2) hansi (~> 0.2.0) mustermann (= 1.1.2) netrc (0.11.0) - nio4r (2.7.1) - nokogiri (1.16.3-arm64-darwin) + nio4r (2.7.3) + nokogiri (1.16.5-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.3-x86_64-darwin) + nokogiri (1.16.5-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.3-x86_64-linux) + nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) @@ -226,7 +213,7 @@ GEM public_suffix (5.0.5) puma (5.6.8) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rake (13.2.1) rdoc (6.6.3.1) @@ -239,7 +226,8 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) rouge (4.2.1) rqrcode (2.2.0) chunky_png (~> 1.0) @@ -273,6 +261,7 @@ GEM unicode-display_width (>= 1.5, < 3.0) unicode_utils (~> 1.4) strings-ansi (0.2.0) + strscan (3.1.0) thor (1.2.2) tilt (2.3.0) tty-color (0.6.0) @@ -292,10 +281,11 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.6.13) + zeitwerk (2.6.14) PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-20 x86_64-linux diff --git a/config/nginx.background.conf b/config/nginx.background.conf index f897472..5cacd0b 100644 --- a/config/nginx.background.conf +++ b/config/nginx.background.conf @@ -53,22 +53,38 @@ http { # the server will close connections after this time keepalive_timeout 600; - location /validator { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_redirect off; - proxy_set_header Connection ''; - proxy_http_version 1.1; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; +# location /validator { +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header Host $http_host; +# proxy_set_header X-Forwarded-Proto $scheme; +# proxy_set_header X-Forwarded-Port $server_port; +# proxy_redirect off; +# proxy_set_header Connection ''; +# proxy_http_version 1.1; +# chunked_transfer_encoding off; +# proxy_buffering off; +# proxy_cache off; +# +# proxy_pass http://fhir_validator_app; +# } - proxy_pass http://fhir_validator_app; - } +# location /validatorapi/ { +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header Host $http_host; +# proxy_set_header X-Forwarded-Proto $scheme; +# proxy_set_header X-Forwarded-Port $server_port; +# proxy_redirect off; +# proxy_set_header Connection ''; +# proxy_http_version 1.1; +# chunked_transfer_encoding off; +# proxy_buffering off; +# proxy_cache off; +# +# proxy_pass http://validator_service:4567/; +# } +# } - location /validatorapi/ { + location /hl7validatorapi/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; @@ -79,8 +95,9 @@ http { chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; + proxy_read_timeout 600s; - proxy_pass http://validator_service:4567/; + proxy_pass http://hl7_validator_service:3500/; } } } diff --git a/config/nginx.conf b/config/nginx.conf index af4b461..a49b549 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -68,7 +68,37 @@ http { proxy_pass http://inferno:4567; } - location /validator { +# location /validator { +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header Host $http_host; +# proxy_set_header X-Forwarded-Proto $scheme; +# proxy_set_header X-Forwarded-Port $server_port; +# proxy_redirect off; +# proxy_set_header Connection ''; +# proxy_http_version 1.1; +# chunked_transfer_encoding off; +# proxy_buffering off; +# proxy_cache off; +# +# proxy_pass http://fhir_validator_app; +# } + +# location /validatorapi/ { +# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +# proxy_set_header Host $http_host; +# proxy_set_header X-Forwarded-Proto $scheme; +# proxy_set_header X-Forwarded-Port $server_port; +# proxy_redirect off; +# proxy_set_header Connection ''; +# proxy_http_version 1.1; +# chunked_transfer_encoding off; +# proxy_buffering off; +# proxy_cache off; +# +# proxy_pass http://validator_service:4567/; +# } + + location /hl7validatorapi/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; @@ -79,23 +109,9 @@ http { chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; + proxy_read_timeout 600s; - proxy_pass http://fhir_validator_app; - } - - location /validatorapi/ { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_redirect off; - proxy_set_header Connection ''; - proxy_http_version 1.1; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - - proxy_pass http://validator_service:4567/; + proxy_pass http://hl7_validator_service:3500/; } } } diff --git a/docker-compose.background.yml b/docker-compose.background.yml index feb789c..61d2cb9 100644 --- a/docker-compose.background.yml +++ b/docker-compose.background.yml @@ -1,17 +1,28 @@ version: '3' services: - validator_service: - image: infernocommunity/fhir-validator-service - # Update this path to match your directory structure - volumes: - - ./lib/covid19_vci/igs:/home/igs - fhir_validator_app: - image: infernocommunity/fhir-validator-app - depends_on: - - validator_service + hl7_validator_service: + image: infernocommunity/inferno-resource-validator environment: - EXTERNAL_VALIDATOR_URL: http://localhost/validatorapi - VALIDATOR_BASE_PATH: /validator + # Defines how long validator sessions last if unused, in minutes: + # Negative values mean sessions never expire, 0 means sessions immediately expire + SESSION_CACHE_DURATION: -1 + volumes: + - ./lib/covid19_vci/igs:/app/igs + # To let the service share your local FHIR package cache, + # uncomment the below line + # - ~/.fhir:/home/ktor/.fhir + # validator_service: + # image: infernocommunity/fhir-validator-service + # # Update this path to match your directory structure + # volumes: + # - ./lib/covid19_vci/igs:/home/igs + # fhir_validator_app: + # image: infernocommunity/fhir-validator-app + # depends_on: + # - validator_service + # environment: + # EXTERNAL_VALIDATOR_URL: http://localhost/validatorapi + # VALIDATOR_BASE_PATH: /validator nginx: image: nginx volumes: @@ -19,8 +30,8 @@ services: ports: - "80:80" command: [nginx, '-g', 'daemon off;'] - depends_on: - - fhir_validator_app + # depends_on: + # - fhir_validator_app redis: image: redis ports: diff --git a/docker-compose.yml b/docker-compose.yml index ffbb49a..16ab428 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,9 @@ services: context: ./ volumes: - ./data:/opt/inferno/data - ports: - - "4567:4567" depends_on: - - validator_service + - hl7_validator_service + # - validator_service worker: build: context: ./ @@ -17,14 +16,18 @@ services: command: bundle exec sidekiq -r ./worker.rb depends_on: - redis - validator_service: + hl7_validator_service: extends: file: docker-compose.background.yml - service: validator_service - fhir_validator_app: - extends: - file: docker-compose.background.yml - service: fhir_validator_app + service: hl7_validator_service + # validator_service: + # extends: + # file: docker-compose.background.yml + # service: validator_service + # fhir_validator_app: + # extends: + # file: docker-compose.background.yml + # service: fhir_validator_app nginx: extends: file: docker-compose.background.yml diff --git a/lib/covid19_vci/igs/README.md b/lib/covid19_vci/igs/README.md new file mode 100644 index 0000000..644c908 --- /dev/null +++ b/lib/covid19_vci/igs/README.md @@ -0,0 +1,21 @@ +# Note on this IGs folder + +There are three reasons why it would be necessary to put an IG package.tgz in this folder. If none of these apply, you do not need to put any files here, or can consider removing any existing files to make it clear they are unused. + +## 1. Generated Test Suites +Some test kits use a "generator" to automatically generate the contents of a test suite for an IG. The IG files are required every time the test suites need to be regenerated. Examples of test kits that use this approach are the US Core Test Kit and CARIN IG for Blue Button® Test Kit. + + +## 2. Non-published IG +If your IG, or the specific version of the IG you want to test against, is not published, then the validator service needs to load the IG from file in order to be able to validate resources with it. The IG must be referenced in the `fhir_resource_validator` block in the test suite definition by filename, ie: + +```ruby + fhir_resource_validator do + igs 'igs/filename.tgz' + + ... + end +``` + +## 3. Inferno Validator UI +The Inferno Validator UI is configured to auto-load any IGs present in the igs folder and include them in all validations. The Inferno Validator UI is currently disabled by default, so this is only relevant if you choose to re-enable it. In general, the Inferno team is currently leaving IGs in this folder even if not otherwise necessary to make it easy to re-enable the validator UI. \ No newline at end of file diff --git a/lib/shc_vaccination_test_kit.rb b/lib/shc_vaccination_test_kit.rb index f67fe8b..d7c6da3 100644 --- a/lib/shc_vaccination_test_kit.rb +++ b/lib/shc_vaccination_test_kit.rb @@ -11,6 +11,18 @@ class Suite < Inferno::TestSuite access to [SMART Health Cards](https://smarthealth.cards/) via file download or HL7® FHIR® API. ) + VALIDATION_MESSAGE_FILTERS = [ + /\A\S+: \S+: URL value '.*' does not resolve/, + ].freeze + + fhir_resource_validator do + igs 'igs/hl7.fhir.uv.smarthealthcards-vaccination-0.5.0-rc.tgz' + + exclude_message do |message| + VALIDATION_MESSAGE_FILTERS.any? { |filter| filter.match? message.message } + end + end + group from: :vci_file_download group from: :vci_fhir_operation end diff --git a/shc_vaccination_test_kit.gemspec b/shc_vaccination_test_kit.gemspec index 5d75983..c98b3d7 100644 --- a/shc_vaccination_test_kit.gemspec +++ b/shc_vaccination_test_kit.gemspec @@ -12,8 +12,8 @@ Gem::Specification.new do |spec| spec.description = 'A collection of tests for the SMART Health Cards: Vaccination & Testing FHIR Implementation Guide' spec.homepage = 'https://github.com/inferno-framework/shc-vaccination-test-kit' spec.license = 'Apache-2.0' - spec.add_runtime_dependency 'health_cards' - spec.add_runtime_dependency 'inferno_core', '>= 0.4.2' + spec.add_runtime_dependency 'health_cards', '0.0.2' + spec.add_runtime_dependency 'inferno_core', '>= 0.4.37' spec.add_development_dependency 'database_cleaner-sequel', '~> 1.8' spec.add_development_dependency 'factory_bot', '~> 6.1' spec.add_development_dependency 'rspec', '~> 3.10'