Skip to content

Commit

Permalink
Added CompositionSwissmedic to oddb_product.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Feb 16, 2015
1 parent 270464a commit 86e33fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions History.txt
@@ -1,5 +1,6 @@
=== 1.9.5 /03.02.2015

* Added field CompositionSwissmedic to oddb_product.xml
* Unittests for upcoming oddb_calc.xml

=== 1.9.4 /21.01.2015
Expand Down
3 changes: 3 additions & 0 deletions lib/oddb2xml/builder.rb
Expand Up @@ -251,6 +251,7 @@ def prepare_products
:siz => '',
:eht => '',
:sub => '',
:comp => '',
}
if obj[:ean] # via EAN-Code
obj[:no8] = obj[:ean][4..11]
Expand All @@ -269,6 +270,7 @@ def prepare_products
obj[:siz] = ppac[:package_size]
obj[:eht] = ppac[:einheit_swissmedic]
obj[:sub] = ppac[:substance_swissmedic]
obj[:comp] = ppac[:composition_swissmedic]
end
if obj[:ean][0..3] == '7680'
@products << obj
Expand Down Expand Up @@ -573,6 +575,7 @@ def build_product
xml.PackGrSwissmedic obj[:siz] unless obj[:siz].empty?
xml.EinheitSwissmedic obj[:eht] unless obj[:eht].empty?
xml.SubstanceSwissmedic obj[:sub] unless obj[:sub].empty?
xml.CompositionSwissmedic obj[:comp] unless obj[:comp].empty?
}
end
xml.RESULT {
Expand Down
2 changes: 2 additions & 0 deletions lib/oddb2xml/extractor.rb
Expand Up @@ -277,6 +277,7 @@ def to_hash # Packungen.xls
siz = 11 # :package_size
eht = 12 # :einheit_swissmedic
sub = 14 # :substance_swissmedic
comp = 15 # :composition_swissmedic
@sheet.each_with_index do |row, i|

next if (i <= 1)
Expand All @@ -296,6 +297,7 @@ def to_hash # Packungen.xls
:package_size => row[siz] ? row[siz].value.to_s : '',
:einheit_swissmedic => row[eht] ? row[eht].value.to_s : '',
:substance_swissmedic => row[sub] ? row[sub].value.to_s : '',
:composition_swissmedic => row[comp] ? row[comp].value.to_s : '',
:sequence_name => row[seq_name] ? row[seq_name].value.to_s : '',
:is_tier => (row[typ] == 'Tierarzneimittel' ? true : false),
}
Expand Down
3 changes: 3 additions & 0 deletions oddb2xml.xsd
Expand Up @@ -75,6 +75,7 @@
E Abgabe ohne Fachberatung
* ATC (if missing from swissINDEX) -> Field SubstanceSwissmedic in oddb_article.xml
* Wirkstoff (column 'O') -> Field SubstanceSwissmedic in oddb_article.xml
* Composition (column 'P') -> Field CompositionSwissmedic in oddb_product.xml
* Packungsgrösse (column 'L') -> Field PackGrSwissmedic in oddb_article.xml
* Packungseinheit(column 'L') -> Field EinheitSwissmedic in oddb_article.xml

Expand Down Expand Up @@ -802,6 +803,7 @@
<xs:element minOccurs="0" ref="ns1:PackGrSwissmedic"/>
<xs:element minOccurs="0" ref="ns1:EinheitSwissmedic"/>
<xs:element minOccurs="0" ref="ns1:SubstanceSwissmedic"/>
<xs:element minOccurs="0" ref="ns1:CompositionSwissmedic"/>
</xs:sequence>
<xs:attribute name="DT" use="required"/>
</xs:complexType>
Expand Down Expand Up @@ -842,6 +844,7 @@
<xs:element name="PackGrSwissmedic" type="xs:string"/>
<xs:element name="EinheitSwissmedic" type="xs:string"/>
<xs:element name="SubstanceSwissmedic" type="xs:string"/>
<xs:element name="CompositionSwissmedic" type="xs:string"/>
<xs:element name="PRODUCTMD">
<xs:complexType>
<xs:sequence>
Expand Down
2 changes: 2 additions & 0 deletions spec/builder_spec.rb
Expand Up @@ -118,6 +118,8 @@ def check_validation_via_xsd
product_xml.match(/<GTIN>7680620690084/).should_not == nil
product_xml.match(/<DSCRD>Levetiracetam DESITIN Filmtabl 250 mg/).should_not == nil
product_xml.match(/<DSCRF>Levetiracetam DESITIN cpr pell 250 mg/).should_not == nil
product_xml.match(/<SubstanceSwissmedic>levetiracetamum</)
product_xml.match(/<CompositionSwissmedic>levetiracetamum 250 mg, excipiens pro compressi obducti pro charta.</).should_not == nil

article_xml.scan(/<ART DT=/).size.should eq(NrPharmaArticles)
article_xml.should match(/<PHAR>5819012</)
Expand Down

0 comments on commit 86e33fc

Please sign in to comment.