de.oddb 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Guide.txt +3 -0
- data/History.txt +5 -0
- data/LICENCE.txt +339 -0
- data/Manifest.txt +430 -0
- data/README +423 -0
- data/README.txt +25 -0
- data/Rakefile +28 -0
- data/bin/admin +71 -0
- data/bin/exportd +44 -0
- data/bin/oddbd +33 -0
- data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
- data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
- data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
- data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
- data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
- data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
- data/data/fulltext/data/german_compound/README +15 -0
- data/data/fulltext/data/german_compound/compound.pl +63 -0
- data/data/fulltext/data/german_compound/german.stop +20 -0
- data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
- data/data/fulltext/redist/dict_french/Makefile +12 -0
- data/data/fulltext/redist/dict_french/README.french +1 -0
- data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
- data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
- data/data/fulltext/redist/dict_french/french_stem.h +16 -0
- data/data/fulltext/redist/dict_french/subinclude.h +2 -0
- data/data/fulltext/redist/dict_german/Makefile +12 -0
- data/data/fulltext/redist/dict_german/README.german +1 -0
- data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
- data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_german/german_stem.c +527 -0
- data/data/fulltext/redist/dict_german/german_stem.h +16 -0
- data/data/fulltext/redist/dict_german/subinclude.h +1 -0
- data/data/fulltext/redist/french_stem.c +1222 -0
- data/data/fulltext/redist/french_stem.h +16 -0
- data/data/fulltext/redist/german_stem.c +527 -0
- data/data/fulltext/redist/german_stem.h +16 -0
- data/jobs/export_chde_xls +20 -0
- data/jobs/export_csv +20 -0
- data/jobs/export_fachinfo_yaml +20 -0
- data/jobs/export_patinfo_yaml +20 -0
- data/jobs/export_yaml +20 -0
- data/jobs/import_dimdi +15 -0
- data/jobs/import_gkv +19 -0
- data/jobs/import_pharma24 +15 -0
- data/jobs/import_pharmnet +30 -0
- data/jobs/import_whocc +18 -0
- data/lib/fixes/singular.rb +9 -0
- data/lib/fixes/yaml.rb +13 -0
- data/lib/oddb.rb +13 -0
- data/lib/oddb/business/company.rb +18 -0
- data/lib/oddb/business/grant_download.rb +27 -0
- data/lib/oddb/business/invoice.rb +75 -0
- data/lib/oddb/config.rb +112 -0
- data/lib/oddb/currency.rb +6 -0
- data/lib/oddb/drugs.rb +16 -0
- data/lib/oddb/drugs/active_agent.rb +37 -0
- data/lib/oddb/drugs/atc.rb +53 -0
- data/lib/oddb/drugs/composition.rb +41 -0
- data/lib/oddb/drugs/ddd.rb +24 -0
- data/lib/oddb/drugs/dose.rb +107 -0
- data/lib/oddb/drugs/galenic_form.rb +21 -0
- data/lib/oddb/drugs/galenic_group.rb +17 -0
- data/lib/oddb/drugs/package.rb +111 -0
- data/lib/oddb/drugs/part.rb +55 -0
- data/lib/oddb/drugs/product.rb +25 -0
- data/lib/oddb/drugs/sequence.rb +68 -0
- data/lib/oddb/drugs/substance.rb +31 -0
- data/lib/oddb/drugs/substance_group.rb +13 -0
- data/lib/oddb/drugs/unit.rb +12 -0
- data/lib/oddb/export.rb +4 -0
- data/lib/oddb/export/csv.rb +94 -0
- data/lib/oddb/export/l10n_sessions.rb +30 -0
- data/lib/oddb/export/rss.rb +44 -0
- data/lib/oddb/export/server.rb +137 -0
- data/lib/oddb/export/xls.rb +127 -0
- data/lib/oddb/export/yaml.rb +212 -0
- data/lib/oddb/html/state/download.rb +13 -0
- data/lib/oddb/html/state/drugs/admin/package.rb +190 -0
- data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
- data/lib/oddb/html/state/drugs/admin/sequence.rb +253 -0
- data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
- data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
- data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
- data/lib/oddb/html/state/drugs/compare.rb +52 -0
- data/lib/oddb/html/state/drugs/download_export.rb +18 -0
- data/lib/oddb/html/state/drugs/downloads.rb +42 -0
- data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/feedback.rb +91 -0
- data/lib/oddb/html/state/drugs/global.rb +270 -0
- data/lib/oddb/html/state/drugs/init.rb +18 -0
- data/lib/oddb/html/state/drugs/login.rb +17 -0
- data/lib/oddb/html/state/drugs/package.rb +32 -0
- data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/products.rb +51 -0
- data/lib/oddb/html/state/drugs/result.rb +125 -0
- data/lib/oddb/html/state/global.rb +206 -0
- data/lib/oddb/html/state/global_predefine.rb +17 -0
- data/lib/oddb/html/state/limit.rb +17 -0
- data/lib/oddb/html/state/login.rb +56 -0
- data/lib/oddb/html/state/paypal/checkout.rb +97 -0
- data/lib/oddb/html/state/paypal/collect.rb +19 -0
- data/lib/oddb/html/state/paypal/download.rb +61 -0
- data/lib/oddb/html/state/paypal/redirect.rb +18 -0
- data/lib/oddb/html/state/register_download.rb +24 -0
- data/lib/oddb/html/state/register_export.rb +38 -0
- data/lib/oddb/html/state/register_poweruser.rb +17 -0
- data/lib/oddb/html/state/viral/admin.rb +79 -0
- data/lib/oddb/html/state/viral/poweruser.rb +16 -0
- data/lib/oddb/html/util/annotated_list.rb +39 -0
- data/lib/oddb/html/util/know_it_all.rb +28 -0
- data/lib/oddb/html/util/known_user.rb +55 -0
- data/lib/oddb/html/util/lookandfeel.rb +698 -0
- data/lib/oddb/html/util/need_all_input.rb +29 -0
- data/lib/oddb/html/util/session.rb +84 -0
- data/lib/oddb/html/util/sort.rb +72 -0
- data/lib/oddb/html/util/unsaved_helper.rb +20 -0
- data/lib/oddb/html/util/validator.rb +59 -0
- data/lib/oddb/html/view/ajax/json.rb +22 -0
- data/lib/oddb/html/view/alpha_header.rb +28 -0
- data/lib/oddb/html/view/document.rb +117 -0
- data/lib/oddb/html/view/download.rb +33 -0
- data/lib/oddb/html/view/drugs/admin/package.rb +245 -0
- data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
- data/lib/oddb/html/view/drugs/admin/sequence.rb +305 -0
- data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
- data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
- data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
- data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
- data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
- data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
- data/lib/oddb/html/view/drugs/compare.rb +95 -0
- data/lib/oddb/html/view/drugs/download_export.rb +28 -0
- data/lib/oddb/html/view/drugs/downloads.rb +128 -0
- data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/feedback.rb +235 -0
- data/lib/oddb/html/view/drugs/init.rb +51 -0
- data/lib/oddb/html/view/drugs/legend.rb +24 -0
- data/lib/oddb/html/view/drugs/package.rb +403 -0
- data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/products.rb +97 -0
- data/lib/oddb/html/view/drugs/result.rb +296 -0
- data/lib/oddb/html/view/drugs/search.rb +33 -0
- data/lib/oddb/html/view/drugs/template.rb +15 -0
- data/lib/oddb/html/view/foot.rb +52 -0
- data/lib/oddb/html/view/google.rb +23 -0
- data/lib/oddb/html/view/google_ads.rb +40 -0
- data/lib/oddb/html/view/head.rb +78 -0
- data/lib/oddb/html/view/limit.rb +109 -0
- data/lib/oddb/html/view/list.rb +59 -0
- data/lib/oddb/html/view/login.rb +38 -0
- data/lib/oddb/html/view/navigation.rb +67 -0
- data/lib/oddb/html/view/offset_header.rb +35 -0
- data/lib/oddb/html/view/paypal/collect.rb +95 -0
- data/lib/oddb/html/view/paypal/redirect.rb +51 -0
- data/lib/oddb/html/view/paypal/register_form.rb +149 -0
- data/lib/oddb/html/view/register_download.rb +29 -0
- data/lib/oddb/html/view/register_export.rb +29 -0
- data/lib/oddb/html/view/register_poweruser.rb +29 -0
- data/lib/oddb/html/view/rss/feedback.rb +64 -0
- data/lib/oddb/html/view/rss_preview.rb +61 -0
- data/lib/oddb/html/view/search.rb +104 -0
- data/lib/oddb/html/view/snapback.rb +24 -0
- data/lib/oddb/html/view/template.rb +56 -0
- data/lib/oddb/import/dimdi.rb +583 -0
- data/lib/oddb/import/excel.rb +45 -0
- data/lib/oddb/import/gkv.rb +463 -0
- data/lib/oddb/import/importer.rb +36 -0
- data/lib/oddb/import/pharma24.rb +211 -0
- data/lib/oddb/import/pharmnet.rb +1186 -0
- data/lib/oddb/import/rtf.rb +409 -0
- data/lib/oddb/import/whocc.rb +148 -0
- data/lib/oddb/import/xml.rb +15 -0
- data/lib/oddb/model.rb +179 -0
- data/lib/oddb/persistence.rb +22 -0
- data/lib/oddb/persistence/odba.rb +32 -0
- data/lib/oddb/persistence/odba/business/company.rb +13 -0
- data/lib/oddb/persistence/odba/business/grant_download.rb +14 -0
- data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
- data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
- data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
- data/lib/oddb/persistence/odba/export.rb +26 -0
- data/lib/oddb/persistence/odba/model.rb +68 -0
- data/lib/oddb/persistence/odba/text/document.rb +11 -0
- data/lib/oddb/persistence/odba/util/code.rb +11 -0
- data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
- data/lib/oddb/persistence/og.rb +16 -0
- data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
- data/lib/oddb/persistence/og/drugs/product.rb +14 -0
- data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
- data/lib/oddb/persistence/og/model.rb +25 -0
- data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
- data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
- data/lib/oddb/remote/business/company.rb +17 -0
- data/lib/oddb/remote/drugs/active_agent.rb +27 -0
- data/lib/oddb/remote/drugs/atc.rb +31 -0
- data/lib/oddb/remote/drugs/dose.rb +8 -0
- data/lib/oddb/remote/drugs/galenic_form.rb +24 -0
- data/lib/oddb/remote/drugs/package.rb +128 -0
- data/lib/oddb/remote/drugs/part.rb +30 -0
- data/lib/oddb/remote/drugs/substance.rb +20 -0
- data/lib/oddb/remote/drugs/unit.rb +20 -0
- data/lib/oddb/remote/object.rb +36 -0
- data/lib/oddb/text/chapter.rb +23 -0
- data/lib/oddb/text/document.rb +42 -0
- data/lib/oddb/text/format.rb +37 -0
- data/lib/oddb/text/paragraph.rb +53 -0
- data/lib/oddb/text/picture.rb +89 -0
- data/lib/oddb/text/table.rb +68 -0
- data/lib/oddb/util.rb +9 -0
- data/lib/oddb/util/annotated_list.rb +37 -0
- data/lib/oddb/util/code.rb +69 -0
- data/lib/oddb/util/comparison.rb +36 -0
- data/lib/oddb/util/download.rb +17 -0
- data/lib/oddb/util/exporter.rb +8 -0
- data/lib/oddb/util/feedback.rb +23 -0
- data/lib/oddb/util/ipn.rb +53 -0
- data/lib/oddb/util/job.rb +23 -0
- data/lib/oddb/util/logger.rb +20 -0
- data/lib/oddb/util/m10l_document.rb +41 -0
- data/lib/oddb/util/mail.rb +87 -0
- data/lib/oddb/util/money.rb +64 -0
- data/lib/oddb/util/multilingual.rb +70 -0
- data/lib/oddb/util/quanty.rb +3 -0
- data/lib/oddb/util/quanty/fact.rb +242 -0
- data/lib/oddb/util/quanty/main.rb +164 -0
- data/lib/oddb/util/quanty/parse.rb +872 -0
- data/lib/oddb/util/quanty/units.dump +0 -0
- data/lib/oddb/util/server.rb +150 -0
- data/lib/oddb/util/smtp_tls.rb +58 -0
- data/lib/oddb/util/updater.rb +161 -0
- data/lib/oddb/util/ydim.rb +110 -0
- data/lib/oddb/util/yus.rb +46 -0
- data/test/business/test_company.rb +29 -0
- data/test/business/test_grant_download.rb +29 -0
- data/test/drugs/test_active_agent.rb +53 -0
- data/test/drugs/test_atc.rb +54 -0
- data/test/drugs/test_composition.rb +88 -0
- data/test/drugs/test_ddd.rb +22 -0
- data/test/drugs/test_dose.rb +189 -0
- data/test/drugs/test_galenic_form.rb +41 -0
- data/test/drugs/test_package.rb +172 -0
- data/test/drugs/test_part.rb +32 -0
- data/test/drugs/test_product.rb +31 -0
- data/test/drugs/test_sequence.rb +140 -0
- data/test/drugs/test_substance.rb +51 -0
- data/test/drugs/test_substance_group.rb +27 -0
- data/test/export/test_rss.rb +86 -0
- data/test/export/test_server.rb +163 -0
- data/test/export/test_xls.rb +146 -0
- data/test/export/test_yaml.rb +120 -0
- data/test/import/data/csv/products.csv +11 -0
- data/test/import/data/html/dimdi_index.html +400 -0
- data/test/import/data/html/gkv/Befreiungsliste_Arzneimittel_Versicherte.gkvnet +508 -0
- data/test/import/data/html/pharma24/1337397.html +754 -0
- data/test/import/data/html/pharma24/842756.html +570 -0
- data/test/import/data/html/pharma24/ac-page-10.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-11.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-12.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-13.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-14.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-15.html +3011 -0
- data/test/import/data/html/pharma24/ac-page-16.html +3050 -0
- data/test/import/data/html/pharma24/ac-page-17.html +3285 -0
- data/test/import/data/html/pharma24/ac-page-18.html +3109 -0
- data/test/import/data/html/pharma24/ac-page-19.html +3126 -0
- data/test/import/data/html/pharma24/ac-page-2.html +3005 -0
- data/test/import/data/html/pharma24/ac-page-20.html +3007 -0
- data/test/import/data/html/pharma24/ac-page-21.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-22.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-23.html +3055 -0
- data/test/import/data/html/pharma24/ac-page-24.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-25.html +3004 -0
- data/test/import/data/html/pharma24/ac-page-26.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-27.html +3167 -0
- data/test/import/data/html/pharma24/ac-page-28.html +3236 -0
- data/test/import/data/html/pharma24/ac-page-29.html +3110 -0
- data/test/import/data/html/pharma24/ac-page-3.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-30.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-31.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-32.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-33.html +3001 -0
- data/test/import/data/html/pharma24/ac-page-34.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-35.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-36.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-37.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-38.html +3003 -0
- data/test/import/data/html/pharma24/ac-page-39.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-4.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-40.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-41.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-42.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-43.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-44.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-45.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-46.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-47.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-48.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-49.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-5.html +3168 -0
- data/test/import/data/html/pharma24/ac-page-50.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-51.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-52.html +3003 -0
- data/test/import/data/html/pharma24/ac-page-53.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-54.html +3095 -0
- data/test/import/data/html/pharma24/ac-page-55.html +3041 -0
- data/test/import/data/html/pharma24/ac-page-56.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-57.html +3001 -0
- data/test/import/data/html/pharma24/ac-page-58.html +3001 -0
- data/test/import/data/html/pharma24/ac-page-59.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-6.html +3072 -0
- data/test/import/data/html/pharma24/ac-page-60.html +3001 -0
- data/test/import/data/html/pharma24/ac-page-61.html +3005 -0
- data/test/import/data/html/pharma24/ac-page-62.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-63.html +3007 -0
- data/test/import/data/html/pharma24/ac-page-64.html +3007 -0
- data/test/import/data/html/pharma24/ac-page-65.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-66.html +3011 -0
- data/test/import/data/html/pharma24/ac-page-67.html +3026 -0
- data/test/import/data/html/pharma24/ac-page-68.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-69.html +3010 -0
- data/test/import/data/html/pharma24/ac-page-7.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-70.html +3192 -0
- data/test/import/data/html/pharma24/ac-page-71.html +3133 -0
- data/test/import/data/html/pharma24/ac-page-72.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-73.html +3227 -0
- data/test/import/data/html/pharma24/ac-page-74.html +3241 -0
- data/test/import/data/html/pharma24/ac-page-75.html +3227 -0
- data/test/import/data/html/pharma24/ac-page-76.html +3244 -0
- data/test/import/data/html/pharma24/ac-page-77.html +1164 -0
- data/test/import/data/html/pharma24/ac-page-8.html +2999 -0
- data/test/import/data/html/pharma24/ac-page-9.html +2999 -0
- data/test/import/data/html/pharma24/ac.html +2999 -0
- data/test/import/data/html/pharmnet/display.html +662 -0
- data/test/import/data/html/pharmnet/display1.html +625 -0
- data/test/import/data/html/pharmnet/display2.html +625 -0
- data/test/import/data/html/pharmnet/display3.html +625 -0
- data/test/import/data/html/pharmnet/display_tramal.html +634 -0
- data/test/import/data/html/pharmnet/empty_result.html +395 -0
- data/test/import/data/html/pharmnet/gate.html +246 -0
- data/test/import/data/html/pharmnet/index.html +258 -0
- data/test/import/data/html/pharmnet/paged_result_1.html +401 -0
- data/test/import/data/html/pharmnet/paged_result_2.html +401 -0
- data/test/import/data/html/pharmnet/result.html +401 -0
- data/test/import/data/html/pharmnet/search.html +865 -0
- data/test/import/data/html/pharmnet/search_filtered.html +182 -0
- data/test/import/data/html/whocc/A.html +56 -0
- data/test/import/data/html/whocc/A03.html +48 -0
- data/test/import/data/html/whocc/A03AB.html +48 -0
- data/test/import/data/html/whocc/A06AA.html +47 -0
- data/test/import/data/html/whocc/C03.html +47 -0
- data/test/import/data/html/whocc/login.html +77 -0
- data/test/import/data/mail/csv.mail +81 -0
- data/test/import/data/rtf/pharmnet/aarane.pi.rtf +648 -0
- data/test/import/data/rtf/pharmnet/ace_hemmer_ratio.pi.rtf +324 -0
- data/test/import/data/rtf/pharmnet/ace_hemmer_ratio.rtf +4816 -0
- data/test/import/data/rtf/pharmnet/acemetacin.pi.rtf +388 -0
- data/test/import/data/rtf/pharmnet/acemit.pi.rtf +240 -0
- data/test/import/data/rtf/pharmnet/acerbon.pi.rtf +1257 -0
- data/test/import/data/rtf/pharmnet/acetylcystein.pi.rtf +323 -0
- data/test/import/data/rtf/pharmnet/aciclo.pi.rtf +287 -0
- data/test/import/data/rtf/pharmnet/aciclovir.pi.rtf +236 -0
- data/test/import/data/rtf/pharmnet/actrapid.pi.rtf +322 -0
- data/test/import/data/rtf/pharmnet/amlodipin.pi.rtf +452 -0
- data/test/import/data/rtf/pharmnet/amlodipin.rtf +473 -0
- data/test/import/data/rtf/pharmnet/aspirin.pi.rtf +313 -0
- data/test/import/data/rtf/pharmnet/aspirin.rtf +781 -0
- data/test/import/data/rtf/pharmnet/baymycard.pi.rtf +447 -0
- data/test/import/data/rtf/pharmnet/omeprazol.pi.rtf +510 -0
- data/test/import/data/rtf/pharmnet/omeprazol.rtf +9216 -0
- data/test/import/data/rtf/pharmnet/paroxetin.pi.rtf +678 -0
- data/test/import/data/rtf/pharmnet/selegilin.pi.rtf +312 -0
- data/test/import/data/rtf/pharmnet/selegilin.rtf +683 -0
- data/test/import/data/rtf/pharmnet/valium.pi.rtf +387 -0
- data/test/import/data/txt/gkv/gkv_p1.txt +17 -0
- data/test/import/data/xls/darform_010706.xls +0 -0
- data/test/import/data/xls/fb010706.xls +0 -0
- data/test/import/data/xls/liste_zuzahlungsbefreite_arzneimittel_suchfunktion.xls +0 -0
- data/test/import/data/xls/wirkkurz_010406.xls +0 -0
- data/test/import/data/xml/ATC_2006.xml +47 -0
- data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
- data/test/import/test_dimdi.rb +323 -0
- data/test/import/test_excel.rb +31 -0
- data/test/import/test_gkv.rb +260 -0
- data/test/import/test_pharma24.rb +112 -0
- data/test/import/test_pharmnet.rb +980 -0
- data/test/import/test_rtf.rb +37 -0
- data/test/import/test_whocc.rb +314 -0
- data/test/remote/drugs/test_active_agent.rb +36 -0
- data/test/selenium/selenium-server.jar +0 -0
- data/test/selenium/test_atc_browser.rb +121 -0
- data/test/selenium/test_atc_guidelines.rb +95 -0
- data/test/selenium/test_collect.rb +137 -0
- data/test/selenium/test_compare.rb +294 -0
- data/test/selenium/test_fachinfo.rb +128 -0
- data/test/selenium/test_feedback.rb +192 -0
- data/test/selenium/test_init.rb +64 -0
- data/test/selenium/test_limit.rb +304 -0
- data/test/selenium/test_login.rb +67 -0
- data/test/selenium/test_package.rb +516 -0
- data/test/selenium/test_patinfo.rb +128 -0
- data/test/selenium/test_product.rb +80 -0
- data/test/selenium/test_products.rb +141 -0
- data/test/selenium/test_search.rb +933 -0
- data/test/selenium/test_sequence.rb +513 -0
- data/test/selenium/unit.rb +190 -0
- data/test/stub/http_server.rb +144 -0
- data/test/stub/model.rb +173 -0
- data/test/suite.rb +15 -0
- data/test/test_model.rb +83 -0
- data/test/util/test_code.rb +74 -0
- data/test/util/test_ipn.rb +117 -0
- data/test/util/test_mail.rb +85 -0
- data/test/util/test_multilingual.rb +97 -0
- data/test/util/test_server.rb +94 -0
- data/test/util/test_updater.rb +130 -0
- data/test/util/test_ydim.rb +115 -0
- data/test/util/test_yus.rb +79 -0
- metadata +568 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Import::TestPharma24 -- de.oddb.org -- 21.04.2008 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
5
|
+
$: << File.expand_path('../../lib', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'flexmock'
|
9
|
+
require 'mechanize'
|
10
|
+
require 'oddb/config'
|
11
|
+
require 'oddb/import/pharma24'
|
12
|
+
require 'stub/model'
|
13
|
+
|
14
|
+
module ODDB
|
15
|
+
module Import
|
16
|
+
class TestPharma24 < Test::Unit::TestCase
|
17
|
+
include FlexMock::TestCase
|
18
|
+
def setup
|
19
|
+
@importer = Pharma24.new
|
20
|
+
end
|
21
|
+
def setup_page(agent, url, name=nil)
|
22
|
+
dir = File.expand_path('data/html/pharma24', File.dirname(__FILE__))
|
23
|
+
uri = URI.parse url
|
24
|
+
name ||= File.basename uri.path
|
25
|
+
path = File.join(dir, name)
|
26
|
+
agent.pluggable_parser.parser("text/html").new(
|
27
|
+
URI.parse("http://www.apotheke-online-internet.de" + uri.path),
|
28
|
+
{'content-type'=>'text/html'}, File.read(path), 200
|
29
|
+
) { |parser| parser.mech = agent }
|
30
|
+
end
|
31
|
+
def test_search
|
32
|
+
agent = flexmock(WWW::Mechanize.new)
|
33
|
+
url = 'http://www.apotheke-online-internet.de/advanced_search_result.php?keywords=1337397'
|
34
|
+
agent.should_receive(:get).with(url).and_return {
|
35
|
+
setup_page agent, url, '1337397.html'
|
36
|
+
}
|
37
|
+
urls = @importer.search agent, '1337397'
|
38
|
+
expected = [
|
39
|
+
{
|
40
|
+
:name => 'BB NEWS Plus Schwangerschafs Stabtest',
|
41
|
+
:code_prescription => false,
|
42
|
+
:size => '1',
|
43
|
+
:unit => 'St',
|
44
|
+
:unitname => 'Test',
|
45
|
+
:price_public => 7.8,
|
46
|
+
:company => 'DR D LOHMANN PH.& MED.',
|
47
|
+
:url => 'http://www.apotheke-online-internet.de/b/bb/p1337397_bb-news-plus-schwangerschafs-stabtest.html',
|
48
|
+
}
|
49
|
+
]
|
50
|
+
assert_equal expected, urls
|
51
|
+
end
|
52
|
+
def test_update_package
|
53
|
+
pac = Drugs::Package.new
|
54
|
+
pac.add_code Util::Code.new(:cid, 1337397, 'DE')
|
55
|
+
pac.sequence = seq = Drugs::Sequence.new
|
56
|
+
seq.product = Drugs::Product.new
|
57
|
+
agent = flexmock(WWW::Mechanize.new)
|
58
|
+
url = 'http://www.apotheke-online-internet.de/advanced_search_result.php?keywords=1337397'
|
59
|
+
agent.should_receive(:get).with(url).and_return {
|
60
|
+
setup_page agent, url, '1337397.html'
|
61
|
+
}
|
62
|
+
@importer.update_package(agent, pac)
|
63
|
+
price = pac.price :public
|
64
|
+
assert_instance_of Util::Money, price
|
65
|
+
assert_equal 7.8, price
|
66
|
+
assert_equal :pharma24, pac.data_origin(:price_public)
|
67
|
+
assert_equal 'BB NEWS Plus Schwangerschafs Stabtest', pac.name.de
|
68
|
+
code = pac.code :prescription
|
69
|
+
assert_instance_of Util::Code, code
|
70
|
+
assert_equal false, code.value
|
71
|
+
part = pac.parts.first
|
72
|
+
assert_equal 1, part.size
|
73
|
+
unit = part.unit
|
74
|
+
assert_instance_of Drugs::Unit, unit
|
75
|
+
assert_equal 'Test', unit.name.de
|
76
|
+
assert_nil part.quantity
|
77
|
+
company = pac.company
|
78
|
+
assert_instance_of Business::Company, company
|
79
|
+
assert_equal 'Dr D Lohmann Ph. & Med.', company.name.de
|
80
|
+
end
|
81
|
+
def test_update_package__2009
|
82
|
+
pac = Drugs::Package.new
|
83
|
+
pac.add_code Util::Code.new(:cid, 842756, 'DE')
|
84
|
+
pac.sequence = seq = Drugs::Sequence.new
|
85
|
+
seq.product = Drugs::Product.new
|
86
|
+
agent = flexmock(WWW::Mechanize.new)
|
87
|
+
url = 'http://www.apotheke-online-internet.de/advanced_search_result.php?keywords=842756'
|
88
|
+
agent.should_receive(:get).with(url).and_return {
|
89
|
+
setup_page agent, url, '842756.html'
|
90
|
+
}
|
91
|
+
@importer.update_package(agent, pac)
|
92
|
+
price = pac.price :public
|
93
|
+
assert_instance_of Util::Money, price
|
94
|
+
assert_equal 164.33, price
|
95
|
+
assert_equal :pharma24, pac.data_origin(:price_public)
|
96
|
+
assert_equal 'TOPAMAX 100 mg Filmtabletten', pac.name.de
|
97
|
+
code = pac.code :prescription
|
98
|
+
assert_instance_of Util::Code, code
|
99
|
+
assert_equal true, code.value
|
100
|
+
part = pac.parts.first
|
101
|
+
assert_equal 50, part.size
|
102
|
+
unit = part.unit
|
103
|
+
assert_instance_of Drugs::Unit, unit
|
104
|
+
assert_equal 'Filmtabletten', unit.name.de
|
105
|
+
assert_nil part.quantity
|
106
|
+
company = pac.company
|
107
|
+
assert_instance_of Business::Company, company
|
108
|
+
assert_equal 'Beragena', company.name.de
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,980 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Import::TestPharmNet -- de.oddb.org -- 15.10.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
$: << File.expand_path('..', File.dirname(__FILE__))
|
5
|
+
$: << File.expand_path('../../lib', File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require 'flexmock'
|
9
|
+
require 'oddb/business/company'
|
10
|
+
require 'oddb/config'
|
11
|
+
require 'oddb/drugs/active_agent'
|
12
|
+
require 'oddb/drugs/galenic_form'
|
13
|
+
require 'oddb/drugs/sequence'
|
14
|
+
require 'oddb/drugs/substance'
|
15
|
+
require 'oddb/import/pharmnet'
|
16
|
+
require 'mechanize'
|
17
|
+
require 'stub/model'
|
18
|
+
|
19
|
+
module ODDB
|
20
|
+
module Import
|
21
|
+
module PharmNet
|
22
|
+
class TestFiParser < Test::Unit::TestCase
|
23
|
+
def setup
|
24
|
+
@importer = FiParser.new 'term is unimportant here'
|
25
|
+
ODDB.config.var = File.expand_path('var', File.dirname(__FILE__))
|
26
|
+
end
|
27
|
+
def test_import__ace_hemmer
|
28
|
+
path = File.expand_path('data/rtf/pharmnet/ace_hemmer_ratio.rtf',
|
29
|
+
File.dirname(__FILE__))
|
30
|
+
document = nil
|
31
|
+
File.open(path) { |fh|
|
32
|
+
document = @importer.import(fh)
|
33
|
+
}
|
34
|
+
assert_instance_of(Text::Document, document)
|
35
|
+
chapters = document.chapters
|
36
|
+
expected = [ "default", "name", "sale_limitation", "composition",
|
37
|
+
"substance_group", "active_agents", "excipients",
|
38
|
+
"indications", "counterindications", "unwanted_effects",
|
39
|
+
"interactions", "precautions", "incompatibilities", "dosage",
|
40
|
+
"application", "overdose", "pharmacology", "toxicology",
|
41
|
+
"pharmacokinetics", "bioavailability", "other_advice",
|
42
|
+
"shelf_life", "storage", "packaging", "date", "company",
|
43
|
+
"producer"]
|
44
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
45
|
+
end
|
46
|
+
def test_import__amlodipin
|
47
|
+
path = File.expand_path('data/rtf/pharmnet/amlodipin.rtf',
|
48
|
+
File.dirname(__FILE__))
|
49
|
+
document = nil
|
50
|
+
File.open(path) { |fh|
|
51
|
+
document = @importer.import(fh)
|
52
|
+
}
|
53
|
+
assert_instance_of(Text::Document, document)
|
54
|
+
chapters = document.chapters
|
55
|
+
expected = %w{default name composition galenic_form clinical indications
|
56
|
+
dosage counterindications precautions interactions pregnancy
|
57
|
+
driving_ability unwanted_effects overdose pharmacology
|
58
|
+
pharmacodynamics pharmacokinetics preclinicals pharmaceutic
|
59
|
+
excipients incompatibilities shelf_life storage packaging
|
60
|
+
disposal company registration registration_date date
|
61
|
+
sale_limitation }
|
62
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
63
|
+
expected = "Wortlaut der f\303\274r die Fachinformation vorgesehenen Angaben\nFachinformation"
|
64
|
+
assert_equal(expected, chapters.at(0).to_s)
|
65
|
+
expected = "1.\tBezeichnung der Arzneimittel\nAmlodipin [besilat] - 1 A Pharma 5 mg Tabletten\nAmlodipin [besilat] - 1 A Pharma 7,5 mg Tabletten\nAmlodipin [besilat] - 1 A Pharma 10 mg Tabletten"
|
66
|
+
assert_equal(expected, chapters.at(1).to_s)
|
67
|
+
expected = "4.6\tSchwangerschaft und Stillzeit\nSchwangerschaft\nEs liegen keine hinreichenden Daten f\303\274r die Anwendung von Amlodipin bei Schwangeren vor. \nTierexperimentelle Studien haben Reproduktionstoxizit\303\244t bei hohen Dosen gezeigt (siehe Abschnitt 5.3). Das potentielle Risiko f\303\274r den Menschen ist unbekannt. Amlodipin darf w\303\244hrend der Schwangerschaft nicht angewendet werden, es sei denn, der therapeutische Nutzen \303\274berwiegt deutlich das potentielle Risiko einer Behandlung.\nStillzeit\nEs ist nicht bekannt, ob Amlodipin in die Muttermilch \303\274bergeht. Es wird geraten, w\303\244hrend der Behandlung mit Amlodipin abzustillen."
|
68
|
+
assert_equal(expected, document.chapter("pregnancy").to_s)
|
69
|
+
expected = "11.\tVerkaufsabgrenzung\nVerschreibungspflichtig"
|
70
|
+
assert_equal(expected, chapters.last.to_s)
|
71
|
+
end
|
72
|
+
def test_import__aspirin
|
73
|
+
path = File.expand_path('data/rtf/pharmnet/aspirin.rtf',
|
74
|
+
File.dirname(__FILE__))
|
75
|
+
document = nil
|
76
|
+
File.open(path) { |fh|
|
77
|
+
document = @importer.import(fh)
|
78
|
+
}
|
79
|
+
assert_instance_of(Text::Document, document)
|
80
|
+
chapters = document.chapters
|
81
|
+
expected = %w{default name composition galenic_form clinical indications
|
82
|
+
dosage counterindications precautions interactions pregnancy
|
83
|
+
driving_ability unwanted_effects overdose pharmacology
|
84
|
+
pharmacodynamics pharmacokinetics preclinicals pharmaceutic
|
85
|
+
excipients incompatibilities shelf_life storage packaging
|
86
|
+
company registration registration_date date sale_limitation
|
87
|
+
additional_information}
|
88
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
89
|
+
expected = "1.\tBezeichnung des Arzneimittels\nAspirin\302\256\nWirkstoff: Acetylsalicyls\303\244ure"
|
90
|
+
assert_equal(expected, chapters.at(1).to_s)
|
91
|
+
expected = <<-EOS
|
92
|
+
zusätzliche Angaben:
|
93
|
+
Bioverfügbarkeit
|
94
|
+
Eine im Jahr 1998/99 durchgeführte Bioverfügbarkeitsuntersuchung an 17 Probanden ergab für Aspirin in Bezug auf Acetylsalicylsäure- und Salicylsäurewerte die folgenden Ergebnisse:
|
95
|
+
Werte für Acetylsalicylsäure Werte für Salicylsäure
|
96
|
+
maximale Plasmakonzentration(Cmax) in μg/ml 3,63 ± 1,94 20,1 ± 1,25
|
97
|
+
Zeitpunkt der maximalen Plasma-Konzentration (tmax) in h* 0.50(0,33 - 2) 2,0 (0,833 - 3,069
|
98
|
+
Fläche unter der Konzentrations-Zeit-Kurve (AUC) in μg x h/ml 4,25 ± 1,53 107 ± 1,30
|
99
|
+
Angabe als geom. Mittelwerte Standardabweichung (* Angabe als Median und Streubreite)
|
100
|
+
EOS
|
101
|
+
assert_equal(expected.strip, chapters.last.to_s)
|
102
|
+
end
|
103
|
+
def test_import__claversal
|
104
|
+
path = File.expand_path('data/rtf/pharmnet/claversal.rtf',
|
105
|
+
File.dirname(__FILE__))
|
106
|
+
document = nil
|
107
|
+
File.open(path) { |fh|
|
108
|
+
document = @importer.import(fh)
|
109
|
+
}
|
110
|
+
assert_instance_of(Text::Document, document)
|
111
|
+
chapters = document.chapters
|
112
|
+
expected = ["default", "name", "sale_limitation", "composition",
|
113
|
+
"substance_group", "active_agents", "excipients",
|
114
|
+
"indications", "counterindications", "unwanted_effects",
|
115
|
+
"interactions", "precautions", "incompatibilities", "dosage",
|
116
|
+
"application", "overdose", "pharmacology", "toxicology",
|
117
|
+
"pharmacokinetics", "bioavailability", "other_advice",
|
118
|
+
"shelf_life", "storage", "packaging", "date", "company"]
|
119
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
120
|
+
chapter = chapters.at(-7)
|
121
|
+
picts = chapter.paragraphs.select { |par| par.is_a? Text::Picture }
|
122
|
+
assert_equal 3, picts.size, "Oh, dear - imagemagick won't convert wmf-files.."
|
123
|
+
end
|
124
|
+
def test_import__omeprazol
|
125
|
+
path = File.expand_path('data/rtf/pharmnet/omeprazol.rtf',
|
126
|
+
File.dirname(__FILE__))
|
127
|
+
document = nil
|
128
|
+
File.open(path) { |fh|
|
129
|
+
document = @importer.import(fh)
|
130
|
+
}
|
131
|
+
assert_instance_of(Text::Document, document)
|
132
|
+
chapters = document.chapters
|
133
|
+
expected = %w{default name composition galenic_form clinical indications
|
134
|
+
dosage counterindications precautions interactions pregnancy
|
135
|
+
driving_ability unwanted_effects overdose pharmacology
|
136
|
+
pharmacodynamics pharmacokinetics preclinicals pharmaceutic
|
137
|
+
excipients incompatibilities shelf_life storage packaging
|
138
|
+
disposal company registration registration_date date
|
139
|
+
sale_limitation }
|
140
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
141
|
+
expected = "11.\tVerschreibungsstatus/Apothekenpflicht\nVerschreibungspflichtig"
|
142
|
+
assert_equal(expected, chapters.last.to_s)
|
143
|
+
end
|
144
|
+
def test_import__selegilin
|
145
|
+
path = File.expand_path('data/rtf/pharmnet/selegilin.rtf',
|
146
|
+
File.dirname(__FILE__))
|
147
|
+
document = nil
|
148
|
+
File.open(path) { |fh|
|
149
|
+
document = @importer.import(fh)
|
150
|
+
}
|
151
|
+
assert_instance_of(Text::Document, document)
|
152
|
+
chapters = document.chapters
|
153
|
+
expected = %w{default name composition galenic_form clinical indications
|
154
|
+
dosage counterindications precautions interactions pregnancy
|
155
|
+
driving_ability unwanted_effects overdose pharmacology
|
156
|
+
pharmacodynamics pharmacokinetics preclinicals pharmaceutic
|
157
|
+
excipients incompatibilities shelf_life storage packaging
|
158
|
+
disposal company registration registration_date date
|
159
|
+
sale_limitation }
|
160
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
161
|
+
expected = "F a c h i n f o r m a t i o n"
|
162
|
+
assert_equal(expected, chapters.at(0).to_s)
|
163
|
+
expected = "1.\tBezeichnung des Arzneimittels\nSelegilin 5 Heumann\nTabletten mit 5 mg Selegilinhydrochlorid"
|
164
|
+
assert_equal(expected, chapters.at(1).to_s)
|
165
|
+
expected = "4.6\tAnwendung w\303\244hrend Schwangerschaft und Stillzeit\nAusreichende tierexperimentelle Untersuchungen oder Erfahrungen \303\274ber den Einfluss von Selegilinhydrochlorid auf die Schwangerschaft und Stillzeit beim Menschen liegen nicht vor. Daher darf Selegilinhydrochlorid in der Schwangerschaft und Stillzeit nicht angewendet werden."
|
166
|
+
assert_equal(expected, document.chapter("pregnancy").to_s)
|
167
|
+
expected = <<-EOS
|
168
|
+
4.7\tAuswirkungen auf die Verkehrst\303\274chtigkeit und das Bedienen von Maschinen
|
169
|
+
Die bei der kombinierten Einnahme von Selegilinhydrochlorid mit Levodopa enthaltenen Arzneimittel k\303\266nnen zentralnerv\303\266se Nebenwirkungen wie z. B. M\303\274digkeit, Benommenheit, Schwindel, vereinzelt Verwirrtheit oder Sehst\303\266rungen ausl\303\266sen. Deshalb kann auch bei bestimmungsgem\303\244\303\237em Gebrauch von Selegilinhydrochlorid das Reaktionsverm\303\266gen so weit ver\303\244ndert werden, dass die F\303\244higkeit zur aktiven Teilnahme am Stra\303\237enverkehr oder zum Bedienen von Maschinen unabh\303\244ngig von der zu behandelnden Grunderkrankung weiter beeintr\303\244chtigt wird. Ferner sind T\303\244tigkeiten, die mit erh\303\266hter Absturz- oder Unfallgefahr einhergehen, zu meiden. Dies gilt in verst\303\244rktem Ma\303\237e im Zusammenwirken mit Alkohol.
|
170
|
+
EOS
|
171
|
+
assert_equal(expected.strip, document.chapter("driving_ability").to_s)
|
172
|
+
expected = "7.\tPharmazeutischer Unternehmer\nHEUMANN PHARMA\nGmbH & Co. Generica KG\nS\303\274dwestpark 50\n90449 N\303\274rnberg\nTelefon/Telefax: 0700 4386 2667 "
|
173
|
+
assert_equal(expected, document.chapter("company").to_s)
|
174
|
+
expected = "11.\tVerschreibungsstatus/Apothekenpflicht \nVerschreibungspflichtig"
|
175
|
+
assert_equal(expected, chapters.last.to_s)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
class TestImport < Test::Unit::TestCase
|
179
|
+
include FlexMock::TestCase
|
180
|
+
def setup
|
181
|
+
ODDB.config.var = File.expand_path('var', File.dirname(__FILE__))
|
182
|
+
@importer = Importer.new
|
183
|
+
@errors = []
|
184
|
+
ODDB.logger = flexmock('logger')
|
185
|
+
ODDB.logger.should_receive(:error).and_return { |type, block|
|
186
|
+
msg = block.call
|
187
|
+
puts msg
|
188
|
+
@errors.push msg
|
189
|
+
}
|
190
|
+
ODDB.logger.should_ignore_missing
|
191
|
+
Drugs::Product.instances.clear
|
192
|
+
Drugs::Sequence.instances.clear
|
193
|
+
Drugs::Package.instances.clear
|
194
|
+
Drugs::GalenicForm.instances.clear
|
195
|
+
Drugs::Substance.instances.clear
|
196
|
+
Business::Company.instances.clear
|
197
|
+
end
|
198
|
+
def setup_search(resultfile='empty_result.html')
|
199
|
+
agent = flexmock(Mechanize.new)
|
200
|
+
flexmock(Mechanize).should_receive(:new).and_return agent
|
201
|
+
setup_agent(agent, resultfile, :get)
|
202
|
+
setup_agent(agent, resultfile, :submit) { |form, button|
|
203
|
+
form.action
|
204
|
+
}
|
205
|
+
setup_agent(agent, resultfile, :click) { |link| link.href }
|
206
|
+
agent
|
207
|
+
end
|
208
|
+
def setup_agent(agent, resultfile, symbol, &block)
|
209
|
+
dir = File.expand_path('data/html/pharmnet', File.dirname(__FILE__))
|
210
|
+
agent.should_receive(symbol).and_return { |argument, *data|
|
211
|
+
if(block)
|
212
|
+
argument = block.call(argument, *data)
|
213
|
+
end
|
214
|
+
name = case argument
|
215
|
+
when "http://www.pharmnet-bund.de/dynamic/de/am-info-system/index.html"
|
216
|
+
'index.html'
|
217
|
+
when "https://portal.dimdi.de/websearch/servlet/Gate#__DEFANCHOR__"
|
218
|
+
'gate.html'
|
219
|
+
when "/websearch/servlet/FlowController/AcceptFZK?uid=0"
|
220
|
+
'search.html'
|
221
|
+
when "/websearch/servlet/FlowController/DisplaySearchForm?uid=000002"
|
222
|
+
'search_filtered.html'
|
223
|
+
when "/websearch/servlet/FlowController/Search?uid=000002",
|
224
|
+
"/websearch/servlet/FlowController/Search?uid=1"
|
225
|
+
(@resultfiles ||= []).shift || resultfile
|
226
|
+
when "/websearch/servlet/FlowController/DisplayTitles?index=1&uid=000002"
|
227
|
+
'paged_result_2.html'
|
228
|
+
when "/websearch/servlet/FlowController/Documents-display"
|
229
|
+
(@displayfiles ||= []).shift || 'display.html'
|
230
|
+
when %r{/amispb/doc}
|
231
|
+
'../../rtf/pharmnet/aspirin.rtf'
|
232
|
+
when /display_.*.html/
|
233
|
+
argument
|
234
|
+
else
|
235
|
+
flunk "encountered unknown path: #{argument}"
|
236
|
+
end
|
237
|
+
path = File.join(dir, name)
|
238
|
+
uri = URI.parse argument
|
239
|
+
agent.pluggable_parser.parser("text/html").new(
|
240
|
+
URI.parse("http://www.pharmnet-bund.de" + uri.path),
|
241
|
+
{'content-type'=>'text/html'}, File.read(path), 200
|
242
|
+
) { |parser| parser.mech = agent }
|
243
|
+
}
|
244
|
+
end
|
245
|
+
def test_get_search_form
|
246
|
+
agent = setup_search
|
247
|
+
form = @importer.get_search_form(agent)
|
248
|
+
assert_instance_of(Mechanize::Form, form)
|
249
|
+
assert_equal("/websearch/servlet/FlowController/Search?uid=1",
|
250
|
+
form.action)
|
251
|
+
radio = form.radiobuttons.find { |b| b.name == "WFTYP" && b.value == "YES" }
|
252
|
+
@importer.set_fi_only(form)
|
253
|
+
assert_equal(true, radio.checked)
|
254
|
+
field = form.field('term')
|
255
|
+
assert_instance_of(Mechanize::Form::Text, field)
|
256
|
+
|
257
|
+
## if the sequence has incomplete active_agents, get all results
|
258
|
+
@importer.set_fi_only(form, "NO_RESTRICTION")
|
259
|
+
assert_equal(false, radio.checked)
|
260
|
+
radio = form.radiobuttons.find { |b|
|
261
|
+
b.name == "WFTYP" && b.value == "NO_RESTRICTION" }
|
262
|
+
assert_equal(true, radio.checked)
|
263
|
+
end
|
264
|
+
def test_import_company
|
265
|
+
assert_equal [], Business::Company.instances
|
266
|
+
comp1 = @importer.import_company 'Axapharm'
|
267
|
+
assert_instance_of Business::Company, comp1
|
268
|
+
assert_equal 'Axapharm', comp1.name.de
|
269
|
+
assert_equal [comp1], Business::Company.instances
|
270
|
+
comp2 = @importer.import_company 'Pfizer Pharmaceuticals AG'
|
271
|
+
assert_instance_of Business::Company, comp2
|
272
|
+
assert_equal 'Pfizer Pharmaceuticals AG', comp2.name.de
|
273
|
+
assert_equal [comp1, comp2], Business::Company.instances
|
274
|
+
comp3 = @importer.import_company 'Axapharm GmbH'
|
275
|
+
assert_equal comp1, comp3
|
276
|
+
assert_equal ['Axapharm GmbH'], comp1.name.synonyms
|
277
|
+
assert_equal [comp1, comp2], Business::Company.instances
|
278
|
+
end
|
279
|
+
def test_import_company__find_existing
|
280
|
+
existing = Business::Company.new
|
281
|
+
existing.name.de = 'Pfizer Pharma GmbH'
|
282
|
+
existing.save
|
283
|
+
assert_equal [existing], Business::Company.instances
|
284
|
+
comp1 = @importer.import_company "Pfizer Ltd. '"
|
285
|
+
assert_equal existing, comp1
|
286
|
+
assert_equal [existing], Business::Company.instances
|
287
|
+
end
|
288
|
+
def test_import_galenic_form
|
289
|
+
assert_equal [], Drugs::GalenicForm.instances
|
290
|
+
galform1 = @importer.import_galenic_form 'Tabletten'
|
291
|
+
assert_instance_of Drugs::GalenicForm, galform1
|
292
|
+
assert_equal 'Tabletten', galform1.name.de
|
293
|
+
assert_equal [galform1], Drugs::GalenicForm.instances
|
294
|
+
galform2 = @importer.import_galenic_form 'Kapseln'
|
295
|
+
assert_instance_of Drugs::GalenicForm, galform2
|
296
|
+
assert_equal 'Kapseln', galform2.name.de
|
297
|
+
assert_equal [galform1, galform2], Drugs::GalenicForm.instances
|
298
|
+
galform3 = @importer.import_galenic_form 'Tablette'
|
299
|
+
assert_equal galform1, galform3
|
300
|
+
assert_equal ['Tablette'], galform1.name.synonyms
|
301
|
+
assert_equal [galform1, galform2], Drugs::GalenicForm.instances
|
302
|
+
end
|
303
|
+
def test_import_missing
|
304
|
+
agent = setup_search "result.html"
|
305
|
+
assert_equal [], Business::Company.instances
|
306
|
+
assert_equal [], Drugs::Product.instances
|
307
|
+
assert_equal [], Drugs::Sequence.instances
|
308
|
+
assert_equal [], Drugs::Package.instances
|
309
|
+
assert_equal [], Drugs::Substance.instances
|
310
|
+
report = @importer.import_missing agent, 'Aarane'#, :repair => true
|
311
|
+
assert_equal 1, Drugs::Product.instances.size
|
312
|
+
prod = Drugs::Product.instances.first
|
313
|
+
assert_instance_of Drugs::Product, prod
|
314
|
+
assert_equal 'Aarane Sanofi-Aventis Deutschland', prod.name.de
|
315
|
+
company = prod.company
|
316
|
+
assert_equal 'Sanofi-Aventis Deutschland GmbH', company.name.de
|
317
|
+
assert_equal [company], Business::Company.instances
|
318
|
+
assert_equal 1, prod.sequences.size
|
319
|
+
seq = prod.sequences.first
|
320
|
+
assert_equal [seq], Drugs::Sequence.instances
|
321
|
+
assert_equal nil, seq.code(:registration)
|
322
|
+
assert_equal 1, seq.compositions.size
|
323
|
+
comp = seq.compositions.first
|
324
|
+
assert_equal 2, comp.active_agents.size
|
325
|
+
agent1, agent2 = comp.active_agents
|
326
|
+
sub1, sub2 = agent1.substance, agent2.substance
|
327
|
+
assert_equal 'Reproterolhydrochlorid', sub1.name.de
|
328
|
+
assert_equal 'Natriumcromoglicat (Ph.Eur.)', sub2.name.de
|
329
|
+
assert_equal [sub1, sub2], Drugs::Substance.instances
|
330
|
+
assert_equal [], Drugs::Package.instances
|
331
|
+
end
|
332
|
+
def test_import_rtf
|
333
|
+
url = "http://gripsdb.dimdi.de/amispb/doc/2136914-20050504/OBFM654A78B701C54FC6.rtf"
|
334
|
+
path = File.expand_path('data/rtf/pharmnet/selegilin.rtf',
|
335
|
+
File.dirname(__FILE__))
|
336
|
+
agent = flexmock('agent')
|
337
|
+
file = flexmock('file')
|
338
|
+
spath = File.join(ODDB.config.var,
|
339
|
+
'rtf', 'pharmnet', 'OBFM654A78B701C54FC6.rtf')
|
340
|
+
file.should_receive(:save).with(spath)
|
341
|
+
agent.should_receive(:get).with(url).and_return(file)
|
342
|
+
file.should_receive(:body).and_return { File.read path }
|
343
|
+
document = @importer.import_rtf(:fachinfo, agent, url, 'selegilin')
|
344
|
+
assert_instance_of Text::Document, document
|
345
|
+
assert_equal url, document.source
|
346
|
+
end
|
347
|
+
def test_import_substance
|
348
|
+
assert_equal [], Drugs::Substance.instances
|
349
|
+
sub1 = @importer.import_substance 'Mefenaminsäure'
|
350
|
+
assert_instance_of Drugs::Substance, sub1
|
351
|
+
assert_equal 'Mefenaminsäure', sub1.name.de
|
352
|
+
assert_equal [sub1], Drugs::Substance.instances
|
353
|
+
sub2 = @importer.import_substance 'Sildenafil'
|
354
|
+
assert_instance_of Drugs::Substance, sub2
|
355
|
+
assert_equal 'Sildenafil', sub2.name.de
|
356
|
+
assert_equal [sub1, sub2], Drugs::Substance.instances
|
357
|
+
sub3 = @importer.import_substance 'Mefenaminsäure'
|
358
|
+
assert_equal sub1, sub3
|
359
|
+
assert_equal [sub1, sub2], Drugs::Substance.instances
|
360
|
+
end
|
361
|
+
def test_result_page__empty_result
|
362
|
+
agent = RenewableAgent.new setup_search
|
363
|
+
form = @importer.get_search_form(agent)
|
364
|
+
page = @importer.result_page(form, 'Aar O S')
|
365
|
+
assert_instance_of EncodedParser, page
|
366
|
+
result = @importer.extract_result agent, page
|
367
|
+
assert result.empty?
|
368
|
+
end
|
369
|
+
def test_result_page
|
370
|
+
agent = RenewableAgent.new setup_search("result.html")
|
371
|
+
form = @importer.get_search_form(agent)
|
372
|
+
page = @importer.result_page(form, 'Aarane')
|
373
|
+
assert_instance_of EncodedParser, page
|
374
|
+
result = @importer.extract_result agent, page
|
375
|
+
assert_equal(1, result.size)
|
376
|
+
expected = [{
|
377
|
+
:data => [ "AARANE N",
|
378
|
+
"Suspension mit Treibmittel",
|
379
|
+
"Sanofi-Aventis Deutschland GmbH" ],
|
380
|
+
:href => "/websearch/servlet/FlowController/Documents-display?uid=000002&docId=1"
|
381
|
+
}]
|
382
|
+
assert_equal expected, result
|
383
|
+
end
|
384
|
+
def test_result_page__paged
|
385
|
+
agent = RenewableAgent.new setup_search("paged_result_1.html")
|
386
|
+
form = @importer.get_search_form(agent)
|
387
|
+
page = @importer.result_page(form, 'Aspirin')
|
388
|
+
assert_instance_of EncodedParser, page
|
389
|
+
result = @importer.extract_result agent, page
|
390
|
+
assert_equal(18, result.size)
|
391
|
+
expected = {
|
392
|
+
:data=> [ "Aspirin", "Tablette", "Bayer Vital GmbH" ],
|
393
|
+
:href=> "/websearch/servlet/FlowController/Documents-display?uid=000002&docId=1"
|
394
|
+
}
|
395
|
+
assert_equal expected, result.first
|
396
|
+
expected = {
|
397
|
+
:data=> [ "Aspirin-Colfarit 100mg",
|
398
|
+
"magensaftresistente Tablette",
|
399
|
+
"Bayer Vital GmbH"],
|
400
|
+
:href=> "/websearch/servlet/FlowController/Documents-display?uid=000002&docId=18"
|
401
|
+
}
|
402
|
+
assert_equal expected, result.last
|
403
|
+
end
|
404
|
+
def test_get_details
|
405
|
+
agent = RenewableAgent.new setup_search("result.html")
|
406
|
+
form = @importer.get_search_form(agent)
|
407
|
+
page = @importer.result_page(form, 'Aarane')
|
408
|
+
result = @importer.extract_result agent, page
|
409
|
+
page = @importer.get_details agent, page, result.first
|
410
|
+
assert_instance_of EncodedParser, page
|
411
|
+
details = @importer.extract_details page
|
412
|
+
expected = {
|
413
|
+
:patinfo => "/amispb/doc/2007/08/15/2103159/OBFM262E63A401C7DE6A.rtf",
|
414
|
+
:fachinfo => "/amispb/doc/2007/08/15/2103159/OBFM2F47BD1E01C7DE6A.rtf",
|
415
|
+
:composition=> [
|
416
|
+
{ :dose => Drugs::Dose.new(0.5, "mg"), :ask_nr => "",
|
417
|
+
:substance => "Reproterolhydrochlorid" },
|
418
|
+
{ :dose => Drugs::Dose.new(1, "mg"), :ask_nr => "",
|
419
|
+
:substance => "Natriumcromoglicat (Ph.Eur.)" }
|
420
|
+
],
|
421
|
+
:date_fachinfo => Date.new(2007,06,29),
|
422
|
+
:date_patinfo => Date.new(2007,06,29),
|
423
|
+
:registration => "3159.00.00",
|
424
|
+
:marketable => true,
|
425
|
+
}
|
426
|
+
assert_equal expected, details
|
427
|
+
end
|
428
|
+
def test_search__paged
|
429
|
+
agent = RenewableAgent.new setup_search("paged_result_1.html")
|
430
|
+
result = @importer.search agent, 'Aspirin'
|
431
|
+
assert_equal 18, result.size
|
432
|
+
expected = {
|
433
|
+
:patinfo=>"/amispb/doc/2007/08/15/2103159/OBFM262E63A401C7DE6A.rtf",
|
434
|
+
:fachinfo=>"/amispb/doc/2007/08/15/2103159/OBFM2F47BD1E01C7DE6A.rtf",
|
435
|
+
:composition=> [
|
436
|
+
{ :dose => Drugs::Dose.new(0.5, "mg"), :ask_nr => "",
|
437
|
+
:substance=>"Reproterolhydrochlorid" },
|
438
|
+
{ :dose => Drugs::Dose.new(1, "mg"), :ask_nr => "",
|
439
|
+
:substance=>"Natriumcromoglicat (Ph.Eur.)" }
|
440
|
+
],
|
441
|
+
:data => ["Aspirin", "Tablette", "Bayer Vital GmbH"],
|
442
|
+
:date_fachinfo => Date.new(2007,06,29),
|
443
|
+
:date_patinfo => Date.new(2007,06,29),
|
444
|
+
:registration=>"3159.00.00",
|
445
|
+
:marketable => true,
|
446
|
+
}
|
447
|
+
assert_equal expected, result.first
|
448
|
+
expected = {
|
449
|
+
:patinfo=>"/amispb/doc/2007/08/15/2103159/OBFM262E63A401C7DE6A.rtf",
|
450
|
+
:fachinfo=>"/amispb/doc/2007/08/15/2103159/OBFM2F47BD1E01C7DE6A.rtf",
|
451
|
+
:composition=> [
|
452
|
+
{ :dose => Drugs::Dose.new(0.5, "mg"), :ask_nr => "",
|
453
|
+
:substance=>"Reproterolhydrochlorid" },
|
454
|
+
{ :dose => Drugs::Dose.new(1, "mg"), :ask_nr => "",
|
455
|
+
:substance=>"Natriumcromoglicat (Ph.Eur.)" }
|
456
|
+
],
|
457
|
+
:data=> [ "Aspirin-Colfarit 100mg",
|
458
|
+
"magensaftresistente Tablette",
|
459
|
+
"Bayer Vital GmbH"],
|
460
|
+
:date_fachinfo => Date.new(2007,06,29),
|
461
|
+
:date_patinfo => Date.new(2007,06,29),
|
462
|
+
:registration=>"3159.00.00",
|
463
|
+
:marketable => true,
|
464
|
+
}
|
465
|
+
assert_equal expected, result.last
|
466
|
+
end
|
467
|
+
def test_search__cached
|
468
|
+
agent = RenewableAgent.new setup_search("paged_result_1.html")
|
469
|
+
result = @importer.search agent, 'Aspirin'
|
470
|
+
agent2= flexmock(Mechanize.new)
|
471
|
+
agent2.should_receive(:get).and_return {
|
472
|
+
raise "the search for aspirin should be cached" }
|
473
|
+
agent2.should_receive(:submit).and_return {
|
474
|
+
raise "the search for aspirin should be cached" }
|
475
|
+
agent2.should_receive(:click).and_return {
|
476
|
+
raise "the search for aspirin should be cached" }
|
477
|
+
result2 = @importer.search agent2, 'aspirin'
|
478
|
+
assert_equal result, result2
|
479
|
+
end
|
480
|
+
def test_search__unresponsive
|
481
|
+
agent = RenewableAgent.new setup_search("result.html")
|
482
|
+
agent = flexmock agent
|
483
|
+
agent.should_receive(:renew!).times(1)
|
484
|
+
result = @importer.search agent, 'Aspirin'
|
485
|
+
assert_equal(0, result.size)
|
486
|
+
assert_equal(["Searched for 'aspirin' but got result for 'Arzneimittelname: Aarane' - creating new session"],
|
487
|
+
@errors)
|
488
|
+
end
|
489
|
+
def test_process__no_suitable_fachinfo_found__no_active_agents
|
490
|
+
@resultfiles = %w{empty_result.html result.html}
|
491
|
+
agent = RenewableAgent.new setup_search
|
492
|
+
sequence = flexmock(Drugs::Sequence.new)
|
493
|
+
sequence.should_receive(:name)\
|
494
|
+
.and_return(Util::Multilingual.new(:de => 'Aar O S'))
|
495
|
+
company = Business::Company.new
|
496
|
+
company.name.de = 'Company'
|
497
|
+
sequence.should_receive(:company).and_return flexmock(company)
|
498
|
+
@importer.process agent, sequence
|
499
|
+
assert sequence.fachinfo.empty?
|
500
|
+
end
|
501
|
+
def test_process__no_suitable_fachinfo_found
|
502
|
+
@resultfiles = %w{empty_result.html result.html}
|
503
|
+
agent = RenewableAgent.new setup_search
|
504
|
+
sequence = flexmock(Drugs::Sequence.new)
|
505
|
+
sequence.should_receive(:name)\
|
506
|
+
.and_return(Util::Multilingual.new(:de => 'Aar O S'))
|
507
|
+
company = Business::Company.new
|
508
|
+
company.name.de = 'Company'
|
509
|
+
sequence.should_receive(:company).and_return flexmock(company)
|
510
|
+
substance = Drugs::Substance.new
|
511
|
+
substance.name.de = 'Acetylsalicylsäure'
|
512
|
+
act = Drugs::ActiveAgent.new substance, 300
|
513
|
+
sequence.should_receive(:active_agents).and_return [flexmock(act)]
|
514
|
+
@importer.process agent, sequence
|
515
|
+
assert sequence.fachinfo.empty?
|
516
|
+
end
|
517
|
+
def test_process__http_500
|
518
|
+
agent = flexmock(Mechanize.new)
|
519
|
+
klass = flexmock(Mechanize)
|
520
|
+
klass.should_receive(:new).and_return agent
|
521
|
+
agent.should_receive(:get).times(3).and_return {
|
522
|
+
raise "500 => Net::HTTPInternalServerError"
|
523
|
+
}
|
524
|
+
sequence = flexmock(Drugs::Sequence.new)
|
525
|
+
sequence.should_receive(:name)\
|
526
|
+
.and_return(Util::Multilingual.new(:de => 'Aarane'))
|
527
|
+
ODDB.logger = flexmock('logger')
|
528
|
+
ODDB.logger.should_ignore_missing
|
529
|
+
assert_nothing_raised {
|
530
|
+
@importer.process PharmNet::RenewableAgent.new(agent),
|
531
|
+
sequence, :retry_unit => 1, :retries => 2
|
532
|
+
}
|
533
|
+
end
|
534
|
+
def test_process
|
535
|
+
agent = RenewableAgent.new setup_search("result.html")
|
536
|
+
sequence = flexmock(Drugs::Sequence.new)
|
537
|
+
sequence.should_receive(:name)\
|
538
|
+
.and_return(Util::Multilingual.new(:de => 'Aarane'))
|
539
|
+
company = Business::Company.new
|
540
|
+
company.name.de = 'Sanofi-Aventis Dt. GmbH'
|
541
|
+
sequence.should_receive(:company).and_return flexmock(company)
|
542
|
+
galform = Drugs::GalenicForm.new
|
543
|
+
galform.description.de = 'Dosieraerosol'
|
544
|
+
sequence.should_receive(:galenic_forms).and_return [flexmock(galform)]
|
545
|
+
substance1 = Drugs::Substance.new
|
546
|
+
substance1.name.de = 'Reproterolhydrochlorid'
|
547
|
+
agent1 = Drugs::ActiveAgent.new substance1, 0.5, 'mg'
|
548
|
+
substance2 = Drugs::Substance.new
|
549
|
+
substance2.name.de = 'Natriumcromoglicat (Ph.Eur.)'
|
550
|
+
agent2 = Drugs::ActiveAgent.new substance2, 0, 'mg'
|
551
|
+
sequence.should_receive(:active_agents)\
|
552
|
+
.and_return [flexmock(agent1), flexmock(agent2)]
|
553
|
+
@importer.process agent, sequence, :repair => true
|
554
|
+
assert !sequence.fachinfo.empty?
|
555
|
+
|
556
|
+
# Agents should be corrected
|
557
|
+
assert_equal(Drugs::Dose.new(1, 'mg'), agent2.dose)
|
558
|
+
|
559
|
+
# Registration should be assigned
|
560
|
+
assert_equal(sequence.code(:registration, 'EU'), '3159.00.00')
|
561
|
+
end
|
562
|
+
def test_process__many
|
563
|
+
@displayfiles = %w{display2.html display3.html display1.html} * 6
|
564
|
+
agent = RenewableAgent.new setup_search("paged_result_1.html")
|
565
|
+
sequence = flexmock(Drugs::Sequence.new)
|
566
|
+
sequence.should_receive(:name)\
|
567
|
+
.and_return(Util::Multilingual.new(:de => 'Aspirin Protect'))
|
568
|
+
company = Business::Company.new
|
569
|
+
company.name.de = 'Bayer Vital GmbH'
|
570
|
+
sequence.should_receive(:company).and_return flexmock(company)
|
571
|
+
galform = Drugs::GalenicForm.new
|
572
|
+
galform.description.de = 'Tabletten, Magensaftresistent'
|
573
|
+
sequence.should_receive(:galenic_forms).and_return [flexmock(galform)]
|
574
|
+
substance = Drugs::Substance.new
|
575
|
+
substance.name.de = 'Acetylsalicylsäure'
|
576
|
+
act = Drugs::ActiveAgent.new substance, 300
|
577
|
+
sequence.should_receive(:active_agents).and_return [flexmock(act)]
|
578
|
+
@importer.process agent, sequence
|
579
|
+
assert !sequence.fachinfo.empty?
|
580
|
+
end
|
581
|
+
def test_exclusive_permutation
|
582
|
+
assert_equal([[[0,0]]], @importer.exclusive_permutation(1))
|
583
|
+
assert_equal([[[0,0], [1,1]], [[1,0], [0,1]]],
|
584
|
+
@importer.exclusive_permutation(2))
|
585
|
+
assert_equal([ [[0,0], [1,1], [2,2]],
|
586
|
+
[[0,0], [2,1], [1,2]],
|
587
|
+
[[1,0], [0,1], [2,2]],
|
588
|
+
[[1,0], [2,1], [0,2]],
|
589
|
+
[[2,0], [0,1], [1,2]],
|
590
|
+
[[2,0], [1,1], [0,2]], ],
|
591
|
+
@importer.exclusive_permutation(3))
|
592
|
+
end
|
593
|
+
def test_ngram_similarity
|
594
|
+
assert_in_delta(1.0, @importer.ngram_similarity('Tablette', 'tablette'),
|
595
|
+
0.00001)
|
596
|
+
assert_in_delta(0.8, @importer.ngram_similarity('Tablette', 'Tabletten'),
|
597
|
+
0.00001)
|
598
|
+
assert_in_delta(0.75,
|
599
|
+
@importer.ngram_similarity('Tablette, magensaftresistent',
|
600
|
+
'magensaftresistente Tabletten'),
|
601
|
+
0.0001)
|
602
|
+
assert_in_delta(0.18,
|
603
|
+
@importer.ngram_similarity('Tablette, magensaftresistent',
|
604
|
+
'Brausetabletten'),
|
605
|
+
0.01)
|
606
|
+
assert_in_delta(0.666,
|
607
|
+
@importer.ngram_similarity('Aspirin Protect',
|
608
|
+
'Aspirin protect 300mg'),
|
609
|
+
0.001)
|
610
|
+
assert_in_delta(0.333,
|
611
|
+
@importer.ngram_similarity('Reproterol',
|
612
|
+
'Reproterolhydrochlorid'),
|
613
|
+
0.001)
|
614
|
+
assert_in_delta(0.238,
|
615
|
+
@importer.ngram_similarity('Cromoglicin',
|
616
|
+
'Natriumcromoglicat (Ph.Eur.)'),
|
617
|
+
0.001)
|
618
|
+
|
619
|
+
end
|
620
|
+
def test_suitable_data
|
621
|
+
data = {
|
622
|
+
:data => ['ACE-Hemmer-ratiopharm 100', 'Tabletten', 'Ratiopharm GmbH'],
|
623
|
+
:composition => []
|
624
|
+
}
|
625
|
+
comparison = ['Ace Hemmer Ratio', 'Tabletten', 'Ratiopharm']
|
626
|
+
|
627
|
+
assert_not_nil @importer._suitable_data(data, comparison, 0)
|
628
|
+
end
|
629
|
+
def test_suitable_data__neupro
|
630
|
+
data = {
|
631
|
+
:data => ["Neupro 4 mg/24 h transdermales Pflaster - OP28",
|
632
|
+
"transdermales Pflaster", "kohlpharma GmbH"],
|
633
|
+
:composition => []
|
634
|
+
}
|
635
|
+
comparison = ["Neupro 28", nil, "KOHLPHARMA GMBH"]
|
636
|
+
|
637
|
+
assert_not_nil @importer._suitable_data(data, comparison, 0)
|
638
|
+
end
|
639
|
+
def test_best_data__tramal
|
640
|
+
agent = setup_search "result.html"
|
641
|
+
page = agent.get '/display_tramal.html'
|
642
|
+
|
643
|
+
sequence = flexmock(Drugs::Sequence.new)
|
644
|
+
sequence.should_receive(:name)\
|
645
|
+
.and_return(Util::Multilingual.new(:de => 'Tramal'))
|
646
|
+
company = Business::Company.new
|
647
|
+
company.name.de = 'Gruenenthal GmbH'
|
648
|
+
sequence.should_receive(:company).and_return flexmock(company)
|
649
|
+
galform = Drugs::GalenicForm.new
|
650
|
+
galform.description.de = 'Injektionslösung'
|
651
|
+
sequence.should_receive(:galenic_forms).and_return [flexmock(galform)]
|
652
|
+
substance1 = Drugs::Substance.new
|
653
|
+
substance1.name.de = 'Tramadol'
|
654
|
+
agent1 = Drugs::ActiveAgent.new substance1, 100, 'mg'
|
655
|
+
sequence.should_receive(:active_agents)\
|
656
|
+
.and_return [flexmock(agent1)]
|
657
|
+
|
658
|
+
details = @importer.extract_details page
|
659
|
+
details.store :data, ['Tramal 100 mg', 'Injektionsl?sung', 'Gr?nenthal GmbH']
|
660
|
+
assert_equal details, @importer.best_data(sequence, [details])
|
661
|
+
|
662
|
+
relevance = @importer.composition_relevance([agent1], details)
|
663
|
+
assert 1.25 < relevance, "Relevance #{relevance} should be > 1.25"
|
664
|
+
end
|
665
|
+
end
|
666
|
+
class TestPiParser < Test::Unit::TestCase
|
667
|
+
def setup
|
668
|
+
ODDB.config.var = File.expand_path('var', File.dirname(__FILE__))
|
669
|
+
end
|
670
|
+
def test_import_pi__aarane
|
671
|
+
@importer = PiParser.new 'Aarane'
|
672
|
+
path = File.expand_path('data/rtf/pharmnet/aarane.pi.rtf',
|
673
|
+
File.dirname(__FILE__))
|
674
|
+
document = nil
|
675
|
+
File.open(path) { |fh|
|
676
|
+
document = @importer.import(fh)
|
677
|
+
}
|
678
|
+
assert_instance_of(Text::Document, document)
|
679
|
+
chapters = document.chapters
|
680
|
+
expected = [ "default", "composition", "indications", "precautions",
|
681
|
+
"application", "unwanted_effects", "storage",
|
682
|
+
"additional_information", "date", "personal" ]
|
683
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
684
|
+
end
|
685
|
+
def test_import_pi__ace_hemmer
|
686
|
+
@importer = PiParser.new 'ace-hemmer'
|
687
|
+
path = File.expand_path('data/rtf/pharmnet/ace_hemmer_ratio.pi.rtf',
|
688
|
+
File.dirname(__FILE__))
|
689
|
+
document = nil
|
690
|
+
File.open(path) { |fh|
|
691
|
+
document = @importer.import(fh)
|
692
|
+
}
|
693
|
+
assert_instance_of(Text::Document, document)
|
694
|
+
chapters = document.chapters
|
695
|
+
expected = [ "default", "composition", "indications", "precautions",
|
696
|
+
"application", "unwanted_effects", "storage", "date" ]
|
697
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
698
|
+
assert_equal(13, document.chapter('indications').paragraphs.size)
|
699
|
+
end
|
700
|
+
def test_import_pi__ace_hemmer_comp
|
701
|
+
@importer = PiParser.new 'Ace.Hemmer'
|
702
|
+
path = File.expand_path('data/rtf/pharmnet/ace_hemmer_comp_ratio.pi.rtf',
|
703
|
+
File.dirname(__FILE__))
|
704
|
+
document = nil
|
705
|
+
File.open(path) { |fh|
|
706
|
+
document = @importer.import(fh)
|
707
|
+
}
|
708
|
+
assert_instance_of(Text::Document, document)
|
709
|
+
chapters = document.chapters
|
710
|
+
expected = [ "default", "composition", "indications", "precautions",
|
711
|
+
"application", "unwanted_effects", "storage",
|
712
|
+
"additional_information", "company", "date" ]
|
713
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
714
|
+
assert document.chapter('indications').paragraphs.size > 1
|
715
|
+
end
|
716
|
+
def test_import_pi__acemetacin
|
717
|
+
@importer = PiParser.new 'Acemetacin.Ct'
|
718
|
+
path = File.expand_path('data/rtf/pharmnet/acemetacin.pi.rtf',
|
719
|
+
File.dirname(__FILE__))
|
720
|
+
document = nil
|
721
|
+
File.open(path) { |fh|
|
722
|
+
document = @importer.import(fh)
|
723
|
+
}
|
724
|
+
assert_instance_of(Text::Document, document)
|
725
|
+
chapters = document.chapters
|
726
|
+
expected = [ "default", "composition", "indications", "precautions",
|
727
|
+
"application", "unwanted_effects", "storage",
|
728
|
+
"additional_information", "company", "date" ]
|
729
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
730
|
+
assert document.chapter('indications').paragraphs.size > 1
|
731
|
+
end
|
732
|
+
def test_import_pi__acemit
|
733
|
+
@importer = PiParser.new 'Acemit'
|
734
|
+
path = File.expand_path('data/rtf/pharmnet/acemit.pi.rtf',
|
735
|
+
File.dirname(__FILE__))
|
736
|
+
document = nil
|
737
|
+
File.open(path) { |fh|
|
738
|
+
document = @importer.import(fh)
|
739
|
+
}
|
740
|
+
assert_instance_of(Text::Document, document)
|
741
|
+
chapters = document.chapters
|
742
|
+
expected = [ "default", "composition", "packaging", "indications",
|
743
|
+
"counterindications", "precautions", "application",
|
744
|
+
"unwanted_effects", "storage", "date", "additional_information" ]
|
745
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
746
|
+
assert document.chapter('indications').paragraphs.size > 1
|
747
|
+
end
|
748
|
+
def test_import_pi__acerbon
|
749
|
+
@importer = PiParser.new 'Acerbon'
|
750
|
+
path = File.expand_path('data/rtf/pharmnet/acerbon.pi.rtf',
|
751
|
+
File.dirname(__FILE__))
|
752
|
+
document = nil
|
753
|
+
File.open(path) { |fh|
|
754
|
+
document = @importer.import(fh)
|
755
|
+
}
|
756
|
+
assert_instance_of(Text::Document, document)
|
757
|
+
chapters = document.chapters
|
758
|
+
expected = [ "default", "composition", "indications", "precautions",
|
759
|
+
"application", "unwanted_effects", "storage", "date",
|
760
|
+
"additional_information" ]
|
761
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
762
|
+
assert document.chapter('indications').paragraphs.size > 1
|
763
|
+
end
|
764
|
+
def test_import_pi__acetylcystein
|
765
|
+
@importer = PiParser.new 'Acetylcystein'
|
766
|
+
path = File.expand_path('data/rtf/pharmnet/acetylcystein.pi.rtf',
|
767
|
+
File.dirname(__FILE__))
|
768
|
+
document = nil
|
769
|
+
File.open(path) { |fh|
|
770
|
+
document = @importer.import(fh)
|
771
|
+
}
|
772
|
+
assert_instance_of(Text::Document, document)
|
773
|
+
chapters = document.chapters
|
774
|
+
expected = [ "default", "composition", "indications", "precautions",
|
775
|
+
"application", "unwanted_effects", "storage", "date",
|
776
|
+
"personal" ]
|
777
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
778
|
+
assert document.chapter('indications').paragraphs.size > 1
|
779
|
+
end
|
780
|
+
def test_import_pi__aciclo
|
781
|
+
@importer = PiParser.new 'Aciclo'
|
782
|
+
path = File.expand_path('data/rtf/pharmnet/aciclo.pi.rtf',
|
783
|
+
File.dirname(__FILE__))
|
784
|
+
document = nil
|
785
|
+
File.open(path) { |fh|
|
786
|
+
document = @importer.import(fh)
|
787
|
+
}
|
788
|
+
assert_instance_of(Text::Document, document)
|
789
|
+
chapters = document.chapters
|
790
|
+
expected = [ "default", "composition", "indications", "precautions",
|
791
|
+
"application", "unwanted_effects", "storage",
|
792
|
+
"additional_information", "company", "date" ]
|
793
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
794
|
+
assert document.chapter('indications').paragraphs.size > 1
|
795
|
+
end
|
796
|
+
def test_import_pi__aciclovir
|
797
|
+
@importer = PiParser.new 'Aciclovir'
|
798
|
+
path = File.expand_path('data/rtf/pharmnet/aciclovir.pi.rtf',
|
799
|
+
File.dirname(__FILE__))
|
800
|
+
document = nil
|
801
|
+
File.open(path) { |fh|
|
802
|
+
document = @importer.import(fh)
|
803
|
+
}
|
804
|
+
assert_instance_of(Text::Document, document)
|
805
|
+
chapters = document.chapters
|
806
|
+
expected = [ "default", "composition", "indications", "precautions",
|
807
|
+
"application", "unwanted_effects", "storage",
|
808
|
+
"additional_information", "company", "date", "personal" ]
|
809
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
810
|
+
assert document.chapter('indications').paragraphs.size > 1
|
811
|
+
end
|
812
|
+
def test_import_pi__actrapid
|
813
|
+
@importer = PiParser.new 'Actrapid'
|
814
|
+
path = File.expand_path('data/rtf/pharmnet/actrapid.pi.rtf',
|
815
|
+
File.dirname(__FILE__))
|
816
|
+
document = nil
|
817
|
+
File.open(path) { |fh|
|
818
|
+
document = @importer.import(fh)
|
819
|
+
}
|
820
|
+
assert_instance_of(Text::Document, document)
|
821
|
+
chapters = document.chapters
|
822
|
+
expected = [ "default", "composition", "indications", "precautions",
|
823
|
+
"application", "emergency", "unwanted_effects", "storage",
|
824
|
+
"date" ]
|
825
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
826
|
+
assert document.chapter('indications').paragraphs.size > 1
|
827
|
+
end
|
828
|
+
def test_import_pi__amlodipin
|
829
|
+
@importer = PiParser.new 'amlodipin'
|
830
|
+
path = File.expand_path('data/rtf/pharmnet/amlodipin.pi.rtf',
|
831
|
+
File.dirname(__FILE__))
|
832
|
+
document = nil
|
833
|
+
File.open(path) { |fh|
|
834
|
+
document = @importer.import(fh)
|
835
|
+
}
|
836
|
+
assert_instance_of(Text::Document, document)
|
837
|
+
chapters = document.chapters
|
838
|
+
expected = [ "default", "composition", "indications", "precautions",
|
839
|
+
"application", "unwanted_effects", "storage", "date" ]
|
840
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
841
|
+
expected = <<-EOS.strip
|
842
|
+
Amlodipin Dexcel 10 mg Tabletten
|
843
|
+
Wirkstoff: Amlodipinmaleat
|
844
|
+
Der arzneilich wirksame Bestandteil ist Amlodipinmaleat.
|
845
|
+
1 Tablette enth\303\244lt 10 mg Amlodipin (als Amlodipinmaleat).
|
846
|
+
Die sonstigen Bestandteile sind: Lactose-Monohydrat; Povidon K 30; Povidon K 90; mikrokristalline Cellulose; Crospovidon; Natriumstearylfumarat.
|
847
|
+
Amlodipin Dexcel 10 mg ist in Packungen mit 20, 50 und
|
848
|
+
100 Tabletten erh\303\244ltlich.
|
849
|
+
EOS
|
850
|
+
assert_equal(expected, chapters.at(1).to_s)
|
851
|
+
indications = <<-EOS.strip
|
852
|
+
1. \tWAS IST Amlodipin Dexcel 10 mg UND WOF\303\234R WIRD ES ANGEWENDET?
|
853
|
+
1.1\tAmlodipin Dexcel 10 mg ist ein Mittel zur Behandlung von Bluthochdruck und Engegef\303\274hl in der Brust (Angina pectoris).
|
854
|
+
1.2\tvon:
|
855
|
+
Dexcel Pharma GmbH
|
856
|
+
R\303\266ntgenstra\303\237e 1
|
857
|
+
63755 Alzenau
|
858
|
+
hergestellt von:
|
859
|
+
Losan Pharma GmbH
|
860
|
+
Otto-Hahn-Stra\303\237e 13
|
861
|
+
79395 Neuenburg
|
862
|
+
1.3\tAmlodipin Dexcel 10 mg wird angewendet
|
863
|
+
bei nicht organbedingtem Bluthochdruck (essentieller Hypertonie) und bei Belastung auftretender (chronischer) und im Ruhezustand auftretender (vasospastischer) Angina pectoris (Engegef\303\274hl in der Brust).
|
864
|
+
EOS
|
865
|
+
assert_equal(indications, chapters.at(2).to_s)
|
866
|
+
unwanted = document.chapter('unwanted_effects')
|
867
|
+
assert_equal(unwanted, chapters.at(5))
|
868
|
+
end
|
869
|
+
def test_import_pi__aspirin
|
870
|
+
@importer = PiParser.new 'aspirin'
|
871
|
+
path = File.expand_path('data/rtf/pharmnet/aspirin.pi.rtf',
|
872
|
+
File.dirname(__FILE__))
|
873
|
+
document = nil
|
874
|
+
File.open(path) { |fh|
|
875
|
+
document = @importer.import(fh)
|
876
|
+
}
|
877
|
+
assert_instance_of(Text::Document, document)
|
878
|
+
chapters = document.chapters
|
879
|
+
expected = [ "default", "composition", "indications", "precautions",
|
880
|
+
"application", "unwanted_effects", "storage",
|
881
|
+
"additional_information", "packaging", "company", "date" ]
|
882
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
883
|
+
end
|
884
|
+
def test_import_pi__baymycard
|
885
|
+
@importer = PiParser.new 'Baymycard'
|
886
|
+
path = File.expand_path('data/rtf/pharmnet/baymycard.pi.rtf',
|
887
|
+
File.dirname(__FILE__))
|
888
|
+
document = nil
|
889
|
+
File.open(path) { |fh|
|
890
|
+
document = @importer.import(fh)
|
891
|
+
}
|
892
|
+
assert_instance_of(Text::Document, document)
|
893
|
+
chapters = document.chapters
|
894
|
+
expected = [ "default", "composition", "indications", "precautions",
|
895
|
+
"application", "unwanted_effects", "storage", "date",
|
896
|
+
"additional_information", "personal" ]
|
897
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
898
|
+
end
|
899
|
+
def test_import_pi__naltrexon
|
900
|
+
@importer = PiParser.new 'naltrexon'
|
901
|
+
path = File.expand_path('data/rtf/pharmnet/naltrexon.pi.rtf',
|
902
|
+
File.dirname(__FILE__))
|
903
|
+
document = nil
|
904
|
+
File.open(path) { |fh|
|
905
|
+
document = @importer.import(fh)
|
906
|
+
}
|
907
|
+
assert_instance_of(Text::Document, document)
|
908
|
+
chapters = document.chapters
|
909
|
+
expected = [ "default", "composition", "indications", "company",
|
910
|
+
"precautions", "application", "unwanted_effects", "storage",
|
911
|
+
"date" ]
|
912
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
913
|
+
end
|
914
|
+
def test_import_pi__omeprazol
|
915
|
+
@importer = PiParser.new 'omeprazol'
|
916
|
+
path = File.expand_path('data/rtf/pharmnet/omeprazol.pi.rtf',
|
917
|
+
File.dirname(__FILE__))
|
918
|
+
document = nil
|
919
|
+
File.open(path) { |fh|
|
920
|
+
document = @importer.import(fh)
|
921
|
+
}
|
922
|
+
assert_instance_of(Text::Document, document)
|
923
|
+
chapters = document.chapters
|
924
|
+
expected = [ "default", "composition", "indications", "precautions",
|
925
|
+
"application", "unwanted_effects", "storage", "date",
|
926
|
+
"additional_information", "personal" ]
|
927
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
928
|
+
end
|
929
|
+
def test_import_pi__paroxetin
|
930
|
+
@importer = PiParser.new 'paroxetin.isis'
|
931
|
+
path = File.expand_path('data/rtf/pharmnet/paroxetin.pi.rtf',
|
932
|
+
File.dirname(__FILE__))
|
933
|
+
document = nil
|
934
|
+
File.open(path) { |fh|
|
935
|
+
document = @importer.import(fh)
|
936
|
+
}
|
937
|
+
assert_instance_of(Text::Document, document)
|
938
|
+
chapters = document.chapters
|
939
|
+
expected = [ "default", "composition", "indications", "precautions",
|
940
|
+
"application", "unwanted_effects", "storage",
|
941
|
+
"additional_information", "company",
|
942
|
+
]
|
943
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
944
|
+
end
|
945
|
+
def test_import_pi__selegilin
|
946
|
+
@importer = PiParser.new 'selegilin'
|
947
|
+
path = File.expand_path('data/rtf/pharmnet/selegilin.pi.rtf',
|
948
|
+
File.dirname(__FILE__))
|
949
|
+
document = nil
|
950
|
+
File.open(path) { |fh|
|
951
|
+
document = @importer.import(fh)
|
952
|
+
}
|
953
|
+
assert_instance_of(Text::Document, document)
|
954
|
+
chapters = document.chapters
|
955
|
+
expected = [ "default", "composition", "indications", "precautions",
|
956
|
+
"application", "unwanted_effects", "storage", "date",
|
957
|
+
"additional_information", "personal" ]
|
958
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
959
|
+
end
|
960
|
+
def test_import_pi__valium
|
961
|
+
@importer = PiParser.new 'valium'
|
962
|
+
path = File.expand_path('data/rtf/pharmnet/valium.pi.rtf',
|
963
|
+
File.dirname(__FILE__))
|
964
|
+
document = nil
|
965
|
+
File.open(path) { |fh|
|
966
|
+
document = @importer.import(fh)
|
967
|
+
}
|
968
|
+
assert_instance_of(Text::Document, document)
|
969
|
+
chapters = document.chapters
|
970
|
+
expected = [ "default", "composition", "packaging", "indications",
|
971
|
+
"counterindications", "precautions", "application",
|
972
|
+
"unwanted_effects", "storage", "date", ]
|
973
|
+
assert_equal(expected, chapters.collect { |ch| ch.name })
|
974
|
+
assert !/nebenwirkungen/i.match(chapters.at(1).to_s),
|
975
|
+
"'Nebenwirkungen' should not appear in Composition"
|
976
|
+
end
|
977
|
+
end
|
978
|
+
end
|
979
|
+
end
|
980
|
+
end
|