Skip to content

Commit

Permalink
Rubocop temporarily addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
jhlee-mitre committed Nov 15, 2024
1 parent 18c0c06 commit 58446f2
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 980 deletions.
38 changes: 19 additions & 19 deletions lib/inferno/dsl/fhir_evaluator/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ class Config
DEFAULT_FILE = File.join(EVALUATOR_HOME, 'config', 'default.yml')
attr_accessor :data

def initialize(config_file = nil)
@data = if config_file.nil?
YAML.load_file(File.absolute_path(DEFAULT_FILE))
else
YAML.load_file(File.absolute_path(config_file))
end
# def initialize(config_file = nil)
# @data = if config_file.nil?
# YAML.load_file(File.absolute_path(DEFAULT_FILE))
# else
# YAML.load_file(File.absolute_path(config_file))
# end

raise(TypeError, 'Malformed configuration') unless @data.is_a?(Hash)
# raise(TypeError, 'Malformed configuration') unless @data.is_a?(Hash)

def method_missing(name, *args, &)
section = @data[name.to_s]
if section
Section.new(section)
else
super
end
end
# def method_missing(name, *args, &)
# section = @data[name.to_s]
# if section
# Section.new(section)
# else
# super
# end
# end

def respond_to_missing?(name, include_private = false)
@data.key?(name.to_s) || super
end
end
# def respond_to_missing?(name, include_private = false)
# @data.key?(name.to_s) || super
# end
# end

class Section
def initialize(details)
Expand Down
20 changes: 10 additions & 10 deletions lib/inferno/dsl/fhir_evaluator/data_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ def validate(data)
end

def summarize(data)
@root_resource_ids = data.map { |r| { type: r.resourceType, id: r.id } }
@root_bundle_resource_ids = data.map { |r| { type: r.resourceType, id: r.id } if r.resourceType == 'Bundle' }
# @root_resource_ids = data.map { |r| { type: r.resourceType, id: r.id } }
# @root_bundle_resource_ids = data.map { |r| { type: r.resourceType, id: r.id } if r.resourceType == 'Bundle' }

id_hash = Hash.new { |hash, key| hash[key] = [] }
data.map { |e| resources(e) }.flatten.each do |item|
id_hash[item[:type]] << item[:id]
end
@domain_resource_ids = id_hash.to_a
# id_hash = Hash.new { |hash, key| hash[key] = [] }
# data.map { |e| resources(e) }.flatten.each do |item|
# id_hash[item[:type]] << item[:id]
# end
# @domain_resource_ids = id_hash.to_a

@resource_profile_map = data.map { |e| resources_profiles(e) }.flatten.uniq
@resource_patient_map = data.map { |e| resources_patients(e) }.flatten.uniq
@resource_subject_map = data.map { |e| resources_subjects(e) }.flatten.uniq
# @resource_profile_map = data.map { |e| resources_profiles(e) }.flatten.uniq
# @resource_patient_map = data.map { |e| resources_patients(e) }.flatten.uniq
# @resource_subject_map = data.map { |e| resources_subjects(e) }.flatten.uniq
end

def resources_ids(resource)
Expand Down
40 changes: 20 additions & 20 deletions lib/inferno/dsl/fhir_evaluator/evaluator_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,26 @@ def extract_ids_references(resources)
end

def extract_references(resources)
resources.each do |resource|
resource.each_element do |value, metadata, path|
if metadata['type'] == 'Reference' && !value.reference.nil?
if value.reference.start_with?('#')
# skip contained references (not separate resources)
next
elsif value.reference.include? '/'
add_parsed_reference(resource, value, path)
# if type is not specified in the reference, get type from the
elsif path.include? 'Reference'
add_reference_typed_path(resource, value, path)
else
# assumes this is a unique uuid
reference = value.reference
reference = reference[9..] if reference.start_with? 'urn:uuid:'
@references[resource.id] << [path, '', reference]
end
end
end
end
# resources.each do |resource|
# resource.each_element do |value, metadata, path|
# if metadata['type'] == 'Reference' && !value.reference.nil?
# if value.reference.start_with?('#')
# # skip contained references (not separate resources)
# next
# elsif value.reference.include? '/'
# add_parsed_reference(resource, value, path)
# # if type is not specified in the reference, get type from the
# elsif path.include? 'Reference'
# add_reference_typed_path(resource, value, path)
# else
# # assumes this is a unique uuid
# reference = value.reference
# reference = reference[9..] if reference.start_with? 'urn:uuid:'
# @references[resource.id] << [path, '', reference]
# end
# end
# end
# end
end

def add_parsed_reference(resource, value, path)
Expand Down
27 changes: 0 additions & 27 deletions lib/inferno/dsl/fhir_evaluator/rules/abstract_has_examples_rule.rb

This file was deleted.

This file was deleted.

71 changes: 0 additions & 71 deletions lib/inferno/dsl/fhir_evaluator/rules/all_extensions_used.rb

This file was deleted.

Loading

0 comments on commit 58446f2

Please sign in to comment.