ips_test_kit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ module IPS
2
+ class Patient < Inferno::TestGroup
3
+ title 'Patient (IPS) Tests'
4
+ description 'Verify support for the server capabilities required by the Patient (IPS) profile.'
5
+ id :ips_patient
6
+
7
+ test do
8
+ title 'Server returns correct Patient resource from the Patient read interaction'
9
+ description %(
10
+ This test will verify that Patient resources can be read from the server.
11
+ )
12
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips'
13
+
14
+ input :patient_id
15
+ makes_request :patient
16
+
17
+ run do
18
+ fhir_read(:patient, patient_id, name: :patient)
19
+
20
+ assert_response_status(200)
21
+ assert_resource_type(:patient)
22
+ assert resource.id == patient_id,
23
+ "Requested resource with id #{patient_id}, received resource with id #{resource.id}"
24
+ end
25
+ end
26
+
27
+ test do
28
+ title 'Server returns Patient resource that matches the Patient (IPS) profile'
29
+ description %(
30
+ This test will validate that the Patient resource returned from the server matches the Patient (IPS) profile.
31
+ )
32
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips'
33
+ uses_request :patient
34
+
35
+ run do
36
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Patient-uv-ips')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ module IPS
2
+ class Practitioner < Inferno::TestGroup
3
+ title 'Practitioner (IPS) Tests'
4
+ description 'Verify support for the server capabilities required by the Practitioner (IPS) profile.'
5
+ id :ips_practitioner
6
+
7
+ test do
8
+ title 'Server returns correct Practitioner resource from the Practitioner read interaction'
9
+ description %(
10
+ This test will verify that Practitioner resources can be read from the server.
11
+ )
12
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips'
13
+
14
+ input :practitioner_id
15
+ makes_request :practitioner
16
+
17
+ run do
18
+ fhir_read(:practitioner, practitioner_id, name: :practitioner)
19
+
20
+ assert_response_status(200)
21
+ assert_resource_type(:practitioner)
22
+ assert resource.id == practitioner_id,
23
+ "Requested resource with id #{practitioner_id}, received resource with id #{resource.id}"
24
+ end
25
+ end
26
+
27
+ test do
28
+ title 'Server returns Practitioner resource that matches the Practitioner (IPS) profile'
29
+ description %(
30
+ This test will validate that the Practitioner resource returned from the server matches the Practitioner (IPS) profile.
31
+ )
32
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips'
33
+ uses_request :practitioner
34
+
35
+ run do
36
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Practitioner-uv-ips')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ module IPS
2
+ class PractitionerRole < Inferno::TestGroup
3
+ title 'PractitionerRole (IPS) Tests'
4
+ description 'Verify support for the server capabilities required by the PractitionerRole (IPS) profile.'
5
+ id :ips_practitioner_role
6
+
7
+ test do
8
+ title 'Server returns correct PractitionerRole resource from the PractitionerRole read interaction'
9
+ description %(
10
+ This test will verify that PractitionerRole resources can be read from the server.
11
+ )
12
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips'
13
+
14
+ input :practitioner_role_id
15
+ makes_request :practitioner_role
16
+
17
+ run do
18
+ fhir_read(:practitioner_role, practitioner_role_id, name: :practitioner_role)
19
+
20
+ assert_response_status(200)
21
+ assert_resource_type(:practitioner_role)
22
+ assert resource.id == practitioner_role_id,
23
+ "Requested resource with id #{practitioner_role_id}, received resource with id #{resource.id}"
24
+ end
25
+ end
26
+
27
+ test do
28
+ title 'Server returns PractitionerRole resource that matches the PractitionerRole (IPS) profile'
29
+ description %(
30
+ This test will validate that the PractitionerRole resource returned from the server matches the PractitionerRole (IPS) profile.
31
+ )
32
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips'
33
+ uses_request :practitioner_role
34
+
35
+ run do
36
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/PractitionerRole-uv-ips')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ module IPS
2
+ class Procedure < Inferno::TestGroup
3
+ title 'Procedure (IPS) Tests'
4
+ description 'Verify support for the server capabilities required by the Procedure (IPS) profile.'
5
+ id :ips_procedure
6
+
7
+ test do
8
+ title 'Server returns correct Procedure resource from the Procedure read interaction'
9
+ description %(
10
+ This test will verify that Procedure resources can be read from the server.
11
+ )
12
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips'
13
+
14
+ input :procedure_id
15
+ makes_request :procedure
16
+
17
+ run do
18
+ fhir_read(:procedure, procedure_id, name: :procedure)
19
+
20
+ assert_response_status(200)
21
+ assert_resource_type(:procedure)
22
+ assert resource.id == procedure_id,
23
+ "Requested resource with id #{procedure_id}, received resource with id #{resource.id}"
24
+ end
25
+ end
26
+
27
+ test do
28
+ title 'Server returns Procedure resource that matches the Procedure (IPS) profile'
29
+ description %(
30
+ This test will validate that the Procedure resource returned from the server matches the Procedure (IPS) profile.
31
+ )
32
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips'
33
+ uses_request :procedure
34
+
35
+ run do
36
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Procedure-uv-ips')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ module IPS
2
+ class Specimen < Inferno::TestGroup
3
+ title 'Specimen (IPS) Tests'
4
+ description 'Verify support for the server capabilities required by the Specimen (IPS) profile.'
5
+ id :ips_specimen
6
+
7
+ test do
8
+ title 'Server returns correct Specimen resource from the Specimen read interaction'
9
+ description %(
10
+ This test will verify that Specimen resources can be read from the server.
11
+ )
12
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips'
13
+
14
+ input :specimen_id
15
+ makes_request :specimen
16
+
17
+ run do
18
+ fhir_read(:specimen, specimen_id, name: :specimen)
19
+
20
+ assert_response_status(200)
21
+ assert_resource_type(:specimen)
22
+ assert resource.id == specimen_id,
23
+ "Requested resource with id #{specimen_id}, received resource with id #{resource.id}"
24
+ end
25
+ end
26
+
27
+ test do
28
+ title 'Server returns Specimen resource that matches the Specimen (IPS) profile'
29
+ description %(
30
+ This test will validate that the Specimen resource returned from the server matches the Specimen (IPS) profile.
31
+ )
32
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips'
33
+ uses_request :specimen
34
+
35
+ run do
36
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Specimen-uv-ips')
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,141 @@
1
+ module IPS
2
+ class SummaryOperation < Inferno::TestGroup
3
+ title 'Summary Operation (IPS) Tests'
4
+ description 'Verify support for the $summary operation required by the Specimen (IPS) profile.'
5
+ id :ips_summary_operation
6
+
7
+ test do
8
+ title 'IPS Server declares support for $summary operation in CapabilityStatement'
9
+ description %(
10
+ The IPS Server SHALL declare support for Patient/[id]/$summary operation in its server CapabilityStatement
11
+ )
12
+ # link 'http://build.fhir.org/ig/HL7/fhir-ips/index.html'
13
+
14
+ run do
15
+ fhir_get_capability_statement
16
+ assert_response_status(200)
17
+
18
+ operations = resource.rest&.flat_map do |rest|
19
+ rest.resource
20
+ &.select { |r| r.type == 'Composition' && r.respond_to?(:operation) }
21
+ &.flat_map(&:operation)
22
+ end&.compact
23
+
24
+ operation_defined = operations.any? do |operation|
25
+ operation.definition == 'http://hl7.org/fhir/OperationDefinition/Patient-summary' ||
26
+ ['summary', 'patient-summary'].include?(operation.name.downcase)
27
+ end
28
+
29
+ assert operation_defined, 'Server CapabilityStatement did not declare support for $summary operation in Composition resource.'
30
+ end
31
+ end
32
+
33
+ test do
34
+ title 'IPS Server returns Bundle resource for Patient/id/$summary operation'
35
+ description %(
36
+ IPS Server return valid IPS Bundle resource as successful result of $summary operation
37
+
38
+ POST [base]/Patient/id/$summary
39
+ )
40
+ # link 'http://build.fhir.org/ig/HL7/fhir-ips/index.html'
41
+ input :patient_id
42
+ makes_request :summary_operation
43
+
44
+ run do
45
+ fhir_operation("Patient/#{patient_id}/$summary", name: :summary_operation)
46
+ assert_response_status(200)
47
+ assert_resource_type(:bundle)
48
+ assert_valid_resource(profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips')
49
+ end
50
+ end
51
+
52
+ test do
53
+ title 'IPS Server returns Bundle resource containing valid IPS Composition entry'
54
+ description %(
55
+ IPS Server return valid IPS Composition resource in the Bundle as first entry
56
+ )
57
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Composition-uv-ips.html'
58
+ uses_request :summary_operation
59
+
60
+ run do
61
+ skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation'
62
+
63
+ assert resource.entry.length.positive?, 'Bundle has no entries'
64
+
65
+ entry = resource.entry.first
66
+
67
+ assert entry.resource.is_a?(FHIR::Composition), 'The first entry in the Bundle is not a Composition'
68
+ assert_valid_resource(resource: entry, profile_url: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips')
69
+ end
70
+ end
71
+
72
+ test do
73
+ title 'IPS Server returns Bundle resource containing valid IPS MedicationStatement entry'
74
+ description %(
75
+ IPS Server return valid IPS MedicationStatement resource in the Bundle as first entry
76
+ )
77
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-MedicationStatement-uv-ips.html'
78
+ uses_request :summary_operation
79
+
80
+ run do
81
+ skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation'
82
+
83
+ resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::MedicationStatement) }
84
+
85
+ assert resources_present, 'Bundle does not contain any MedicationStatement resources'
86
+
87
+ assert_valid_bundle_entries(
88
+ resource_types: {
89
+ medication_statement: 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips'
90
+ }
91
+ )
92
+ end
93
+ end
94
+
95
+ test do
96
+ title 'IPS Server returns Bundle resource containing valid IPS AllergyIntolerance entry'
97
+ description %(
98
+ IPS Server return valid IPS AllergyIntolerance resource in the Bundle as first entry
99
+ )
100
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-AllergyIntolerance-uv-ips.html'
101
+ uses_request :summary_operation
102
+
103
+ run do
104
+ skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation'
105
+
106
+ resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::AllergyIntolerance) }
107
+
108
+ assert resources_present, 'Bundle does not contain any AllergyIntolerance resources'
109
+
110
+ assert_valid_bundle_entries(
111
+ resource_types: {
112
+ allergy_intolerance: 'http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips'
113
+ }
114
+ )
115
+ end
116
+ end
117
+
118
+ test do
119
+ title 'IPS Server returns Bundle resource containing valid IPS Condition entry'
120
+ description %(
121
+ IPS Server return valid IPS Condition resource in the Bundle as first entry
122
+ )
123
+ # link 'http://hl7.org/fhir/uv/ips/StructureDefinition-Condition-uv-ips.html'
124
+ uses_request :summary_operation
125
+
126
+ run do
127
+ skip_if !resource.is_a?(FHIR::Bundle), 'No Bundle returned from document operation'
128
+
129
+ resources_present = resource.entry.any? { |r| r.resource.is_a?(FHIR::Condition) }
130
+
131
+ assert resources_present, 'Bundle does not contain any Condition resources'
132
+
133
+ assert_valid_bundle_entries(
134
+ resource_types: {
135
+ condition: 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips'
136
+ }
137
+ )
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,3 @@
1
+ module IPS
2
+ VERSION = '0.0.1'.freeze
3
+ end
@@ -0,0 +1,56 @@
1
+ Dir.glob(File.join(__dir__, 'ips', '*.rb')).each { |path| require_relative path.delete_prefix("#{__dir__}/") }
2
+
3
+ module IPS
4
+ class Suite < Inferno::TestSuite
5
+ title 'International Patient Summary (IPS)'
6
+ description 'International Patient Summary (IPS)'
7
+
8
+ id 'ips'
9
+
10
+ input :url
11
+
12
+ fhir_client do
13
+ url :url
14
+ end
15
+
16
+ group do
17
+ title 'IPS Operations'
18
+
19
+ group from: :ips_document_operation
20
+ group from: :ips_summary_operation
21
+ end
22
+
23
+ group do
24
+ title 'IPS Profiles'
25
+
26
+ group from: :ips_observation_alcohol_use
27
+ group from: :ips_practitioner
28
+ group from: :ips_observation_results_radiology
29
+ group from: :ips_device
30
+ group from: :ips_observation_results_laboratory
31
+ group from: :ips_bundle
32
+ group from: :ips_observation_results
33
+ group from: :ips_allergy_intolerance
34
+ group from: :ips_practitioner_role
35
+ group from: :ips_observation_pregnancy_status
36
+ group from: :ips_medication_statement
37
+ group from: :ips_patient
38
+ group from: :ips_observation_pregnancy_edd
39
+ group from: :ips_specimen
40
+ group from: :ips_immunization
41
+ group from: :ips_device_observer
42
+ group from: :ips_composition
43
+ group from: :ips_organization
44
+ group from: :ips_imaging_study
45
+ group from: :ips_media_observation
46
+ group from: :ips_device_use_statement
47
+ group from: :ips_condition
48
+ group from: :ips_observation_tobacco_use
49
+ group from: :ips_observation_results_pathology
50
+ group from: :ips_diagnostic_report
51
+ group from: :ips_medication
52
+ group from: :ips_procedure
53
+ group from: :ips_observation_pregnancy_outcome
54
+ end
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ips_test_kit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stephen MacVicar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: inferno_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: database_cleaner-sequel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: factory_bot
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '6.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '6.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.11'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.11'
83
+ description: A collection of tests for the International Patient Summary FHIR Implementation
84
+ Guide
85
+ email:
86
+ - inferno@groups.mitre.org
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - LICENSE
92
+ - lib/ips/allergy_intolerance.rb
93
+ - lib/ips/bundle.rb
94
+ - lib/ips/composition.rb
95
+ - lib/ips/condition.rb
96
+ - lib/ips/device.rb
97
+ - lib/ips/device_observer.rb
98
+ - lib/ips/device_use_statement.rb
99
+ - lib/ips/diagnostic_report.rb
100
+ - lib/ips/document_operation.rb
101
+ - lib/ips/imaging_study.rb
102
+ - lib/ips/immunization.rb
103
+ - lib/ips/media_observation.rb
104
+ - lib/ips/medication.rb
105
+ - lib/ips/medication_statement.rb
106
+ - lib/ips/observation_alcohol_use.rb
107
+ - lib/ips/observation_pregnancy_edd.rb
108
+ - lib/ips/observation_pregnancy_outcome.rb
109
+ - lib/ips/observation_pregnancy_status.rb
110
+ - lib/ips/observation_results.rb
111
+ - lib/ips/observation_results_laboratory.rb
112
+ - lib/ips/observation_results_pathology.rb
113
+ - lib/ips/observation_results_radiology.rb
114
+ - lib/ips/observation_tobacco_use.rb
115
+ - lib/ips/organization.rb
116
+ - lib/ips/patient.rb
117
+ - lib/ips/practitioner.rb
118
+ - lib/ips/practitioner_role.rb
119
+ - lib/ips/procedure.rb
120
+ - lib/ips/specimen.rb
121
+ - lib/ips/summary_operation.rb
122
+ - lib/ips/version.rb
123
+ - lib/ips_test_kit.rb
124
+ homepage: https://github.com/inferno_community/ips-test-kit
125
+ licenses:
126
+ - Apache-2.0
127
+ metadata:
128
+ homepage_uri: https://github.com/inferno_community/ips-test-kit
129
+ source_code_uri: https://github.com/inferno_community/ips-test-kit
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.7.0
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ requirements: []
145
+ rubygems_version: 3.1.4
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: A collection of tests for the International Patient Summary FHIR Implementation
149
+ Guide
150
+ test_files: []