inferno_core 0.4.30 → 0.4.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +26 -0
  3. data/lib/inferno/apps/cli/templates/Dockerfile.tt +22 -0
  4. data/lib/inferno/apps/cli/templates/Gemfile.tt +9 -0
  5. data/lib/inferno/apps/cli/templates/LICENSE.tt +201 -0
  6. data/lib/inferno/apps/cli/templates/Procfile.tt +2 -0
  7. data/lib/inferno/apps/cli/templates/README.md.tt +41 -0
  8. data/lib/inferno/apps/cli/templates/Rakefile.tt +15 -0
  9. data/lib/inferno/apps/cli/templates/config/database.yml.tt +18 -0
  10. data/lib/inferno/apps/cli/templates/config/nginx.background.conf.tt +86 -0
  11. data/lib/inferno/apps/cli/templates/config/nginx.conf.tt +101 -0
  12. data/lib/inferno/apps/cli/templates/config/puma.rb.tt +2 -0
  13. data/lib/inferno/apps/cli/templates/config.ru.tt +11 -0
  14. data/lib/inferno/apps/cli/templates/docker-compose.background.yml.tt +30 -0
  15. data/lib/inferno/apps/cli/templates/docker-compose.yml.tt +35 -0
  16. data/lib/inferno/apps/cli/templates/lib/%library_name%/igs/put_ig_package_dot_tgz_here +0 -0
  17. data/lib/inferno/apps/cli/templates/lib/%library_name%/patient_group.rb.tt +44 -0
  18. data/lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt +53 -0
  19. data/lib/inferno/apps/cli/templates/run.sh +3 -0
  20. data/lib/inferno/apps/cli/templates/setup.sh +4 -0
  21. data/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt +105 -0
  22. data/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt +141 -0
  23. data/lib/inferno/apps/cli/templates/worker.rb.tt +3 -0
  24. data/lib/inferno/repositories/validator_sessions.rb +1 -1
  25. data/lib/inferno/version.rb +1 -1
  26. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4439e9a6fff9fbd72efd09c4a14342206c509151fc0b6782089bf991b1849442
4
- data.tar.gz: f386dba398dbf37c48fd3864fa4fe21e89732abccf155c5a2002530f802c7a34
3
+ metadata.gz: 2cc7cf96fbaba860fa20b9d3ce24ece91e898f06006974536c46d15d0f875888
4
+ data.tar.gz: 84eabfe9895b4dcd17d251b51e6cc7dceb9132ed7af66a3d0c707d6126e343ed
5
5
  SHA512:
