ramaze.ch.oddb.org 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. data/History.txt +6 -0
  2. data/LICENSE +339 -0
  3. data/Manifest.txt +285 -0
  4. data/README.txt +45 -0
  5. data/Rakefile +28 -0
  6. data/bin/admin +69 -0
  7. data/bin/exportd +63 -0
  8. data/bin/migrate +461 -0
  9. data/bin/oddbd +62 -0
  10. data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
  11. data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
  12. data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
  13. data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
  14. data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
  15. data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
  16. data/data/fulltext/data/german_compound/README +15 -0
  17. data/data/fulltext/data/german_compound/compound.pl +63 -0
  18. data/data/fulltext/data/german_compound/german.stop +20 -0
  19. data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
  20. data/data/fulltext/redist/dict_french/Makefile +12 -0
  21. data/data/fulltext/redist/dict_french/README.french +1 -0
  22. data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
  23. data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
  24. data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
  25. data/data/fulltext/redist/dict_french/french_stem.h +16 -0
  26. data/data/fulltext/redist/dict_french/subinclude.h +2 -0
  27. data/data/fulltext/redist/dict_german/Makefile +12 -0
  28. data/data/fulltext/redist/dict_german/README.german +1 -0
  29. data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
  30. data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
  31. data/data/fulltext/redist/dict_german/german_stem.c +527 -0
  32. data/data/fulltext/redist/dict_german/german_stem.h +16 -0
  33. data/data/fulltext/redist/dict_german/subinclude.h +1 -0
  34. data/data/fulltext/redist/french_stem.c +1222 -0
  35. data/data/fulltext/redist/french_stem.h +16 -0
  36. data/data/fulltext/redist/german_stem.c +527 -0
  37. data/data/fulltext/redist/german_stem.h +16 -0
  38. data/lib/fixes/ruby19.rb +21 -0
  39. data/lib/fixes/selenium.rb +20 -0
  40. data/lib/fixes/singular.rb +8 -0
  41. data/lib/fixes/yaml.rb +13 -0
  42. data/lib/oddb.rb +11 -0
  43. data/lib/oddb/business/company.rb +18 -0
  44. data/lib/oddb/business/invoice.rb +75 -0
  45. data/lib/oddb/business/price.rb +60 -0
  46. data/lib/oddb/config.rb +73 -0
  47. data/lib/oddb/drugs.rb +16 -0
  48. data/lib/oddb/drugs/active_agent.rb +37 -0
  49. data/lib/oddb/drugs/atc.rb +53 -0
  50. data/lib/oddb/drugs/composition.rb +41 -0
  51. data/lib/oddb/drugs/ddd.rb +24 -0
  52. data/lib/oddb/drugs/dose.rb +107 -0
  53. data/lib/oddb/drugs/galenic_form.rb +21 -0
  54. data/lib/oddb/drugs/galenic_group.rb +17 -0
  55. data/lib/oddb/drugs/package.rb +87 -0
  56. data/lib/oddb/drugs/part.rb +56 -0
  57. data/lib/oddb/drugs/product.rb +25 -0
  58. data/lib/oddb/drugs/sequence.rb +61 -0
  59. data/lib/oddb/drugs/substance.rb +31 -0
  60. data/lib/oddb/drugs/substance_group.rb +13 -0
  61. data/lib/oddb/drugs/unit.rb +12 -0
  62. data/lib/oddb/export.rb +4 -0
  63. data/lib/oddb/export/csv.rb +89 -0
  64. data/lib/oddb/export/l10n_sessions.rb +30 -0
  65. data/lib/oddb/export/rss.rb +44 -0
  66. data/lib/oddb/export/server.rb +58 -0
  67. data/lib/oddb/export/xls.rb +119 -0
  68. data/lib/oddb/export/yaml.rb +123 -0
  69. data/lib/oddb/html/state/drugs/admin/package.rb +189 -0
  70. data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
  71. data/lib/oddb/html/state/drugs/admin/sequence.rb +259 -0
  72. data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
  73. data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
  74. data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
  75. data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
  76. data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
  77. data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
  78. data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
  79. data/lib/oddb/html/state/drugs/compare.rb +52 -0
  80. data/lib/oddb/html/state/drugs/download_export.rb +18 -0
  81. data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
  82. data/lib/oddb/html/state/drugs/feedback.rb +94 -0
  83. data/lib/oddb/html/state/drugs/global.rb +266 -0
  84. data/lib/oddb/html/state/drugs/init.rb +18 -0
  85. data/lib/oddb/html/state/drugs/login.rb +17 -0
  86. data/lib/oddb/html/state/drugs/package.rb +32 -0
  87. data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
  88. data/lib/oddb/html/state/drugs/products.rb +51 -0
  89. data/lib/oddb/html/state/drugs/result.rb +125 -0
  90. data/lib/oddb/html/state/global.rb +165 -0
  91. data/lib/oddb/html/state/global_predefine.rb +17 -0
  92. data/lib/oddb/html/state/limit.rb +17 -0
  93. data/lib/oddb/html/state/login.rb +56 -0
  94. data/lib/oddb/html/state/paypal/checkout.rb +130 -0
  95. data/lib/oddb/html/state/paypal/collect.rb +46 -0
  96. data/lib/oddb/html/state/paypal/redirect.rb +18 -0
  97. data/lib/oddb/html/state/register_export.rb +38 -0
  98. data/lib/oddb/html/state/register_poweruser.rb +17 -0
  99. data/lib/oddb/html/state/viral/admin.rb +76 -0
  100. data/lib/oddb/html/state/viral/poweruser.rb +16 -0
  101. data/lib/oddb/html/util/annotated_list.rb +39 -0
  102. data/lib/oddb/html/util/know_it_all.rb +28 -0
  103. data/lib/oddb/html/util/known_user.rb +55 -0
  104. data/lib/oddb/html/util/lookandfeel.rb +554 -0
  105. data/lib/oddb/html/util/need_all_input.rb +29 -0
  106. data/lib/oddb/html/util/session.rb +88 -0
  107. data/lib/oddb/html/util/sort.rb +72 -0
  108. data/lib/oddb/html/util/unsaved_helper.rb +20 -0
  109. data/lib/oddb/html/util/validator.rb +54 -0
  110. data/lib/oddb/html/view/ajax/json.rb +22 -0
  111. data/lib/oddb/html/view/alpha_header.rb +28 -0
  112. data/lib/oddb/html/view/document.rb +126 -0
  113. data/lib/oddb/html/view/drugs/admin/package.rb +237 -0
  114. data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
  115. data/lib/oddb/html/view/drugs/admin/sequence.rb +312 -0
  116. data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
  117. data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
  118. data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
  119. data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
  120. data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
  121. data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
  122. data/lib/oddb/html/view/drugs/compare.rb +95 -0
  123. data/lib/oddb/html/view/drugs/download_export.rb +28 -0
  124. data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
  125. data/lib/oddb/html/view/drugs/feedback.rb +231 -0
  126. data/lib/oddb/html/view/drugs/init.rb +51 -0
  127. data/lib/oddb/html/view/drugs/legend.rb +24 -0
  128. data/lib/oddb/html/view/drugs/package.rb +398 -0
  129. data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
  130. data/lib/oddb/html/view/drugs/products.rb +97 -0
  131. data/lib/oddb/html/view/drugs/result.rb +296 -0
  132. data/lib/oddb/html/view/drugs/search.rb +33 -0
  133. data/lib/oddb/html/view/drugs/template.rb +15 -0
  134. data/lib/oddb/html/view/foot.rb +52 -0
  135. data/lib/oddb/html/view/google.rb +23 -0
  136. data/lib/oddb/html/view/google_ads.rb +40 -0
  137. data/lib/oddb/html/view/head.rb +78 -0
  138. data/lib/oddb/html/view/limit.rb +109 -0
  139. data/lib/oddb/html/view/list.rb +59 -0
  140. data/lib/oddb/html/view/login.rb +38 -0
  141. data/lib/oddb/html/view/navigation.rb +67 -0
  142. data/lib/oddb/html/view/offset_header.rb +35 -0
  143. data/lib/oddb/html/view/paypal/collect.rb +84 -0
  144. data/lib/oddb/html/view/paypal/redirect.rb +51 -0
  145. data/lib/oddb/html/view/paypal/register_form.rb +106 -0
  146. data/lib/oddb/html/view/register_export.rb +29 -0
  147. data/lib/oddb/html/view/register_poweruser.rb +29 -0
  148. data/lib/oddb/html/view/rss/feedback.rb +64 -0
  149. data/lib/oddb/html/view/rss_preview.rb +54 -0
  150. data/lib/oddb/html/view/search.rb +104 -0
  151. data/lib/oddb/html/view/snapback.rb +24 -0
  152. data/lib/oddb/html/view/template.rb +56 -0
  153. data/lib/oddb/import/excel.rb +45 -0
  154. data/lib/oddb/import/import.rb +39 -0
  155. data/lib/oddb/import/rtf.rb +410 -0
  156. data/lib/oddb/import/whocc.rb +173 -0
  157. data/lib/oddb/import/xml.rb +15 -0
  158. data/lib/oddb/model.rb +179 -0
  159. data/lib/oddb/persistence/odba.rb +33 -0
  160. data/lib/oddb/persistence/odba/business/company.rb +13 -0
  161. data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
  162. data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
  163. data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
  164. data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
  165. data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
  166. data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
  167. data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
  168. data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
  169. data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
  170. data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
  171. data/lib/oddb/persistence/odba/export.rb +26 -0
  172. data/lib/oddb/persistence/odba/model.rb +68 -0
  173. data/lib/oddb/persistence/odba/regulatory/authority.rb +13 -0
  174. data/lib/oddb/persistence/odba/regulatory/registration.rb +13 -0
  175. data/lib/oddb/persistence/odba/text/document.rb +11 -0
  176. data/lib/oddb/persistence/odba/util/code.rb +11 -0
  177. data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
  178. data/lib/oddb/persistence/og.rb +16 -0
  179. data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
  180. data/lib/oddb/persistence/og/drugs/product.rb +14 -0
  181. data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
  182. data/lib/oddb/persistence/og/model.rb +25 -0
  183. data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
  184. data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
  185. data/lib/oddb/regulatory/authority.rb +14 -0
  186. data/lib/oddb/regulatory/registration.rb +15 -0
  187. data/lib/oddb/remote/business/company.rb +23 -0
  188. data/lib/oddb/remote/drugs/active_agent.rb +27 -0
  189. data/lib/oddb/remote/drugs/atc.rb +32 -0
  190. data/lib/oddb/remote/drugs/dose.rb +8 -0
  191. data/lib/oddb/remote/drugs/galenic_form.rb +25 -0
  192. data/lib/oddb/remote/drugs/package.rb +126 -0
  193. data/lib/oddb/remote/drugs/part.rb +30 -0
  194. data/lib/oddb/remote/drugs/product.rb +19 -0
  195. data/lib/oddb/remote/drugs/sequence.rb +46 -0
  196. data/lib/oddb/remote/drugs/substance.rb +20 -0
  197. data/lib/oddb/remote/drugs/unit.rb +19 -0
  198. data/lib/oddb/remote/object.rb +36 -0
  199. data/lib/oddb/remote/text/document.rb +20 -0
  200. data/lib/oddb/remote/util/m10l_document.rb +22 -0
  201. data/lib/oddb/text/chapter.rb +27 -0
  202. data/lib/oddb/text/document.rb +43 -0
  203. data/lib/oddb/text/format.rb +37 -0
  204. data/lib/oddb/text/paragraph.rb +58 -0
  205. data/lib/oddb/text/picture.rb +93 -0
  206. data/lib/oddb/text/table.rb +68 -0
  207. data/lib/oddb/util.rb +8 -0
  208. data/lib/oddb/util/annotated_list.rb +37 -0
  209. data/lib/oddb/util/code.rb +69 -0
  210. data/lib/oddb/util/comparison.rb +36 -0
  211. data/lib/oddb/util/exporter.rb +8 -0
  212. data/lib/oddb/util/feedback.rb +23 -0
  213. data/lib/oddb/util/ipn.rb +48 -0
  214. data/lib/oddb/util/m10l_document.rb +38 -0
  215. data/lib/oddb/util/mail.rb +73 -0
  216. data/lib/oddb/util/money.rb +60 -0
  217. data/lib/oddb/util/multilingual.rb +70 -0
  218. data/lib/oddb/util/quanty.rb +4 -0
  219. data/lib/oddb/util/quanty/fact.rb +229 -0
  220. data/lib/oddb/util/quanty/main.rb +160 -0
  221. data/lib/oddb/util/quanty/parse.rb +853 -0
  222. data/lib/oddb/util/quanty/units.dump +0 -0
  223. data/lib/oddb/util/server.rb +117 -0
  224. data/lib/oddb/util/updater.rb +41 -0
  225. data/lib/oddb/util/ydim.rb +110 -0
  226. data/lib/oddb/util/yus.rb +46 -0
  227. data/test/business/test_company.rb +29 -0
  228. data/test/business/test_price.rb +46 -0
  229. data/test/drugs/test_active_agent.rb +53 -0
  230. data/test/drugs/test_atc.rb +54 -0
  231. data/test/drugs/test_composition.rb +88 -0
  232. data/test/drugs/test_ddd.rb +22 -0
  233. data/test/drugs/test_dose.rb +190 -0
  234. data/test/drugs/test_galenic_form.rb +41 -0
  235. data/test/drugs/test_package.rb +173 -0
  236. data/test/drugs/test_part.rb +32 -0
  237. data/test/drugs/test_product.rb +31 -0
  238. data/test/drugs/test_sequence.rb +140 -0
  239. data/test/drugs/test_substance.rb +51 -0
  240. data/test/drugs/test_substance_group.rb +27 -0
  241. data/test/export/test_rss.rb +94 -0
  242. data/test/export/test_server.rb +117 -0
  243. data/test/export/test_xls.rb +152 -0
  244. data/test/export/test_yaml.rb +120 -0
  245. data/test/import/data/html/whocc/A.html +56 -0
  246. data/test/import/data/html/whocc/A03.html +48 -0
  247. data/test/import/data/html/whocc/A03AB.html +48 -0
  248. data/test/import/data/html/whocc/A06AA.html +47 -0
  249. data/test/import/data/html/whocc/C03.html +47 -0
  250. data/test/import/data/html/whocc/login.html +77 -0
  251. data/test/import/data/xml/ATC_2006.xml +47 -0
  252. data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
  253. data/test/import/test_excel.rb +34 -0
  254. data/test/import/test_rtf.rb +40 -0
  255. data/test/import/test_whocc.rb +315 -0
  256. data/test/remote/drugs/test_active_agent.rb +36 -0
  257. data/test/selenium/selenium-server.jar +0 -0
  258. data/test/selenium/test_atc_browser.rb +122 -0
  259. data/test/selenium/test_atc_guidelines.rb +96 -0
  260. data/test/selenium/test_collect.rb +138 -0
  261. data/test/selenium/test_compare.rb +206 -0
  262. data/test/selenium/test_fachinfo.rb +130 -0
  263. data/test/selenium/test_feedback.rb +196 -0
  264. data/test/selenium/test_init.rb +52 -0
  265. data/test/selenium/test_limit.rb +305 -0
  266. data/test/selenium/test_login.rb +67 -0
  267. data/test/selenium/test_package.rb +512 -0
  268. data/test/selenium/test_patinfo.rb +131 -0
  269. data/test/selenium/test_product.rb +80 -0
  270. data/test/selenium/test_products.rb +142 -0
  271. data/test/selenium/test_search.rb +715 -0
  272. data/test/selenium/test_sequence.rb +543 -0
  273. data/test/selenium/unit.rb +185 -0
  274. data/test/stub/http_server.rb +169 -0
  275. data/test/stub/model.rb +173 -0
  276. data/test/suite.rb +15 -0
  277. data/test/test_model.rb +83 -0
  278. data/test/util/test_code.rb +74 -0
  279. data/test/util/test_ipn.rb +117 -0
  280. data/test/util/test_mail.rb +86 -0
  281. data/test/util/test_multilingual.rb +97 -0
  282. data/test/util/test_server.rb +48 -0
  283. data/test/util/test_updater.rb +353 -0
  284. data/test/util/test_ydim.rb +115 -0
  285. data/test/util/test_yus.rb +79 -0
  286. metadata +418 -0
