us_core_test_kit 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/allergy_intolerance_validation_test.rb +1 -0
  3. data/lib/us_core_test_kit/generated/v3.1.1/allergy_intolerance/metadata.yml +1 -0
  4. data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/bodyheight_validation_test.rb +1 -0
  5. data/lib/us_core_test_kit/generated/v3.1.1/bodyheight/metadata.yml +1 -0
  6. data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/bodytemp_validation_test.rb +1 -0
  7. data/lib/us_core_test_kit/generated/v3.1.1/bodytemp/metadata.yml +1 -0
  8. data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/bodyweight_validation_test.rb +1 -0
  9. data/lib/us_core_test_kit/generated/v3.1.1/bodyweight/metadata.yml +1 -0
  10. data/lib/us_core_test_kit/generated/v3.1.1/bp/bp_validation_test.rb +1 -0
  11. data/lib/us_core_test_kit/generated/v3.1.1/bp/metadata.yml +1 -0
  12. data/lib/us_core_test_kit/generated/v3.1.1/care_plan/care_plan_validation_test.rb +1 -0
  13. data/lib/us_core_test_kit/generated/v3.1.1/care_plan/metadata.yml +1 -0
  14. data/lib/us_core_test_kit/generated/v3.1.1/care_team/care_team_validation_test.rb +1 -0
  15. data/lib/us_core_test_kit/generated/v3.1.1/care_team/metadata.yml +1 -0
  16. data/lib/us_core_test_kit/generated/v3.1.1/condition/condition_validation_test.rb +1 -0
  17. data/lib/us_core_test_kit/generated/v3.1.1/condition/metadata.yml +1 -0
  18. data/lib/us_core_test_kit/generated/v3.1.1/device/device_validation_test.rb +1 -0
  19. data/lib/us_core_test_kit/generated/v3.1.1/device/metadata.yml +1 -0
  20. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +1 -0
  21. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_lab/metadata.yml +1 -0
  22. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/diagnostic_report_note_validation_test.rb +1 -0
  23. data/lib/us_core_test_kit/generated/v3.1.1/diagnostic_report_note/metadata.yml +1 -0
  24. data/lib/us_core_test_kit/generated/v3.1.1/document_reference/document_reference_validation_test.rb +1 -0
  25. data/lib/us_core_test_kit/generated/v3.1.1/document_reference/metadata.yml +1 -0
  26. data/lib/us_core_test_kit/generated/v3.1.1/encounter/encounter_validation_test.rb +1 -0
  27. data/lib/us_core_test_kit/generated/v3.1.1/encounter/metadata.yml +1 -0
  28. data/lib/us_core_test_kit/generated/v3.1.1/goal/goal_validation_test.rb +1 -0
  29. data/lib/us_core_test_kit/generated/v3.1.1/goal/metadata.yml +2 -1
  30. data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/head_circumference_validation_test.rb +1 -0
  31. data/lib/us_core_test_kit/generated/v3.1.1/head_circumference/metadata.yml +1 -0
  32. data/lib/us_core_test_kit/generated/v3.1.1/heartrate/heartrate_validation_test.rb +1 -0
  33. data/lib/us_core_test_kit/generated/v3.1.1/heartrate/metadata.yml +1 -0
  34. data/lib/us_core_test_kit/generated/v3.1.1/immunization/immunization_validation_test.rb +1 -0
  35. data/lib/us_core_test_kit/generated/v3.1.1/immunization/metadata.yml +1 -0
  36. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_request_validation_test.rb +1 -0
  37. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/medication_validation_test.rb +1 -0
  38. data/lib/us_core_test_kit/generated/v3.1.1/medication_request/metadata.yml +1 -0
  39. data/lib/us_core_test_kit/generated/v3.1.1/metadata.yml +33 -1
  40. data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/metadata.yml +1 -0
  41. data/lib/us_core_test_kit/generated/v3.1.1/observation_lab/observation_lab_validation_test.rb +1 -0
  42. data/lib/us_core_test_kit/generated/v3.1.1/organization/metadata.yml +1 -0
  43. data/lib/us_core_test_kit/generated/v3.1.1/organization/organization_validation_test.rb +1 -0
  44. data/lib/us_core_test_kit/generated/v3.1.1/patient/metadata.yml +1 -0
  45. data/lib/us_core_test_kit/generated/v3.1.1/patient/patient_validation_test.rb +1 -0
  46. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/metadata.yml +1 -0
  47. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +1 -0
  48. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/metadata.yml +1 -0
  49. data/lib/us_core_test_kit/generated/v3.1.1/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +1 -0
  50. data/lib/us_core_test_kit/generated/v3.1.1/practitioner/metadata.yml +1 -0
  51. data/lib/us_core_test_kit/generated/v3.1.1/practitioner/practitioner_validation_test.rb +1 -0
  52. data/lib/us_core_test_kit/generated/v3.1.1/procedure/metadata.yml +1 -0
  53. data/lib/us_core_test_kit/generated/v3.1.1/procedure/procedure_validation_test.rb +1 -0
  54. data/lib/us_core_test_kit/generated/v3.1.1/provenance/metadata.yml +1 -0
  55. data/lib/us_core_test_kit/generated/v3.1.1/provenance/provenance_validation_test.rb +1 -0
  56. data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/metadata.yml +1 -0
  57. data/lib/us_core_test_kit/generated/v3.1.1/pulse_oximetry/pulse_oximetry_validation_test.rb +1 -0
  58. data/lib/us_core_test_kit/generated/v3.1.1/resprate/metadata.yml +1 -0
  59. data/lib/us_core_test_kit/generated/v3.1.1/resprate/resprate_validation_test.rb +1 -0
  60. data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/metadata.yml +1 -0
  61. data/lib/us_core_test_kit/generated/v3.1.1/smokingstatus/smokingstatus_validation_test.rb +1 -0
  62. data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/allergy_intolerance_validation_test.rb +1 -0
  63. data/lib/us_core_test_kit/generated/v4.0.0/allergy_intolerance/metadata.yml +1 -0
  64. data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/blood_pressure_validation_test.rb +1 -0
  65. data/lib/us_core_test_kit/generated/v4.0.0/blood_pressure/metadata.yml +1 -0
  66. data/lib/us_core_test_kit/generated/v4.0.0/bmi/bmi_validation_test.rb +1 -0
  67. data/lib/us_core_test_kit/generated/v4.0.0/bmi/metadata.yml +1 -0
  68. data/lib/us_core_test_kit/generated/v4.0.0/body_height/body_height_validation_test.rb +1 -0
  69. data/lib/us_core_test_kit/generated/v4.0.0/body_height/metadata.yml +1 -0
  70. data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/body_temperature_validation_test.rb +1 -0
  71. data/lib/us_core_test_kit/generated/v4.0.0/body_temperature/metadata.yml +1 -0
  72. data/lib/us_core_test_kit/generated/v4.0.0/body_weight/body_weight_validation_test.rb +1 -0
  73. data/lib/us_core_test_kit/generated/v4.0.0/body_weight/metadata.yml +1 -0
  74. data/lib/us_core_test_kit/generated/v4.0.0/care_plan/care_plan_validation_test.rb +1 -0
  75. data/lib/us_core_test_kit/generated/v4.0.0/care_plan/metadata.yml +1 -0
  76. data/lib/us_core_test_kit/generated/v4.0.0/care_team/care_team_validation_test.rb +1 -0
  77. data/lib/us_core_test_kit/generated/v4.0.0/care_team/metadata.yml +1 -0
  78. data/lib/us_core_test_kit/generated/v4.0.0/condition/condition_validation_test.rb +1 -0
  79. data/lib/us_core_test_kit/generated/v4.0.0/condition/metadata.yml +1 -0
  80. data/lib/us_core_test_kit/generated/v4.0.0/device/device_validation_test.rb +1 -0
  81. data/lib/us_core_test_kit/generated/v4.0.0/device/metadata.yml +1 -0
  82. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/diagnostic_report_lab_validation_test.rb +1 -0
  83. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_lab/metadata.yml +1 -0
  84. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/diagnostic_report_note_validation_test.rb +1 -0
  85. data/lib/us_core_test_kit/generated/v4.0.0/diagnostic_report_note/metadata.yml +1 -0
  86. data/lib/us_core_test_kit/generated/v4.0.0/document_reference/document_reference_validation_test.rb +1 -0
  87. data/lib/us_core_test_kit/generated/v4.0.0/document_reference/metadata.yml +1 -0
  88. data/lib/us_core_test_kit/generated/v4.0.0/encounter/encounter_validation_test.rb +1 -0
  89. data/lib/us_core_test_kit/generated/v4.0.0/encounter/metadata.yml +1 -0
  90. data/lib/us_core_test_kit/generated/v4.0.0/goal/goal_validation_test.rb +1 -0
  91. data/lib/us_core_test_kit/generated/v4.0.0/goal/metadata.yml +2 -1
  92. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/head_circumference_validation_test.rb +1 -0
  93. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference/metadata.yml +1 -0
  94. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/head_circumference_percentile_validation_test.rb +1 -0
  95. data/lib/us_core_test_kit/generated/v4.0.0/head_circumference_percentile/metadata.yml +1 -0
  96. data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/heart_rate_validation_test.rb +1 -0
  97. data/lib/us_core_test_kit/generated/v4.0.0/heart_rate/metadata.yml +1 -0
  98. data/lib/us_core_test_kit/generated/v4.0.0/immunization/immunization_validation_test.rb +1 -0
  99. data/lib/us_core_test_kit/generated/v4.0.0/immunization/metadata.yml +1 -0
  100. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_request_validation_test.rb +1 -0
  101. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/medication_validation_test.rb +1 -0
  102. data/lib/us_core_test_kit/generated/v4.0.0/medication_request/metadata.yml +1 -0
  103. data/lib/us_core_test_kit/generated/v4.0.0/metadata.yml +36 -9
  104. data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/metadata.yml +1 -0
  105. data/lib/us_core_test_kit/generated/v4.0.0/observation_lab/observation_lab_validation_test.rb +1 -0
  106. data/lib/us_core_test_kit/generated/v4.0.0/organization/metadata.yml +1 -0
  107. data/lib/us_core_test_kit/generated/v4.0.0/organization/organization_validation_test.rb +1 -0
  108. data/lib/us_core_test_kit/generated/v4.0.0/patient/metadata.yml +1 -8
  109. data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_must_support_test.rb +4 -6
  110. data/lib/us_core_test_kit/generated/v4.0.0/patient/patient_validation_test.rb +1 -0
  111. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/metadata.yml +1 -0
  112. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_bmi_for_age/pediatric_bmi_for_age_validation_test.rb +1 -0
  113. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/metadata.yml +1 -0
  114. data/lib/us_core_test_kit/generated/v4.0.0/pediatric_weight_for_height/pediatric_weight_for_height_validation_test.rb +1 -0
  115. data/lib/us_core_test_kit/generated/v4.0.0/practitioner/metadata.yml +1 -0
  116. data/lib/us_core_test_kit/generated/v4.0.0/practitioner/practitioner_validation_test.rb +1 -0
  117. data/lib/us_core_test_kit/generated/v4.0.0/procedure/metadata.yml +1 -0
  118. data/lib/us_core_test_kit/generated/v4.0.0/procedure/procedure_validation_test.rb +1 -0
  119. data/lib/us_core_test_kit/generated/v4.0.0/provenance/metadata.yml +1 -0
  120. data/lib/us_core_test_kit/generated/v4.0.0/provenance/provenance_validation_test.rb +1 -0
  121. data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/metadata.yml +1 -0
  122. data/lib/us_core_test_kit/generated/v4.0.0/pulse_oximetry/pulse_oximetry_validation_test.rb +1 -0
  123. data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/metadata.yml +1 -0
  124. data/lib/us_core_test_kit/generated/v4.0.0/respiratory_rate/respiratory_rate_validation_test.rb +1 -0
  125. data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/metadata.yml +1 -0
  126. data/lib/us_core_test_kit/generated/v4.0.0/smokingstatus/smokingstatus_validation_test.rb +1 -0
  127. data/lib/us_core_test_kit/generator/group_metadata.rb +1 -0
  128. data/lib/us_core_test_kit/generator/group_metadata_extractor.rb +5 -0
  129. data/lib/us_core_test_kit/generator/ig_loader.rb +12 -5
  130. data/lib/us_core_test_kit/generator/must_support_metadata_extractor.rb +0 -12
  131. data/lib/us_core_test_kit/generator/validation_test_generator.rb +4 -0
  132. data/lib/us_core_test_kit/generator.rb +9 -14
  133. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodyheight.json +0 -0
  134. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodytemp.json +0 -0
  135. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bodyweight.json +0 -0
  136. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-bp.json +0 -0
  137. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-heartrate.json +0 -0
  138. data/lib/us_core_test_kit/igs/{v311 → us_core_311}/StructureDefinition-resprate.json +0 -0
  139. data/lib/us_core_test_kit/igs/{v311/package.tgz → us_core_311.tgz} +0 -0
  140. data/lib/us_core_test_kit/igs/{v400/package.tgz → us_core_400.tgz} +0 -0
  141. data/lib/us_core_test_kit/must_support_test.rb +6 -0
  142. data/lib/us_core_test_kit/search_test.rb +3 -2
  143. data/lib/us_core_test_kit/validation_test.rb +4 -2
  144. data/lib/us_core_test_kit/version.rb +1 -1
  145. metadata +13 -13
