inferno_core 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno/apps/cli/evaluate.rb +97 -0
  3. data/lib/inferno/apps/cli/main.rb +38 -0
  4. data/lib/inferno/apps/cli/templates/%library_name%.gemspec.tt +10 -3
  5. data/lib/inferno/apps/cli/templates/Dockerfile.tt +3 -2
  6. data/lib/inferno/apps/cli/templates/lib/%library_name%/metadata.rb.tt +18 -0
  7. data/lib/inferno/apps/cli/templates/lib/%library_name%/suite.rb.tt +59 -0
  8. data/lib/inferno/apps/cli/templates/lib/%library_name%/version.rb.tt +3 -0
  9. data/lib/inferno/apps/cli/templates/lib/%library_name%.rb.tt +1 -58
  10. data/lib/inferno/apps/web/serializers/input.rb +2 -1
  11. data/lib/inferno/apps/web/serializers/markdown_extractor.rb +16 -0
  12. data/lib/inferno/config/boot/presets.rb +18 -1
  13. data/lib/inferno/dsl/fhir_evaluation/config.rb +21 -0
  14. data/lib/inferno/dsl/fhir_evaluation/dataset_loader.rb +33 -0
  15. data/lib/inferno/dsl/fhir_evaluation/evaluation_context.rb +25 -0
  16. data/lib/inferno/dsl/fhir_evaluation/evaluation_result.rb +62 -0
  17. data/lib/inferno/dsl/fhir_evaluation/evaluator.rb +36 -0
  18. data/lib/inferno/dsl/fhir_evaluation/rule.rb +13 -0
  19. data/lib/inferno/dsl/suite_endpoint.rb +58 -58
  20. data/lib/inferno/dsl.rb +2 -0
  21. data/lib/inferno/entities/ig.rb +149 -0
  22. data/lib/inferno/entities/test_kit.rb +4 -2
  23. data/lib/inferno/entities/test_suite.rb +23 -3
  24. data/lib/inferno/entities.rb +2 -0
  25. data/lib/inferno/public/bundle.js +2 -2
  26. data/lib/inferno/repositories/igs.rb +9 -0
  27. data/lib/inferno/repositories/presets.rb +12 -6
  28. data/lib/inferno/result_summarizer.rb +2 -0
  29. data/lib/inferno/utils/ig_downloader.rb +3 -3
  30. data/lib/inferno/utils/named_thor_actions.rb +5 -1
  31. data/lib/inferno/version.rb +1 -1
  32. data/spec/extract_tgz_helper.rb +13 -0
  33. metadata +17 -5
  34. data/lib/inferno/public/175.bundle.js +0 -1
  35. data/lib/inferno/public/217.bundle.js +0 -1
@@ -0,0 +1,9 @@
1
+ require_relative 'in_memory_repository'
2
+
3
+ module Inferno
4
+ module Repositories
5
+ # Repository that deals with persistence for the `IG` entity.
6
+ class IGs < InMemoryRepository
7
+ end
8
+ end
9
+ end
@@ -8,14 +8,20 @@ module Inferno
8
8
  # Repository that deals with persistence for the `Preset` entity.
9
9
  class Presets < InMemoryRepository
10
10
  def insert_from_file(path)
11
- case path
12
- when /\.json$/
13
- preset_hash = JSON.parse(File.read(path))
14
- when /\.erb$/
15
- templated = ERB.new(File.read(path)).result
16
- preset_hash = JSON.parse(templated)
11
+ raw_contents =
12
+ case path
13
+ when /\.json$/
14
+ File.read(path)
15
+ when /\.erb$/
16
+ ERB.new(File.read(path)).result
17
+ end
18
+
19
+ if Application['base_url'].start_with? 'https://inferno-qa.healthit.gov'
20
+ raw_contents.gsub!('https://inferno.healthit.gov', 'https://inferno-qa.healthit.gov')
17
21
  end
18
22
 
23
+ preset_hash = JSON.parse(raw_contents)
24
+
19
25
  preset_hash.deep_symbolize_keys!
20
26
  preset_hash[:id] ||= SecureRandom.uuid
21
27
  preset = Entities::Preset.new(preset_hash)
@@ -12,6 +12,8 @@ module Inferno
12
12
  end
13
13
 
14
14
  def summarize
15
+ return 'wait' if results.any? { |result| result.result == 'wait' }
16
+
15
17
  return 'pass' if optional_results_passing_criteria_met?
16
18
 
17
19
  prioritized_result_strings.find { |result_string| unique_result_strings.include? result_string }