@@ -0,0 +1,47 @@
1
+
2
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
+
4
+ <html>
5
+ <head>
6
+ <title>ATC/DDD</title>
7
+
8
+ <style type="text/css">
9
+ <!--
10
+
11
+ body,p,td,h1,h2,h3,ol,ul,li,dl,input,a,center,div {font-family: Tahoma, Helvetica, Arial}
12
+ body,p,td,ol,ul,li,dl,input,div.c {font-size: x-small}
13
+
14
+ body {
15
+ scrollbar-face-color : #554488;
16
+ scrollbar-shadow-color : #333366;
17
+ scrollbar-highlight-color : #8877aa;
18
+ scrollbar-3dlight-color : #9999cc;
19
+ scrollbar-darkshadow-color : #000000;
20
+ scrollbar-track-color : #666699;
21
+ scrollbar-arrow-color : #ccccee
22
+ }
23
+
24
+ h2 {color: #000000; font-size: large}
25
+ h3 {color: #554488; font-size: medium}
26
+ h4 {color: #6644aa; font-size: small}
27
+
28
+ a:hover {color:#000099; background:#ccccff; text-decoration: underline}
29
+
30
+ //-->
31
+ </style>
32
+
33
+ </head>
34
+
35
+
36
+ <body bgcolor="#ffffff" text="#000000" link="#6633ff" vlink="#993399">
37
+ <p align="right"><a href="index.php">New search</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php?query=C03">Hide text from Guidelines</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.php?logout=true">Log out</a>&nbsp;&nbsp;&nbsp;&nbsp;</p>C <b><a href="index.php?query=C">CARDIOVASCULAR SYSTEM</a></b><br>
38
+ C03 <b><a href="index.php?query=C03">DIURETICS</a></b><br>
39
+ <p>This group comprises diuretics, plain and in combination with potassium or other agents. Potassium-sparing agents are classified in C03D and C03E.<br><br>Combinations with digitalis glycosides, see C01AA.<br><br>Combinations with antihypertensives, see C02L - Antihypertensives and diuretics in combination.<br><br>Combinations with beta blocking agents, see C07B - C07D.<br><br>Combinations with calcium channel blockers, see C08.<br><br>Combinations with agents acting on the renin angiotensin system, see C09B and C09D.<br><br><table bgcolor="#cccccc" cellpadding="4" cellspacing="0" border="0"><tr><td>The DDDs for diuretics are based on monotherapy. Most diuretics are used both for the treatment of edema and hypertension in similar doses and the DDDs are therefore based on both indications.<br><br>The DDDs for combinations correspond to the DDD for the diuretic component, except for ATC group C03E, see comments under this level.</td></tr></table></p><br>
40
+ <p>C03A <b><a href="index.php?query=C03A&showdescription=yes">LOW-CEILING DIURETICS, THIAZIDES</a></b><br>
41
+ <p>Combinations with potassium-sparing agents, see C03EA.<br><br><table bgcolor="#cccccc" cellpadding="4" cellspacing="0" border="0"><tr><td>The different lipid solubility of the thiazides should be considered when assigning DDDs.</td></tr></table><p>C03B <b><a href="index.php?query=C03B&showdescription=yes">LOW-CEILING DIURETICS, EXCL. THIAZIDES</a></b><br>
42
+ <p>This group comprises all low-ceiling diuretics not classified in C03A.<br><br>Combinations with potassium-sparing agents, see C03EA.<p>C03C <b><a href="index.php?query=C03C&showdescription=yes">HIGH-CEILING DIURETICS</a></b><br>
43
+ <p>This group comprises high-ceiling diuretics (loop-diuretics) e.g. furosemide.<br><br>Combinations with potassium-sparing agents, see C03EB.<p>C03D <b><a href="index.php?query=C03D&showdescription=yes">POTASSIUM-SPARING AGENTS</a></b><br>
44
+ C03E <b><a href="index.php?query=C03E&showdescription=yes">DIURETICS AND POTASSIUM-SPARING AGENTS IN COMBINATION</a></b><br>
45
+ <p><table bgcolor="#cccccc" cellpadding="4" cellspacing="0" border="0"><tr><td>Fixed DDDs are assigned for combinations in this group. <br>E.g. 1 tablet regardless of strengths is the DDD assigned for hydrochlorothiazide and amiloride in combinations. See comments to C02L also.</td></tr></table><p>
46
+ </body>
47
+ </html>
@@ -0,0 +1,77 @@
1
+
2
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
+
4
+ <html>
5
+ <head>
6
+ <title>WHO Collaborating Centre for Drug Statistics Methodology</title>
7
+
8
+ <style type="text/css">
9
+ <!--
10
+
11
+ body,p,td,h1,h2,h3,ol,ul,li,dl,input,a,center,div {font-family: Tahoma, Helvetica, Arial}
12
+ body,p,td,ol,ul,li,dl,input,div.c {font-size: x-small}
13
+
14
+ body {
15
+ scrollbar-face-color : #554488;
16
+ scrollbar-shadow-color : #333366;
17
+ scrollbar-highlight-color : #8877aa;
18
+ scrollbar-3dlight-color : #9999cc;
19
+ scrollbar-darkshadow-color : #000000;
20
+ scrollbar-track-color : #666699;
21
+ scrollbar-arrow-color : #ccccee
22
+ }
23
+
24
+ h2 {color: #000000; font-size: large}
25
+ h3 {color: #554488; font-size: medium}
26
+ h4 {color: #6644aa; font-size: small}
27
+
28
+ a:hover {color:#000099; background:#ccccff; text-decoration: underline}
29
+
30
+ //-->
31
+ </style>
32
+
33
+ </head>
34
+
35
+
36
+ <body bgcolor="#ffffff" text="#000000" link="#6633ff" vlink="#993399">
37
+ <h2>Please log in.</h2>
38
+ <form action="index.php" method="post"><table cellpadding="0" cellspacing="0" border="0">
39
+ <tr><td>E-mail:</td><td>&nbsp;<input type="text" name="username" value="" size="20" maxlength="150"></td></tr>
40
+ <tr><td>Password:</td><td>&nbsp;<input type="password" name="password" size="20" maxlength="14"></td></tr>
41
+ <tr><td><input type="submit" value="log in"></td><td></td></tr>
42
+ </table></form>
43
+
44
+ <h3>Welcome to the integrated version of the ATC Index with DDDs and the Guidelines for ATC classification and DDD assignment, January 2007.</h3>
45
+
46
+ <p>This database is available on subscription, only.</p>
47
+
48
+ <p>The database is a useful tool for users of the ATC/DDD system. The search options enable you to find ATC codes and DDDs for specific substances and levels linked to relevant comments in the Guidelines. This is a fast and convenient way to answer your questions.</p>
49
+
50
+ <p>Search options:</p>
51
+
52
+ <ul>
53
+ <li>ATC codes at all levels</li>
54
+ <li>Substance name</li>
55
+ <li>ATC level name</li>
56
+ </ul>
57
+
58
+ <p>The ATC codes are linked to the DDDs and to relevant comments in the Guidelines for each ATC group.</p>
59
+
60
+ <p>A print option (text file) of the two publications is also available on this site.</p>
61
+
62
+ <p>
63
+ The Index and Guidelines are updated annually in January, and are available on a yearly
64
+ subscription basis. The subscription period is from 1 January to 31 December. Price: �200 per
65
+ year. Half price after 1 July.
66
+ </p>
67
+
68
+ <p><a href="../order_form.html">Click here to order!</a></p>
69
+
70
+ <p>Access to the ATC index with DDDs 2007 free of charge (<a href="../indexdatabase/">click here</a>).
71
+ </p>
72
+
73
+ <p>&nbsp;</p>
74
+
75
+
76
+ </body>
77
+ </html>
@@ -0,0 +1,47 @@
1
+ <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
2
+ xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
3
+ xmlns:rs='urn:schemas-microsoft-com:rowset'
4
+ xmlns:z='#RowsetSchema'>
5
+ <s:Schema id='RowsetSchema'>
6
+ <s:ElementType name='row' content='eltOnly' rs:updatable='true'>
7
+ <s:AttributeType name='ATCCode' rs:number='1' rs:writeunknown='true' rs:basecatalog='ATC' rs:basetable='#t1'
8
+ rs:basecolumn='ATCCode'>
9
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10' rs:maybenull='false'/>
10
+ </s:AttributeType>
11
+ <s:AttributeType name='Name' rs:number='2' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC' rs:basetable='#t1'
12
+ rs:basecolumn='Name'>
13
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='255'/>
14
+ </s:AttributeType>
15
+ <s:AttributeType name='Comment' rs:number='3' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC'
16
+ rs:basetable='#t1' rs:basecolumn='Comment'>
17
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='255'/>
18
+ </s:AttributeType>
19
+ <s:extends type='rs:rowbase'/>
20
+ </s:ElementType>
21
+ </s:Schema>
22
+ <rs:data>
23
+ <z:row ATCCode='A' Name='ALIMENTÄRES SYSTEM UND STOFFWECHSEL'/>
24
+ <z:row ATCCode='A01' Name='STOMATOLOGIKA'/>
25
+ <z:row ATCCode='A01A' Name='STOMATOLOGIKA'/>
26
+ <z:row ATCCode='A01AA' Name='Mittel zur Kariesprophylaxe'/>
27
+ <z:row ATCCode='A01AA01' Name='Natriumfluorid'/>
28
+ <z:row ATCCode='A01AA30' Name='Kombinationen'/>
29
+ <z:row ATCCode='A01AB' Name='Antiinfektiva und Antiseptika zur oralen Lokalbehandlung'/>
30
+ <z:row ATCCode='A01AB02' Name='Wasserstoffperoxid'/>
31
+ <z:row ATCCode='V' Name='VARIA'/>
32
+ <z:row ATCCode='V01' Name='ALLERGENE'/>
33
+ <z:row ATCCode='V01A' Name='ALLERGENE'/>
34
+ <z:row ATCCode='V01AA' Name='Allergen-Extrakte'/>
35
+ <z:row ATCCode='V01AA01' Name='Federn'/>
36
+ <z:row ATCCode='V03' Name='ALLE ÜBRIGEN THERAPEUTISCHEN MITTEL'/>
37
+ <z:row ATCCode='V03A' Name='ALLE ÜBRIGEN THERAPEUTISCHEN MITTEL'/>
38
+ <z:row ATCCode='V03AB' Name='Antidote'/>
39
+ <z:row ATCCode='V03AB01' Name='Ipecacuanha'/>
40
+ <z:row ATCCode='V03AZ01' Name='Ethanol'/>
41
+ <z:row ATCCode='V04' Name='DIAGNOSTIKA'/>
42
+ <z:row ATCCode='V04C' Name='ANDERE DIAGNOSTIKA'/>
43
+ <z:row ATCCode='V04CC04' Name='Ceruletid'/>
44
+ <z:row ATCCode='V04CD' Name='Hypophysenfunktions-Tests'/>
45
+ <z:row ATCCode='V04CD05' Name='Somatorelin'/>
46
+ </rs:data>
47
+ </xml>
@@ -0,0 +1,35 @@
1
+ <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
2
+ xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
3
+ xmlns:rs='urn:schemas-microsoft-com:rowset'
4
+ xmlns:z='#RowsetSchema'>
5
+ <s:Schema id='RowsetSchema'>
6
+ <s:ElementType name='row' content='eltOnly' rs:updatable='true'>
7
+ <s:AttributeType name='ATCCode' rs:number='1' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC'
8
+ rs:basetable='#t1' rs:basecolumn='ATCCode'>
9
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10'/>
10
+ </s:AttributeType>
11
+ <s:AttributeType name='DDD' rs:number='2' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC' rs:basetable='#t1'
12
+ rs:basecolumn='DDD'>
13
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='20'/>
14
+ </s:AttributeType>
15
+ <s:AttributeType name='UnitType' rs:number='3' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC'
16
+ rs:basetable='#t1' rs:basecolumn='UnitType'>
17
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='255'/>
18
+ </s:AttributeType>
19
+ <s:AttributeType name='AdmCode' rs:number='4' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC'
20
+ rs:basetable='#t1' rs:basecolumn='AdmCode'>
21
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='255'/>
22
+ </s:AttributeType>
23
+ <s:AttributeType name='DDDComment' rs:number='5' rs:nullable='true' rs:writeunknown='true' rs:basecatalog='ATC'
24
+ rs:basetable='#t1' rs:basecolumn='DDDComment'>
25
+ <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='255'/>
26
+ </s:AttributeType>
27
+ <s:extends type='rs:rowbase'/>
28
+ </s:ElementType>
29
+ </s:Schema>
30
+ <rs:data>
31
+ <z:row ATCCode='A01AB02' DDD='60' UnitType='mg' AdmCode='O'/>
32
+ <z:row ATCCode='A10BB01' DDD='7' UnitType='mg' AdmCode='O' DDDComment='mikrokristall. Substanz'/>
33
+ <z:row ATCCode='A10BB01' DDD='10' UnitType='mg' AdmCode='O'/>
34
+ </rs:data>
35
+ </xml>
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Import::TestExcel -- de.oddb.org -- 04.09.2006 -- hwyss@ywesee.com
4
+
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'oddb/import/excel'
9
+
10
+ module ODDB
11
+ module Import
12
+ class TestExcel < Test::Unit::TestCase
13
+ def setup
14
+ @data_dir = File.expand_path('data', File.dirname(__FILE__))
15
+ @path = File.expand_path('xls/fb010706.xls', @data_dir)
16
+ @input = open(@path)
17
+ @import = Excel.new
18
+ end
19
+ =begin ## disabled until 2.0
20
+ def test_parse__and_cell
21
+ workbook = @import.parse(@input)
22
+ assert_instance_of(Spreadsheet::Excel::Workbook, workbook)
23
+ assert_equal(1, workbook.worksheets.size)
24
+ worksheet = workbook.worksheet(0)
25
+ assert_instance_of(Spreadsheet::Excel::Worksheet, worksheet)
26
+ assert_equal(u("PIROXICAM RATIO"), @import.cell(worksheet.row(1), 0))
27
+ assert_equal(20, @import.cell(worksheet.row(1), 5))
28
+ assert_equal(Date.new(2006,7),
29
+ @import.cell(worksheet.row(1), 13))
30
+ end
31
+ =end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Import::TestRtf -- de.oddb.org -- 16.10.2007 -- hwyss@ywesee.com
4
+
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'oddb/import/rtf'
9
+
10
+ module ODDB
11
+ module Import
12
+ class TestRtf < Test::Unit::TestCase
13
+ def setup
14
+ @importer = Rtf.new
15
+ end
16
+ =begin ## reactivate for 2.0
17
+ def test_import__rtf
18
+ path = File.expand_path('data/rtf/pharmnet/selegilin.rtf',
19
+ File.dirname(__FILE__))
20
+ document = nil
21
+ File.open(path) { |fh|
22
+ document = @importer.import(fh)
23
+ }
24
+ assert_instance_of(Text::Document, document)
25
+ assert_equal(1, document.chapters.size)
26
+ assert_instance_of(Text::Chapter, document.chapter('default'))
27
+ end
28
+ def test_import__html__raises_error
29
+ path = File.expand_path('data/html/pharmnet/gate.html',
30
+ File.dirname(__FILE__))
31
+ assert_raises(ArgumentError) do
32
+ File.open(path) do |fh|
33
+ @importer.import(fh)
34
+ end
35
+ end
36
+ end
37
+ =end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,315 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # Import::Whocc::TestAtc -- de.oddb.org -- 17.11.2006 -- hwyss@ywesee.com
4
+
5
+ $: << File.expand_path('..', File.dirname(__FILE__))
6
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
7
+
8
+ require 'flexmock'
9
+ require 'test/unit'
10
+ require 'oddb/config'
11
+ require 'oddb/import/whocc'
12
+ require 'mechanize'
13
+ require 'stub/model'
14
+
15
+ module ODDB
16
+ module Drugs
17
+ class Atc < Model
18
+ simulate_database(:code)
19
+ end
20
+ class Ddd < Model
21
+ simulate_database
22
+ end
23
+ end
24
+ module Import
25
+ module Whocc
26
+ class TestAtc < Test::Unit::TestCase
27
+ def setup
28
+ Drugs::Atc.instances.clear
29
+ @data_dir = File.expand_path('data', File.dirname(__FILE__))
30
+ @path = File.expand_path('xml/ATC_2006.xml', @data_dir)
31
+ @import = Atc.new
32
+ end
33
+ def test_import
34
+ assert_equal([], Drugs::Atc.instances)
35
+ input = open(@path)
36
+ @import.import(input)
37
+ assert_equal(23, Drugs::Atc.instances.size)
38
+ atc = Drugs::Atc.instances.first
39
+ expected = [ 'A', 'A01', 'A01A', 'A01AA', 'A01AA01', 'A01AA30',
40
+ 'A01AB', 'A01AB02', 'V', 'V01', 'V01A', 'V01AA', 'V01AA01',
41
+ 'V03', 'V03A', 'V03AB', 'V03AB01', 'V03AZ01', 'V04', 'V04C',
42
+ 'V04CC04', 'V04CD', 'V04CD05', ]
43
+ codes = Drugs::Atc.instances.collect { |atc| atc.code }
44
+ assert_equal(expected, codes)
45
+ assert_equal('ALIMENTÄRES SYSTEM UND STOFFWECHSEL',
46
+ Drugs::Atc.instances.at(0).name.de)
47
+ assert_equal('STOMATOLOGIKA',
48
+ Drugs::Atc.instances.at(1).name.de)
49
+ assert_equal('Somatorelin',
50
+ Drugs::Atc.instances.at(22).name.de)
51
+
52
+ # do it again, nothing should change
53
+ input = open(@path)
54
+ @import.import(input)
55
+ assert_equal(23, Drugs::Atc.instances.size)
56
+ atc = Drugs::Atc.instances.first
57
+ codes = Drugs::Atc.instances.collect { |atc| atc.code }
58
+ assert_equal(expected, codes)
59
+ assert_equal('ALIMENTÄRES SYSTEM UND STOFFWECHSEL',
60
+ Drugs::Atc.instances.at(0).name.de)
61
+ assert_equal('STOMATOLOGIKA',
62
+ Drugs::Atc.instances.at(1).name.de)
63
+ assert_equal('Somatorelin',
64
+ Drugs::Atc.instances.at(22).name.de)
65
+ end
66
+ end
67
+ class TestDdd < Test::Unit::TestCase
68
+ def setup
69
+ Drugs::Atc.instances.clear
70
+ Drugs::Ddd.instances.clear
71
+ @data_dir = File.expand_path('data', File.dirname(__FILE__))
72
+ @path = File.expand_path('xml/ATC_2006_ddd.xml', @data_dir)
73
+ @import = Ddd.new
74
+ end
75
+ def test_import
76
+ assert_equal([], Drugs::Atc.instances)
77
+ assert_equal([], Drugs::Ddd.instances)
78
+ input = open(@path)
79
+ @import.import(input)
80
+ assert_equal(2, Drugs::Atc.instances.size)
81
+ assert_equal(3, Drugs::Ddd.instances.size)
82
+ atc1 = Drugs::Atc.instances.at(0)
83
+ atc2 = Drugs::Atc.instances.at(1)
84
+ ddds = Drugs::Ddd.instances
85
+ assert_equal(ddds[0,1], atc1.ddds)
86
+ assert_equal(ddds[1,2], atc2.ddds)
87
+ ddd1 = atc2.ddds.first
88
+ ddd2 = atc2.ddds.last
89
+ assert_equal('O', ddd1.administration)
90
+ assert_equal(Drugs::Dose.new(7, 'mg'), ddd1.dose)
91
+ assert_equal('mikrokristall. Substanz', ddd1.comment)
92
+ assert_equal(atc2, ddd1.atc)
93
+ assert_equal('O', ddd2.administration)
94
+ assert_equal(Drugs::Dose.new(10, 'mg'), ddd2.dose)
95
+ assert_nil(ddd2.comment)
96
+ assert_equal(atc2, ddd2.atc)
97
+ codes = Drugs::Atc.instances.collect { |atc| atc.code }
98
+
99
+ # do it again, nothing should change
100
+ input = open(@path)
101
+ @import.import(input)
102
+ assert_equal(2, Drugs::Atc.instances.size)
103
+ assert_equal(3, Drugs::Ddd.instances.size)
104
+ atc1 = Drugs::Atc.instances.at(0)
105
+ atc2 = Drugs::Atc.instances.at(1)
106
+ ddds = Drugs::Ddd.instances
107
+ assert_equal(ddds[0,1], atc1.ddds)
108
+ assert_equal(ddds[1,2], atc2.ddds)
109
+ ddd1 = atc2.ddds.first
110
+ ddd2 = atc2.ddds.last
111
+ assert_equal('O', ddd1.administration)
112
+ assert_equal(Drugs::Dose.new(7, 'mg'), ddd1.dose)
113
+ assert_equal('mikrokristall. Substanz', ddd1.comment)
114
+ assert_equal(atc2, ddd1.atc)
115
+ assert_equal('O', ddd2.administration)
116
+ assert_equal(Drugs::Dose.new(10, 'mg'), ddd2.dose)
117
+ assert_nil(ddd2.comment)
118
+ assert_equal(atc2, ddd2.atc)
119
+ codes = Drugs::Atc.instances.collect { |atc| atc.code }
120
+ end
121
+ end
122
+ class TestGuidelines < Test::Unit::TestCase
123
+ include FlexMock::TestCase
124
+ def setup
125
+ Drugs::Atc.instances.clear
126
+ @import = Guidelines.new
127
+ @html_path = File.expand_path('data/html/whocc',
128
+ File.dirname(__FILE__))
129
+ end
130
+ def setup_page(url, html)
131
+ response = {'content-type' => 'text/html'}
132
+ WWW::Mechanize::Page.new(URI.parse(url), response, html, 200)
133
+ end
134
+ def teardown
135
+ ODDB.config.credentials = {}
136
+ super
137
+ end
138
+ def test_login
139
+ ODDB.config.credentials = {
140
+ 'whocc' => {'username' => 'tester', 'password' => 'secret'},
141
+ }
142
+ url = 'http://www.whocc.no/atcddd/database/index.php'
143
+ html = File.read(File.join(@html_path, 'login.html'))
144
+ page = setup_page(url, html)
145
+ agent = flexmock('Mechanize')
146
+ agent.should_receive(:get).with(url).and_return(page)
147
+ agent.should_receive(:submit).with(WWW::Mechanize::Form)\
148
+ .and_return { |form|
149
+ assert_equal('tester', form.username)
150
+ assert_equal('secret', form.password)
151
+ }
152
+ @import.login(agent)
153
+ end
154
+ def test_login__no_credentials
155
+ agent = flexmock('Mechanize')
156
+ assert_raises(RuntimeError) {
157
+ @import.login(agent)
158
+ }
159
+ end
160
+ def test_import
161
+ stub = flexstub(@import)
162
+ stub.should_receive(:login).with('agent')
163
+ %w{A B C D G H J L M N P R S V}.each { |level|
164
+ stub.should_receive(:import_code).with('agent', level)\
165
+ .times(1).and_return { assert true }
166
+ }
167
+ res = @import.import('agent')
168
+ assert_equal(@import.report, res)
169
+ end
170
+ def test_import_code__A
171
+ url = "http://www.whocc.no/atcddd/database/index.php?query=A&showdescription=yes"
172
+ html = File.read(File.join(@html_path, 'A.html'))
173
+ page = setup_page(url, html)
174
+ agent = flexmock('Mechanize')
175
+ agent.should_receive(:get).with(url).times(1).and_return(page)
176
+ @import.import_code(agent, @import.codes.shift)
177
+ assert_equal(['A'], @import.codes.visited)
178
+ assert_equal(%w{B C D G H J L M N P R S V A01 A02 A03 A04 A05 A06
179
+ A07 A08 A09 A10 A11 A12 A13 A14 A15 A16},
180
+ @import.codes.queue)
181
+ assert_equal(1, Drugs::Atc.instances.size)
182
+ atc = Drugs::Atc.instances.first
183
+ assert_equal('A', atc.code)
184
+ assert_equal('Alimentary Tract and Metabolism', atc.name.en)
185
+ assert_equal(nil, atc.guidelines.en)
186
+ assert_equal(nil, atc.ddd_guidelines.en)
187
+ end
188
+ def test_import_code__A03
189
+ url = "http://www.whocc.no/atcddd/database/index.php?query=A03&showdescription=yes"
190
+ html = File.read(File.join(@html_path, 'A03.html'))
191
+ page = setup_page(url, html)
192
+ agent = flexmock('Mechanize')
193
+ agent.should_receive(:get).with(url).times(1).and_return(page)
194
+ @import.codes.queue.clear.push('A03')
195
+ @import.import_code(agent, @import.codes.shift)
196
+ assert_equal(['A03'], @import.codes.visited)
197
+ assert_equal(%w{A A03A A03B A03C A03D A03E A03F},
198
+ @import.codes.queue)
199
+ assert_equal(1, Drugs::Atc.instances.size)
200
+ atc = Drugs::Atc.instances.first
201
+ assert_equal('A03', atc.code)
202
+ assert_equal('Drugs for Functional Gastrointestinal Disorders',
203
+ atc.name.en)
204
+ expected = <<-EOS
205
+ A major part of the preparations in this group are combined preparations. Preparations containing e.g. analgesics and antispasmodics could be classified either in this group or in N02 - Analgesics. Combinations of psycholeptics and antispasmodics could be classified in A03 or in N05 - Psycholeptics etc. The main indication for the use of the combination will, together with the relative effect of the active components, decide the classification. In the treatment of pain caused by spasms, the spasmolytic component must be judged as more important than the analgesic component. Accordingly, analgesic/antispasmodic combinations should be classified in A03 if the main effect of the preparation is the antispasmodic action.
206
+ Combined preparations are classified in:
207
+
208
+
209
+ A03C - Antispasmodics in combination with psycholeptics
210
+ A03D - Antispasmodics in combination with analgesics
211
+ A03E - Antispasmodics and anticholinergics in combination with other drugs
212
+
213
+ Antispasmodics, which are used specifically in the urogenital tractus, are classified in G04BD - Urinary antispasmodics.
214
+
215
+ EOS
216
+ assert_equal(expected, atc.guidelines.en)
217
+ expected = <<-EOS
218
+ The DDD is equal for different routes of administration (oral, parenteral or rectal) of the same compound and is based on the oral dose.
219
+ EOS
220
+ assert_equal(expected.chop, atc.ddd_guidelines.en)
221
+ end
222
+ def test_import_code__A03AB
223
+ url = "http://www.whocc.no/atcddd/database/index.php?query=A03AB&showdescription=yes"
224
+ html = File.read(File.join(@html_path, 'A03AB.html'))
225
+ page = setup_page(url, html)
226
+ agent = flexmock('Mechanize')
227
+ agent.should_receive(:get).with(url).times(1).and_return(page)
228
+ @import.codes.queue.clear.push('A03AB')
229
+ @import.import_code(agent, @import.codes.shift)
230
+ assert_equal(['A03AB'], @import.codes.visited)
231
+ assert_equal(%w{A A03 A03A}, @import.codes.queue)
232
+ assert_equal(22, Drugs::Atc.instances.size)
233
+ atc = Drugs::Atc.instances.first
234
+ assert_equal('A03AB', atc.code)
235
+ assert_equal('Synthetic Anticholinergics, Quaternary Ammonium Compounds',
236
+ atc.name.en)
237
+ expected = <<-EOS
238
+ Plain preparations containing glycopyrronium are classified in this group. Preparations containing glycopyrronium in combination with neostigmine are classified in N07AA51. Trospium see G04BD and A03DA.
239
+ EOS
240
+ assert_equal(expected.chop, atc.guidelines.en)
241
+ assert_equal(nil, atc.ddd_guidelines.en)
242
+ atc = Drugs::Atc.instances.at(1)
243
+ assert_equal('A03AB01', atc.code)
244
+ assert_equal('Benzilone', atc.name.en)
245
+ end
246
+ def test_import_code__C03
247
+ url = "http://www.whocc.no/atcddd/database/index.php?query=C03&showdescription=yes"
248
+ html = File.read(File.join(@html_path, 'C03.html'))
249
+ page = setup_page(url, html)
250
+ agent = flexmock('Mechanize')
251
+ agent.should_receive(:get).with(url).times(1).and_return(page)
252
+ @import.codes.queue.clear.push('C03')
253
+ @import.import_code(agent, @import.codes.shift)
254
+ assert_equal(['C03'], @import.codes.visited)
255
+ assert_equal(%w{C C03A C03B C03C C03D C03E}, @import.codes.queue)
256
+ assert_equal(1, Drugs::Atc.instances.size)
257
+ atc = Drugs::Atc.instances.first
258
+ assert_equal('C03', atc.code)
259
+ assert_equal('Diuretics', atc.name.en)
260
+ expected = <<-EOS
261
+ This group comprises diuretics, plain and in combination with potassium or other agents. Potassium-sparing agents are classified in C03D and C03E.
262
+
263
+ Combinations with digitalis glycosides, see C01AA.
264
+
265
+ Combinations with antihypertensives, see C02L - Antihypertensives and diuretics in combination.
266
+
267
+ Combinations with beta blocking agents, see C07B - C07D.
268
+
269
+ Combinations with calcium channel blockers, see C08.
270
+
271
+ Combinations with agents acting on the renin angiotensin system, see C09B and C09D.
272
+
273
+ EOS
274
+ assert_equal(expected, atc.guidelines.en)
275
+ expected = <<-EOS
276
+ The DDDs for diuretics are based on monotherapy. Most diuretics are used both for the treatment of edema and hypertension in similar doses and the DDDs are therefore based on both indications.
277
+
278
+ The DDDs for combinations correspond to the DDD for the diuretic component, except for ATC group C03E, see comments under this level.
279
+ EOS
280
+ assert_equal(expected.chop, atc.ddd_guidelines.en)
281
+ end
282
+ def test_report
283
+ assert_instance_of(Array, @import.report)
284
+ end
285
+ end
286
+ class TestCodeHandler < Test::Unit::TestCase
287
+ def setup
288
+ @handler = Guidelines::CodeHandler.new
289
+ end
290
+ def test_shift
291
+ @handler.instance_variable_set('@queue', ['A', 'B'])
292
+ assert_equal('A', @handler.shift)
293
+ assert_equal(['A'], @handler.instance_variable_get('@visited'))
294
+ assert_equal(['B'], @handler.instance_variable_get('@queue'))
295
+ end
296
+ def test_push
297
+ @handler.instance_variable_set('@queue', ['A'])
298
+ @handler.push('B')
299
+ assert_equal(['A', 'B'], @handler.instance_variable_get('@queue'))
300
+ end
301
+ def test_push__visited
302
+ @handler.instance_variable_set('@queue', ['A'])
303
+ @handler.instance_variable_set('@visited', ['B'])
304
+ @handler.push('B')
305
+ assert_equal(['A'], @handler.instance_variable_get('@queue'))
306
+ end
307
+ def test_push__twice
308
+ @handler.instance_variable_set('@queue', ['A', 'B'])
309
+ @handler.push('B')
310
+ assert_equal(['A', 'B'], @handler.instance_variable_get('@queue'))
311
+ end
312
+ end
313
+ end
314
+ end
315
+ end