@@ -64,6 +64,10 @@ module USCoreTestKit
64
64
  group_metadata.profile_name
65
65
  end
66
66
 
67
+ def profile_version
68
+ group_metadata.profile_version
69
+ end
70
+
67
71
  def test_id
68
72
  "us_core_#{group_metadata.reformatted_version}_#{profile_identifier}_validation_test"
69
73
  end
@@ -16,26 +16,21 @@ require_relative 'generator/validation_test_generator'
16
16
  module USCoreTestKit
17
17
  class Generator
18
18
  def self.generate
19
- base_ig_directory = File.join(Dir.pwd, 'lib', 'us_core_test_kit', 'igs')
20
- ig_directories =
21
- Dir.entries(base_ig_directory)
22
- .reject { |path| path.start_with? '.' }
23
- .map { |path| File.join(base_ig_directory, path) }
24
- .select { |path| File.directory? path }
25
-
26
- ig_directories.each do |ig_directory|
27
- new(ig_directory).generate
19
+ ig_packages = Dir.glob(File.join(Dir.pwd, 'lib', 'us_core_test_kit', 'igs', '*.tgz'))
20
+
21
+ ig_packages.each do |ig_package|
22
+ new(ig_package).generate
28
23
  end
29
24
  end
30
25
 
31
- attr_accessor :ig_resources, :ig_metadata, :ig_directory
26
+ attr_accessor :ig_resources, :ig_metadata, :ig_file_name
32
27
 
