davinci_us_drug_formulary_test_kit 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/capability_statement/conformance_support_test.rb +41 -0
  4. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/capability_statement/fhir_version_test.rb +15 -0
  5. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/capability_statement/instantiate_test.rb +19 -0
  6. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/capability_statement/json_support_test.rb +40 -0
  7. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/capability_statement/profile_support_test.rb +39 -0
  8. data/lib/davinci_us_drug_formulary_test_kit/custom_groups/v2.0.1/capability_statement_group.rb +78 -0
  9. data/lib/davinci_us_drug_formulary_test_kit/date_search_validation.rb +121 -0
  10. data/lib/davinci_us_drug_formulary_test_kit/fhir_resource_navigation.rb +155 -0
  11. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_code_search_test.rb +54 -0
  12. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_drug_tier_search_test.rb +43 -0
  13. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_formulary_include_search_test.rb +40 -0
  14. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_formulary_search_test.rb +43 -0
  15. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_id_search_test.rb +42 -0
  16. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_lastupdated_search_test.rb +42 -0
  17. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_must_support_test.rb +46 -0
  18. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_period_search_test.rb +42 -0
  19. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_pharmacy_benefit_type_search_test.rb +43 -0
  20. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_read_test.rb +26 -0
  21. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_reference_resolution_test.rb +40 -0
  22. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_status_search_test.rb +42 -0
  23. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_subject_include_search_test.rb +40 -0
  24. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_subject_search_test.rb +43 -0
  25. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/basic_validation_test.rb +39 -0
  26. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic/metadata.yml +292 -0
  27. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/basic_group.rb +107 -0
  28. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_coverage_area_search_test.rb +45 -0
  29. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_coverage_type_search_test.rb +45 -0
  30. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_formulary_coverage_search_test.rb +45 -0
  31. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_id_search_test.rb +42 -0
  32. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_identifier_search_test.rb +43 -0
  33. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_lastupdated_search_test.rb +42 -0
  34. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_must_support_test.rb +42 -0
  35. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_name_search_test.rb +42 -0
  36. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_period_search_test.rb +42 -0
  37. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_read_test.rb +26 -0
  38. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_status_search_test.rb +53 -0
  39. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_type_search_test.rb +43 -0
  40. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/formulary_validation_test.rb +39 -0
  41. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary/metadata.yml +278 -0
  42. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/formulary_group.rb +104 -0
  43. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_address_city_search_test.rb +44 -0
  44. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_address_postalcode_search_test.rb +44 -0
  45. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_address_search_test.rb +42 -0
  46. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_address_state_search_test.rb +44 -0
  47. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_id_search_test.rb +56 -0
  48. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_lastupdated_search_test.rb +44 -0
  49. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_must_support_test.rb +37 -0
  50. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_read_test.rb +26 -0
  51. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/location_validation_test.rb +39 -0
  52. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location/metadata.yml +177 -0
  53. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/location_group.rb +92 -0
  54. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_code_search_test.rb +43 -0
  55. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_doseform_search_test.rb +45 -0
  56. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_drug_name_search_test.rb +44 -0
  57. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_id_search_test.rb +42 -0
  58. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_lastupdated_search_test.rb +42 -0
  59. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_must_support_test.rb +47 -0
  60. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_read_test.rb +26 -0
  61. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_status_search_test.rb +53 -0
  62. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/medication_knowledge_validation_test.rb +39 -0
  63. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge/metadata.yml +214 -0
  64. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/medication_knowledge_group.rb +91 -0
  65. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/metadata.yml +1192 -0
  66. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/metadata.yml +371 -0
  67. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_coverage_area_search_test.rb +43 -0
  68. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_coverage_type_search_test.rb +43 -0
  69. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_formulary_coverage_include_search_test.rb +40 -0
  70. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_formulary_coverage_search_test.rb +43 -0
  71. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_id_search_test.rb +42 -0
  72. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_identifier_search_test.rb +43 -0
  73. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_lastupdated_search_test.rb +42 -0
  74. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_must_support_test.rb +66 -0
  75. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_name_search_test.rb +42 -0
  76. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_period_search_test.rb +42 -0
  77. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_read_test.rb +26 -0
  78. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_reference_resolution_test.rb +40 -0
  79. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_status_search_test.rb +53 -0
  80. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_type_search_test.rb +43 -0
  81. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan/payer_insurance_plan_validation_test.rb +39 -0
  82. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/payer_insurance_plan_group.rb +108 -0
  83. data/lib/davinci_us_drug_formulary_test_kit/generated/v2.0.1/usdf_test_suite.rb +114 -0
  84. data/lib/davinci_us_drug_formulary_test_kit/generator/group_generator.rb +181 -0
  85. data/lib/davinci_us_drug_formulary_test_kit/generator/group_metadata.rb +79 -0
  86. data/lib/davinci_us_drug_formulary_test_kit/generator/group_metadata_extractor.rb +329 -0
  87. data/lib/davinci_us_drug_formulary_test_kit/generator/ig_loader.rb +77 -0
  88. data/lib/davinci_us_drug_formulary_test_kit/generator/ig_metadata.rb +33 -0
  89. data/lib/davinci_us_drug_formulary_test_kit/generator/ig_metadata_extractor.rb +40 -0
  90. data/lib/davinci_us_drug_formulary_test_kit/generator/ig_resources.rb +60 -0
  91. data/lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb +68 -0
  92. data/lib/davinci_us_drug_formulary_test_kit/generator/must_support_metadata_extractor.rb +384 -0
  93. data/lib/davinci_us_drug_formulary_test_kit/generator/must_support_test_generator.rb +117 -0
  94. data/lib/davinci_us_drug_formulary_test_kit/generator/naming.rb +28 -0
  95. data/lib/davinci_us_drug_formulary_test_kit/generator/read_test_generator.rb +92 -0
  96. data/lib/davinci_us_drug_formulary_test_kit/generator/reference_resolution_test_generator.rb +91 -0
  97. data/lib/davinci_us_drug_formulary_test_kit/generator/search_definition_metadata_extractor.rb +187 -0
  98. data/lib/davinci_us_drug_formulary_test_kit/generator/search_metadata_extractor.rb +59 -0
  99. data/lib/davinci_us_drug_formulary_test_kit/generator/search_test_generator.rb +270 -0
  100. data/lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb +94 -0
  101. data/lib/davinci_us_drug_formulary_test_kit/generator/terminology_binding_metadata_extractor.rb +116 -0
  102. data/lib/davinci_us_drug_formulary_test_kit/generator/validation_test_generator.rb +102 -0
  103. data/lib/davinci_us_drug_formulary_test_kit/generator/value_extractor.rb +113 -0
  104. data/lib/davinci_us_drug_formulary_test_kit/generator.rb +94 -0
  105. data/lib/davinci_us_drug_formulary_test_kit/igs/package/r4_search-parameters.json +65408 -0
  106. data/lib/davinci_us_drug_formulary_test_kit/igs/package.tgz +0 -0
  107. data/lib/davinci_us_drug_formulary_test_kit/must_support_test.rb +224 -0
  108. data/lib/davinci_us_drug_formulary_test_kit/read_test.rb +62 -0
  109. data/lib/davinci_us_drug_formulary_test_kit/reference_resolution_test.rb +174 -0
  110. data/lib/davinci_us_drug_formulary_test_kit/request_logger.rb +46 -0
  111. data/lib/davinci_us_drug_formulary_test_kit/search_test.rb +767 -0
  112. data/lib/davinci_us_drug_formulary_test_kit/search_test_properties.rb +58 -0
  113. data/lib/davinci_us_drug_formulary_test_kit/validation_test.rb +56 -0
  114. data/lib/davinci_us_drug_formulary_test_kit/version.rb +5 -0
  115. data/lib/davinci_us_drug_formulary_test_kit.rb +1 -0
  116. metadata +245 -0