@@ -14,7 +14,7 @@ module Inferno
14
14
  File.join(ig_path, suffix ? "package_#{suffix}.tgz" : 'package.tgz')
15
15
  end
16
16
 
17
- def load_ig(ig_input, idx = nil, thor_config = { verbose: true })
17
+ def load_ig(ig_input, idx = nil, thor_config = { verbose: true }, output_path = nil)
18
18
  case ig_input
19
19
  when FHIR_PACKAGE_NAME_REG_EX
20
20
  uri = ig_registry_url(ig_input)
@@ -25,12 +25,12 @@ module Inferno
25
25
  else
26
26
  raise StandardError, <<~FAILED_TO_LOAD
27
27
  Could not find implementation guide: #{ig_input}
28
- Put its package.tgz file directly in #{ig_path}
29
28
  FAILED_TO_LOAD
30
29
  end
31
30
 
31
+ destination = output_path || ig_file(idx)
32
32
  # use Thor's get to support CLI options config
33
- get(uri, ig_file(idx), thor_config)
33
+ get(uri, destination, thor_config)
34
34
  uri
35
35
  end
36
36
 
@@ -25,8 +25,12 @@ module Inferno
25
25
  human_name.split.map(&:capitalize).join(' ')
26
26
  end
27
27
 
28
+ def test_kit_id
29
+ library_name.delete_suffix('_test_kit')
30
+ end
31
+
28
32
  def test_suite_id
29
- "#{library_name}_test_suite"
33
+ test_kit_id
30
34
  end
31
35
  end
32
36
  end
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.5.2'.freeze
3
+ VERSION = '0.5.4'.freeze
4
4
  end
@@ -0,0 +1,13 @@
1
+ module ExtractTGZHelper
2
+ def extract_tgz(fixture)
3
+ filename = File.basename(fixture, '.tgz')
4
+ target_dir = Dir.mktmpdir(filename)
5
+ system "mkdir -p #{target_dir}"
6
+ system "tar -xzf #{fixture} --directory #{target_dir}"
7
+ target_dir
8
+ end
9
+
10
+ def cleanup(target_dir)
11
+ FileUtils.remove_entry(target_dir)
12
+ end
13
+ 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.5.2
4
+ version: 0.5.4
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-12-06 00:00:00.000000000 Z
13
+ date: 2024-12-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -390,6 +390,7 @@ files:
390
390
  - lib/inferno.rb
391
391
  - lib/inferno/apps/cli.rb
392
392
  - lib/inferno/apps/cli/console.rb
393
+ - lib/inferno/apps/cli/evaluate.rb
393
394
  - lib/inferno/apps/cli/execute.rb
394
395
  - lib/inferno/apps/cli/execute/console_outputter.rb
395
396
  - lib/inferno/apps/cli/execute/json_outputter.rb
@@ -432,7 +433,10 @@ files:
432
433
  - lib/inferno/apps/cli/templates/lib/%library_name%/igs/.keep
433
434
  - lib/inferno/apps/cli/templates/lib/%library_name%/igs/README.md
434
435
  - lib/inferno/apps/cli/templates/lib/%library_name%/igs/put_ig_package_dot_tgz_here
436
+ - lib/inferno/apps/cli/templates/lib/%library_name%/metadata.rb.tt
435
437
  - lib/inferno/apps/cli/templates/lib/%library_name%/patient_group.rb.tt
438
+ - lib/inferno/apps/cli/templates/lib/%library_name%/suite.rb.tt
439
+ - lib/inferno/apps/cli/templates/lib/%library_name%/version.rb.tt
436
440
  - lib/inferno/apps/cli/templates/run.sh
437
441
  - lib/inferno/apps/cli/templates/setup.sh
438
442
  - lib/inferno/apps/cli/templates/spec/%library_name%/patient_group_spec.rb.tt
@@ -461,6 +465,7 @@ files:
461
465
  - lib/inferno/apps/web/serializers/hash_value_extractor.rb
462
466
  - lib/inferno/apps/web/serializers/header.rb
463
467
  - lib/inferno/apps/web/serializers/input.rb
468
+ - lib/inferno/apps/web/serializers/markdown_extractor.rb
464
469
  - lib/inferno/apps/web/serializers/message.rb
465
470
  - lib/inferno/apps/web/serializers/preset.rb
466
471
  - lib/inferno/apps/web/serializers/request.rb
@@ -500,6 +505,12 @@ files:
500
505
  - lib/inferno/dsl/configurable.rb
501
506
  - lib/inferno/dsl/fhir_client.rb
502
507
  - lib/inferno/dsl/fhir_client_builder.rb