33
- def initialize(ig_directory)
34
- self.ig_directory = ig_directory
28
+ def initialize(ig_file_name)
29
+ self.ig_file_name = ig_file_name
35
30
  end
36
31
 
37
32
  def generate
38
- puts "Generating tests for IG in #{ig_directory}"
33
+ puts "Generating tests for IG #{File.basename(ig_file_name)}"
39
34
  load_ig_package
40
35
  extract_metadata
41
36
  generate_resource_list
@@ -68,7 +63,7 @@ module USCoreTestKit
68
63
 
69
64
  def load_ig_package
70
65
  FHIR.logger = Logger.new('/dev/null')
71
- self.ig_resources = IGLoader.new(ig_directory).load
66
+ self.ig_resources = IGLoader.new(ig_file_name).load
72
67
  end
73
68
 
74
69
  def generate_resource_list
@@ -140,6 +140,12 @@ module USCoreTestKit
140
140
  rescue ArgumentError
141
141
  false
142
142
  end
143
+ when 'DateTime'
144
+ begin
145
+ DateTime.parse(element)
146
+ rescue ArgumentError
147
+ false
148
+ end
143
149
  when 'String'
144
150
  element.is_a? String
145
151
  else
@@ -228,8 +228,9 @@ module USCoreTestKit
228
228
 
