inferno_core 0.4.29 → 0.4.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/apps/cli/new.rb +42 -18
  3. data/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +26 -0
  4. data/lib/inferno/apps/cli/templates/Dockerfile.tt +22 -0
  5. data/lib/inferno/apps/cli/templates/Gemfile.tt +9 -0
  6. data/lib/inferno/apps/cli/templates/LICENSE.tt +201 -0
  7. data/lib/inferno/apps/cli/templates/Procfile.tt +2 -0
  8. data/lib/inferno/apps/cli/templates/README.md.tt +41 -0
  9. data/lib/inferno/apps/cli/templates/Rakefile.tt +15 -0
  10. data/lib/inferno/apps/cli/templates/config/database.yml.tt +18 -0
  11. data/lib/inferno/apps/cli/templates/config/nginx.background.conf.tt +86 -0
  12. data/lib/inferno/apps/cli/templates/config/nginx.conf.tt +101 -0
  13. data/lib/inferno/apps/cli/templates/config/puma.rb.tt +2 -0
  14. data/lib/inferno/apps/cli/templates/config.ru.tt +11 -0
  15. data/lib/inferno/apps/cli/templates/docker-compose.background.yml.tt +30 -0
  16. data/lib/inferno/apps/cli/templates/docker-compose.yml.tt +35 -0
  17. data/lib/inferno/apps/cli/templates/lib/%library_name%/igs/put_ig_package_dot_tgz_here +0 -0
  18. data/lib/inferno/apps/cli/templates/lib/%library_name%/patient_group.rb.tt +44 -0
  19. data/lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt +53 -0
  20. data/lib/inferno/apps/cli/templates/run.sh +3 -0
  21. data/lib/inferno/apps/cli/templates/setup.sh +4 -0
  22. data/lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt +105 -0
  23. data/lib/inferno/apps/cli/templates/spec/spec_helper.rb.tt +141 -0
  24. data/lib/inferno/apps/cli/templates/worker.rb.tt +3 -0
  25. data/lib/inferno/db/migrations/010_add_validator_sessions.rb +14 -0
  26. data/lib/inferno/db/schema.rb +14 -0
  27. data/lib/inferno/dsl/fhir_client_builder.rb +1 -1
  28. data/lib/inferno/dsl/fhir_resource_validation.rb +21 -7
  29. data/lib/inferno/dsl/http_client_builder.rb +1 -1
  30. data/lib/inferno/entities/validator_session.rb +22 -0
  31. data/lib/inferno/entities.rb +1 -0
  32. data/lib/inferno/jobs/invoke_validator_session.rb +3 -3
  33. data/lib/inferno/public/175.bundle.js +1 -0
  34. data/lib/inferno/public/assets.json +1 -1
  35. data/lib/inferno/public/bundle.js +21 -21
  36. data/lib/inferno/public/bundle.js.LICENSE.txt +17 -5
  37. data/lib/inferno/repositories/validator_sessions.rb +58 -0
  38. data/lib/inferno/repositories.rb +1 -0
  39. data/lib/inferno/utils/ig_downloader.rb +57 -0
  40. data/lib/inferno/version.rb +1 -1
  41. metadata +29 -2
@@ -60,15 +60,27 @@
60
60
  */
61
61
 
62
62
  /**
63
- * @mui/styled-engine v5.13.2
63
+ * @license React
64
+ * use-sync-external-store-shim.production.min.js
65
+ *
66
+ * Copyright (c) Facebook, Inc. and its affiliates.
67
+ *
68
+ * This source code is licensed under the MIT license found in the
69
+ * LICENSE file in the root directory of this source tree.
70
+ */
71
+
72
+ /**
73
+ * @license React
74
+ * use-sync-external-store-shim/with-selector.production.min.js
75
+ *
76
+ * Copyright (c) Facebook, Inc. and its affiliates.
64
77
  *
65
- * @license MIT
66
78
  * This source code is licensed under the MIT license found in the
67
79
  * LICENSE file in the root directory of this source tree.
68
80
  */
