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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3fdb786000c21de4c30b2dff3a8e49399dd013b7355915c6cbefd5e6614571b4
4
+ data.tar.gz: aeb9facea59395c4aaa4547a8224365a97d2632407fe0cfac5eb03a39cf0da5e
5
+ SHA512:
6
+ metadata.gz: 35af1690d08ec5418cf23dacc8b40e779beac29708e9b8f55aee6f85ea31730de14d4810d54b371287e96d39cf495772cc0e9278e0f19d350c98bfca9b118b78
7
+ data.tar.gz: e94ed5bd8b74e2bf410a7d429dc3cb7b4bc14b9f55b4d1fd69cf30f6f32e3c7a38db8b7c2d50f389066d88a9a8c0885f7775712ab83dfac48df793bae1ee8fd6
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,41 @@
1
+ module DaVinciUSDrugFormularyTestKit
2
+ class ConformanceSupportTest < Inferno::Test
3
+ id :usdf_conformance_support
4
+ title 'FHIR Server supports the conformance interaction'
5
+ description %(
6
+ The conformance 'whole system' interaction provides a method to get the
7
+ CapabilityStatement for the FHIR server. This test checks that the
8
+ server responds to a `GET` request at the following endpoint:
9
+
10
+ ```
11
+ GET [base]/metadata
12
+ ```
13
+
14
+ This test checks the following SHALL requirement:
15
+
16
+ > Applications SHALL return a resource that describes the functionality
17
+ of the server end-point.
18
+
19
+ [http://hl7.org/fhir/R4/http.html#capabilities](http://hl7.org/fhir/R4/http.html#capabilities)
20
+
21
+ It does this by checking that the server responds with an HTTP OK 200
22
+ status code and that the body of the response contains a valid
23
+ [CapabilityStatement
24
+ resource](http://hl7.org/fhir/R4/capabilitystatement.html). This test
25
+ does not inspect the content of the CapabilityStatement to see if it
26
+ contains the required information. It only checks to see if the RESTful
27
+ interaction is supported and returns a valid CapabilityStatement
28
+ resource.
29
+ )
30
+ makes_request :capability_statement
31
+
32
+ run do
33
+ fhir_client.set_no_auth
34
+ fhir_get_capability_statement(name: :capability_statement)
35
+
36
+ assert_response_status(200)
37
+ assert_resource_type(:capability_statement)
38
+ assert_valid_resource
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ module DaVinciUSDrugFormularyTestKit
2
+ class FHIRVersionTest < Inferno::Test
3
+ id :usdf_fhir_version
4
+ title 'Server is using FHIR R4'
5
+ description %(
6
+ This test inspects the CapabilityStatement returned by the server to
7
+ verify that the server is using FHIR R4.
8
+ )
9
+
10
+ run do
11
+ server_version = fhir_client.detect_version.to_s.upcase
12
+ assert server_version == 'R4', "Server is using FHIR version #{server_version} rather than R4"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module DaVinciUSDrugFormularyTestKit
2
+ class InstantiateTest < Inferno::Test
3
+ id :usdf_instantiate
4
+ title 'Server instantiates US Drug Formulary Server'
5
+ description %(
6
+ This test inspects the CapabilityStatement returned by the server to
7
+ verify that the server instantiates http://hl7.org/fhir/us/davinci-drug-formulary/CapabilityStatement/usdf-server
8
+ )
9
+ uses_request :capability_statement
10
+
11
+ run do
12
+ assert_resource_type(:capability_statement)
13
+ capability_statement = resource
14
+
15
+ assert capability_statement.instantiates.include?('http://hl7.org/fhir/us/davinci-drug-formulary/CapabilityStatement/usdf-server'),
16
+ "Server CapabilityStatement.instantiates does not include 'http://hl7.org/fhir/us/davinci-drug-formulary/CapabilityStatement/usdf-server'"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,40 @@
1
+ module DaVinciUSDrugFormularyTestKit
2
+ class JSONSupportTest < Inferno::Test
3
+ id :usdf_json_support
4
+ title 'FHIR server capability states JSON support'
5
+ description %(
6
+ FHIR provides multiple [representation
7
+ formats](https://www.hl7.org/fhir/formats.html) for resources, including
8
+ JSON and XML. US Drug Formulary profiles require servers to use the [JSON
9
+ representation](https://www.hl7.org/fhir/json.html):
10
+
11
+ [```The US Drug Formulary Server **SHALL** Support json source formats for all US
12
+ Drug Formulary
13
+ interactions.```](https://hl7.org/fhir/us/davinci-drug-formulary/CapabilityStatement-usdf-server.html#behavior)
14
+
15
+ The FHIR conformance interaction require servers to describe which
16
+ formats are available for clients to use. The server must explicitly
17
+ state that JSON is supported. This is located in the [format
18
+ element](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.format)
19
+ of the CapabilityStatement Resource.
20
+
21
+ This test checks that one of the following values are located in the
22
+ format field.
23
+
24
+ * json
25
+ * application/json
26
+ * application/fhir+json
27
+ )
28
+ uses_request :capability_statement
29
+
30
+ run do
31
+ assert_resource_type(:capability_statement)
32
+
33
+ json_formats = ['json', 'application/json', 'application/fhir+json']
34
+ server_formats = resource.format
35
+
36
+ assert server_formats.any? { |format| json_formats.include? format },
37
+ 'CapabilityStatement does not state support for JSON'
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,39 @@
1
+ module DaVinciUSDrugFormularyTestKit
2
+ class ProfileSupportTest < Inferno::Test
3
+ id :usdf_profile_support
4
+ title 'Capability Statement lists support for required US Drug Formulary Profiles'
5
+ description %(
6
+ The US Drug Formulary Implementation Guide states:
7
+
8
+ ```
9
+ The US Drug Formulary Server SHALL:
10
+ 1. Support all profiles defined in the USDF Implementation Guide.
11
+
12
+ ```
13
+ )
14
+ uses_request :capability_statement
15
+
16
+ run do
17
+ assert_resource_type(:capability_statement)
18
+ capability_statement = resource
19
+
20
+ supported_resources =
21
+ capability_statement.rest
22
+ &.each_with_object([]) do |rest, resources|
23
+ rest.resource.each { |resource| resources << resource.type }
24
+ end&.uniq
25
+ usdf_resources = config.options[:required_resources]
26
+ unsupported_resources = usdf_resources - supported_resources
27
+
28
+ all_resources_supported = unsupported_resources.none?
29
+
30
+ unsupported_resource_list =
31
+ unsupported_resources
32
+ .map { |resource| "`#{resource}`" }
33
+ .join(', ')
34
+
35
+ assert all_resources_supported,
36
+ "Not all US Drug Formulary resources are supported. Missing support for: #{unsupported_resource_list}"
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,78 @@
1
+ require 'tls_test_kit'
2
+ require_relative '../capability_statement/conformance_support_test'
3
+ require_relative '../capability_statement/fhir_version_test'
4
+ require_relative '../capability_statement/json_support_test'
5
+ require_relative '../capability_statement/profile_support_test'
6
+ require_relative '../capability_statement/instantiate_test'
7
+
8
+ module DaVinciUSDrugFormularyTestKit
9
+ module USDFV201
10
+ class CapabilityStatementGroup < Inferno::TestGroup
11
+ id :usdf_v201_capability_statement
12
+ title 'Capability Statement'
13
+ short_description 'Retrieve information about supported server functionality ' \
14
+ 'using the FHIR capabilties interaction.'
15
+ description %(
16
+ # Background
17
+ The #{title} Sequence tests a FHIR server's ability to formally describe
18
+ features supported by the API by using the [Capability
19
+ Statement](https://www.hl7.org/fhir/capabilitystatement.html) resource.
20
+ The features described in the Capability Statement must be consistent with
21
+ the required [capabilities of a US Drug Formulary](http://hl7.org/fhir/us/davinci-drug-formulary/STU2.0.1/CapabilityStatement-usdf-server.html). The Capability Statement
22
+ must also advertise the location of the required SMART on FHIR endpoints
23
+ that enable authenticated access to the FHIR server resources.
24
+
25
+ The Capability Statement resource allows clients to determine which
26
+ resources are supported by a FHIR Server. Not all servers are expected to
27
+ implement all possible queries and data elements described in the US Drug Formulary
28
+ API.
29
+
30
+ # Test Methodology
31
+
32
+ This test sequence accesses the server endpoint at `/metadata` using a
33
+ `GET` request. It parses the Capability Statement and verifies that:
34
+
35
+ * The endpoint is secured by an appropriate cryptographic protocol
36
+ * The resource matches the expected FHIR version defined by the tests
37
+ * The resource is a valid FHIR resource
38
+ * The server claims support for JSON encoding of resources
39
+
40
+ It collects the following information that is saved in the testing session
41
+ for use by later tests:
42
+
43
+ * List of resources supported
44
+ * List of queries parameters supported
45
+ )
46
+ run_as_group
47
+
48
+ PROFILES = {
49
+ 'InsurancePlan' => [
50
+ 'http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-PayerInsurancePlan', 'http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-Formulary'
51
+ ].freeze,
52
+ 'Basic' => ['http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyItem'].freeze,
53
+ 'MedicationKnowledge' => ['http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-FormularyDrug'].freeze,
54
+ 'Location' => ['http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-InsurancePlanLocation'].freeze
55
+ }.freeze
56
+
57
+ test from: :tls_version_test,
58
+ id: :standalone_auth_tls,
59
+ title: 'FHIR server secured by transport layer security',
60
+ description: %(
61
+ Systems **SHALL** use TLS version 1.2 or higher for all transmissions
62
+ not taking place over a secure network connection.
63
+ ),
64
+ config: {
65
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
66
+ }
67
+ test from: :usdf_conformance_support
68
+ test from: :usdf_fhir_version
69
+ test from: :usdf_json_support
70
+ test from: :usdf_instantiate
71
+ test from: :usdf_profile_support do
72
+ config(
73
+ options: { required_resources: PROFILES.keys }
74
+ )
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DaVinciUSDrugFormularyTestKit
4
+ module DateSearchValidation
5
+ def get_fhir_datetime_range(datetime)
6
+ range = { start: DateTime.xmlschema(datetime), end: nil }
7
+ range[:end] =
8
+ case datetime
9
+ when /^\d{4}$/ # YYYY
10
+ range[:start].next_year - 1.seconds
11
+ when /^\d{4}-\d{2}$/ # YYYY-MM
12
+ range[:start].next_month - 1.seconds
13
+ when /^\d{4}-\d{2}-\d{2}$/ # YYYY-MM-DD
14
+ range[:start].next_day - 1.seconds
15
+ else # YYYY-MM-DDThh:mm:ss+zz:zz
16
+ range[:start]
17
+ end
18
+ range
19
+ end
20
+
21
+ def get_fhir_period_range(period)
22
+ range = { start: nil, end: nil }
23
+ range[:start] = DateTime.xmlschema(period.start) unless period.start.nil?
24
+ return range if period.end.nil?
25
+
26
+ period_end_beginning = DateTime.xmlschema(period.end)
27
+ range[:end] =
28
+ case period.end
29
+ when /^\d{4}$/ # YYYY
30
+ period_end_beginning.next_year - 1.seconds
31
+ when /^\d{4}-\d{2}$/ # YYYY-MM
32
+ period_end_beginning.next_month - 1.seconds
33
+ when /^\d{4}-\d{2}-\d{2}$/ # YYYY-MM-DD
34
+ period_end_beginning.next_day - 1.seconds
35
+ else # YYYY-MM-DDThh:mm:ss+zz:zz
36
+ period_end_beginning
37
+ end
38
+ range
39
+ end
40
+
41
+ def fhir_date_comparer(search_range, target_range, comparator, extend_start = false, extend_end = false)
42
+ # Implicitly, a missing lower boundary is "less than" any actual date. A
43
+ # missing upper boundary is "greater than" any actual date.
44
+ case comparator
45
+ when 'eq' # the range of the search value fully contains the range of the target value
46
+ !target_range[:start].nil? && !target_range[:end].nil? &&
47
+ search_range[:start] <= target_range[:start] && search_range[:end] >=
48
+ target_range[:end]
49
+ when 'ne' # the range of the search value does not fully contain the range of the target value
50
+ target_range[:start].nil? || target_range[:end].nil? ||
51
+ search_range[:start] > target_range[:start] || search_range[:end] <
52
+ target_range[:end]
53
+ when 'gt' # the range above the search value intersects (i.e. overlaps) with the range of the target value
54
+ target_range[:end].nil? || search_range[:end] < target_range[:end] ||
55
+ (search_range[:end] < (target_range[:end] + 1) && extend_end)
56
+ when 'lt' # the range below the search value intersects (i.e. overlaps) with the range of the target value
57
+ target_range[:start].nil? || search_range[:start] > target_range[:start] ||
58
+ (search_range[:start] > (target_range[:start] - 1) && extend_start)
59
+ when 'ge'
60
+ fhir_date_comparer(search_range, target_range, 'gt', extend_start,
61
+ extend_end) || fhir_date_comparer(search_range, target_range, 'eq')
62
+ when 'le'
63
+ fhir_date_comparer(search_range, target_range, 'lt', extend_start,
64
+ extend_end) || fhir_date_comparer(search_range, target_range, 'eq')
65
+ when 'sa' # the range above the search value contains the range of the target value
66
+ !target_range[:start].nil? && search_range[:end] < target_range[:start]
67
+ when 'eb' # the range below the search value contains the range of the target value
68
+ !target_range[:end].nil? && search_range[:start] > target_range[:end]
69
+ when 'ap' # the range of the search value overlaps with the range of the target value
70
+ if target_range[:start].nil? || target_range[:end].nil?
71
+ (target_range[:start].nil? && search_range[:start] < target_range[:end]) ||
72
+ (target_range[:end].nil? && search_range[:end] > target_range[:start])
73
+ else
74
+ (search_range[:start] >= target_range[:start] && search_range[:start] <= target_range[:end]) ||
75
+ (search_range[:end] >= target_range[:start] && search_range[:end] <= target_range[:end])
76
+ end
77
+ end
78
+ end
79
+
80
+ def validate_date_search(search_value, target_value)
81
+ if target_value.instance_of? FHIR::Period
82
+ validate_period_search(search_value, target_value)
83
+ else
84
+ validate_datetime_search(search_value, target_value)
85
+ end
86
+ end
87
+
88
+ def validate_datetime_search(search_value, target_value)
89
+ comparator = search_value[0..1]
90
+ if ['eq', 'ge', 'gt', 'le', 'lt', 'ne', 'sa', 'eb', 'ap'].include? comparator
91
+ search_value = search_value[2..]
92
+ else
93
+ comparator = 'eq'
94
+ end
95
+ search_is_date = is_date?(search_value)
96
+ target_is_date = is_date?(target_value)
97
+ search_range = get_fhir_datetime_range(search_value)
98
+ target_range = get_fhir_datetime_range(target_value)
99
+ fhir_date_comparer(search_range, target_range, comparator, !search_is_date && target_is_date,
100
+ !search_is_date && target_is_date)
101
+ end
102
+
103
+ def validate_period_search(search_value, target_value)
104
+ comparator = search_value[0..1]
105
+ if ['eq', 'ge', 'gt', 'le', 'lt', 'ne', 'sa', 'eb', 'ap'].include? comparator
106
+ search_value = search_value[2..]
107
+ else
108
+ comparator = 'eq'
109
+ end
110
+ search_is_date = is_date?(search_value)
111
+ search_range = get_fhir_datetime_range(search_value)
112
+ target_range = get_fhir_period_range(target_value)
113
+ fhir_date_comparer(search_range, target_range, comparator, !search_is_date && is_date?(target_value.start),
114
+ !search_is_date && is_date?(target_value.end))
115
+ end
116
+
117
+ def is_date?(value)
118
+ /^\d{4}(-\d{2})?(-\d{2})?$/.match?(value) # YYYY or YYYY-MM or YYYY-MM-DD
119
+ end
120
+ end
121
+ end