class RxNav::Interaction
Public Class Methods
new(interaction_hash)
click to toggle source
# File lib/rx_nav/interaction.rb, line 6 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/rx_nav/interaction.rb, line 16 def extract_drugs concepts concepts.select { |c| c[:concept_kind] != 'DRUG_INTERACTION_KIND' }.map{ |c| RxNav::Concept.new(c) } end
extract_interaction_id(concepts)
click to toggle source
# File lib/rx_nav/interaction.rb, line 20 def extract_interaction_id concepts concepts.select { |c| c[:concept_kind] == 'DRUG_INTERACTION_KIND' }.first[:concept_nui] end