Class: ODDB::Drugs::Sequence

Inherits:
Model
  • Object
show all
Defined in:
lib/oddb/export/yaml.rb,
lib/oddb/drugs/sequence.rb,
lib/oddb/persistence/og/drugs/sequence.rb,
lib/oddb/persistence/odba/drugs/sequence.rb

Constant Summary

Constants included from OddbUri

OddbUri::YAML_URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#__odba_delete__, #__odba_save__, _serializables, belongs_to, connections, connector, connectors, #data_origin, #data_origins, delegates, #delete, find_by_uid, has_many, is_coded, m10l_document, multilingual, #odba_serializables, #oid, on_delete, on_save, predicates, #save, #saved?, serializables, serialize, singular

Methods included from ODBA::Persistable

#to_yaml_properties

Methods included from Yaml

append_features, #to_yaml_properties

Methods included from OddbUri

#to_yaml, #to_yaml_map, #to_yaml_type

Instance Attribute Details

#fachinfo_urlObject

Returns the value of attribute fachinfo_url.



9
10
11
# File 'lib/oddb/drugs/sequence.rb', line 9

def fachinfo_url
  @fachinfo_url
end

#marketableObject

Returns the value of attribute marketable.



9
10
11
# File 'lib/oddb/drugs/sequence.rb', line 9

def marketable
  @marketable
end

#patinfo_urlObject

Returns the value of attribute patinfo_url.



9
10
11
# File 'lib/oddb/drugs/sequence.rb', line 9

def patinfo_url
  @patinfo_url
end

Instance Method Details

#comparable?(other) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/oddb/drugs/sequence.rb', line 21

def comparable?(other)
  other.is_a?(Sequence) && compositions == other.compositions
end

#comparablesObject



24
25
26
27
28
# File 'lib/oddb/drugs/sequence.rb', line 24

def comparables
  atc.sequences.select { |sequence|
    comparable?(sequence)
  }
end

#dddsObject

ddds depend on the sequence’s Route of Administration



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/oddb/drugs/sequence.rb', line 29

def ddds # ddds depend on the sequence's Route of Administration
  forms = galenic_forms
  if(forms.size == 1 && (atc_class = atc) \
     && (group = forms.first.group) \
     && (roa = group.administration))
    atc_class.ddds.select { |ddd| 
      ddd.administration == roa }
  else
    []
  end
end

#galenic_formsObject



40
41
42
# File 'lib/oddb/drugs/sequence.rb', line 40

def galenic_forms
  compositions.collect { |comp| comp.galenic_form }.compact.uniq
end

#identical?(other) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
49
50
# File 'lib/oddb/drugs/sequence.rb', line 43

def identical?(other)
  comparable?(other) && other.product == product \
    && compositions.each_with_index { |comp, idx| 
    unless(comp.galenic_form.eql?(other.compositions.at(idx).galenic_form))
      return false
    end
  } && true
end

#include?(substance, dose = nil, unit = nil) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
55
# File 'lib/oddb/drugs/sequence.rb', line 51

def include?(substance, dose=nil, unit=nil)
  compositions.any? { |comp|
    comp.include?(substance, dose, unit)
  }
end

#registrationObject



56
57
58
# File 'lib/oddb/drugs/sequence.rb', line 56

def registration
  code(:registration, 'EU')
end