Skip to content

Commit

Permalink
Merge pull request fhir-crucible#18 from fhir-crucible/update_get_dis…
Browse files Browse the repository at this point in the history
…play

Removed single-character variable name in get_display, and switched t…
  • Loading branch information
jawalonoski committed Jan 12, 2017
2 parents 66ec645 + 28b0123 commit ce5b4f1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/fhir_models/bootstrap/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,25 @@ def self.get_codes(uri)
def self.get_display(uri, code)
return nil if uri.nil? || code.nil?
load_expansions
valuesets = @@expansions.select { |x| !x['compose']['include'].select {|i| i['system'] == uri }.empty? }
valuesets = @@expansions.select { |x| x['compose']['include'].detect {|i| i['system'] == uri } }
valuesets += @@valuesets.select { |x| x['url'] == uri }
c = nil
code_hash = nil
valuesets.each do |valueset|
if !valueset['expansion'].nil? && !valueset['expansion']['contains'].nil?
c = valueset['expansion']['contains'].select { |x| x['system'] == uri && x['code'] == code}.first
code_hash = valueset['expansion']['contains'].select { |x| x['system'] == uri && x['code'] == code}.first
elsif !valueset['compose'].nil? && !valueset['compose']['include'].nil?
included_systems = valueset['compose']['include'].map { |x| x['system'] }.uniq
systems = @@valuesets.select { |x| x['resourceType'] == 'CodeSystem' && included_systems.include?(x['url']) }
systems.each do |x|
c = x['concept'].select { |con| con['url'] == uri && con['code'] == code }.first if x['concept']
break if c
code_hash = x['concept'].select { |con| con['url'] == uri && con['code'] == code }.first if x['concept']
break if code_hash
end
elsif valueset['concept']
c = valueset['concept'].select { |v| v['code'] == code }.first
code_hash = valueset['concept'].select { |v| v['code'] == code }.first
end
break if c
break if code_hash
end
c['display'] if c
code_hash['display'] if code_hash
end

# ----------------------------------------------------------------
Expand Down

0 comments on commit ce5b4f1

Please sign in to comment.