class NDFRT::Interaction
Attributes
drugs[RW]
nui[RW]
severity[RW]
Public Class Methods
new(interaction_hash)
click to toggle source
# File lib/ndfrt/interaction.rb, line 5 def initialize interaction_hash concepts = interaction_hash[:group_concepts][:concept] @drugs = extract_drugs concepts @nui = extract_interaction_id concepts @severity = interaction_hash[:severity] end
Private Instance Methods
extract_drugs(concepts)
click to toggle source
# File lib/ndfrt/interaction.rb, line 15 def extract_drugs concepts concepts.select { |c| c[:concept_kind] != 'DRUG_INTERACTION_KIND' }.map{ |c| NDFRT::Concept.new(c) } end
extract_interaction_id(concepts)
click to toggle source
# File lib/ndfrt/interaction.rb, line 19 def extract_interaction_id concepts concepts.select { |c| c[:concept_kind] == 'DRUG_INTERACTION_KIND' }.first[:concept_nui] end