6
- metadata.gz: 062e5019bcd5b1ca6cf67ac9fe94719e4a9e82fe2e8243f57a928ab28df35e8d517e0b180e48f6e7c1a5555ab691009399fc7f8d509d2d02cbbe0c4cbae8a3a3
7
- data.tar.gz: 6105c47597428f29714650ea36492892bd399bac93323178144d2ad9b52dcbf27e643d514d18de533ec7c76d63dc9c53128fab9282b50d5cf91ea069ddf2760b
6
+ metadata.gz: 7772ee37760aed0f39a36972f0d6881166d7caef69d62b3df6f868f26d1f5948928dc8a05e392aaa35af11cb71f11cf7f18ed8d47fcefa1efa431f3685872319
7
+ data.tar.gz: bf9319e60aff26082d19e67260ca93bb0e39304111f63a1ece0e4307b52c55a6da8a3959e227ea61c2848607f58a2087b340533d6e690125789f0b565919724c
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = '<%= library_name %>'
3
+ spec.version = '0.0.1'
4
+ spec.authors = <%= authors %>
5
+ # spec.email = ['TODO']
6
+ spec.date = Time.now.utc.strftime('%Y-%m-%d')
7
+ spec.summary = '<%= title_name %> Test Kit'
8
+ spec.description = '<%= human_name %> Inferno test kit for FHIR'
9
+ # spec.homepage = 'TODO'
10
+ spec.license = 'Apache-2.0'
11
+ spec.add_runtime_dependency 'inferno_core', '~> <%= Inferno::VERSION %>'
12
+ spec.add_development_dependency 'database_cleaner-sequel', '~> 1.8'
13
+ spec.add_development_dependency 'factory_bot', '~> 6.1'
14
+ spec.add_development_dependency 'rspec', '~> 3.10'
15
+ spec.add_development_dependency 'webmock', '~> 3.11'
16
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.2')
17
+ # spec.metadata['homepage_uri'] = spec.homepage
18
+ # spec.metadata['source_code_uri'] = 'TODO'
19
+ spec.files = [
20
+ Dir['lib/**/*.rb'],
21
+ Dir['lib/**/*.json'],
22
+ 'LICENSE'
23
+ ].flatten
24
+
25
+ spec.require_paths = ['lib']
26
+ end
@@ -0,0 +1,22 @@
1
+ FROM ruby:3.1.2
2
+
3
+ ENV INSTALL_PATH=/opt/inferno/
4
+ ENV APP_ENV=production
5
+ RUN mkdir -p $INSTALL_PATH
6
+
7
+ WORKDIR $INSTALL_PATH
8
+
9
+ ADD *.gemspec $INSTALL_PATH
10
+ ADD Gemfile* $INSTALL_PATH
11
+ RUN gem install bundler
12
+ # The below RUN line is commented out for development purposes, because any change to the
13
+ # required gems will break the dockerfile build process.
14
+ # If you want to run in Deploy mode, just run `bundle install` locally to update
15
+ # Gemfile.lock, and uncomment the following line.
16
+ # RUN bundle config set --local deployment 'true'
17
+ RUN bundle install
18
+
19
+ ADD . $INSTALL_PATH
20
+
21
+ EXPOSE 4567
22
+ CMD ["bundle", "exec", "puma"]
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ gem 'debug'
9
+ end
@@ -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,2 @@
1
+ web: bundle exec puma
2
+ worker: bundle exec sidekiq -r ./worker.rb
@@ -0,0 +1,41 @@
1
+ # <%= title_name %> Test Kit
2
+
3
+ <%= human_name %> [Inferno](https://github.com/inferno-community/inferno-core) test kit
4
+ for FHIR testing.
5
+
6
+ ## Documentation
7
+ - [Inferno documentation](https://inferno-framework.github.io/inferno-core/)
8
+ - [Ruby API documentation](https://inferno-framework.github.io/inferno-core/docs)
9
+ - [JSON API documentation](https://inferno-framework.github.io/inferno-core/api-docs)
10
+
11
+ ## Instructions for Developing tests
12
+
13
+ To get started writing tests, click "Use this template" on
14
+ github or use the Ruby-based command: `gem install inferno_core && inferno new my-test-kit`.
15
+ Refer to the Inferno documentation for information about [setting up your development
16
+ environment and running
17
+ Inferno](https://inferno-framework.github.io/inferno-core/getting-started.html#getting-started-for-inferno-test-writers).
18
+
19
+ ## Example Inferno test kits
20
+
21
+ - https://github.com/inferno-community/ips-test-kit
22
+ - https://github.com/inferno-community/shc-vaccination-test-kit
23
+
24
+ ## License
25
+ Copyright <%= Time.now.year %> TODO
26
+
27
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
28
+ this file except in compliance with the License. You may obtain a copy of the
29
+ License at
30
+ ```
31
+ http://www.apache.org/licenses/LICENSE-2.0
32
+ ```
33
+ Unless required by applicable law or agreed to in writing, software distributed
34
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
35
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
36
+ specific language governing permissions and limitations under the License.
37
+
38
+ ## Trademark Notice
39
+
40
+ HL7, FHIR and the FHIR [FLAME DESIGN] are the registered trademarks of Health
41
+ Level Seven International and their use does not constitute endorsement by HL7.
@@ -0,0 +1,15 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task default: :spec
5
+ rescue LoadError # rubocop:disable Lint/SuppressedException
6
+ end
7
+
8
+ namespace :db do
9
+ desc 'Apply changes to the database'
10
+ task :migrate do
11
+ require 'inferno/config/application'
12
+ require 'inferno/utils/migration'
13
+ Inferno::Utils::Migration.new.run
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ development:
2
+ adapter: sqlite
3
+ database: data/inferno_development.db
4
+ max_connections: 10
5
+ # user:
6
+ # password:
7
+ # host:
8
+ # port:
9
+
10
+ production:
11
+ adapter: sqlite
12
+ database: data/inferno_production.db
13
+ max_connections: 10
14
+
15
+ test:
16
+ adapter: sqlite
17
+ database: ':memory:'
18
+ max_connections: 10
@@ -0,0 +1,86 @@
1
+ # this sets the user nginx will run as,
2
+ #and the number of worker processes
3
+ user nobody nogroup;
4
+ worker_processes 2;
5
+ #user www-data;
6
+ #worker_processes auto;
7
+
8
+ # setup where nginx will log errors to
9
+ # and where the nginx process id resides
10
+ error_log /var/log/nginx/error.log;
11
+ pid /var/run/nginx.pid;
12
+
13
+ events {
14
+ worker_connections 1024;
15
+ # set to on if you have more than 1 worker_processes
16
+ accept_mutex on;
17
+ }
18
+
19
+ http {
20
+ include /etc/nginx/mime.types;
21
+
22
+ default_type application/octet-stream;
23
+ access_log /tmp/nginx.access.log combined;
24
+
25
+ # use the kernel sendfile
26
+ # sendfile on; # this causes over-caching because modified timestamps lost in VM
27
+ # prepend http headers before sendfile()
28
+ tcp_nopush on;
29
+
30
+ keepalive_timeout 600;
31
+ tcp_nodelay on;
32
+
33
+ gzip on;
34
+ gzip_vary on;
35
+ gzip_min_length 500;
36
+
37
+ gzip_disable "MSIE [1-6]\.(?!.*SV1)";
38
+ gzip_types text/plain text/xml text/css
39
+ text/comma-separated-values
40
+ text/javascript application/x-javascript
41
+ application/atom+xml image/x-icon;
42
+
43
+ # configure the virtual host
44
+ server {
45
+ # replace with your domain name
46
+ # server_name inferno-server;
47
+
48
+ # port to listen for requests on
49
+ listen 80;
50
+
51
+ # maximum accepted body size of client request
52
+ client_max_body_size 4G;
53
+ # the server will close connections after this time
54
+ keepalive_timeout 600;
55
+
56
+ location /validator {
57
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58
+ proxy_set_header Host $http_host;
59
+ proxy_set_header X-Forwarded-Proto $scheme;
60
+ proxy_set_header X-Forwarded-Port $server_port;
61
+ proxy_redirect off;
62
+ proxy_set_header Connection '';
63
+ proxy_http_version 1.1;
64
+ chunked_transfer_encoding off;
65
+ proxy_buffering off;
66
+ proxy_cache off;
67
+
68
+ proxy_pass http://fhir_validator_app;
69
+ }
70
+
71
+ location /validatorapi/ {
72
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
73
+ proxy_set_header Host $http_host;
74
+ proxy_set_header X-Forwarded-Proto $scheme;
75
+ proxy_set_header X-Forwarded-Port $server_port;
76
+ proxy_redirect off;
77
+ proxy_set_header Connection '';
78
+ proxy_http_version 1.1;
79
+ chunked_transfer_encoding off;
80
+ proxy_buffering off;
81
+ proxy_cache off;
82
+
83
+ proxy_pass http://validator_service:4567/;
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,101 @@
1
+ # this sets the user nginx will run as,
2
+ #and the number of worker processes
3
+ user nobody nogroup;
4
+ worker_processes 2;
5
+ #user www-data;
6
+ #worker_processes auto;
7
+
8
+ # setup where nginx will log errors to
9
+ # and where the nginx process id resides
10
+ error_log /var/log/nginx/error.log;
11
+ pid /var/run/nginx.pid;
12
+
13
+ events {
14
+ worker_connections 1024;
15
+ # set to on if you have more than 1 worker_processes
16
+ accept_mutex on;
17
+ }
18
+
19
+ http {
20
+ include /etc/nginx/mime.types;
21
+
22
+ default_type application/octet-stream;
23
+ access_log /tmp/nginx.access.log combined;
24
+
25
+ # use the kernel sendfile
26
+ # sendfile on; # this causes over-caching because modified timestamps lost in VM
27
+ # prepend http headers before sendfile()
28
+ tcp_nopush on;
29
+
30
+ keepalive_timeout 600;
31
+ tcp_nodelay on;
32
+
33
+ gzip on;
34
+ gzip_vary on;
35
+ gzip_min_length 500;
36
+
37
+ gzip_disable "MSIE [1-6]\.(?!.*SV1)";
38
+ gzip_types text/plain text/xml text/css
39
+ text/comma-separated-values
40
+ text/javascript application/x-javascript
41
+ application/atom+xml image/x-icon;
42
+
43
+ # configure the virtual host
44
+ server {
45
+ # replace with your domain name
46
+ # server_name inferno-server;
47
+
48
+ # port to listen for requests on
49
+ listen 80;
50
+
51
+ # maximum accepted body size of client request
52
+ client_max_body_size 4G;
53
+ # the server will close connections after this time
54
+ keepalive_timeout 600;
55
+
56
+ location / {
57
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58
+ proxy_set_header Host $http_host;
59
+ proxy_set_header X-Forwarded-Proto $scheme;
60
+ proxy_set_header X-Forwarded-Port $server_port;
61
+ proxy_redirect off;
62
+ proxy_set_header Connection '';
63
+ proxy_http_version 1.1;
64
+ chunked_transfer_encoding off;
65
+ proxy_buffering off;
66
+ proxy_cache off;
67
+
68
+ proxy_pass http://inferno:4567;
69
+ }
70
+
71
+ location /validator {
72
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
73
+ proxy_set_header Host $http_host;
74
+ proxy_set_header X-Forwarded-Proto $scheme;
75
+ proxy_set_header X-Forwarded-Port $server_port;
76
+ proxy_redirect off;
77
+ proxy_set_header Connection '';
78
+ proxy_http_version 1.1;
79
+ chunked_transfer_encoding off;
80
+ proxy_buffering off;
81
+ proxy_cache off;
82
+
83
+ proxy_pass http://fhir_validator_app;
84
+ }
85
+
86
+ location /validatorapi/ {
87
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
88
+ proxy_set_header Host $http_host;
89
+ proxy_set_header X-Forwarded-Proto $scheme;
90
+ proxy_set_header X-Forwarded-Port $server_port;
91
+ proxy_redirect off;
92
+ proxy_set_header Connection '';
93
+ proxy_http_version 1.1;
94
+ chunked_transfer_encoding off;
95
+ proxy_buffering off;
96
+ proxy_cache off;
97
+
98
+ proxy_pass http://validator_service:4567/;
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,2 @@
1
+ environment ENV.fetch('APP_ENV', 'development')
2
+ port ENV.fetch('INFERNO_PORT', 4567)
@@ -0,0 +1,11 @@
1
+ require 'inferno'
2
+
3
+ use Rack::Static,
4
+ urls: Inferno::Utils::StaticAssets.static_assets_map,
5
+ root: Inferno::Utils::StaticAssets.inferno_path
6
+
7
+ Inferno::Application.finalize!
8
+
9
+ use Inferno::Utils::Middleware::RequestLogger
10
+
11
+ run Inferno::Web.app
@@ -0,0 +1,30 @@
1
+ version: '3'
2
+ services:
3
+ validator_service:
4
+ image: infernocommunity/fhir-validator-service
5
+ # Update this path to match your directory structure
6
+ volumes:
7
+ - ./<%= ig_path %>:/home/igs
8
+ fhir_validator_app:
9
+ image: infernocommunity/fhir-validator-app
10
+ depends_on:
11
+ - validator_service
12
+ environment:
13
+ EXTERNAL_VALIDATOR_URL: http://localhost/validatorapi
14
+ VALIDATOR_BASE_PATH: /validator
15
+ nginx:
16
+ image: nginx
17
+ volumes:
18
+ - ./config/nginx.background.conf:/etc/nginx/nginx.conf
19
+ ports:
20
+ - "80:80"
21
+ command: [nginx, '-g', 'daemon off;']
22
+ depends_on:
23
+ - fhir_validator_app
24
+ redis:
25
+ image: redis
26
+ ports:
27
+ - "6379:6379"
28
+ volumes:
29
+ - ./data/redis:/data
30
+ command: redis-server --appendonly yes
@@ -0,0 +1,35 @@
1
+ version: '3'
2
+ services:
3
+ inferno:
4
+ build:
5
+ context: ./
6
+ volumes:
7
+ - ./data:/opt/inferno/data
8
+ depends_on:
9
+ - validator_service
10
+ worker:
11
+ build:
12
+ context: ./
13
+ volumes:
14
+ - ./data:/opt/inferno/data
15
+ command: bundle exec sidekiq -r ./worker.rb
16
+ depends_on:
17
+ - redis
18
+ validator_service:
19
+ extends:
20
+ file: docker-compose.background.yml
21
+ service: validator_service
22
+ fhir_validator_app:
23
+ extends:
24
+ file: docker-compose.background.yml
25
+ service: fhir_validator_app
26
+ nginx:
27
+ extends:
28
+ file: docker-compose.background.yml
29
+ service: nginx
30
+ volumes:
31
+ - ./config/nginx.conf:/etc/nginx/nginx.conf
32
+ redis:
33
+ extends:
34
+ file: docker-compose.background.yml
35
+ service: redis
@@ -0,0 +1,44 @@
1
+ module <%= module_name %>
2
+ class PatientGroup < Inferno::TestGroup
3
+ title 'Patient Tests'
4
+ description 'Verify that the server makes Patient resources available'
5
+ id :patient_group
6
+
7
+ test do
8
+ title 'Server returns requested Patient resource from the Patient read interaction'
9
+ description %(
10
+ Verify that Patient resources can be read from the server.
11
+ )
12
+
13
+ input :patient_id,
14
+ title: 'Patient ID'
15
+
16
+ # Named requests can be used by other tests
17
+ makes_request :patient
18
+
19
+ run do
20
+ fhir_read(:patient, patient_id, name: :patient)
21
+
22
+ assert_response_status(200)
23
+ assert_resource_type(:patient)
24
+ assert resource.id == patient_id,
25
+ "Requested resource with id #{patient_id}, received resource with id #{resource.id}"
26
+ end
27
+ end
28
+
29
+ test do
30
+ title 'Patient resource is valid'
31
+ description %(
32
+ Verify that the Patient resource returned from the server is a valid FHIR resource.
33
+ )
34
+ # This test will use the response from the :patient request in the
35
+ # previous test
36
+ uses_request :patient
37
+
38
+ run do
39
+ assert_resource_type(:patient)
40
+ assert_valid_resource
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '<%= library_name %>/patient_group'
2
+
3
+ module <%= module_name %>
4
+ class Suite < Inferno::TestSuite
5
+ id :<%= test_suite_id %>
6
+ title '<%= title_name %> Test Suite'
7
+ description 'Inferno <%= human_name.downcase %> test suite for FHIR'
8
+
9
+ # These inputs will be available to all tests in this suite
10
+ input :url,
11
+ title: 'FHIR Server Base Url'
12
+
13
+ input :credentials,
14
+ title: 'OAuth Credentials',
15
+ type: :oauth_credentials,
16
+ optional: true
17
+
18
+ # All FHIR requests in this suite will use this FHIR client
19
+ fhir_client do
20
+ url :url
21
+ oauth_credentials :credentials
22
+ end
23
+
24
+ # All FHIR validation requsets will use this FHIR validator
25
+ validator do
26
+ url ENV.fetch('VALIDATOR_URL')
27
+ end
28
+
29
+ # Tests and TestGroups can be defined inline
30
+ group do
31
+ id :capability_statement
32
+ title 'Capability Statement'
33
+ description 'Verify that the server has a CapabilityStatement'
34
+
35
+ test do
36
+ id :capability_statement_read
37
+ title 'Read CapabilityStatement'
38
+ description 'Read CapabilityStatement from /metadata endpoint'
39
+
40
+ run do
41
+ fhir_get_capability_statement
42
+
43
+ assert_response_status(200)
44
+ assert_resource_type(:capability_statement)
45
+ end
46
+ end
47
+ end
48
+
49
+ # Tests and TestGroups can be written in separate files and then included
50
+ # using their id
51
+ group from: :patient_group
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ docker compose build
3
+ docker compose up
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ docker compose pull
3
+ docker compose build
4
+ docker compose run inferno bundle exec inferno migrate
@@ -0,0 +1,105 @@
1
+ RSpec.describe <%= module_name %>::PatientGroup do
2
+ let(:suite) { Inferno::Repositories::TestSuites.new.find('<%= test_suite_id %>') }
3
+ let(:group) { suite.groups[1] }
4
+ let(:session_data_repo) { Inferno::Repositories::SessionData.new }
5
+ let(:test_session) { repo_create(:test_session, test_suite_id: '<%= test_suite_id %>') }
6
+ let(:url) { 'http://example.com/fhir' }
7
+ let(:error_outcome) { FHIR::OperationOutcome.new(issue: [{ severity: 'error' }]) }
8
+
9
+ def run(runnable, inputs = {})
10
+ test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash)
11
+ test_run = Inferno::Repositories::TestRuns.new.create(test_run_params)
12
+ inputs.each do |name, value|
13
+ session_data_repo.save(test_session_id: test_session.id, name: name, value: value, type: 'text')
14
+ end
15
+ Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable)
16
+ end
17
+
18
+ describe 'read test' do
19
+ let(:test) { group.tests.first }
20
+ let(:patient_id) { 'abc123' }
21
+
22
+ it 'passes if a Patient was received' do
23
+ resource = FHIR::Patient.new(id: patient_id)
24
+ stub_request(:get, "#{url}/Patient/#{patient_id}")
25
+ .to_return(status: 200, body: resource.to_json)
26
+
27
+ result = run(test, url: url, patient_id: patient_id)
28
+
29
+ expect(result.result).to eq('pass')
30
+ end
31
+
32
+ it 'fails if a 200 is not received' do
33
+ resource = FHIR::Patient.new(id: patient_id)
34
+ stub_request(:get, "#{url}/Patient/#{patient_id}")
35
+ .to_return(status: 201, body: resource.to_json)
36
+
37
+ result = run(test, url: url, patient_id: patient_id)
38
+
39
+ expect(result.result).to eq('fail')
40
+ expect(result.result_message).to match(/200/)
41
+ end
42
+
43
+ it 'fails if a Patient is not received' do
44
+ resource = FHIR::Condition.new(id: patient_id)
45
+ stub_request(:get, "#{url}/Patient/#{patient_id}")
46
+ .to_return(status: 200, body: resource.to_json)
47
+
48
+ result = run(test, url: url, patient_id: patient_id)
49
+
50
+ expect(result.result).to eq('fail')
51
+ expect(result.result_message).to match(/Patient/)
52
+ end
53
+
54
+ it 'fails if the id received does not match the one requested' do
55
+ resource = FHIR::Patient.new(id: '456')
56
+ stub_request(:get, "#{url}/Patient/#{patient_id}")
57
+ .to_return(status: 200, body: resource.to_json)
58
+
59
+ result = run(test, url: url, patient_id: patient_id)
60
+
61
+ expect(result.result).to eq('fail')
62
+ expect(result.result_message).to match(/resource with id/)
63
+ end
64
+ end
65
+
66
+ describe 'validation test' do
67
+ let(:test) { group.tests.last }
68
+
69
+ it 'passes if the resource is valid' do
70
+ stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate")
71
+ .with(query: hash_including({}))
72
+ .to_return(status: 200, body: FHIR::OperationOutcome.new.to_json)
73
+
74
+ resource = FHIR::Patient.new
75
+ repo_create(
76
+ :request,
77
+ name: :patient,
78
+ test_session_id: test_session.id,
79
+ response_body: resource.to_json
80
+ )
81
+
82
+ result = run(test)
83
+
84
+ expect(result.result).to eq('pass')
85
+ end
86
+
87
+ it 'fails if the resource is not valid' do
88
+ stub_request(:post, "#{ENV.fetch('VALIDATOR_URL')}/validate")
89
+ .with(query: hash_including({}))
90
+ .to_return(status: 200, body: error_outcome.to_json)
91
+
92
+ resource = FHIR::Patient.new
93
+ repo_create(
94
+ :request,
95
+ name: :patient,
96
+ test_session_id: test_session.id,
97
+ response_body: resource.to_json
98
+ )
99
+
100
+ result = run(test)
101
+
102
+ expect(result.result).to eq('fail')
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,141 @@
1
+ # Hide deprecation warnings
2
+ $VERBOSE = nil
3
+
4
+ ENV['APP_ENV'] ||= 'test'
5
+
6
+ require 'database_cleaner/sequel'
7
+ require 'pry'
8
+ require 'pry-byebug'
9
+
10
+ require 'webmock/rspec'
11
+ WebMock.disable_net_connect!
12
+
13
+ require 'factory_bot'
14
+
15
+ # This file was generated by the `rspec --init` command. Conventionally, all
16
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
17
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
18
+ # this file to always be loaded, without a need to explicitly require it in any
19
+ # files.
20
+ #
21
+ # Given that it is always loaded, you are encouraged to keep this file as
22
+ # light-weight as possible. Requiring heavyweight dependencies from this file
23
+ # will add to the boot time of your test suite on EVERY test run, even for an
24
+ # individual file that may not need all of that loaded. Instead, consider making
25
+ # a separate helper file that requires the additional dependencies and performs
26
+ # the additional setup, and require it from the spec files that actually need
27
+ # it.
28
+ #
29
+ # The `.rspec` file also contains a few flags that are not defaults but that
30
+ # users commonly want.
31
+ #
32
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
33
+ RSpec.configure do |config|
34
+ # rspec-expectations config goes here. You can use an alternate
35
+ # assertion/expectation library such as wrong or the stdlib/minitest
36
+ # assertions if you prefer.
37
+ config.expect_with :rspec do |expectations|
38
+ # This option will default to `true` in RSpec 4. It makes the `description`
39
+ # and `failure_message` of custom matchers include text for helper methods
40
+ # defined using `chain`, e.g.:
41
+ # be_bigger_than(2).and_smaller_than(4).description
42
+ # # => "be bigger than 2 and smaller than 4"
43
+ # ...rather than:
44
+ # # => "be bigger than 2"
45
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
46
+ end
47
+
48
+ # rspec-mocks config goes here. You can use an alternate test double
49
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
50
+ config.mock_with :rspec do |mocks|
51
+ # Prevents you from mocking or stubbing a method that does not exist on
52
+ # a real object. This is generally recommended, and will default to
53
+ # `true` in RSpec 4.
54
+ mocks.verify_partial_doubles = true
55
+ end
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = 'spec/examples.txt'
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
67
+ config.disable_monkey_patching!
68
+
69
+ # Many RSpec users commonly either run the entire suite or an individual
70
+ # file, and it's useful to allow more verbose output when running an
71
+ # individual spec file.
72
+ if config.files_to_run.one?
73
+ # Use the documentation formatter for detailed output,
74
+ # unless a formatter has already been configured
75
+ # (e.g. via a command-line flag).
76
+ config.default_formatter = 'doc'
77
+ end
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+
91
+ # These two settings work together to allow you to limit a spec run
92
+ # to individual examples or groups you care about by tagging them with
93
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
94
+ # get run.
95
+ config.filter_run :focus
96
+ config.run_all_when_everything_filtered = true
97
+
98
+ # This setting enables warnings. It's recommended, but in many cases may
99
+ # be too noisy due to issues in dependencies.
100
+ # config.warnings = false
101
+
102
+ # Print the 10 slowest examples and example groups at the
103
+ # end of the spec run, to help surface which specs are running
104
+ # particularly slow.
105
+ # config.profile_examples = 10
106
+
107
+ config.before(:suite) do
108
+ DatabaseCleaner.strategy = :transaction
109
+ DatabaseCleaner.clean_with(:truncation)
110
+ end
111
+
112
+ config.around do |example|
113
+ DatabaseCleaner.cleaning { example.run }
114
+ end
115
+
116
+ config.include FactoryBot::Syntax::Methods
117
+
118
+ config.before(:suite) do
119
+ FactoryBot.find_definitions
120
+ end
121
+ end
122
+
123
+ require 'inferno/config/application'
124
+ require 'inferno/utils/migration'
125
+ Inferno::Utils::Migration.new.run
126
+
127
+ require 'inferno'
128
+ Inferno::Application.finalize!
129
+
130
+ require Inferno::SpecSupport::FACTORY_BOT_SUPPORT_PATH
131
+
132
+ FactoryBot.definition_file_paths = [
133
+ Inferno::SpecSupport::FACTORY_PATH
134
+ ]
135
+
136
+ RSpec::Matchers.define_negated_matcher :exclude, :include
137
+
138
+ FHIR.logger = Inferno::Application['logger']
139
+
140
+ DatabaseCleaner[:sequel].strategy = :truncation
141
+ DatabaseCleaner[:sequel].db = Inferno::Application['db.connection']
@@ -0,0 +1,3 @@
1
+ require 'inferno'
2
+
3
+ Inferno::Application.finalize!
@@ -27,7 +27,7 @@ module Inferno
27
27
  suite_options:,
28
28
  validator_name: }
29
29
  ).insert(
30
- id: "#{validator_session_id}_#{validator_name}",
30
+ id: SecureRandom.uuid,
31
31
  validator_session_id:,
32
32
  test_suite_id:,
33
33
  validator_name:,
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.4.30'.freeze
3
+ VERSION = '0.4.31'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.30
4
+ version: 0.4.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-03-08 00:00:00.000000000 Z
13
+ date: 2024-03-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -551,6 +551,28 @@ files:
551
551
  - lib/inferno/apps/cli/suite.rb
552
552
  - lib/inferno/apps/cli/suite_input_template.rb
553
553
  - lib/inferno/apps/cli/suites.rb
554
+ - lib/inferno/apps/cli/templates/%library_name%.gemspec.tt
555
+ - lib/inferno/apps/cli/templates/Dockerfile.tt
556
+ - lib/inferno/apps/cli/templates/Gemfile.tt
557
+ - lib/inferno/apps/cli/templates/LICENSE.tt
558
+ - lib/inferno/apps/cli/templates/Procfile.tt
559
+ - lib/inferno/apps/cli/templates/README.md.tt
560
+ - lib/inferno/apps/cli/templates/Rakefile.tt
561
+ - lib/inferno/apps/cli/templates/config.ru.tt
562
+ - lib/inferno/apps/cli/templates/config/database.yml.tt
563
+ - lib/inferno/apps/cli/templates/config/nginx.background.conf.tt
564
+ - lib/inferno/apps/cli/templates/config/nginx.conf.tt
565
+ - lib/inferno/apps/cli/templates/config/puma.rb.tt
566
+ - lib/inferno/apps/cli/templates/docker-compose.background.yml.tt
567
+ - lib/inferno/apps/cli/templates/docker-compose.yml.tt
568
+ - lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt
569
+ - lib/inferno/apps/cli/templates/lib/%library_name%/igs/put_ig_package_dot_tgz_here
570
+ - lib/inferno/apps/cli/templates/lib/%library_name%/patient_group.rb.tt
571
+ - lib/inferno/apps/cli/templates/run.sh
572
+ - lib/inferno/apps/cli/templates/setup.sh
573
+ - lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt
574
+ - lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt
575
+ - lib/inferno/apps/cli/templates/worker.rb.tt
554
576
  - lib/inferno/apps/web/application.rb
555
577
  - lib/inferno/apps/web/controllers/controller.rb
556
578
  - lib/inferno/apps/web/controllers/requests/show.rb