diff --git a/.travis.yml b/.travis.yml index 89854dca..b513e837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,5 +22,5 @@ before_script: - bower install - npm install -g istanbul script: - - ./bin/rake test + - FHIR_LOG_LEVEL=fatal ./bin/rake test # lower log levels overwhelm travis - ./bin/teaspoon diff --git a/Gemfile b/Gemfile index d1c55b64..fa26ad04 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc # gem 'fhir_models', :git => 'https://github.com/fhir-crucible/fhir_models.git' # gem 'fhir_client', :git => 'https://github.com/fhir-crucible/fhir_client.git' -gem 'plan_executor', :git => 'https://github.com/fhir-crucible/plan_executor.git' +gem 'plan_executor', :git => 'https://github.com/fhir-crucible/plan_executor.git', :branch => 'r4' # gem 'plan_executor', :path => '../plan_executor' gem 'fhir_scorecard', :git => 'https://github.com/fhir-crucible/fhir_scorecard.git' #gem 'fhir_scorecard', :path => '../fhir_scorecard' diff --git a/Gemfile.lock b/Gemfile.lock index 5937928d..058986f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,8 @@ GIT GIT remote: https://github.com/fhir-crucible/plan_executor.git - revision: 4f1d2da69535d3a5978909d64dcd587f720b6156 + revision: 2bd7047e1f35bc701995d512e45f890b81edd5d7 + branch: r4 specs: plan_executor (1.8.0) bcp47 @@ -16,6 +17,7 @@ GIT fhir_client fhir_dstu2_models fhir_models + fhir_stu3_models jsonpath nokogiri (>= 1.8.2) nokogiri-diff @@ -47,41 +49,41 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) + actionmailer (4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.10) - actionview (= 4.2.10) - activesupport (= 4.2.10) + actionpack (4.2.11.1) + actionview (= 4.2.11.1) + activesupport (= 4.2.11.1) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.10) - activesupport (= 4.2.10) + actionview (4.2.11.1) + activesupport (= 4.2.11.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_model_serializers (0.10.7) + active_model_serializers (0.10.9) actionpack (>= 4.1, < 6) activemodel (>= 4.1, < 6) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (4.2.10) - activesupport (= 4.2.10) + activejob (4.2.11.1) + activesupport (= 4.2.11.1) globalid (>= 0.3.0) - activemodel (4.2.10) - activesupport (= 4.2.10) + activemodel (4.2.11.1) + activesupport (= 4.2.11.1) builder (~> 3.1) - activerecord (4.2.10) - activemodel (= 4.2.10) - activesupport (= 4.2.10) + activerecord (4.2.11.1) + activemodel (= 4.2.11.1) + activesupport (= 4.2.11.1) arel (~> 6.0) - activesupport (4.2.10) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -92,16 +94,16 @@ GEM area (0.10.0) fastercsv (~> 1.5) arel (6.0.4) - autoprefixer-rails (9.1.3) + autoprefixer-rails (9.5.1) execjs bcp47 (0.3.3) i18n bson (3.2.7) builder (3.2.3) - byebug (10.0.2) + byebug (11.0.1) case_transform (0.2) activesupport - chunky_png (1.3.10) + chunky_png (1.3.11) coderay (1.1.2) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -115,13 +117,13 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.4) - daemons (1.2.6) + daemons (1.3.1) date_time_precision (0.8.1) delayed_job (4.1.5) activesupport (>= 3.0, < 5.3) - delayed_job_mongoid (2.3.0) + delayed_job_mongoid (2.3.1) delayed_job (>= 3.0, < 5) - mongoid (>= 3.0, < 7) + mongoid (>= 3.0, < 8) mongoid-compatibility (>= 0.4.0) distribution (0.7.3) docile (1.3.1) @@ -134,37 +136,43 @@ GEM erubis (2.7.0) eventmachine (1.2.7) execjs (2.7.0) - faker (1.9.1) + faker (1.9.3) i18n (>= 0.7) faraday (0.15.4) multipart-post (>= 1.2, < 3) fastercsv (1.5.5) - ffi (1.9.25) - fhir_client (3.1.2) + ffi (1.10.0) + fhir_client (4.0.0) activesupport (>= 3) addressable (>= 2.3) - fhir_dstu2_models (>= 1.0.4) - fhir_models (>= 3.0.3) + fhir_dstu2_models (>= 1.0.9) + fhir_models (>= 4.0.0) + fhir_stu3_models (>= 3.0.0) nokogiri (>= 1.8.2) oauth2 (~> 1.1) rack (>= 1.5) rest-client (~> 2.0) tilt (>= 1.1) - fhir_dstu2_models (1.0.8) + fhir_dstu2_models (1.0.9) bcp47 (>= 0.3) date_time_precision (>= 0.8) - mime-types (>= 1.16, < 3) + mime-types (>= 3.0) + nokogiri (>= 1.8.5) + fhir_models (4.0.0) + bcp47 (>= 0.3) + date_time_precision (>= 0.8) + mime-types (>= 3.0) nokogiri (>= 1.8.2) - fhir_models (3.0.3) + fhir_stu3_models (3.0.0) bcp47 (>= 0.3) date_time_precision (>= 0.8) - mime-types (>= 1.16, < 3) + mime-types (>= 3.0) nokogiri (>= 1.8.2) formatador (0.2.5) georuby (2.5.2) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) - guard (2.14.2) + guard (2.15.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -184,43 +192,45 @@ GEM multi_json sprockets (>= 2.0.3) tilt - hashdiff (0.3.7) - highline (2.0.0) + hashdiff (0.3.9) + highline (2.0.2) hike (1.2.3) http-cookie (1.0.3) domain_name (~> 0.5) http_parser.rb (0.6.0) i18n (0.9.5) concurrent-ruby (~> 1.0) - jbuilder (2.7.0) + jbuilder (2.8.0) activesupport (>= 4.2.0) multi_json (>= 1.2) json (1.8.6) jsonapi-renderer (0.2.0) - jsonpath (1.0.1) + jsonpath (1.0.4) multi_json to_regexp (~> 0.2.1) - jwt (2.1.0) + jwt (2.2.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.2.2) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.0.13) - magic_lamp (1.8.1) + magic_lamp (1.9.0) method_source rails (>= 4.0.0) rake - mail (2.7.0) + mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.9.0) - mime-types (2.99.3) + method_source (0.9.2) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2019.0331) mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) - minitest-reporters (1.3.3) + minitest-reporters (1.3.6) ansi builder minitest (>= 5.0) @@ -246,13 +256,13 @@ GEM optionable (~> 0.2.0) multi_json (1.13.1) multi_xml (0.6.0) - multipart-post (2.0.0) + multipart-post (2.1.1) nenv (0.3.0) net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (5.0.2) + net-ssh (5.2.0) netrc (0.11.0) - nokogiri (1.10.2) + nokogiri (1.10.3) mini_portile2 (~> 2.4.0) nokogiri-diff (0.2.0) nokogiri (~> 1.5) @@ -271,26 +281,26 @@ GEM optionable (0.2.0) origin (2.3.1) pickup (0.0.11) - pry (0.11.3) + pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) - pry-byebug (3.6.0) - byebug (~> 10.0) + pry-byebug (3.7.0) + byebug (~> 11.0) pry (~> 0.10) - public_suffix (3.0.3) + public_suffix (3.1.0) rack (1.6.11) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.10) - actionmailer (= 4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) - activemodel (= 4.2.10) - activerecord (= 4.2.10) - activesupport (= 4.2.10) + rails (4.2.11.1) + actionmailer (= 4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + activemodel (= 4.2.11.1) + activerecord (= 4.2.11.1) + activesupport (= 4.2.11.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.10) + railties (= 4.2.11.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -300,28 +310,28 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (4.2.10) - actionpack (= 4.2.10) - activesupport (= 4.2.10) + railties (4.2.11.1) + actionpack (= 4.2.11.1) + activesupport (= 4.2.11.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.1) + rake (12.3.2) rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) + rb-inotify (0.10.0) + ffi (~> 1.0) rdoc (4.3.0) recursive-open-struct (1.1.0) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) rest-client (2.0.2) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - ruby-graphviz (1.2.3) + ruby-graphviz (1.2.4) ruby-progressbar (1.10.0) ruby_dep (1.5.0) - safe_yaml (1.0.4) + safe_yaml (1.0.5) sass (3.2.19) sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) @@ -351,7 +361,7 @@ GEM railties (>= 3.2.5, < 6) teaspoon-jasmine (2.3.4) teaspoon (>= 1.0.0) - thor (0.20.0) + thor (0.20.3) thread_safe (0.3.6) tilt (1.4.1) time_difference (0.5.0) @@ -359,12 +369,12 @@ GEM to_regexp (0.2.1) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.18) + uglifier (4.1.20) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.5) - webmock (3.4.2) + unf_ext (0.0.7.6) + webmock (3.5.1) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff @@ -412,4 +422,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.16.2 + 1.17.3 diff --git a/README.md b/README.md index f196c59e..3bbc049d 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ If no refresh token is available, or the refresh attempt fails, the lock icon wi # License -Copyright 2015-2018 The MITRE Corporation +Copyright 2015-2019 The MITRE Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/app/assets/javascripts/views/component/conformance.coffee b/app/assets/javascripts/views/component/conformance.coffee index dc8bbafe..6676ff7e 100644 --- a/app/assets/javascripts/views/component/conformance.coffee +++ b/app/assets/javascripts/views/component/conformance.coffee @@ -26,7 +26,7 @@ class Crucible.Conformance @removeConformanceSpinner() @mismatch_alert_element.hide() @server_fhir_version.html("#{data.fhir_sequence} (#{data.fhir_version})") - if data.fhir_sequence != 'DSTU2' && data.fhir_sequence != 'STU3' + if data.fhir_sequence != 'DSTU2' && data.fhir_sequence != 'STU3' && data.fhir_sequence != 'R4' @mismatch_alert_element.html(@version_mismatch_template(data)) @mismatch_alert_element.show() @element.trigger('conformanceInitialized') if data.conformance.updated diff --git a/app/assets/javascripts/views/component/server-filter.coffee b/app/assets/javascripts/views/component/server-filter.coffee index d54d59b4..653c8078 100644 --- a/app/assets/javascripts/views/component/server-filter.coffee +++ b/app/assets/javascripts/views/component/server-filter.coffee @@ -17,6 +17,13 @@ class Crucible.ServerFilter @registerHandlers() registerHandlers: => + @element.find('#filters_r4').on('click', () => + @element.find('#filters_r4').parent().find('button').removeClass('active') + @element.find('#filters_r4').addClass('active') + @setVersion('R4') + @containerElement.trigger('filterchange') + false + ) @element.find('#filters_stu3').on('click', () => @element.find('#filters_stu3').parent().find('button').removeClass('active') @element.find('#filters_stu3').addClass('active') diff --git a/app/assets/javascripts/views/templates/servers/partials/fhir_version_notification.hbs b/app/assets/javascripts/views/templates/servers/partials/fhir_version_notification.hbs index cc16c6e7..7b4dc533 100644 --- a/app/assets/javascripts/views/templates/servers/partials/fhir_version_notification.hbs +++ b/app/assets/javascripts/views/templates/servers/partials/fhir_version_notification.hbs @@ -1,3 +1,3 @@ -This version of Crucible tests FHIR DSTU2 and STU3. This server does not currently +This version of Crucible tests FHIR DSTU2, STU3 and R4. This server does not currently appear to support these versions as it is reporting version "{{fhir_version}}" in its capability statement. If this is not correct, please update the capability statement for this server and click Refresh in the Capability Statement tab below. diff --git a/app/controllers/servers_controller.rb b/app/controllers/servers_controller.rb index 7f2f298f..35b87676 100644 --- a/app/controllers/servers_controller.rb +++ b/app/controllers/servers_controller.rb @@ -97,7 +97,7 @@ def conformance def summary server = Server.where(_id: params[:server_id]).only(:fhir_sequence, :summary).first - fhir_sequence = server.fhir_sequence || 'STU3' + fhir_sequence = server.fhir_sequence || 'R4' summary = server.summary render json: {summary: summary, fhir_sequence: fhir_sequence} end @@ -134,8 +134,8 @@ def supported_tests server.collect_supported_tests rescue logger.error "error collecting supported tests" - server_version = (server.fhir_sequence || 'STU3').downcase.to_sym - @suites.select!{|s| s.supported_versions.include? server_version} + server_version = (server.fhir_sequence || 'R4').downcase.to_sym + @suites.select!{|s|s.supported_versions.include? server_version} if server.supported_suites @suites.each do |suite| diff --git a/app/controllers/smarts_controller.rb b/app/controllers/smarts_controller.rb index 94969c21..167d19cd 100644 --- a/app/controllers/smarts_controller.rb +++ b/app/controllers/smarts_controller.rb @@ -103,6 +103,32 @@ def show '8478-0' => 'Mean blood pressure' } elsif client.detect_version == :stu3 + version = client.detect_version + klass_header = "FHIR::STU3::" + conformance_klass = FHIR::CapabilityStatement + supporting_resources = [ + FHIR::AllergyIntolerance, FHIR::CarePlan, FHIR::CareTeam, FHIR::Condition, FHIR::Device, + FHIR::DiagnosticReport, FHIR::Goal, FHIR::Immunization, FHIR::MedicationRequest, + FHIR::MedicationStatement, FHIR::Observation, FHIR::Procedure, FHIR::RelatedPerson, FHIR::Specimen + ] + # Vital Signs includes these codes as defined in http://hl7.org/fhir/STU3/observation-vitalsigns.html + vital_signs = { + '85353-1' => 'Vital signs, weight, height, head circumference, oxygen saturation and BMI panel', + '9279-1' => 'Respiratory Rate', + '8867-4' => 'Heart rate', + '59408-5' => 'Oxygen saturation in Arterial blood by Pulse oximetry', + '8310-5' => 'Body temperature', + '8302-2' => 'Body height', + '8306-3' => 'Body height --lying', + '8287-5' => 'Head Occipital-frontal circumference by Tape measure', + '29463-7' => 'Body weight', + '39156-5' => 'Body mass index (BMI) [Ratio]', + '85354-9' => 'Blood pressure systolic and diastolic', + '8480-6' => 'Systolic blood pressure', + '8462-4' => 'Diastolic blood pressure' + } + elsif client.detect_version == :R4 + ## TODO version = client.detect_version klass_header = "FHIR::" conformance_klass = FHIR::CapabilityStatement @@ -128,7 +154,7 @@ def show '8462-4' => 'Diastolic blood pressure' } else - raise "Invalid FHIR client. Expected STU3 or DSTU2 version." + raise "Invalid FHIR client. Expected STU3, DSTU2 or R4 version." end # Parse accessible resources from scopes diff --git a/app/controllers/synthea_controller.rb b/app/controllers/synthea_controller.rb index 0b823437..ea62265c 100644 --- a/app/controllers/synthea_controller.rb +++ b/app/controllers/synthea_controller.rb @@ -24,8 +24,10 @@ def load_data client.default_format = FHIR::Formats::ResourceFormat::RESOURCE_JSON if format_type.upcase=='JSON' if fhir_version == 'dstu2' client.use_dstu2 - else - # assume stu3 by default + else + # Assume stu3 by default + # We do not support R4 in the Ruby version of Synthea + fhir_version = 'stu3' client.use_stu3 end diff --git a/app/models/server.rb b/app/models/server.rb index 96fc1952..dc9121cc 100644 --- a/app/models/server.rb +++ b/app/models/server.rb @@ -116,7 +116,7 @@ def get_oauth2_client def get_compliance() #todo: investigate moving this elsewhere. - compliance = Crucible::FHIRStructure.get((self.fhir_sequence || 'STU3').downcase.to_sym) + compliance = Crucible::FHIRStructure.get((self.fhir_sequence || 'R4').downcase.to_sym) node_map = {} build_compliance_node_map(compliance, node_map) @@ -201,7 +201,7 @@ def collect_supported_tests self.supported_tests = [] self.supported_suites = [] value = JSON.parse(self.conformance) - server_version = (self.fhir_sequence || 'STU3').downcase.to_sym + server_version = (self.fhir_sequence || 'R4').downcase.to_sym operations = [] resource_operations = [] @@ -288,38 +288,54 @@ def extract_version_from_conformance if value self.fhir_version = value['fhirVersion'] begin + + # 4.0.0 FHIR Release #4: First Normative Content (Permanent Home) + # 2018-11-09 3.5a.0 Special R4 Ballot #3 : Normative Packages for Terminology / Conformance + Observation + # 2018-08-21 3.5.0 R4 Ballot #2 : Mixed Normative/Trial use (Second Normative ballot + Baltimore Connectathon) + # 2018-04-02 3.3.0 R4 Ballot #1 : Mixed Normative/Trial use (First Normative ballot) + # 2018-04-02 3.2.0 + + # 3.0.1 + # FHIR Release 3 (STU) with 1 technical errata (Permanent Home) + + # Technical Errata Archive (zip): v3.0.0 + + # 2016-12-06 1.8.0 FHIR STU3 Candidate + Connectathon 14 (San Antonio) + # 2016-08-11 1.6.0 FHIR STU3 Ballot + Connectathon 13 (Baltimore) + # 2016-03-30 1.4.0 CQF on FHIR Ballot + Connectathon 12 (Montreal) + # 2015-12-11 1.2.0 Draft for comment + # 2015-12-03 1.1.0 + version_abbreviated = self.fhir_version version_abbreviated = self.fhir_version.split('-').first if self.fhir_version and self.fhir_version.include? '-' version = version_abbreviated.split('.').map(&:to_i) - if (version[0] >= 1 && version[1] >= 1) || version[0] == 3 - self.fhir_sequence = 'STU3' - elsif ['1.0.2', '1.0.1', '1.0.0', '0.5.0', '0.4.0', '0.40'].include? version_abbreviated + + if ['1.0.2', '1.0.1', '1.0.0', '0.5.0', '0.4.0', '0.40'].include? version_abbreviated self.fhir_sequence = 'DSTU2' - # currently not supporting DSTU1 - # elsif ['0.0.82', '0.11', '0.06', '0.05'].include? version_abbreviated - # self.fhir_sequence = 'DSTU1' - else # Set to most recent sequence and version if not STU3 or DSTU2 + elsif ['3.0.0', '3.0.1', '1.8.0', '1.6.0', '1.4.0', '1.2.0', '1.1.0'].include? version_abbreviated self.fhir_sequence = 'STU3' - self.fhir_version = '3.0.1' + else # Set to most recent sequence and version if not STU3 or DSTU2 + self.fhir_sequence = 'R4' + self.fhir_version = '4.0.0' end rescue # Set to most recent sequence and version if unexpected input - self.fhir_sequence = 'STU3' - self.fhir_version = '3.0.1' + self.fhir_sequence = 'R4' + self.fhir_version = '4.0.0' end else # Set to most recent sequence and version if no conformance value - self.fhir_sequence = 'STU3' - self.fhir_version = '3.0.1' + self.fhir_sequence = 'R4' + self.fhir_version = '4.0.0' end else # Set to most recent sequence and version if no conformance - self.fhir_sequence = 'STU3' - self.fhir_version = '3.0.1' + self.fhir_sequence = 'R4' + self.fhir_version = '4.0.0' end self.save end def generate_history summaries = Summary.where({server_id: self.id}) - summary_tree = Crucible::FHIRStructure.get((self.fhir_sequence || 'STU3').downcase.to_sym) + summary_tree = Crucible::FHIRStructure.get((self.fhir_sequence || 'R4').downcase.to_sym) zeroize_summary(summary_tree) diff --git a/app/models/summary.rb b/app/models/summary.rb index 303401b4..cfd3f01f 100644 --- a/app/models/summary.rb +++ b/app/models/summary.rb @@ -4,7 +4,7 @@ class Summary field :server_id, type: BSON::ObjectId field :compliance field :generated_at, type: Time - field :fhir_version, type: String, default: 'stu3' + field :fhir_version, type: String, default: 'r4' index(server_id: 1) end diff --git a/app/models/test.rb b/app/models/test.rb index 6624bf59..5324f3d7 100644 --- a/app/models/test.rb +++ b/app/models/test.rb @@ -16,7 +16,7 @@ class Test field :tags, type: Array field :details, type: Hash field :category, type: Hash - field :supported_versions, type: Array, default: [] # stu3, dstu2, etc + field :supported_versions, type: Array, default: [] # r4, stu3, dstu2, etc def serializable_hash(options = nil) hash = super(options) diff --git a/app/models/test_run.rb b/app/models/test_run.rb index ae85b96b..aeb8f9ec 100644 --- a/app/models/test_run.rb +++ b/app/models/test_run.rb @@ -16,7 +16,7 @@ class TestRun field :nightly, type: Boolean, default: false has_and_belongs_to_many :tests, inverse_of: nil has_many :test_results, autosave: true - field :fhir_version, type: String, default: 'stu3' + field :fhir_version, type: String, default: 'r4' def add_tests(tests) self.tests.push(*tests) @@ -40,8 +40,10 @@ def execute() if self.fhir_version.downcase == 'dstu2' client1.use_dstu2 - else + elsif self.fhir_version.downcase == 'stu3' client1.use_stu3 + else + client1.use_r4 end client1.default_format = self.server.default_format if self.server.default_format @@ -107,7 +109,13 @@ def execute() if t.resource_class? resource = t.resource_class.constantize - resource = "FHIR::DSTU2::#{t.resource_class.demodulize}".constantize if self.fhir_version.downcase == 'dstu2' + + if self.fhir_version.downcase == 'dstu2' + resource = "FHIR::DSTU2::#{t.resource_class.demodulize}".constantize + elsif self.fhir_version.downcase == 'stu3' + resource = "FHIR::STU3::#{t.resource_class.demodulize}".constantize + end + val = test.execute(resource).values.first else val = test.execute().values.first diff --git a/app/views/components/_server_summary_carousel.html.erb b/app/views/components/_server_summary_carousel.html.erb index 1796004f..d42e1f40 100644 --- a/app/views/components/_server_summary_carousel.html.erb +++ b/app/views/components/_server_summary_carousel.html.erb @@ -19,6 +19,7 @@