229
229
  search_and_check_response(params_with_comparator)
230
230
 
231
- fetch_all_bundled_resources
232
- .each { |resource| check_resource_against_params(resource, params_with_comparator) }
231
+ fetch_all_bundled_resources.each do |resource|
232
+ check_resource_against_params(resource, params_with_comparator) if resource.resourceType == resource_type
233
+ end
233
234
  end
234
235
 
235
236
  search_variant_test_records[:comparator_searches] << name
@@ -5,6 +5,7 @@ module USCoreTestKit
5
5
 
6
6
  def perform_validation_test(resources,
7
7
  profile_url,
8
+ profile_version,
8
9
  skip_if_empty: true)
9
10
 
10
11
  skip_if skip_if_empty && resources.blank?,
@@ -13,14 +14,15 @@ module USCoreTestKit
13
14
  omit_if resources.blank?,
14
15
  "No #{resource_type} resources provided so the #{profile_url} profile does not apply"
15
16
 
17
+ profile_with_version = "#{profile_url}|#{profile_version}"
16
18
  resources.each do |resource|
17
- resource_is_valid?(resource: resource, profile_url: profile_url)
19
+ resource_is_valid?(resource: resource, profile_url: profile_with_version)
18
20
  check_for_dar(resource)
19
21
  end
