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?

Methods included from Inspect

#inspect

Constructor Details

#initialize(hash) ⇒ Internal

Returns a new instance of Internal.


21
22
23
# File 'lib/stupidedi/schema/code_list.rb', line 21

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:


42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/stupidedi/schema/code_list.rb', line 42

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>)

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

def codes
  @hash.keys
end

#external?Boolean

Returns:

  • (Boolean)

30
31
32
# File 'lib/stupidedi/schema/code_list.rb', line 30

def external?
  false
end