508
+ - lib/inferno/dsl/fhir_evaluation/config.rb
509
+ - lib/inferno/dsl/fhir_evaluation/dataset_loader.rb
510
+ - lib/inferno/dsl/fhir_evaluation/evaluation_context.rb
511
+ - lib/inferno/dsl/fhir_evaluation/evaluation_result.rb
512
+ - lib/inferno/dsl/fhir_evaluation/evaluator.rb
513
+ - lib/inferno/dsl/fhir_evaluation/rule.rb
503
514
  - lib/inferno/dsl/fhir_resource_validation.rb
504
515
  - lib/inferno/dsl/fhir_validation.rb
505
516
  - lib/inferno/dsl/fhirpath_evaluation.rb
@@ -523,6 +534,7 @@ files:
523
534
  - lib/inferno/entities/entity.rb
524
535
  - lib/inferno/entities/has_runnable.rb
525
536
  - lib/inferno/entities/header.rb
537
+ - lib/inferno/entities/ig.rb
526
538
  - lib/inferno/entities/input.rb
527
539
  - lib/inferno/entities/message.rb
528
540
  - lib/inferno/entities/preset.rb
@@ -546,8 +558,6 @@ files:
546
558
  - lib/inferno/jobs/invoke_validator_session.rb
547
559
  - lib/inferno/jobs/resume_test_run.rb
548
560
  - lib/inferno/public/0e0b993fd6ff351f435ff1c2938daf2d.png
549
- - lib/inferno/public/175.bundle.js
550
- - lib/inferno/public/217.bundle.js
551
561
  - lib/inferno/public/237.bundle.js
552
562
  - lib/inferno/public/a5cd39450ab0336db73c5e57228b649d.png
553
563
  - lib/inferno/public/assets.json
@@ -557,6 +567,7 @@ files:
557
567
  - lib/inferno/public/logo192.png
558
568
  - lib/inferno/repositories.rb
559
569
  - lib/inferno/repositories/headers.rb
570
+ - lib/inferno/repositories/igs.rb
560
571
  - lib/inferno/repositories/in_memory_repository.rb
561
572
  - lib/inferno/repositories/messages.rb
562
573
  - lib/inferno/repositories/presets.rb
@@ -588,6 +599,7 @@ files:
588
599
  - lib/inferno/utils/static_assets.rb
589
600
  - lib/inferno/utils/verify_runnable.rb
590
601
  - lib/inferno/version.rb
602
+ - spec/extract_tgz_helper.rb
591
603
  - spec/factories/header.rb
592
604
  - spec/factories/message.rb
593
605
  - spec/factories/request.rb
@@ -627,7 +639,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
627
639
  - !ruby/object:Gem::Version
628
640
  version: '0'
629
641
  requirements: []
630
- rubygems_version: 3.5.9
642
+ rubygems_version: 3.3.7
631
643
  signing_key:
632
644
  specification_version: 4
