When logged in as desitin the search order of ventolin is not correct. Is not correct because
Result of http://ch.oddb.org/de/gcc/search/zone/drugs/search_query/Ventolin/search_type/st_oddb?#best_result is
The first columsn for searching by Ventolin on evidentia.ch return
Salbutamol (R03AC02) 12 Präparate Ventolin 1 mg/ml Infusionskonzentrat 5mg / 5ml 5 1 Ventolin 1 mg/ml Infusionskonzentrat 5mg / 5ml 5 1 Ventolin 0.5 mg/ml Injektionslösung 0.5 mg/ml 5 1 Ventolin 5 mg/ml Lösung 5 mg/ml 20 ml Salamol Autohaler Dosier-Aerosol 0.1 mg 200 Inhalation(en) Salbu Orion Easyhaler ug Inhalationspulver 100 µg Salbu Orion Easyhaler ug Inhalationspulver 200 µg Ventolin Dosier-Aerosol 0.1 mg 0.1 mg Ventolin 1,25 mg/2,5 ml Lösung 1.25 mg 60 Einzeldosen Ventolin Sirup 2mg / 5ml 150 ml 1.78 Ventolin Diskus Multidosen-Pulverinhalator 200 µg 60 Einzeldosen Ventolin 0.5 mg/ml Injektionslösung 0.5 mg/ml 5 1 Ampulle(n) ą 1 ml
Zeno wants the to sort by
befor sorting by the galenic form
Improved the debugging output. Now I see in the oddbd-console output, that some Ventolin products are not classified as originals and thereof are shown after Salamol Autohaler.
id 1: 7680443970240 expired? fal out_of_trade fal priorize fals 1 (:or/nil) 'Ventolin 1 mg/ml' gal_name ["Infusionskonzentrat"] name "Ventolin" id 2: 7680443970226 expired? fal out_of_trade fal priorize fals 1 (:or/nil) 'Ventolin 1 mg/ml' gal_name ["Infusionskonzentrat"] name "Ventolin" id 3: 7680443970233 expired? fal out_of_trade fal priorize fals 1 (:or/nil) 'Ventolin 0.5 mg/ml' gal_name ["Injektionslösung"] name "Ventolin" id 4: 7680373970242 expired? fal out_of_trade fal priorize fals 1 (:un/:or) 'Ventolin 5 mg/ml' gal_name ["Lösung"] name "Ventolin" id 5: 7680550920022 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Salamol Autohaler' gal_name ["Dosier-Aerosol"] name "Salamol Autohaler" id 6: 7680543200193 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Ventolin' gal_name ["Dosier-Aerosol"] name "Ventolin" id 7: 7680373970327 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Ventolin 1,25 mg/2,5 ml' gal_name ["Lösung"] name "Ventolin" id 8: 7680538980178 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Ventolin Diskus' gal_name ["Multidosen-Pulverinhalator"] name "Ventolin Diskus" id 9: 7680372620131 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Ventolin' gal_name ["Sirup"] name "Ventolin" id 10: 7680531900500 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Salbu Orion Easyhaler' gal_name ["ug Inhalationspulver"] name "Salbu Orion Easyhaler" id 11: 7680531900517 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Salbu Orion Easyhaler' gal_name ["ug Inhalationspulver"] name "Salbu Orion Easyhaler" id 12: 7680443970134 expired? fal out_of_trade tru priorize fals 4 (:or/nil) 'Ventolin 0.5 mg/ml' gal_name ["Injektionslösung"] name "Ventolin"
Looking at a similar example, the search for "Loperamid". The third product Iomodiu (which points to http://evidentia.oddb.org/de/evidentia/compare/ean13/7680431390104) is (according to an email not a generic and should be listed later). The debug output shows
id 1: 7680403630177 expired? fal out_of_trade fal priorize fals 1 (:or/:or) 'Imodium' gal_name ["Kapseln"] name "Imodium" id 2: 7680403630252 expired? fal out_of_trade fal priorize fals 1 (:or/:or) 'Imodium' gal_name ["Kapseln"] name "Imodium" id 3: 7680431390104 expired? fal out_of_trade fal priorize fals 1 (:or/nil) 'Imodium' gal_name ["Sirup"] name "Imodium" id 4: 7680529650127 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid-Mepha 2' gal_name ["Filmtabletten"] name "Loperamid-Mepha 2" id 5: 7680529650202 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid-Mepha 2' gal_name ["Filmtabletten"] name "Loperamid-Mepha 2" id 6: 7680560490027 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Helvepharm 2mg' gal_name ["Kapseln"] name "Loperamid Helvepharm" id 7: 7680560490041 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Helvepharm 2mg' gal_name ["Kapseln"] name "Loperamid Helvepharm" id 8: 7680612950011 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Sandoz' gal_name ["Kapseln"] name "Loperamid Sandoz" id 9: 7680612950028 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Sandoz' gal_name ["Kapseln"] name "Loperamid Sandoz" id 10: 7680536860281 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Streuli' gal_name ["Kapseln"] name "Loperamid Streuli" id 11: 7680536860366 expired? fal out_of_trade fal priorize fals 2 (:ge/:ge) 'Loperamid Streuli' gal_name ["Kapseln"] name "Loperamid Streuli" id 12: 7680536860441 expired? fal out_of_trade fal priorize fals 2 (:ge/nil) 'Loperamid Streuli' gal_name ["Kapseln"] name "Loperamid Streuli" id 13: 7680630360014 expired? fal out_of_trade fal priorize fals 3 (nil/nil) 'Amavita Loperamid 2 mg' gal_name ["Kapseln"] name "Amavita Loperamid" id 14: 7680654200013 expired? fal out_of_trade nil priorize fals 3 (nil/nil) 'Coop Vitality Loperamid 2 mg' gal_name ["Kapseln"] name "Coop Vitality Loperamid" id 15: 7680510420340 expired? fal out_of_trade fal priorize fals 3 (nil/nil) 'Lopimed' gal_name ["Kapseln"] name "Lopimed" id 16: 7680510420425 expired? fal out_of_trade fal priorize fals 3 (nil/nil) 'Lopimed' gal_name ["Kapseln"] name "Lopimed" id 17: 7680529750186 expired? fal out_of_trade fal priorize fals 3 (:un/nil) 'Imodium lingual' gal_name ["Schmelztabletten"] name "Imodium lingual" id 18: 7680580590011 expired? fal out_of_trade fal priorize fals 3 (nil/nil) 'Imodium lingual Durchfall akut' gal_name ["Schmelztabletten"] name "Imodium lingual Durchfall akut" id 19: 7680613660049 expired? fal out_of_trade fal priorize fals 3 (nil/nil) 'Imodium' gal_name ["Softkapseln"] name "Imodium" id 20: 7680613660025 expired? fal out_of_trade tru priorize fals 4 (nil/nil) 'Imodium' gal_name ["Softkapseln"] name "Imodium" id 21: 7680613660056 expired? fal out_of_trade tru priorize fals 4 (nil/nil) 'Imodium' gal_name ["Softkapseln"] name "Imodium"
Here the problem is, that in the ODDB.org database EAN13 7680431390104 is listed as an original. bin/admin reports
ch.oddb> registration('43139').sequence('01').package('010').sl_generic_type -> ch.oddb> registration('43139').sequence('01').package('010').sl_generic_type.class -> NilClass ch.oddb> registration('43139').sequence('01').package('010').generic_type -> original
Now analysing the problem why this is not displayed as being generic. Reason is that when displaying whether a drug is generic or not src/view/drugs/package.rb looks only at the field sl_generic_type, whereas we often have also a method generic_type for a registration, which return the generic_type for the given company. We must rethink/rework the whole stuff about generic_type as nowadays we often have companies which produce generics and original drugs at the same time. This method (in src/model/registration.rb) is also marke with the comment def generic_type # This is old value. Pleas use Package#sl_generic_type
In src/plugin/bsv_xml.rb we find the following code snippet
when 'OrgGenCode' gtype = GENERIC_TYPES[@text] unless (registration = @app.registration(@iksnr) and registration.keep_generic_type) @reg_data.store(:generic_type, (gtype || :unknown)) end @pac_data.store :sl_generic_type, gtype
Now I want to find all registrations which have flag keep_generic_type. Found 3 entries via bin/admin
ch.oddb> $res= registrations.find_all{ |k,v| v.iksnr if v.keep_generic_type} -> Array ch.oddb> $res.size -> 3 ch.oddb> $res[0] -> ["54268", #<ODBA::Stub:55268540#27773 @odba_class= @odba_container=67494680#22>] ch.oddb> $res[1] -> ["54467", #<ODBA::Stub:57079520#25886 @odba_class= @odba_container=67494680#22>] ch.oddb> $res[2] -> ["55431", #<ODBA::Stub:58418140#24305 @odba_class= @odba_container=67494680#22>] ch.oddb>
Names are [Orfiril long 150 mg, Diazepam Desitin 5 mg, Orfiril long 500 mg]
Use only sl_generic_type in src/util/resultsort.rb to make result consistent with visual information.
Pushed commit
Fixed some unit test with commit Set TZ to UTC while running test