Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

v1.0.3 #100

Merged
merged 33 commits into from Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
329ecdb
Added UI elements to warn users before test runs if their conformance…
schreiaj Oct 17, 2018
3af174d
change css and wording in warning state
schreiaj Oct 18, 2018
c3770f9
Moved warning to be a little more subtle
schreiaj Oct 25, 2018
b35c283
Add check to not display warning if not supported after run
schreiaj Oct 30, 2018
a36b686
Fix tooltip not showing up on conformance warning.
arscan Nov 2, 2018
1e9b01f
Merge pull request #84 from siteadmin/conformance_supports
arscan Nov 2, 2018
327cccc
medication order tests
radamson Nov 4, 2018
37d5b91
fix duplicate resource_references
radamson Nov 4, 2018
e88136e
add some documentation and some formatting
radamson Nov 4, 2018
bc82a5b
Merge branch 'development' into medication
radamson Nov 5, 2018
f9e47f2
update medication_order sequence and test
radamson Nov 6, 2018
3ebd0fc
Merge pull request #93 from siteadmin/medication
arscan Nov 8, 2018
53a6046
Update version to 1.0.3
arscan Nov 8, 2018
9714325
Merge pull request #96 from siteadmin/update-version
arscan Nov 8, 2018
6045094
TLS should not be disabled by default.
arscan Nov 8, 2018
63e6c6c
break out documentreference and provenance sequences
radamson Nov 8, 2018
51d89ab
Set TLS tests to required.
arscan Nov 8, 2018
d003063
pulled over by rubocop
radamson Nov 9, 2018
4274b42
test all medication statements
radamson Nov 9, 2018
da6a9a7
follow medication reference
radamson Nov 9, 2018
89fd19c
validate medication references against argonaut profiles
radamson Nov 9, 2018
48835f8
Merge pull request #98 from siteadmin/tls_not_optional
radamson Nov 9, 2018
00b13e4
tests and updates for medication statement
radamson Nov 9, 2018
c4cf6ef
Added resources to state popup; Trimmed down docref test
arscan Nov 9, 2018
4aaa15e
Merge pull request #97 from siteadmin/add_tests
arscan Nov 9, 2018
e00f45a
remove some unecessary stuff from tests
radamson Nov 9, 2018
4d1e4fa
remove validate_reference_read_reply
radamson Nov 9, 2018
de4c0a7
Add explicit pass option that allows test writer to return message.
arscan Nov 13, 2018
ecc0a30
Merge pull request #99 from siteadmin/med_state
arscan Nov 14, 2018
00440aa
Simplify the provenance tests for now.
arscan Nov 14, 2018
f2b6556
Merge pull request #102 from siteadmin/provenance-simplification
arscan Nov 14, 2018
d29c06e
Update tests so that disabled tls tests just pass.
arscan Nov 14, 2018
1805e64
Merge pull request #103 from siteadmin/fix-tls-disable-pass
arscan Nov 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -40,7 +40,7 @@ And run the following commands from the terminal:
git clone https://github.com/siteadmin/inferno
cd inferno
bundle install
rackup
bundle exec rackup
```

Inferno can then be accessed at http://localhost:4567 in a web browser.
Expand Down
3 changes: 3 additions & 0 deletions config.yml
Expand Up @@ -34,3 +34,6 @@ logging_enabled: true

# Automatically Run Conformance Sequence on new server create
autorun_conformance: false

# Include extra tests: true or false
include_extras: true
1 change: 1 addition & 0 deletions lib/app/endpoint.rb
Expand Up @@ -14,6 +14,7 @@ class Endpoint < Sinatra::Base
Inferno::DEFAULT_SCOPES = settings.default_scopes
Inferno::ENVIRONMENT = settings.environment
Inferno::PURGE_ON_RELOAD = settings.purge_database_on_reload
Inferno::EXTRAS = settings.include_extras

if settings.logging_enabled
Inferno.logger = if settings.log_to_file
Expand Down
5 changes: 3 additions & 2 deletions lib/app/models/resource_reference.rb
@@ -1,13 +1,14 @@
# frozen_string_literal: true

module Inferno
module Models
class ResourceReference
include DataMapper::Resource
property :id, String, key: true, default: proc { SecureRandom.uuid}
property :id, String, key: true, default: proc { SecureRandom.uuid }
property :resource_type, String
property :resource_id, String

belongs_to :testing_instance
end
end
end

21 changes: 19 additions & 2 deletions lib/app/models/testing_instance.rb
Expand Up @@ -86,9 +86,11 @@ def patient_id
end

def patient_id= patient_id
return if patient_id.to_s == self.patient_id.to_s

existing_patients = self.resource_references.select{|ref| ref.resource_type == 'Patient'}
self.resource_references.each(&:destroy)
# Use destroy directly (instead of on each, so we don't have to reload)
self.resource_references.destroy
self.save!

self.resource_references << ResourceReference.new({
Expand All @@ -113,7 +115,9 @@ def save_supported_resources(conformance)
'MedicationStatement',
'MedicationOrder',
'Observation',
'Procedure']
'Procedure',
'DocumentReference',
'Provenance']

supported_resources = conformance.rest.first.resource.select{ |r| resources.include? r.type}.reduce({}){|a,k| a[k.type] = k; a}

Expand Down Expand Up @@ -162,6 +166,19 @@ def conformance_supported?(resource, methods = [])
end
end
end

def post_resource_references(resource_type: nil, resource_id: nil)
self.resource_references.each do |ref|
if (ref.resource_type == resource_type) && (ref.resource_id == resource_id)
ref.destroy
end
end
self.resource_references << ResourceReference.new({resource_type: resource_type,
resource_id: resource_id})
self.save!
# Ensure the instance resource references are accurate
self.reload
end
end
end
end
135 changes: 71 additions & 64 deletions lib/app/sequence_base.rb
Expand Up @@ -15,12 +15,12 @@ class SequenceBase
include Inferno::WebDriver

STATUS = {
pass: 'pass',
fail: 'fail',
error: 'error',
todo: 'todo',
wait: 'wait',
skip: 'skip'
pass: 'pass',
fail: 'fail',
error: 'error',
todo: 'todo',
wait: 'wait',
skip: 'skip'
}

@@test_index = 0
Expand All @@ -31,6 +31,7 @@ class SequenceBase
@@descriptions = {}
@@details = {}
@@requires = {}
@@conformance_supports = {}
@@defines = {}
@@test_metadata = {}

Expand Down Expand Up @@ -226,6 +227,11 @@ def self.requires(*requires)
@@requires[self.sequence_name] || []
end

def self.conformance_supports(*supports)
@@conformance_supports[self.sequence_name] = supports unless supports.empty?
@@conformance_supports[self.sequence_name] || []
end

def self.missing_requirements(instance, recurse = false)

return [] unless @@requires.key?(self.sequence_name)
Expand Down Expand Up @@ -306,7 +312,7 @@ def self.optional?

def self.preconditions(description, &block)
@@preconditions[self.sequence_name] = {
block: block,
block: block,
description: description
}
end
Expand Down Expand Up @@ -460,11 +466,11 @@ def warning
def get_resource_by_params(klass, params = {})
assert !params.empty?, "No params for search"
options = {
:search => {
:flag => false,
:compartment => nil,
:parameters => params
}
:search => {
:flag => false,
:compartment => nil,
:parameters => params
}
}
@client.search(klass, options)
end
Expand Down Expand Up @@ -510,16 +516,14 @@ def validate_search_reply(klass, reply)
end

def save_resource_ids_in_bundle(klass, reply)

return if reply.try(:resource).try(:entry).nil?

entries = reply.resource.entry.select{ |entry| entry.resource.class == klass }

entries.each do |entry|
@instance.resource_references << Models::ResourceReference.new({resource_type: klass.name.split(':').last, resource_id: entry.resource.id})
@instance.post_resource_references(resource_type: klass.name.split(':').last,
resource_id: entry.resource.id)
end

@instance.save!
end

def validate_read_reply(resource, klass)
Expand Down Expand Up @@ -617,61 +621,64 @@ def self.sequences_overview
end

def self.sequences_groups
[{
groups = [{
name: 'Discovery',
overview: %(
This is a description of the discovery group
Sequences related to discovering servers and learning about their capabilities.
),
sequences: [ConformanceSequence],
run_all: false
},
{
name: 'Authentication and Authorization',
overview: %(



),
sequences: [
DynamicRegistrationSequence,
ManualRegistrationSequence,
StandaloneLaunchSequence,
EHRLaunchSequence,
OpenIDConnectSequence,
TokenRefreshSequence
],
run_all: false
},
{
name: 'Argonaut Profile Conformance',
overview: %(



),
sequences: [
ArgonautPatientSequence,
ArgonautAllergyIntoleranceSequence,
ArgonautCarePlanSequence,
ArgonautCareTeamSequence,
ArgonautConditionSequence,
ArgonautDeviceSequence,
ArgonautDiagnosticReportSequence,
ArgonautObservationSequence,
ArgonautGoalSequence,
ArgonautImmunizationSequence,
ArgonautMedicationStatementSequence,
ArgonautMedicationOrderSequence,
ArgonautProcedureSequence,
ArgonautSmokingStatusSequence,
ArgonautVitalSignsSequence
],
run_all: true
}]


{
name: 'Authentication and Authorization',
overview: %(Tests for Authentication and Authorization. Primarily in regards to SMART-on-FHIR),
sequences: [
DynamicRegistrationSequence,
ManualRegistrationSequence,
StandaloneLaunchSequence,
EHRLaunchSequence,
OpenIDConnectSequence,
TokenRefreshSequence
],
run_all: false
},
{
name: 'Argonaut Profile Conformance',
overview: %(Tests related the the Arognauts Data Query Implementation Guide),
sequences: [
ArgonautPatientSequence,
ArgonautAllergyIntoleranceSequence,
ArgonautCarePlanSequence,
ArgonautCareTeamSequence,
ArgonautConditionSequence,
ArgonautDeviceSequence,
ArgonautDiagnosticReportSequence,
ArgonautObservationSequence,
ArgonautGoalSequence,
ArgonautImmunizationSequence,
ArgonautMedicationStatementSequence,
ArgonautMedicationOrderSequence,
ArgonautProcedureSequence,
ArgonautSmokingStatusSequence,
ArgonautVitalSignsSequence
],
run_all: true
}]

if Inferno::EXTRAS
groups << {
name: 'Additional Resources',
overview: %(
Tests for resources corresponding to [Draft USCDI v1](https://www.healthit.gov/sites/default/files/draft-uscdi.pdf) that are not represeted in the Argonaut Data Query Implementation Guide.
),
sequences: [
DocumentReferenceSequence,
ProvenanceSequence
]
}
end
groups
end

end

Dir[File.join(__dir__, 'sequences', '*_sequence.rb')].each { |file| require file }
Expand Down
1 change: 0 additions & 1 deletion lib/app/sequences/01_conformance_sequence.rb
Expand Up @@ -57,7 +57,6 @@ class ConformanceSequence < SequenceBase
metadata {
id '01'
link 'https://www.hl7.org/fhir/security.html'
optional
desc %(
All exchange of production data should be secured with TLS/SSL v1.2.
)
Expand Down
1 change: 0 additions & 1 deletion lib/app/sequences/02_dynamic_registration_sequence.rb
Expand Up @@ -31,7 +31,6 @@ class DynamicRegistrationSequence < SequenceBase
metadata {
id '01'
link 'https://www.hl7.org/fhir/security.html'
optional
desc %(
The client registration endpoint MUST be protected by a transport layer security.
)
Expand Down
2 changes: 0 additions & 2 deletions lib/app/sequences/03_patient_standalone_launch_sequence.rb
Expand Up @@ -18,7 +18,6 @@ class StandaloneLaunchSequence < SequenceBase
metadata {
id '01'
link 'http://www.hl7.org/fhir/smart-app-launch/'
optional
desc %(
The client registration endpoint MUST be protected by a transport layer security.
)
Expand Down Expand Up @@ -88,7 +87,6 @@ class StandaloneLaunchSequence < SequenceBase
metadata {
id '04'
link 'http://www.hl7.org/fhir/smart-app-launch/'
optional
desc %(
Apps must assure that sensitive information (authentication secrets, authorization codes, tokens) is transmitted ONLY to authenticated servers, over TLS-secured channels.
)
Expand Down
2 changes: 0 additions & 2 deletions lib/app/sequences/04_provider_ehr_launch_sequence.rb
Expand Up @@ -50,7 +50,6 @@ class EHRLaunchSequence < SequenceBase
metadata {
id '03'
link 'http://www.hl7.org/fhir/smart-app-launch/'
optional
desc %(
Apps MUST assure that sensitive information (authentication secrets, authorization codes, tokens) is transmitted ONLY to authenticated servers, over TLS-secured channels.
opaque identifier for the launch in the launch querystring parameter.
Expand Down Expand Up @@ -116,7 +115,6 @@ class EHRLaunchSequence < SequenceBase
metadata {
id '06'
link 'http://www.hl7.org/fhir/smart-app-launch/'
optional
desc %(
Apps MUST assure that sensitive information (authentication secrets, authorization codes, tokens) is transmitted ONLY to authenticated servers, over TLS-secured channels.
)
Expand Down
1 change: 0 additions & 1 deletion lib/app/sequences/06_token_introspection_sequence.rb
Expand Up @@ -17,7 +17,6 @@ class TokenIntrospectionSequence < SequenceBase
metadata {
id '01'
link 'https://tools.ietf.org/html/rfc7662'
optional
desc %(
The server MUST support Transport Layer Security (TLS) 1.2.
)
Expand Down
5 changes: 3 additions & 2 deletions lib/app/sequences/08a_argonaut_patient_sequence.rb
Expand Up @@ -9,6 +9,7 @@ class ArgonautPatientSequence < SequenceBase
test_id_prefix 'ARPA'

requires :token, :patient_id
conformance_supports :Patient

test 'Server rejects patient read without proper authorization' do

Expand Down Expand Up @@ -225,7 +226,7 @@ class ArgonautPatientSequence < SequenceBase
All servers SHOULD make available the vread and history-instance interactions for the Argonaut Profiles the server chooses to support. )
}

skip_if_not_supported(:Patient, [:history])

validate_history_reply(@patient, FHIR::DSTU2::Patient)

Expand All @@ -242,7 +243,7 @@ class ArgonautPatientSequence < SequenceBase
)
}

skip_if_not_supported(:Patient, [:vread])

validate_vread_reply(@patient, FHIR::DSTU2::Patient)

Expand Down