@@ -0,0 +1,66 @@
1
+ require_relative '../../../must_support_test'
2
+
3
+ module DaVinciUSDrugFormularyTestKit
4
+ module DaVinciUSDrugFormularyV201
5
+ class PayerInsurancePlanMustSupportTest < Inferno::Test
6
+ include DaVinciUSDrugFormularyTestKit::MustSupportTest
7
+
8
+ title 'All must support elements are provided in the InsurancePlan resources returned'
9
+ description %(
10
+ US Drug Formulary Responders SHALL be capable of populating all data elements as
11
+ part of the query results as specified by the US Drug Formulary Capability
12
+ Statement. This test will look through the InsurancePlan resources
13
+ found previously for the following must support elements:
14
+
15
+ * InsurancePlan.contact.name
16
+ * InsurancePlan.contact.name.text
17
+ * InsurancePlan.contact.telecom
18
+ * InsurancePlan.contact.telecom.system
19
+ * InsurancePlan.contact.telecom.value
20
+ * InsurancePlan.coverage
21
+ * InsurancePlan.coverage.type
22
+ * InsurancePlan.coverage:drug-coverage
23
+ * InsurancePlan.coverage:drug-coverage.benefit:drug-plan
24
+ * InsurancePlan.coverage:drug-coverage.extension
25
+ * InsurancePlan.coverage:drug-coverage.extension:usdf-FormularyReference-extension
26
+ * InsurancePlan.coverageArea
27
+ * InsurancePlan.identifier
28
+ * InsurancePlan.meta.lastUpdated
29
+ * InsurancePlan.name
30
+ * InsurancePlan.period
31
+ * InsurancePlan.plan
32
+ * InsurancePlan.plan:drug-plan
33
+ * InsurancePlan.plan:drug-plan.specificCost
34
+ * InsurancePlan.plan:drug-plan.specificCost.benefit
35
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost
36
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost.qualifiers
37
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost.value
38
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost:coinsurance
39
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost:copay
40
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.cost:copay.value.value
41
+ * InsurancePlan.plan:drug-plan.specificCost.benefit.type
42
+ * InsurancePlan.plan:drug-plan.specificCost.category
43
+ * InsurancePlan.status
44
+ * InsurancePlan.type
45
+ )
46
+
47
+ id :usdf_v201_payer_insurance_plan_must_support_test
48
+
49
+ def resource_type
50
+ 'InsurancePlan'
51
+ end
52
+
53
+ def self.metadata
54
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
55
+ end
56
+
57
+ def scratch_resources
58
+ scratch[:payer_insurance_plan_resources] ||= {}
59
+ end
60
+
61
+ run do
62
+ perform_must_support_test(all_scratch_resources)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,42 @@
1
+ require_relative '../../../search_test'
2
+ require_relative '../../../generator/group_metadata'
3
+
4
+ module DaVinciUSDrugFormularyTestKit
5
+ module DaVinciUSDrugFormularyV201
6
+ class PayerInsurancePlanNameSearchTest < Inferno::Test
7
+ include DaVinciUSDrugFormularyTestKit::SearchTest
8
+
9
+ title 'Server returns valid results for InsurancePlan search by name'
10
+ description %(
11
+ A server SHALL support searching by
12
+ name on the InsurancePlan resource. This test
13
+ will pass if resources are returned and match the search criteria. If
14
+ none are returned, the test is skipped.
15
+
16
+ [US Drug Formulary](http://hl7.org/fhir/us/davinci-drug-formulary/STU2/CapabilityStatement-usdf-server.html)
17
+
18
+ )
19
+
20
+ id :usdf_v201_payer_insurance_plan_name_search_test
21
+
22
+ def self.properties
23
+ @properties ||= SearchTestProperties.new(
24
+ resource_type: 'InsurancePlan',
25
+ search_param_names: ['name']
26
+ )
27
+ end
28
+
29
+ def self.metadata
30
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
31
+ end
32
+
33
+ def scratch_resources
34
+ scratch[:payer_insurance_plan_resources] ||= {}
35
+ end
36
+
37
+ run do
38
+ run_search_test
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ require_relative '../../../search_test'
2
+ require_relative '../../../generator/group_metadata'
3
+
4
+ module DaVinciUSDrugFormularyTestKit
5
+ module DaVinciUSDrugFormularyV201
6
+ class PayerInsurancePlanPeriodSearchTest < Inferno::Test
7
+ include DaVinciUSDrugFormularyTestKit::SearchTest
8
+
9
+ title 'Server returns valid results for InsurancePlan search by period'
10
+ description %(
11
+ A server SHALL support searching by
12
+ period on the InsurancePlan resource. This test
13
+ will pass if resources are returned and match the search criteria. If
14
+ none are returned, the test is skipped.
15
+
16
+ [US Drug Formulary](http://hl7.org/fhir/us/davinci-drug-formulary/STU2/CapabilityStatement-usdf-server.html)
17
+
18
+ )
19
+
20
+ id :usdf_v201_payer_insurance_plan_period_search_test
21
+
22
+ def self.properties
23
+ @properties ||= SearchTestProperties.new(
24
+ resource_type: 'InsurancePlan',
25
+ search_param_names: ['period']
26
+ )
27
+ end
28
+
29
+ def self.metadata
30
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
31
+ end
32
+
33
+ def scratch_resources
34
+ scratch[:payer_insurance_plan_resources] ||= {}
35
+ end
36
+
37
+ run do
38
+ run_search_test
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../../read_test'
2
+
3
+ module DaVinciUSDrugFormularyTestKit
4
+ module USDFV201
5
+ class PayerInsurancePlanReadTest < Inferno::Test
6
+ include DaVinciUSDrugFormularyTestKit::ReadTest
7
+
8
+ title 'Server returns correct InsurancePlan resource from InsurancePlan read interaction'
9
+ description 'A server SHALL support the InsurancePlan read interaction.'
10
+
11
+ id :usdf_v201_payer_insurance_plan_read_test
12
+
13
+ def resource_type
14
+ 'InsurancePlan'
15
+ end
16
+
17
+ def scratch_resources
18
+ scratch[:payer_insurance_plan_resources] ||= {}
19
+ end
20
+
21
+ run do
22
+ perform_read_test(all_scratch_resources)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ require_relative '../../../reference_resolution_test'
2
+
3
+ module DaVinciUSDrugFormularyTestKit
4
+ module DaVinciUSDrugFormularyV201
5
+ class PayerInsurancePlanReferenceResolutionTest < Inferno::Test
6
+ include DaVinciUSDrugFormularyTestKit::ReferenceResolutionTest
7
+
8
+ title 'MustSupport references within InsurancePlan resources are valid'
9
+ description %(
10
+ This test will attempt to read external references provided within elements
11
+ marked as 'MustSupport', if any are available.
12
+
13
+ It verifies that at least one external reference for each MustSupport Reference element
14
+ can be accessed by the test client, and conforms to corresponding US Core profile.
15
+
16
+ Elements which may provide external references include:
17
+
18
+ * InsurancePlan.coverageArea
19
+ )
20
+
21
+ id :usdf_v201_payer_insurance_plan_reference_resolution_test
22
+
23
+ def resource_type
24
+ 'InsurancePlan'
25
+ end
26
+
27
+ def self.metadata
28
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
29
+ end
30
+
31
+ def scratch_resources
32
+ scratch[:payer_insurance_plan_resources] ||= {}
33
+ end
34
+
35
+ run do
36
+ perform_reference_resolution_test(scratch_resources[:all])
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '../../../search_test'
2
+ require_relative '../../../generator/group_metadata'
3
+
4
+ module DaVinciUSDrugFormularyTestKit
5
+ module DaVinciUSDrugFormularyV201
6
+ class PayerInsurancePlanStatusSearchTest < Inferno::Test
7
+ include DaVinciUSDrugFormularyTestKit::SearchTest
8
+
9
+ title 'Server returns valid results for InsurancePlan search by status'
10
+ description %(
11
+ A server SHALL support searching by
12
+ status on the InsurancePlan resource. This test
13
+ will pass if resources are returned and match the search criteria. If
14
+ none are returned, the test is skipped.
15
+
16
+ Because this is the first search of the sequence, resources in the
17
+ response will be used for subsequent tests.
18
+
19
+ Additionally, this test will check that GET and POST search methods
20
+ return the same number of results. Search by POST is required by the
21
+ FHIR R4 specification, and these tests interpret search by GET as a
22
+ requirement of US Core v2.0.1.
23
+
24
+ [US Drug Formulary](http://hl7.org/fhir/us/davinci-drug-formulary/STU2/CapabilityStatement-usdf-server.html)
25
+
26
+ )
27
+
28
+ id :usdf_v201_payer_insurance_plan_status_search_test
29
+
30
+ def self.properties
31
+ @properties ||= SearchTestProperties.new(
32
+ first_search: true,
33
+ fixed_value_search: true,
34
+ resource_type: 'InsurancePlan',
35
+ search_param_names: ['status'],
36
+ test_post_search: true
37
+ )
38
+ end
39
+
40
+ def self.metadata
41
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
42
+ end
43
+
44
+ def scratch_resources
45
+ scratch[:payer_insurance_plan_resources] ||= {}
46
+ end
47
+
48
+ run do
49
+ run_search_test
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,43 @@
1
+ require_relative '../../../search_test'
2
+ require_relative '../../../generator/group_metadata'
3
+
4
+ module DaVinciUSDrugFormularyTestKit
5
+ module DaVinciUSDrugFormularyV201
6
+ class PayerInsurancePlanTypeSearchTest < Inferno::Test
7
+ include DaVinciUSDrugFormularyTestKit::SearchTest
8
+
9
+ title 'Server returns valid results for InsurancePlan search by type'
10
+ description %(
11
+ A server SHALL support searching by
12
+ type on the InsurancePlan resource. This test
13
+ will pass if resources are returned and match the search criteria. If
14
+ none are returned, the test is skipped.
15
+
16
+ [US Drug Formulary](http://hl7.org/fhir/us/davinci-drug-formulary/STU2/CapabilityStatement-usdf-server.html)
17
+
18
+ )
19
+
20
+ id :usdf_v201_payer_insurance_plan_type_search_test
21
+
22
+ def self.properties
23
+ @properties ||= SearchTestProperties.new(
24
+ resource_type: 'InsurancePlan',
25
+ search_param_names: ['type'],
26
+ token_search_params: ['type']
27
+ )
28
+ end
29
+
30
+ def self.metadata
31
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
32
+ end
33
+
34
+ def scratch_resources
35
+ scratch[:payer_insurance_plan_resources] ||= {}
36
+ end
37
+
38
+ run do
39
+ run_search_test
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../../../validation_test'
2
+
3
+ module DaVinciUSDrugFormularyTestKit
4
+ module DaVinciUSDrugFormularyV201
5
+ class PayerInsurancePlanValidationTest < Inferno::Test
6
+ include DaVinciUSDrugFormularyTestKit::ValidationTest
7
+
8
+ id :usdf_v201_payer_insurance_plan_validation_test
9
+ title 'InsurancePlan resources returned during previous tests conform to the Payer Insurance Plan profile'
10
+ description %(
11
+ This test verifies resources returned from the first search conform to
12
+ the [Payer Insurance Plan profile](http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-PayerInsurancePlan).
13
+
14
+ Systems must demonstrate at least one valid example in order to pass this test.
15
+ It verifies the presence of mandatory elements and that elements with
16
+ required bindings contain appropriate values. CodeableConcept element
17
+ bindings will fail if none of their codings have a code/system belonging
18
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
19
+ fail if their code/system are not found in the valueset.
20
+
21
+ )
22
+ output :dar_code_found, :dar_extension_found
23
+
24
+ def resource_type
25
+ 'InsurancePlan'
26
+ end
27
+
28
+ def scratch_resources
29
+ scratch[:payer_insurance_plan_resources] ||= {}
30
+ end
31
+
32
+ run do
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-PayerInsurancePlan',
35
+ '2.0.1')
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,108 @@
1
+ require_relative 'payer_insurance_plan/payer_insurance_plan_status_search_test'
2
+ require_relative 'payer_insurance_plan/payer_insurance_plan_id_search_test'
3
+ require_relative 'payer_insurance_plan/payer_insurance_plan_lastupdated_search_test'
4
+ require_relative 'payer_insurance_plan/payer_insurance_plan_identifier_search_test'
5
+ require_relative 'payer_insurance_plan/payer_insurance_plan_period_search_test'
6
+ require_relative 'payer_insurance_plan/payer_insurance_plan_type_search_test'
7
+ require_relative 'payer_insurance_plan/payer_insurance_plan_name_search_test'
8
+ require_relative 'payer_insurance_plan/payer_insurance_plan_coverage_type_search_test'
9
+ require_relative 'payer_insurance_plan/payer_insurance_plan_formulary_coverage_search_test'
10
+ require_relative 'payer_insurance_plan/payer_insurance_plan_coverage_area_search_test'
11
+ require_relative 'payer_insurance_plan/payer_insurance_plan_read_test'
12
+ require_relative 'payer_insurance_plan/payer_insurance_plan_formulary_coverage_include_search_test'
13
+ require_relative 'payer_insurance_plan/payer_insurance_plan_validation_test'
14
+ require_relative 'payer_insurance_plan/payer_insurance_plan_must_support_test'
15
+ require_relative 'payer_insurance_plan/payer_insurance_plan_reference_resolution_test'
16
+
17
+ module DaVinciUSDrugFormularyTestKit
18
+ module USDFV201
19
+ class PayerInsurancePlanGroup < Inferno::TestGroup
20
+ title 'Payer Insurance Plan Tests'
21
+ short_description 'Verify support for the server capabilities required by the Payer Insurance Plan.'
22
+ description %(
23
+ # Background
24
+
25
+ The USDF Payer Insurance Plan sequence verifies that the system under test is
26
+ able to provide correct responses for InsurancePlan queries. These queries
27
+ must contain resources conforming to the Payer Insurance Plan as
28
+ specified in the USDF v2.0.1 Implementation Guide.
29
+
30
+ # Testing Methodology
31
+ ## Searching
32
+ This test sequence will first perform each required search associated
33
+ with this resource. This sequence will perform searches with the
34
+ following parameters:
35
+
36
+ * status
37
+ * _id
38
+ * _lastUpdated
39
+ * identifier
40
+ * period
41
+ * type
42
+ * name
43
+ * coverage-type
44
+ * formulary-coverage
45
+ * coverage-area
46
+
47
+ ### Search Parameters
48
+ The first search uses the selected resources from the prior launch
49
+ sequence. Any subsequent searches will look for its parameter values
50
+ from the results of the first search. If a value cannot be found this way, the search is skipped.
51
+
52
+ ### Search Validation
53
+ Inferno will retrieve up to the first 20 bundle pages of the reply for
54
+ InsurancePlan resources and save them for subsequent tests. Each of
55
+ these resources is then checked to see if it matches the searched
56
+ parameters in accordance with [FHIR search
57
+ guidelines](https://www.hl7.org/fhir/search.html).
58
+
59
+
60
+ ## Must Support
61
+ Each profile contains elements marked as "must support". This test
62
+ sequence expects to see each of these elements at least once. If at
63
+ least one cannot be found, the test will fail. The test will look
64
+ through the InsurancePlan resources found in the first test for these
65
+ elements.
66
+
67
+ ## Profile Validation
68
+ Each resource returned from the first search is expected to conform to
69
+ the [Payer Insurance Plan](http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-PayerInsurancePlan). Each element is checked against
70
+ teminology binding and cardinality requirements.
71
+
72
+ Elements with a required binding are validated against their bound
73
+ ValueSet. If the code/system in the element is not part of the ValueSet,
74
+ then the test will fail.
75
+
76
+ ## Reference Validation
77
+ At least one instance of each external reference in elements marked as
78
+ "must support" within the resources provided by the system must resolve.
79
+ The test will attempt to read each reference found and will fail if no
80
+ read succeeds.
81
+
82
+ )
83
+
84
+ id :usdf_v201_payer_insurance_plan
85
+ run_as_group
86
+
87
+ def self.metadata
88
+ @metadata ||= Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'payer_insurance_plan', 'metadata.yml'), aliases: true))
89
+ end
90
+
91
+ test from: :usdf_v201_payer_insurance_plan_status_search_test
92
+ test from: :usdf_v201_payer_insurance_plan__id_search_test
93
+ test from: :usdf_v201_payer_insurance_plan__lastUpdated_search_test
94
+ test from: :usdf_v201_payer_insurance_plan_identifier_search_test
95
+ test from: :usdf_v201_payer_insurance_plan_period_search_test
96
+ test from: :usdf_v201_payer_insurance_plan_type_search_test
97
+ test from: :usdf_v201_payer_insurance_plan_name_search_test
98
+ test from: :usdf_v201_payer_insurance_plan_coverage_type_search_test
99
+ test from: :usdf_v201_payer_insurance_plan_formulary_coverage_search_test
100
+ test from: :usdf_v201_payer_insurance_plan_coverage_area_search_test
101
+ test from: :usdf_v201_payer_insurance_plan_read_test
102
+ test from: :usdf_v201_payer_insurance_plan_formulary_coverage_include_search_test
103
+ test from: :usdf_v201_payer_insurance_plan_validation_test
104
+ test from: :usdf_v201_payer_insurance_plan_must_support_test
105
+ test from: :usdf_v201_payer_insurance_plan_reference_resolution_test
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,114 @@
1
+ require 'inferno/dsl/oauth_credentials'
2
+ require_relative '../../version'
3
+ require_relative '../../custom_groups/v2.0.1/capability_statement_group'
4
+ require_relative 'payer_insurance_plan_group'
5
+ require_relative 'formulary_group'
6
+ require_relative 'basic_group'
7
+ require_relative 'medication_knowledge_group'
8
+ require_relative 'location_group'
9
+
10
+ module DaVinciUSDrugFormularyTestKit
11
+ module USDFV201
12
+ class USDFTestSuite < Inferno::TestSuite
13
+ title 'Da Vinci US Drug Formulary v2.0.1'
14
+ short_title 'US Drug Formulary v2.0.1'
15
+ description %(
16
+ The Da Vinci US Drug Formulary Test Kit tests systems for their
17
+ conformance to the [US Drug Formulary Implementation Guide](https://hl7.org/fhir/us/davinci-drug-formulary/STU2.0.1/).
18
+
19
+ ## Instructions
20
+ In order to run the tests, provide the base URL of the FHIR server to
21
+ test, along with the IDs of Insurance Plan Location resources.
22
+ Credentials may optionally be provided if testing against a system which
23
+ requires authorization.
24
+
25
+ ## Scope
26
+ These tests check the following behaviors as defined in the IG:
27
+ - FHIR Interactions
28
+ - Conformance
29
+ - Read
30
+ - Search
31
+ - Individual search parameters
32
+ - _include searches
33
+ - FHIR Data
34
+ - Validation against IG profiles
35
+ - Presence of all Must Support fields
36
+ - Resolution of Must Support references
37
+
38
+ **Known Issues**
39
+ - Must Support checks are not performed for all elements of Formulary
40
+ Drug resources due to the use of an intensional value set for slicing
41
+ `MedicationKnowledge.code.coding` elements.
42
+ - The following search features are not tested:
43
+ - Combination searches
44
+ - Multiple Or
45
+ - Multiple And
46
+ - Comparators
47
+ )
48
+ version VERSION
49
+
50
+ VALIDATION_MESSAGE_FILTERS = [
51
+ %r{Sub-extension url 'introspect' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris},
52
+ %r{Sub-extension url 'revoke' is not defined by the Extension http://fhir-registry\.smarthealthit\.org/StructureDefinition/oauth-uris},
53
+ /Observation\.effective\.ofType\(Period\): .*vs-1:/ # Invalid invariant in FHIR v4.0.1
54
+ ].freeze
55
+
56
+ VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
57
+
58
+ def self.metadata
59
+ @metadata ||= YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true)[:groups].map do |raw_metadata|
60
+ Generator::GroupMetadata.new(raw_metadata)
61
+ end
62
+ end
63
+
64
+ validator do
65
+ url ENV.fetch('V201_VALIDATOR_URL', 'http://validator_service:4567')
66
+ message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS
67
+
68
+ exclude_message do |message|
69
+
70
+ message_filters.any? { |filter| filter.match? message.message }
71
+ end
72
+
73
+ perform_additional_validation do |resource, profile_url|
74
+ ProvenanceValidator.validate(resource) if resource.instance_of?(FHIR::Provenance)
75
+ end
76
+ end
77
+
78
+ links [
79
+ {
80
+ label: 'Report Issue',
81
+ url: 'https://github.com/inferno-framework/davinci-us-drug-formulary-test-kit/issues'
82
+ },
83
+ {
84
+ label: 'Source Code',
85
+ url: 'https://github.com/inferno-framework/davinci-us-drug-formulary-test-kit'
86
+ }
87
+ ]
88
+
89
+
90
+ id :davinci_us_drug_formulary_v201
91
+
92
+ input :url,
93
+ title: 'FHIR Endpoint',
94
+ description: 'URL of the FHIR endpoint'
95
+ input :smart_credentials,
96
+ title: 'OAuth Credentials',
97
+ type: :oauth_credentials,
98
+ optional: true
99
+
100
+ fhir_client do
101
+ url :url
102
+ oauth_credentials :smart_credentials
103
+ end
104
+
105
+ group from: :usdf_v201_capability_statement
106
+
107
+ group from: :usdf_v201_payer_insurance_plan
108
+ group from: :usdf_v201_formulary
109
+ group from: :usdf_v201_basic
110
+ group from: :usdf_v201_medication_knowledge
111
+ group from: :usdf_v201_location
112
+ end
113
+ end
114
+ end