69
81
 
70
82
  /**
71
- * @remix-run/router v1.6.3
83
+ * @remix-run/router v1.15.2
72
84
  *
73
85
  * Copyright (c) Remix Software Inc.
74
86
  *
@@ -79,7 +91,7 @@
79
91
  */
80
92
 
81
93
  /**
82
- * React Router DOM v6.12.0
94
+ * React Router DOM v6.22.2
83
95
  *
84
96
  * Copyright (c) Remix Software Inc.
85
97
  *
@@ -90,7 +102,7 @@
90
102
  */
91
103
 
92
104
  /**
93
- * React Router v6.12.0
105
+ * React Router v6.22.2
94
106
  *
95
107
  * Copyright (c) Remix Software Inc.
96
108
  *
@@ -0,0 +1,58 @@
1
+ require 'base62-rb'
2
+ require_relative 'repository'
3
+
4
+ module Inferno
5
+ module Repositories
6
+ class ValidatorSessions < Repository
7
+ def save(params)
8
+ validator_session_id = params[:validator_session_id]
9
+ validator_name = params[:validator_name]
10
+ test_suite_id = params[:test_suite_id]
11
+ raw_suite_options = params[:suite_options]
12
+ time = Time.now
13
+
14
+ suite_options =
15
+ if raw_suite_options.blank?
16
+ '[]'
17
+ else
18
+ raw_suite_options.sort.to_s
19
+ end
20
+
21
+ db.insert_conflict(
22
+ target: [:test_suite_id,
23
+ :suite_options,
24
+ :validator_name],
25
+ update: { validator_session_id:,
26
+ test_suite_id:,
27
+ suite_options:,
28
+ validator_name: }
29
+ ).insert(
30
+ id: SecureRandom.uuid,
31
+ validator_session_id:,
32
+ test_suite_id:,
33
+ validator_name:,
34
+ suite_options:,
35
+ last_accessed: time
36
+ )
37
+ end
38
+
39
+ def find_validator_session_id(test_suite_id, validator_name, suite_options)
40
+ suite_options = suite_options.nil? ? '[]' : suite_options.sort.to_s
41
+ session = self.class::Model
42
+ .find(test_suite_id:, validator_name:, suite_options:)
43
+ return nil if session.nil?
44
+
45
+ time = Time.now
46
+ session.update(last_accessed: time)
47
+ session[:validator_session_id]
48
+ end
49
+
50
+ class Model < Sequel::Model(db)
51
+ def before_save
52
+ time = Time.now
53
+ self.last_accessed ||= time
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -15,6 +15,7 @@ unless ENV['NO_DB']&.casecmp? 'true'
15
15
  require_relative 'repositories/session_data'
16
16
  require_relative 'repositories/test_runs'
17
17
  require_relative 'repositories/test_sessions'
18
+ require_relative 'repositories/validator_sessions'
18
19
  end
19
20
 
20
21
  module Inferno
@@ -0,0 +1,57 @@
1
+ module Inferno
2
+ module Utils
3
+ module IgDownloader
4
+ FHIR_PACKAGE_NAME_REG_EX = /^[a-z][a-zA-Z0-9-]*\.([a-z][a-zA-Z0-9-]*\.?)*/
5
+ HTTP_URI_REG_EX = %r{^https?://[^/?#]+[^?#]*}
6
+ FILE_URI_REG_EX = %r{^file://(.+)}
7
+ HTTP_URI_END_REG_EX = %r{[^/]*\.x?html?$}
8
+
9
+ def ig_path
10
+ File.join('lib', library_name, 'igs')
11
+ end
12
+
13
+ def ig_file(suffix = nil)
14
+ File.join(ig_path, suffix ? "package_#{suffix}.tgz" : 'package.tgz')
15
+ end
16
+
17
+ def load_ig(ig_input, idx = nil, thor_config = { verbose: true })
18
+ case ig_input
19
+ when FHIR_PACKAGE_NAME_REG_EX
20
+ uri = ig_registry_url(ig_input)
21
+ when HTTP_URI_REG_EX
22
+ uri = ig_http_url(ig_input)
23
+ when FILE_URI_REG_EX
24
+ uri = ig_input[7..]
25
+ else
26
+ raise StandardError, <<~FAILED_TO_LOAD
27
+ Could not find implementation guide: #{ig_input}
28
+ Put its package.tgz file directly in #{ig_path}
29
+ FAILED_TO_LOAD
30
+ end
31
+
32
+ # use Thor's get to support CLI options config
33
+ get(uri, ig_file(idx), thor_config)
34
+ uri
35
+ end
36
+
37
+ def ig_registry_url(ig_npm_style)
38
+ unless ig_npm_style.include? '@'
39
+ raise StandardError, <<~NO_VERSION
40
+ No IG version specified for #{ig_npm_style}; you must specify one with '@'. I.e: hl7.fhir.us.core@6.1.0
41
+ NO_VERSION
42
+ end
43
+
44
+ package_name, version = ig_npm_style.split('@')
45
+ "https://packages.fhir.org/#{package_name}/-/#{package_name}-#{version}.tgz"
46
+ end
47
+
48
+ def ig_http_url(ig_page_url)
49
+ return ig_page_url if ig_page_url.end_with? 'package.tgz'
50
+
51
+ return "#{ig_page_url}package.tgz" if ig_page_url.end_with? '/'
52
+
53
+ ig_page_url.gsub(HTTP_URI_END_REG_EX, 'package.tgz')
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.4.29'.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.29
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-02-12 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
@@ -603,6 +625,7 @@ files:
603
625
  - lib/inferno/db/migrations/007_add_suite_options.rb
604
626
  - lib/inferno/db/migrations/008_remove_timestamps.rb
605
627
  - lib/inferno/db/migrations/009_add_request_tags.rb
628
+ - lib/inferno/db/migrations/010_add_validator_sessions.rb
606
629
  - lib/inferno/db/schema.rb
607
630
  - lib/inferno/dsl.rb
608
631
  - lib/inferno/dsl/assertions.rb
@@ -637,6 +660,7 @@ files:
637
660
  - lib/inferno/entities/test_run.rb
638
661
  - lib/inferno/entities/test_session.rb
639
662
  - lib/inferno/entities/test_suite.rb
663
+ - lib/inferno/entities/validator_session.rb
640
664
  - lib/inferno/exceptions.rb
641
665
  - lib/inferno/ext/fhir_client.rb
642
666
  - lib/inferno/ext/fhir_models.rb
@@ -645,6 +669,7 @@ files:
645
669
  - lib/inferno/jobs/invoke_validator_session.rb
646
670
  - lib/inferno/jobs/resume_test_run.rb
647
671
  - lib/inferno/public/0e0b993fd6ff351f435ff1c2938daf2d.png
672
+ - lib/inferno/public/175.bundle.js
648
673
  - lib/inferno/public/217.bundle.js
649
674
  - lib/inferno/public/a5cd39450ab0336db73c5e57228b649d.png
650
675
  - lib/inferno/public/assets.json
@@ -668,9 +693,11 @@ files:
668
693
  - lib/inferno/repositories/test_suites.rb
669
694
  - lib/inferno/repositories/tests.rb
670
695
  - lib/inferno/repositories/validate_runnable_reference.rb
696
+ - lib/inferno/repositories/validator_sessions.rb
671
697
  - lib/inferno/result_summarizer.rb
672
698
  - lib/inferno/spec_support.rb
673
699
  - lib/inferno/test_runner.rb
700
+ - lib/inferno/utils/ig_downloader.rb
674
701
  - lib/inferno/utils/markdown_formatter.rb
675
702
  - lib/inferno/utils/middleware/request_logger.rb
676
703
  - lib/inferno/utils/migration.rb