633
645
  summary: Inferno Core is an open source tool for testing data exchanges enabled by
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkinferno_web_app=self.webpackChunkinferno_web_app||[]).push([[175],{9175:(t,e,n)=>{n.r(e),n.d(e,{getCLS:()=>d,getFCP:()=>m,getFID:()=>v,getLCP:()=>h,getTTFB:()=>S});var i,a,r=function(t){return{name:t,value:arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,delta:0,entries:[],id:"".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),isFinal:!1}},o=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},s=!1,u=!1,c=function(t){s=!t.persisted},p=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];u||(addEventListener("pagehide",c),addEventListener("beforeunload",(function(){})),u=!0),addEventListener("visibilitychange",(function(e){var n=e.timeStamp;"hidden"===document.visibilityState&&t({timeStamp:n,isUnloading:s})}),{capture:!0,once:e})},l=function(t,e,n,i){var a;return function(){n&&e.isFinal&&n.disconnect(),e.value>=0&&(i||e.isFinal||"hidden"===document.visibilityState)&&(e.delta=e.value-(a||0),(e.delta||e.isFinal||void 0===a)&&(t(e),a=e.value))}},d=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=r("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),e())},s=o("layout-shift",a);s&&(e=l(t,i,s,n),p((function(t){var n=t.isUnloading;s.takeRecords().map(a),n&&(i.isFinal=!0),e()})))},f=function(){return void 0===i&&(i="hidden"===document.visibilityState?0:1/0,p((function(t){var e=t.timeStamp;return i=e}),!0)),{get timeStamp(){return i}}},m=function(t){var e,n=r("FCP"),i=f(),a=o("paint",(function(t){"first-contentful-paint"===t.name&&t.startTime<i.timeStamp&&(n.value=t.startTime,n.isFinal=!0,n.entries.push(t),e())}));a&&(e=l(t,n,a))},v=function(t){var e=r("FID"),n=f(),i=function(t){t.startTime<n.timeStamp&&(e.value=t.processingStart-t.startTime,e.entries.push(t),e.isFinal=!0,s())},a=o("first-input",i),s=l(t,e,a);a?p((function(){a.takeRecords().map(i),a.disconnect()}),!0):window.perfMetrics&&window.perfMetrics.onFirstInputDelay&&window.perfMetrics.onFirstInputDelay((function(t,i){i.timeStamp<n.timeStamp&&(e.value=t,e.isFinal=!0,e.entries=[{entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+t}],s())}))},g=function(){return a||(a=new Promise((function(t){return["scroll","keydown","pointerdown"].map((function(e){addEventListener(e,t,{once:!0,passive:!0,capture:!0})}))}))),a},h=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=r("LCP"),a=f(),s=function(t){var n=t.startTime;n<a.timeStamp?(i.value=n,i.entries.push(t)):i.isFinal=!0,e()},u=o("largest-contentful-paint",s);if(u){e=l(t,i,u,n);var c=function(){i.isFinal||(u.takeRecords().map(s),i.isFinal=!0,e())};g().then(c),p(c,!0)}},S=function(t){var e,n=r("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();n.value=n.delta=e.responseStart,n.entries=[e],n.isFinal=!0,t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkinferno_web_app=self.webpackChunkinferno_web_app||[]).push([[217],{3217:(t,e,n)=>{n.r(e),n.d(e,{getCLS:()=>d,getFCP:()=>m,getFID:()=>v,getLCP:()=>h,getTTFB:()=>S});var i,a,r=function(t){return{name:t,value:arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,delta:0,entries:[],id:"".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),isFinal:!1}},o=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},s=!1,u=!1,c=function(t){s=!t.persisted},p=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];u||(addEventListener("pagehide",c),addEventListener("beforeunload",(function(){})),u=!0),addEventListener("visibilitychange",(function(e){var n=e.timeStamp;"hidden"===document.visibilityState&&t({timeStamp:n,isUnloading:s})}),{capture:!0,once:e})},l=function(t,e,n,i){var a;return function(){n&&e.isFinal&&n.disconnect(),e.value>=0&&(i||e.isFinal||"hidden"===document.visibilityState)&&(e.delta=e.value-(a||0),(e.delta||e.isFinal||void 0===a)&&(t(e),a=e.value))}},d=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=r("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),e())},s=o("layout-shift",a);s&&(e=l(t,i,s,n),p((function(t){var n=t.isUnloading;s.takeRecords().map(a),n&&(i.isFinal=!0),e()})))},f=function(){return void 0===i&&(i="hidden"===document.visibilityState?0:1/0,p((function(t){var e=t.timeStamp;return i=e}),!0)),{get timeStamp(){return i}}},m=function(t){var e,n=r("FCP"),i=f(),a=o("paint",(function(t){"first-contentful-paint"===t.name&&t.startTime<i.timeStamp&&(n.value=t.startTime,n.isFinal=!0,n.entries.push(t),e())}));a&&(e=l(t,n,a))},v=function(t){var e=r("FID"),n=f(),i=function(t){t.startTime<n.timeStamp&&(e.value=t.processingStart-t.startTime,e.entries.push(t),e.isFinal=!0,s())},a=o("first-input",i),s=l(t,e,a);a?p((function(){a.takeRecords().map(i),a.disconnect()}),!0):window.perfMetrics&&window.perfMetrics.onFirstInputDelay&&window.perfMetrics.onFirstInputDelay((function(t,i){i.timeStamp<n.timeStamp&&(e.value=t,e.isFinal=!0,e.entries=[{entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+t}],s())}))},g=function(){return a||(a=new Promise((function(t){return["scroll","keydown","pointerdown"].map((function(e){addEventListener(e,t,{once:!0,passive:!0,capture:!0})}))}))),a},h=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=r("LCP"),a=f(),s=function(t){var n=t.startTime;n<a.timeStamp?(i.value=n,i.entries.push(t)):i.isFinal=!0,e()},u=o("largest-contentful-paint",s);if(u){e=l(t,i,u,n);var c=function(){i.isFinal||(u.takeRecords().map(s),i.isFinal=!0,e())};g().then(c),p(c,!0)}},S=function(t){var e,n=r("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();n.value=n.delta=e.responseStart,n.entries=[e],n.isFinal=!0,t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]);