# oddb2xml
[![Build Status](https://secure.travis-ci.org/zdavatz/oddb2xml.png)](http://travis-ci.org/zdavatz/oddb2xml)
* oddb2xml -a nonpharma -o fi
creates the following xml files:
* oddb_substance.xml
* oddb_limitation.xml
* oddb_interaction.xml
* oddb_code.xml
* oddb_product.xml
* oddb_article.xml
* oddb_fi.xml
* oddb_fi_product.xml
and
* oddb2xml -f dat
* oddb2xml -f dat -a nonpharma
creates .dat files according to ([IGM-11](http://dev.ywesee.com/uploads/att/IGM.pdf))
* oddb.dat
* oddb_with_migel.dat
the files are using [swissINDEX](http://www.refdata.ch/downloads/company/download/swissindex_TechnischeBeschreibung.pdf), [BAG-XML](http://bag.e-mediat.net/SL2007.Web.External/Default.aspx?webgrab=ignore) and [Swissmedic](http://www.swissmedic.ch/daten/00080/00251/index.html?lang=de) as sources.
The following additional data is in the files:
* [Wirkstoffe](http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip) (BAG XML)
* [Kühlkette](http://www.swissmedic.ch/daten/00080/00254/index.html?lang=de&download=NHzLpZeg7t,lnp6I0NTU042l2Z6ln1acy4Zn4Z2qZpnO2Yuq2Z6gpJCDdH57e2ym162epYbg2c_JjKbNoKOn6A--) (Swissmedic)
* [Orphan Drugs](http://www.swissmedic.ch/daten/00081/index.html?lang=de&download=NHzLpZeg7t,lnp6I0NTU042l2Z6ln1acy4Zn4Z2qZpnO2Yuq2Z6gpJCDdH55f2ym162epYbg2c_JjKbNoKSn6A--&.xls) (Swissmedic)
* [FI: de, fr](http://download.swissmedicinfo.ch) (Swissmedic)
* Limitation-Texte (BAG XML)
* Interaktionen [EPha.ch](http://epha.ch)
* [Betäubungsmittel](http://www.swissmedic.ch/produktbereiche/00447/00536/index.html?lang=de&download=NHzLpZeg7t,lnp6I0NTU042l2Z6ln1acy4Zn4Z2qZpnO2Yuq2Z6gpJCDdH1,fWym162epYbg2c_JjKbNoKSn6A--&.pdf) und psychotrope Stoffe (Swissmedic)
* Non-Pharma from Refdata and Suppliers (swissINDEX)
## usage
see `--help`.
```
$ oddb2xml --help
oddb2xml ver.1.2.7
Usage:
oddb2xml [option]
-a T, --append=T Additional target. T, only 'nonpharma' is available.
-c F, --compress=F Compress format F. {tar.gz|zip}
-f F, --format=F File format F, default is xml. {xml|dat}
If F is given, -o option is ignored.
-o O, --optional=O Optional output. O, only 'fi' is available.
-i I, --include=I Include target option for 'dat' format. only 'ean14' is available.
'xml' format includes always ean14 records.
-t S, --tag-suffix=S XML tag suffix S. Default is none. [A-z0-9]
If S is given, it is also used as prefix of filename.
-h, --help Show this help message.
```
## Option examples
```
$ oddb2xml -t md # => md_article.xml, md_product.xml, md_substance.xml
$ oddb2xml -a nonpharma -t md -c tar.gz # => md_xml_dd.mm.yyyy_hh.mm.tar.gz
$ oddb2xml -f dat # => oddb.dat
$ oddb2xml -f dat -a nonpharma # => oddb_with_migel.dat
```
output.
```
$ oddb2xml
DE
Pharma products: 14801
FR
Pharma products: 14801
```
## XSD files
If you need the XSD files, generate them yourself using the javabeans tool:
* http://xmlbeans.apache.org/docs/2.0.0/guide/tools.html#inst2xsd
this will generate you a valid XSD file that can be used to validate against the XML file.
i.e.:
* /home/zeno/.software/xmlbeans-2.6.0/bin/inst2xsd oddb_article.xml -outPrefix oddb_article
## XML files
xml files generated are:
* oddb_substance.xml
* oddb_limitation.xml
* oddb_interaction.xml
* oddb_code.xml
* oddb_product.xml
* oddb_article.xml
* oddb_fi.xml
* oddb_fi_product.xml
### article.xml
oddb2xml creates article.xml as oddb_article.xml by default.
```
31532
4123
D
29152039
A
10 Stk
BEN-U-RON Supp 250 mg Kind
BEN-U-RON supp 250 mg enf
BEN-U-RON SUPP 250 MG KIND
BEN-U-RON SUPP 250 MG ENF
Ben-u-ron
Ben-u-ron
2
E13
7680291520390
A
01.11.2012
PEXF
1.780086
01.11.2012
PPUB
3.3
...
OK
14801
```
### product.xml
For example, if `-t _swiss` is given then oddb2xml creates product.xml as swiss_product.xml.
```
7680353660163
353661
Kendural Depottabl
Kendural cpr dépôt
B03AE10
06.07.1.
0
507
105
mg
1
23
500
mg
30
Tablette(n)
ferrum(II), acidum ascorbicum
...
OK
14336
```
### substance.xml
product.xml has relation to substance as ``.
```
1
3-Methoxy-butylis acetas
2
4-Methylbenzylidene camphor
...
OK
1441
```
## SSLv3 cert for Windows Users
Some websites need SSLv3 connection.
If you don't have these root CA files (x509), Please install these Certificates before running.
see [cURL Website](http://curl.haxx.se/ca/)
You can confirm wit `ruby -ropenssl -e 'p OpenSSL::X509::DEFAULT_CERT_FILE'`.
### Windows User: Making your SSL Certificate permanent via your PATH
1. Download this [cacert.pem](http://curl.haxx.se/ca/cacert.pem) (cURL) into your HOME directory.
* or directly select cacert.pem from your oddb2xml-x.x.x gems directory.
* tools/cacert.pem is bundled with the oddb2xml gem.
2. Then Choose Menu "Control Panel" > "System" > "Advanced system settings"
* This opens the "System Properties" Window.
3. Click "Advanced" Tab.
4. Click "Environment Variables" button.
5. Add set variable entry "SSL\_CERT\_FILE=%HOMEPATH%\cacert.pem"
* Variable name: SSL\_CERT\_FILE
* Variable value: %HOMEPATH%\cacert.pem
* with "New..." button into upper are "User variables for xxx"
6. Do not remove this cacert.pem. All SSLv3 connections use this file.
### win_fetch_cacerts.rb
You can also run
* tools/win_fetch_cacerts.rb
for your currently open Terminal to download and set the Certificate.