Class: Stupidedi::Schema::CodeList::Internal

Inherits:
Stupidedi::Schema::CodeList show all
Defined in:
lib/stupidedi/schema/code_list.rb

Instance Method Summary collapse

Methods inherited from Stupidedi::Schema::CodeList

build, external, internal, #internal?

Methods included from Inspect

#inspect

Constructor Details

#initialize(hash) ⇒ Internal

Returns a new instance of Internal.


18
19
20
# File 'lib/stupidedi/schema/code_list.rb', line 18

def initialize(hash)
  @hash = hash
end

Instance Method Details

#code_lists(subset = Sets.universal) ⇒ AbstractSet<CodeList>

Some elements are qualifiers that select which code list is applicable to the qualified element. For instance, the diagnosis codes in the HI segment are qualified by E1270 "Code List Qualifier Code", which indicates which code list should be used to validate the E1271's diagnosis code. It maybe ICD-9, ICD-10, etc.

Returns:


39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/stupidedi/schema/code_list.rb', line 39

def code_lists(subset = Sets.universal)
  related =
    @hash.select do |k, v|
      subset.include?(k) and v.is_a?(Schema::CodeList)
    end

  if subset.finite?
    Sets.build([self]) + related.map{|k,v| v }
  else
    Sets.build([self])
  end
end

#codesArray<String>

Returns:

  • (Array<String>)

23
24
25
# File 'lib/stupidedi/schema/code_list.rb', line 23

def codes
  @hash.keys
end

#external?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/stupidedi/schema/code_list.rb', line 27

def external?
  false
end