Class: ODDB::Drugs::Sequence
- 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
Instance Attribute Summary collapse
-
#fachinfo_url ⇒ Object
Returns the value of attribute fachinfo_url.
-
#marketable ⇒ Object
Returns the value of attribute marketable.
-
#patinfo_url ⇒ Object
Returns the value of attribute patinfo_url.
Instance Method Summary collapse
- #comparable?(other) ⇒ Boolean
- #comparables ⇒ Object
-
#ddds ⇒ Object
ddds depend on the sequence’s Route of Administration.
- #galenic_forms ⇒ Object
- #identical?(other) ⇒ Boolean
- #include?(substance, dose = nil, unit = nil) ⇒ Boolean
- #registration ⇒ Object
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
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_url ⇒ Object
Returns the value of attribute fachinfo_url.
9 10 11 |
# File 'lib/oddb/drugs/sequence.rb', line 9 def fachinfo_url @fachinfo_url end |
#marketable ⇒ Object
Returns the value of attribute marketable.
9 10 11 |
# File 'lib/oddb/drugs/sequence.rb', line 9 def marketable @marketable end |
#patinfo_url ⇒ Object
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
21 22 23 |
# File 'lib/oddb/drugs/sequence.rb', line 21 def comparable?(other) other.is_a?(Sequence) && compositions == other.compositions end |
#comparables ⇒ Object
24 25 26 27 28 |
# File 'lib/oddb/drugs/sequence.rb', line 24 def comparables atc.sequences.select { |sequence| comparable?(sequence) } end |
#ddds ⇒ Object
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_forms ⇒ Object
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
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
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 |
#registration ⇒ Object
56 57 58 |
# File 'lib/oddb/drugs/sequence.rb', line 56 def registration code(:registration, 'EU') end |