Module: Inferno::DSL::FHIREvaluation::DatasetLoader

Defined in:
lib/inferno/dsl/fhir_evaluation/dataset_loader.rb

Class Method Summary collapse

Class Method Details

.from_contents(source_array) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/inferno/dsl/fhir_evaluation/dataset_loader.rb', line 5

def self.from_contents(source_array)
  dataset = []

  source_array.each do |json|
    resource = FHIR::Json.from_json(json)
    next if resource.nil?

    dataset.push resource
  end

  dataset
end

.from_path(path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/inferno/dsl/fhir_evaluation/dataset_loader.rb', line 18

def self.from_path(path)
  dataset = []

  Dir["#{path}/*.json"].each do |f|
    resource = FHIR::Json.from_json(File.read(f))
    next if resource.nil?

    dataset.push resource
  end

  dataset
end