20
22
 
21
23
  errors_found = messages.any? { |message| message[:type] == 'error' }
22
24
 
23
- assert !errors_found, "Resource does not conform to the profile #{profile_url}"
25
+ assert !errors_found, "Resource does not conform to the profile #{profile_with_version}"
24
26
  end
25
27
 
26
28
  def check_for_dar(resource)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module USCoreTestKit
4
- VERSION = '0.2.4'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_core_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -818,14 +818,14 @@ files:
818
818
  - lib/us_core_test_kit/generator/suite_generator.rb
819
819
  - lib/us_core_test_kit/generator/terminology_binding_metadata_extractor.rb
820
820
  - lib/us_core_test_kit/generator/validation_test_generator.rb
821
- - lib/us_core_test_kit/igs/v311/StructureDefinition-bodyheight.json
822
- - lib/us_core_test_kit/igs/v311/StructureDefinition-bodytemp.json
823
- - lib/us_core_test_kit/igs/v311/StructureDefinition-bodyweight.json
824
- - lib/us_core_test_kit/igs/v311/StructureDefinition-bp.json
825
- - lib/us_core_test_kit/igs/v311/StructureDefinition-heartrate.json
826
- - lib/us_core_test_kit/igs/v311/StructureDefinition-resprate.json
827
- - lib/us_core_test_kit/igs/v311/package.tgz
828
- - lib/us_core_test_kit/igs/v400/package.tgz
821
+ - lib/us_core_test_kit/igs/us_core_311.tgz
822
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bodyheight.json
823
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bodytemp.json
824
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bodyweight.json
825
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-bp.json
826
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-heartrate.json
827
+ - lib/us_core_test_kit/igs/us_core_311/StructureDefinition-resprate.json
828
+ - lib/us_core_test_kit/igs/us_core_400.tgz
829
829
  - lib/us_core_test_kit/must_support_test.rb
830
830
  - lib/us_core_test_kit/read_test.rb
831
831
  - lib/us_core_test_kit/reference_resolution_test.rb
@@ -840,7 +840,7 @@ licenses:
840
840
  metadata:
841
841
  homepage_uri: https://github.com/inferno_framework/us-core-test-kit
842
842
  source_code_uri: https://github.com/inferno_framework/us-core-test-kit
843
- post_install_message:
843
+ post_install_message:
844
844
  rdoc_options: []
845
845
  require_paths:
846
846
  - lib
@@ -856,7 +856,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
856
856
  version: '0'
857
857
  requirements: []
858
858
  rubygems_version: 3.1.6
859
- signing_key:
859
+ signing_key:
860
860
  specification_version: 4
861
861
  summary: US Core Inferno tests
862
862
  test_files: []