lib/oddb2xml/cli.rb in oddb2xml-1.1.4 vs lib/oddb2xml/cli.rb in oddb2xml-1.1.5
- old
+ new
@@ -15,10 +15,11 @@
def initialize(args)
@options = args
@mutex = Mutex.new
@items = {} # Items from Preparations.xml in BAG
@index = {} # Base index from swissINDEX
+ @flags = {} # narcotics flag from ywesee
@infos = {} # [option] FI from SwissmedicInfo
@actions = [] # [addition] interactions from epha
@orphans = [] # [addition] Orphaned drugs from Swissmedic xls
@fridges = [] # [addition] ReFridge drugs from Swissmedic xls
LANGUAGES.each do |lang|
@@ -49,11 +50,11 @@
# epha
threads << Thread.new do
downloader = EphaDownloader.new
io = downloader.download
@mutex.synchronize do
- @actions = EphaExtractor.new(io).to_hash
+ @actions = EphaExtractor.new(io).to_arry
end
end
# bag
threads << Thread.new do
downloader = BagXmlDownloader.new
@@ -61,10 +62,18 @@
@mutex.synchronize do
hsh = BagXmlExtractor.new(xml).to_hash
@items = hsh
end
end
+ # ywesee
+ threads << Thread.new do
+ downloader = YweseeBMDownloader.new
+ io = downloader.download
+ @mutex.synchronize do
+ @flags = YweseeBMExtractor.new(io).to_hash
+ end
+ end
LANGUAGES.each do |lang|
# swissindex
types.each do |type|
threads << Thread.new do
downloader = SwissIndexDownloader.new(type, lang)
@@ -94,16 +103,14 @@
end
end
builder.subject = sbj
builder.index = index
builder.items = @items
+ builder.flags = @flags
# additions
%w[actions orphans fridges].each do |addition|
builder.send("#{addition}=".intern, self.instance_variable_get("@#{addition}"))
end
- #builder.actions = @actions
- #builder.orphans = @orphans
- #builder.fridges = @fridges
# optionals
builder.infos = @infos
builder.tag_suffix = @options[:tag_suffix]
end
xml = builder.to_xml