From 87bf5da92731b134d5f783715bb94a92f99313cd Mon Sep 17 00:00:00 2001 From: nvim Date: Thu, 13 Jun 2024 12:48:08 +0200 Subject: [PATCH 01/11] Migrate to the HL7 official validator Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .env.development | 11 ++-- .env.production | 11 ++-- compose.yaml | 17 ++----- config/nginx.conf | 50 ++++++++++++------- .../generator/suite_generator.rb | 8 ++- .../generator/templates/suite.rb.erb | 13 ++--- .../reference_resolution_test.rb | 4 +- 7 files changed, 65 insertions(+), 49 deletions(-) diff --git a/.env.development b/.env.development index 4ec45c6f..59f85fec 100644 --- a/.env.development +++ b/.env.development @@ -1,6 +1,7 @@ -V311_VALIDATOR_URL=http://localhost/validatorapi -V400_VALIDATOR_URL=http://localhost/validatorapi -V501_VALIDATOR_URL=http://localhost/validatorapi -V610_VALIDATOR_URL=http://localhost/validatorapi -V700_BALLOT_VALIDATOR_URL=http://localhost/validatorapi +V311_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi +V400_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi +V501_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi +V610_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi +V700_BALLOT_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi + REDIS_URL=redis://localhost:6379/0 \ No newline at end of file diff --git a/.env.production b/.env.production index 0aa9b96d..a19b90f2 100644 --- a/.env.production +++ b/.env.production @@ -1,6 +1,7 @@ REDIS_URL=redis://redis:6379/0 -V311_VALIDATOR_URL=http://validator-service:4567 -V400_VALIDATOR_URL=http://validator-service:4567 -V501_VALIDATOR_URL=http://validator-service:4567 -V610_VALIDATOR_URL=http://validator-service:4567 -V700_BALLOT_VALIDATOR_URL=http://validator-service:4567 \ No newline at end of file + +V311_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 +V400_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 +V501_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 +V610_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 +V700_BALLOT_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index b2865669..bf4f024c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -8,8 +8,6 @@ services: - ./lib/:/opt/inferno/lib - ./:/opt/inferno/ depends_on: - validator-api: - condition: service_started redis: condition: service_started postgres: @@ -35,20 +33,13 @@ services: POSTGRES_PASSWORD: password POSTGRES_DB: inferno POSTGRES_USER: postgres - validator-api: - image: infernocommunity/fhir-validator-service + hl7_validator_service: + image: infernocommunity/inferno-resource-validator environment: + SESSION_CACHE_DURATION: -1 TX_SERVER_URL: https://tx.dev.hl7.org.au/fhir volumes: - ./lib/au_core_test_kit/igs:/home/igs - validator-web: - image: infernocommunity/fhir-validator-app - depends_on: - validator-api: - condition: service_started - environment: - EXTERNAL_VALIDATOR_URL: http://localhost/validatorapi - VALIDATOR_BASE_PATH: /validator nginx: image: nginx ports: @@ -57,8 +48,6 @@ services: volumes: - ./config/nginx.conf:/etc/nginx/nginx.conf depends_on: - validator-api: - condition: service_started inferno: condition: service_started redis: diff --git a/config/nginx.conf b/config/nginx.conf index d3996081..ba4514d2 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://validator-web; + # } + + # 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-api: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://validator-web; - } - - 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-api:4567/; + proxy_pass http://hl7_validator_service:3500/; } } } diff --git a/lib/au_core_test_kit/generator/suite_generator.rb b/lib/au_core_test_kit/generator/suite_generator.rb index 58649e31..14625d6d 100644 --- a/lib/au_core_test_kit/generator/suite_generator.rb +++ b/lib/au_core_test_kit/generator/suite_generator.rb @@ -60,7 +60,13 @@ def title end def validator_env_name - "#{ig_metadata.reformatted_version.upcase}_VALIDATOR_URL" + # "#{ig_metadata.reformatted_version.upcase}_VALIDATOR_URL" + "#{ig_metadata.reformatted_version.upcase}_FHIR_RESOURCE_VALIDATOR_URL" + end + + def ig_identifier + version = ig_metadata.ig_version[1..] # Remove leading 'v' + "hl7.fhir.au.core##{version}" end def ig_link diff --git a/lib/au_core_test_kit/generator/templates/suite.rb.erb b/lib/au_core_test_kit/generator/templates/suite.rb.erb index 486f6845..17afa43b 100644 --- a/lib/au_core_test_kit/generator/templates/suite.rb.erb +++ b/lib/au_core_test_kit/generator/templates/suite.rb.erb @@ -27,6 +27,7 @@ module AUCoreTestKit /Observation\.effective\.ofType\(Period\): .*vs-1:/, # Invalid invariant in FHIR v4.0.1 /Observation\.effective\.ofType\(Period\): .*us-core-1:/, # Invalid invariant in AU Core v3.1.1 /Provenance.agent\[\d*\]: Rule provenance-1/, #Invalid invariant in AU Core v5.0.1 + /\A\S+: \S+: URL value '.*' does not resolve/, ].freeze VERSION_SPECIFIC_MESSAGE_FILTERS = <%=version_specific_message_filters%>.freeze @@ -37,18 +38,18 @@ module AUCoreTestKit end end - validator do - url ENV.fetch('<%= validator_env_name %>', 'http://validator-api:4567') + fhir_resource_validator do + url ENV.fetch('<%= validator_env_name %>', 'http://hl7_validator_service:3500') + igs '<%= ig_identifier %>' message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS exclude_message do |message| - message_filters.any? { |filter| filter.match? message.message } end - # perform_additional_validation do |resource, profile_url| - # ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) - # end + perform_additional_validation do |resource, profile_url| + ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) + end end id :<%= suite_id %> diff --git a/lib/au_core_test_kit/reference_resolution_test.rb b/lib/au_core_test_kit/reference_resolution_test.rb index b5d73486..2621fe6c 100644 --- a/lib/au_core_test_kit/reference_resolution_test.rb +++ b/lib/au_core_test_kit/reference_resolution_test.rb @@ -176,7 +176,9 @@ def resource_is_valid_with_target_profile?(resource, target_profile) target_profile_with_version = target_profile.include?('|') ? target_profile : "#{target_profile}|#{metadata.profile_version}" - outcome = FHIR::OperationOutcome.new(JSON.parse(validator.validate(resource, target_profile_with_version))) + # outcome = FHIR::OperationOutcome.new(JSON.parse(validator.validate(resource, target_profile_with_version))) + validator_response = validator.validate(resource, target_profile_with_version) + outcome = validator.operation_outcome_from_hl7_wrapped_response(validator_response) message_hashes = outcome.issue&.map { |issue| validator.message_hash_from_issue(issue, resource) } || [] From 3d13f468b5a6f4bff090b37c357cd88e2d736a8b Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 14 Jun 2024 14:51:14 +0200 Subject: [PATCH 02/11] WIP: Update validator env Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .env.development | 7 +- .env.production | 6 +- Gemfile.lock | 123 ++++++++++-------- compose.yaml | 3 +- .../v0.3.0-ballot/au_core_test_suite.rb | 16 ++- .../v0.4.0-ci-build/au_core_test_suite.rb | 17 ++- .../generator/templates/suite.rb.erb | 5 +- 7 files changed, 95 insertions(+), 82 deletions(-) diff --git a/.env.development b/.env.development index 59f85fec..e8690f6a 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,2 @@ -V311_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi -V400_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi -V501_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi -V610_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi -V700_BALLOT_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi - +FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi REDIS_URL=redis://localhost:6379/0 \ No newline at end of file diff --git a/.env.production b/.env.production index a19b90f2..1e0f0c0e 100644 --- a/.env.production +++ b/.env.production @@ -1,7 +1,3 @@ REDIS_URL=redis://redis:6379/0 -V311_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 -V400_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 -V501_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 -V610_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 -V700_BALLOT_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 \ No newline at end of file +FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 92fad529..962d15f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,13 +9,13 @@ PATH GEM remote: https://rubygems.org/ specs: - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + actionview (6.1.7.8) + activesupport (= 6.1.7.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (6.1.7.6) + activesupport (6.1.7.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -39,12 +39,13 @@ GEM bigdecimal (3.1.8) bindata (2.5.0) blueprinter (0.25.2) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) connection_pool (2.4.1) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) database_cleaner (1.99.0) @@ -52,10 +53,10 @@ GEM database_cleaner (~> 1.99.0) sequel date_time_precision (0.8.1) - debug (1.6.3) - irb (>= 1.3.6) - reline (>= 0.3.1) - diff-lcs (1.5.0) + debug (1.9.2) + irb (~> 1.10) + reline (>= 0.3.8) + diff-lcs (1.5.1) domain_name (0.6.20240107) dotenv (2.8.1) dry-auto_inject (1.0.1) @@ -77,8 +78,8 @@ GEM dry-inflector (~> 1.0, < 2) dry-transformer (1.0.1) zeitwerk (~> 2.6) - erubi (1.12.0) - factory_bot (6.2.1) + erubi (1.13.0) + factory_bot (6.4.6) activesupport (>= 5.0.0) faraday (1.10.3) faraday-em_http (~> 1.0) @@ -146,14 +147,14 @@ GEM dry-core (~> 1.0, < 2) dry-transformer (~> 1.0, < 2) hansi (0.2.1) - hashdiff (1.0.1) + hashdiff (1.1.0) http-accept (1.7.0) http-cookie (1.0.6) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) - inferno_core (0.4.37) + inferno_core (0.4.38) activesupport (~> 6.1.7.5) base62-rb (= 0.3.1) blueprinter (= 0.25.2) @@ -175,13 +176,14 @@ GEM puma (~> 5.6.7) rake (~> 13.0) sequel (~> 5.42.0) - sidekiq (~> 6.5.6) + sidekiq (~> 7.2.4) sqlite3 (~> 1.4) thor (~> 1.2.1) tty-markdown (~> 0.7.1) - io-console (0.5.11) - irb (1.4.2) - reline (>= 0.3.0) + io-console (0.7.2) + irb (1.13.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) json (2.7.2) json-jwt (1.15.3.1) activesupport (>= 4.2) @@ -199,9 +201,9 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0507) - mini_portile2 (2.8.6) - minitest (5.22.3) + mime-types-data (3.2024.0604) + mini_portile2 (2.8.7) + minitest (5.23.1) multi_json (1.15.0) multi_xml (0.7.1) bigdecimal (~> 3.1) @@ -213,14 +215,14 @@ GEM mustermann (= 1.1.2) netrc (0.11.0) nio4r (2.7.3) - nokogiri (1.16.4) + nokogiri (1.16.6) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.4-arm64-darwin) + nokogiri (1.16.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) + nokogiri (1.16.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.6-x86_64-linux) racc (~> 1.4) oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) @@ -229,8 +231,8 @@ GEM multi_xml (~> 0.5) rack (>= 1.2, < 4) oj (3.11.0) - parallel (1.24.0) - parser (3.3.0.5) + parallel (1.25.1) + parser (3.3.3.0) ast (~> 2.4.1) racc pastel (0.8.0) @@ -242,10 +244,12 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + psych (5.1.2) + stringio public_suffix (5.0.5) puma (5.6.8) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) @@ -256,31 +260,35 @@ GEM nokogiri (~> 1.14) rainbow (3.1.1) rake (13.2.1) - redis (4.8.1) - regexp_parser (2.9.0) - reline (0.3.1) + rdoc (6.7.0) + psych (>= 4.0.0) + redis-client (0.22.2) + connection_pool + regexp_parser (2.9.2) + reline (0.5.9) io-console (~> 0.5) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.6) - rouge (4.2.1) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.0) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rexml (3.3.0) + strscan + rouge (4.3.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) - rubocop (1.63.2) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + rubocop (1.63.5) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -291,18 +299,19 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) rubocop-erb (0.3.1) better_html rubocop (~> 1.45) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) sequel (5.42.0) - sidekiq (6.5.12) - connection_pool (>= 2.2.5, < 3) - rack (~> 2.0) - redis (>= 4.5.0, < 5) + sidekiq (7.2.4) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.19.0) smart_app_launch_test_kit (0.4.2) inferno_core (>= 0.4.2) json-jwt (~> 1.15.3) @@ -314,14 +323,16 @@ GEM sqlite3 (1.7.3-arm64-darwin) sqlite3 (1.7.3-x86_64-darwin) sqlite3 (1.7.3-x86_64-linux) + stringio (3.1.1) strings (0.2.1) strings-ansi (~> 0.2) 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) - tls_test_kit (0.2.1) + tls_test_kit (0.2.2) inferno_core (>= 0.4.2) tty-color (0.6.0) tty-markdown (0.7.2) @@ -336,11 +347,11 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) unicode_utils (1.4.0) - webmock (3.18.1) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - zeitwerk (2.6.13) + zeitwerk (2.6.15) PLATFORMS arm64-darwin-21 @@ -361,4 +372,4 @@ DEPENDENCIES webmock (~> 3.11) BUNDLED WITH - 2.3.23 + 2.3.7 diff --git a/compose.yaml b/compose.yaml index bf4f024c..f8e8e7cc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -34,10 +34,9 @@ services: POSTGRES_DB: inferno POSTGRES_USER: postgres hl7_validator_service: - image: infernocommunity/inferno-resource-validator + image: infernocommunity/inferno-resource-validator:1.0.52 environment: SESSION_CACHE_DURATION: -1 - TX_SERVER_URL: https://tx.dev.hl7.org.au/fhir volumes: - ./lib/au_core_test_kit/igs:/home/igs nginx: diff --git a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb index 846214e5..25bb4d33 100644 --- a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb @@ -49,6 +49,7 @@ class AUCoreTestSuite < Inferno::TestSuite /Observation\.effective\.ofType\(Period\): .*vs-1:/, # Invalid invariant in FHIR v4.0.1 /Observation\.effective\.ofType\(Period\): .*us-core-1:/, # Invalid invariant in AU Core v3.1.1 /Provenance.agent\[\d*\]: Rule provenance-1/, #Invalid invariant in AU Core v5.0.1 + /\A\S+: \S+: URL value '.*' does not resolve/, ].freeze VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze @@ -59,18 +60,21 @@ def self.metadata end end - validator do - url ENV.fetch('V030_BALLOT_VALIDATOR_URL', 'http://validator-api:4567') + fhir_resource_validator do + igs 'hl7.fhir.au.core#0.3.0-ballot' message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS - exclude_message do |message| + cli_context do + txServer 'https://tx.dev.hl7.org.au/fhir' + end + exclude_message do |message| message_filters.any? { |filter| filter.match? message.message } end - # perform_additional_validation do |resource, profile_url| - # ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) - # end + perform_additional_validation do |resource, profile_url| + ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) + end end id :au_core_v030_ballot diff --git a/lib/au_core_test_kit/generated/v0.4.0-ci-build/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.4.0-ci-build/au_core_test_suite.rb index f383d8b1..b5899569 100644 --- a/lib/au_core_test_kit/generated/v0.4.0-ci-build/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.4.0-ci-build/au_core_test_suite.rb @@ -48,7 +48,8 @@ class AUCoreTestSuite < Inferno::TestSuite %r{Sub-extension url 'revoke' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris}, /Observation\.effective\.ofType\(Period\): .*vs-1:/, # Invalid invariant in FHIR v4.0.1 /Observation\.effective\.ofType\(Period\): .*us-core-1:/, # Invalid invariant in AU Core v3.1.1 - /Provenance.agent\[\d*\]: Rule provenance-1/ # Invalid invariant in AU Core v5.0.1 + /Provenance.agent\[\d*\]: Rule provenance-1/, # Invalid invariant in AU Core v5.0.1 + /\A\S+: \S+: URL value '.*' does not resolve/ ].freeze VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze @@ -59,17 +60,21 @@ def self.metadata end end - validator do - url ENV.fetch('V040_CI_BUILD_VALIDATOR_URL', 'http://validator-api:4567') + fhir_resource_validator do + igs 'hl7.fhir.au.core#0.4.0-ci-build' message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS + cli_context do + txServer 'https://tx.dev.hl7.org.au/fhir' + end + exclude_message do |message| message_filters.any? { |filter| filter.match? message.message } end - # perform_additional_validation do |resource, profile_url| - # ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) - # end + perform_additional_validation do |resource, _profile_url| + ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) + end end id :au_core_v040_ci_build diff --git a/lib/au_core_test_kit/generator/templates/suite.rb.erb b/lib/au_core_test_kit/generator/templates/suite.rb.erb index 17afa43b..703b66ca 100644 --- a/lib/au_core_test_kit/generator/templates/suite.rb.erb +++ b/lib/au_core_test_kit/generator/templates/suite.rb.erb @@ -39,10 +39,13 @@ module AUCoreTestKit end fhir_resource_validator do - url ENV.fetch('<%= validator_env_name %>', 'http://hl7_validator_service:3500') igs '<%= ig_identifier %>' message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS + cli_context do + txServer 'https://tx.dev.hl7.org.au/fhir' + end + exclude_message do |message| message_filters.any? { |filter| filter.match? message.message } end From fc2475c21e826d9719a1eaacaef0f7d4f39944d8 Mon Sep 17 00:00:00 2001 From: nvim Date: Mon, 17 Jun 2024 14:35:25 +0200 Subject: [PATCH 03/11] Configure cli context for the validator Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- lib/au_core_test_kit/generator/suite_generator.rb | 5 ----- lib/au_core_test_kit/generator/templates/suite.rb.erb | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/au_core_test_kit/generator/suite_generator.rb b/lib/au_core_test_kit/generator/suite_generator.rb index 14625d6d..0583c9dc 100644 --- a/lib/au_core_test_kit/generator/suite_generator.rb +++ b/lib/au_core_test_kit/generator/suite_generator.rb @@ -59,11 +59,6 @@ def title "AU Core #{ig_metadata.ig_version}" end - def validator_env_name - # "#{ig_metadata.reformatted_version.upcase}_VALIDATOR_URL" - "#{ig_metadata.reformatted_version.upcase}_FHIR_RESOURCE_VALIDATOR_URL" - end - def ig_identifier version = ig_metadata.ig_version[1..] # Remove leading 'v' "hl7.fhir.au.core##{version}" diff --git a/lib/au_core_test_kit/generator/templates/suite.rb.erb b/lib/au_core_test_kit/generator/templates/suite.rb.erb index 703b66ca..11ee350d 100644 --- a/lib/au_core_test_kit/generator/templates/suite.rb.erb +++ b/lib/au_core_test_kit/generator/templates/suite.rb.erb @@ -44,6 +44,7 @@ module AUCoreTestKit cli_context do txServer 'https://tx.dev.hl7.org.au/fhir' + disableDefaultResourceFetcher false end exclude_message do |message| From 9c31f98a1b4837085efd6401dd15eb5f5f3d5c63 Mon Sep 17 00:00:00 2001 From: nvim Date: Tue, 18 Jun 2024 11:45:32 +0200 Subject: [PATCH 04/11] Temporary change to the custom validator wrapper image Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index f8e8e7cc..05b0a440 100644 --- a/compose.yaml +++ b/compose.yaml @@ -34,7 +34,8 @@ services: POSTGRES_DB: inferno POSTGRES_USER: postgres hl7_validator_service: - image: infernocommunity/inferno-resource-validator:1.0.52 + # image: infernocommunity/inferno-resource-validator:1.0.52 + image: pavelrozhkov/wrapper:6.3.11 environment: SESSION_CACHE_DURATION: -1 volumes: From eed1c5273ccbf0641aaaf4bd5457293bbaf52346 Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 10:00:26 +0200 Subject: [PATCH 05/11] Fix init validator Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .../v0.3.0-ballot/au_core_test_suite.rb | 1 + .../v0.4.0-preview/au_core_test_suite.rb | 18 ++++++++++++------ .../v0.5.0-ci-build/au_core_test_suite.rb | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb index 4512bde7..d78ce901 100644 --- a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb @@ -66,6 +66,7 @@ def self.metadata cli_context do txServer 'https://tx.dev.hl7.org.au/fhir' + disableDefaultResourceFetcher false end exclude_message do |message| diff --git a/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb index d9050741..a78d07e8 100644 --- a/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb @@ -48,7 +48,8 @@ class AUCoreTestSuite < Inferno::TestSuite %r{Sub-extension url 'revoke' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris}, /Observation\.effective\.ofType\(Period\): .*vs-1:/, # Invalid invariant in FHIR v4.0.1 /Observation\.effective\.ofType\(Period\): .*us-core-1:/, # Invalid invariant in AU Core v3.1.1 - /Provenance.agent\[\d*\]: Rule provenance-1/ # Invalid invariant in AU Core v5.0.1 + /Provenance.agent\[\d*\]: Rule provenance-1/, # Invalid invariant in AU Core v5.0.1 + /\A\S+: \S+: URL value '.*' does not resolve/ ].freeze VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze @@ -59,17 +60,22 @@ def self.metadata end end - validator do - url ENV.fetch('V040_PREVIEW_VALIDATOR_URL', 'http://validator-api:4567') + fhir_resource_validator do + igs 'hl7.fhir.au.core#0.4.0-preview' message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS + cli_context do + txServer 'https://tx.dev.hl7.org.au/fhir' + disableDefaultResourceFetcher false + end + exclude_message do |message| message_filters.any? { |filter| filter.match? message.message } end - # perform_additional_validation do |resource, profile_url| - # ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) - # end + perform_additional_validation do |resource, _profile_url| + ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance) + end end id :au_core_v040_preview diff --git a/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb index 5f024dd6..4d75a44d 100644 --- a/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb @@ -66,6 +66,7 @@ def self.metadata cli_context do txServer 'https://tx.dev.hl7.org.au/fhir' + disableDefaultResourceFetcher false end exclude_message do |message| From 8bb7c9561df7622fe4228517c7b9b75cf656511f Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 10:25:28 +0200 Subject: [PATCH 06/11] Use old service name Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .env.production | 2 +- compose.yaml | 2 +- config/nginx.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.production b/.env.production index 1e0f0c0e..a94dfead 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ REDIS_URL=redis://redis:6379/0 -FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 \ No newline at end of file +FHIR_RESOURCE_VALIDATOR_URL=http://validator-api:3500 \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index 05b0a440..6dd03641 100644 --- a/compose.yaml +++ b/compose.yaml @@ -33,7 +33,7 @@ services: POSTGRES_PASSWORD: password POSTGRES_DB: inferno POSTGRES_USER: postgres - hl7_validator_service: + validator-api: # image: infernocommunity/inferno-resource-validator:1.0.52 image: pavelrozhkov/wrapper:6.3.11 environment: diff --git a/config/nginx.conf b/config/nginx.conf index ba4514d2..381317df 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -111,7 +111,7 @@ http { proxy_cache off; proxy_read_timeout 600s; - proxy_pass http://hl7_validator_service:3500/; + proxy_pass http://validator-api:3500/; } } } From 7718958c089372f928e6ef6fc5760b2182a80db3 Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 10:41:00 +0200 Subject: [PATCH 07/11] Use .env variable for the tx server URL Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- compose.yaml | 1 + .../generated/v0.3.0-ballot/au_core_test_suite.rb | 2 +- .../generated/v0.4.0-preview/au_core_test_suite.rb | 2 +- .../generated/v0.5.0-ci-build/au_core_test_suite.rb | 2 +- lib/au_core_test_kit/generator/templates/suite.rb.erb | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compose.yaml b/compose.yaml index 6dd03641..fefecf2b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -17,6 +17,7 @@ services: POSTGRES_PASSWORD: password POSTGRES_DB: inferno POSTGRES_USER: postgres + TX_SERVER_URL: https://tx.dev.hl7.org.au/fhir inferno-worker: build: context: ./ diff --git a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb index d78ce901..cf0033e4 100644 --- a/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.3.0-ballot/au_core_test_suite.rb @@ -65,7 +65,7 @@ def self.metadata message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS cli_context do - txServer 'https://tx.dev.hl7.org.au/fhir' + txServer ENV.fetch('TX_SERVER_URL', 'https://tx.dev.hl7.org.au/fhir') disableDefaultResourceFetcher false end diff --git a/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb index a78d07e8..e9a19d54 100644 --- a/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.4.0-preview/au_core_test_suite.rb @@ -65,7 +65,7 @@ def self.metadata message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS cli_context do - txServer 'https://tx.dev.hl7.org.au/fhir' + txServer ENV.fetch('TX_SERVER_URL', 'https://tx.dev.hl7.org.au/fhir') disableDefaultResourceFetcher false end diff --git a/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb b/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb index 4d75a44d..e9e97d8e 100644 --- a/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb +++ b/lib/au_core_test_kit/generated/v0.5.0-ci-build/au_core_test_suite.rb @@ -65,7 +65,7 @@ def self.metadata message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS cli_context do - txServer 'https://tx.dev.hl7.org.au/fhir' + txServer ENV.fetch('TX_SERVER_URL', 'https://tx.dev.hl7.org.au/fhir') disableDefaultResourceFetcher false end diff --git a/lib/au_core_test_kit/generator/templates/suite.rb.erb b/lib/au_core_test_kit/generator/templates/suite.rb.erb index 33fe1e2e..318b6e82 100644 --- a/lib/au_core_test_kit/generator/templates/suite.rb.erb +++ b/lib/au_core_test_kit/generator/templates/suite.rb.erb @@ -43,7 +43,7 @@ module AUCoreTestKit message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS cli_context do - txServer 'https://tx.dev.hl7.org.au/fhir' + txServer ENV.fetch('TX_SERVER_URL', 'https://tx.dev.hl7.org.au/fhir') disableDefaultResourceFetcher false end From 5a8b8e118e30e1ec415b9d0166f01bdd7bfe529f Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 10:53:09 +0200 Subject: [PATCH 08/11] Move TX_SERVER_URL to inferno from validator-api Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .../manifests/inferno/inferno.deployment.yaml | 5 ++++- .../manifests/inferno/validator-api.deployment.yaml | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infra/modules/au_fhir_inferno/manifests/inferno/inferno.deployment.yaml b/infra/modules/au_fhir_inferno/manifests/inferno/inferno.deployment.yaml index aad5f5d1..755207f6 100644 --- a/infra/modules/au_fhir_inferno/manifests/inferno/inferno.deployment.yaml +++ b/infra/modules/au_fhir_inferno/manifests/inferno/inferno.deployment.yaml @@ -33,6 +33,9 @@ spec: imagePullPolicy: Always ports: - containerPort: 4567 + env: + - name: TX_SERVER_URL + value: ${terminology_server} envFrom: - secretRef: name: postgres-database @@ -40,4 +43,4 @@ spec: name: postgres - configMapRef: name: inferno - + diff --git a/infra/modules/au_fhir_inferno/manifests/inferno/validator-api.deployment.yaml b/infra/modules/au_fhir_inferno/manifests/inferno/validator-api.deployment.yaml index 6058a35a..c1a47c2f 100644 --- a/infra/modules/au_fhir_inferno/manifests/inferno/validator-api.deployment.yaml +++ b/infra/modules/au_fhir_inferno/manifests/inferno/validator-api.deployment.yaml @@ -31,9 +31,6 @@ spec: - name: validator-api image: infernocommunity/fhir-validator-service:latest imagePullPolicy: Always - env: - - name: TX_SERVER_URL - value: ${terminology_server} ports: - containerPort: 4567 volumeMounts: From c077a5faabcc3c08f66547c9d4d304a38c8732b9 Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 10:55:26 +0200 Subject: [PATCH 09/11] Remove old validator web Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- .../inferno/validator-web.deployment.yaml | 28 ------------------- .../inferno/validator-web.service.yaml | 13 --------- 2 files changed, 41 deletions(-) delete mode 100644 infra/modules/au_fhir_inferno/manifests/inferno/validator-web.deployment.yaml delete mode 100644 infra/modules/au_fhir_inferno/manifests/inferno/validator-web.service.yaml diff --git a/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.deployment.yaml b/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.deployment.yaml deleted file mode 100644 index 7a7679ea..00000000 --- a/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.deployment.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: validator-web - namespace: ${namespace} -spec: - replicas: 1 - selector: - matchLabels: - workload: validator-web - template: - metadata: - labels: - workload: validator-web - spec: - nodeSelector: - kubernetes.io/arch: amd64 - containers: - - name: validator-web - image: infernocommunity/fhir-validator-app:latest - imagePullPolicy: Always - env: - - name: EXTERNAL_VALIDATOR_URL - value: ${external_validator_url} - - name: VALIDATOR_BASE_PATH - value: ${validator_base_path} - ports: - - containerPort: 80 diff --git a/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.service.yaml b/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.service.yaml deleted file mode 100644 index d29c3652..00000000 --- a/infra/modules/au_fhir_inferno/manifests/inferno/validator-web.service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: validator-web - namespace: ${namespace} -spec: - type: NodePort - ports: - - port: 80 - protocol: TCP - targetPort: 80 - selector: - workload: validator-web From 904124e03a95cf4f8ed02d15f9c90e6936ff97a2 Mon Sep 17 00:00:00 2001 From: nvim Date: Fri, 21 Jun 2024 11:07:33 +0200 Subject: [PATCH 10/11] Add validator api link Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- docs/validator_instructions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/validator_instructions.md b/docs/validator_instructions.md index 17477cb8..03e3277b 100644 --- a/docs/validator_instructions.md +++ b/docs/validator_instructions.md @@ -1,5 +1,7 @@ # Step-by-Step Guide to Using the FHIR Resources Validator +The validator is available at this [link](https://inferno.hl7.org.au/hl7validatorapi/). + 1. Paste the complete target resource in **JSON** format into the text input field. ![Past the complete target resource](/docs/assets/1_validator_paste_resource.png "Past the complete target resource") 2. Click the **"Advanced"** button to open advanced options for the validator. From 9957b9041882b36ef92176292d4f1a2e5041dbe2 Mon Sep 17 00:00:00 2001 From: nvim Date: Sun, 23 Jun 2024 15:42:02 +0200 Subject: [PATCH 11/11] Remove commented lines Ref: https://github.com/hl7au/au-fhir-core-inferno/issues/110 --- compose.yaml | 2 ++ config/nginx.conf | 30 ------------------- .../reference_resolution_test.rb | 1 - 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/compose.yaml b/compose.yaml index fefecf2b..c2cc8260 100644 --- a/compose.yaml +++ b/compose.yaml @@ -49,6 +49,8 @@ services: volumes: - ./config/nginx.conf:/etc/nginx/nginx.conf depends_on: + validator-api: + condition: service_started inferno: condition: service_started redis: diff --git a/config/nginx.conf b/config/nginx.conf index 381317df..a5a6d79d 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -68,36 +68,6 @@ http { proxy_pass http://inferno:4567; } - # 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://validator-web; - # } - - # 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-api:4567/; - # } - location /hl7validatorapi/ { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; diff --git a/lib/au_core_test_kit/reference_resolution_test.rb b/lib/au_core_test_kit/reference_resolution_test.rb index 2621fe6c..b8cbe355 100644 --- a/lib/au_core_test_kit/reference_resolution_test.rb +++ b/lib/au_core_test_kit/reference_resolution_test.rb @@ -176,7 +176,6 @@ def resource_is_valid_with_target_profile?(resource, target_profile) target_profile_with_version = target_profile.include?('|') ? target_profile : "#{target_profile}|#{metadata.profile_version}" - # outcome = FHIR::OperationOutcome.new(JSON.parse(validator.validate(resource, target_profile_with_version))) validator_response = validator.validate(resource, target_profile_with_version) outcome = validator.operation_outcome_from_hl7_wrapped_response(validator_response)