zdavatz/oddb.org

Ex-Factory Preise und PPUB sind nicht aktuell

Closed this issue · 20 comments

  1. Die Ex-Factory Preise sind nicht aktuell
  2. Beispiele: Nasonex, Arcoxia
  3. latest-screenshot

When I look at the file Publications.xslx found after unzipping 'http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip' I have the following lines:

Organon GmbH O 17019 54189036 B 15.03.1998 Nasonex Dosier Nasenspray, Nasenspray 50 mcg, 140 Dos 8.5 18     12.02.30. Mometasoni-17 furoas 7450 N 7680541890365 R01AD09 1742 Nasonex Nasal N
With a price of 18 francs and Ex-Factory of 8.5. For ` Arcoxia, Filmtabl 30 mg, 28 Stk | 15.38 | 34.1`

We do not care about the XLSX, we care about the Preparations.xml

The same prices are found in the Preparations.xml

I extracted the nasonex-XML into the files nasonex_2023.xml and nasonex_2023.xml. Diffing them gets the following output

 diff -w nasonex_2023.xml  nasonex_2024.xml
12c12
<  <FlagSB20>Y</FlagSB20>
---
>     <FlagSB20>N</FlagSB20>
35c35
<   <PrevPharmacode />
---
>         <PrevGTINcode />
40,41c40,41
< <Price>9.09</Price>
< <ValidFromDate>01.02.2018</ValidFromDate>
---
>             <Price>8.5</Price>
>             <ValidFromDate>01.01.2024</ValidFromDate>
50a51
>             <LastPriceChange>01.01.2024</LastPriceChange>
53,54c54,55
< <Price>18.65</Price>
< <ValidFromDate>01.02.2018</ValidFromDate>
---
>             <Price>18</Price>
>             <ValidFromDate>01.01.2024</ValidFromDate>
121a123
>   </Preparation>

I see the following changes:

  • FlagSB changed from Y to N
  • Field PrevPharmacode changed name to PrevGTINcode
  • ExFactoryPrice changed from 9.09 to 8.5
  • PublicPrice changed from 18.65 to 18

so why, are our prices wrong?

For PEXF this Tag is new: <LastPriceChange>01.03.2021</LastPriceChange> and seems to confuse the parser.

Could add a ex (10.0) and public price (20.0) with bin/admin and setting the ValidFrom to 31.1.2022 for both prices. After a restart of oddb.org I see under http://localhost:8012/de/gcc/search/zone/drugs/search_query/nasonex/search_type/st_sequence?#best_result the correct prices nasonex.pdf
but the price_history if wrong Nasonex_Pricehistory.pdf

so the Problem is connected to the price history.

When the last price_public was added with a wrong validFrom date, this is not corrected and only a new exFactory-Price is set, but which will not be correctly displayed in the price history.
Therefore I will update bsv_xml to set a correct validFrom-date in this case.

great!

Running the bsv_import I found another problem!

in https://ch.oddb.org/de/gcc/price_history/reg/66015/seq/01/pack/011 we see the changes in the VAT

     01.01.2024	 	 	58.60	(+0.09 %)	SL	http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip (01.01.2024)	MWSTAENDERUNG
     01.12.2020	36.71	 	58.55	 	SL	http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip (01.12.2020)	Erstaufnahme in die SL

Whereas my first solution silently overwrites it and gives here

    01.12.2020	36.71	 	58.55	(+0.00 %)	SL	http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip (01.12.2020)	Erstaufnahme in die SL

By debugging in the src/state/drugs/price_history.rb I found the following three prices

   exfactory Added 2020-12-01 00:00:00 +0100 ex 36.71  pub 
   public Added 2020-12-01 00:00:00 +0100 ex 36.71  pub 58.60
   public Added 2020-12-01 00:00:00 +0100 ex 36.71  pub 58.55

Must think about how to handle this. Maybe we must handle the tag (set in this example) PriceChangeTypeCode MWSTAENDERUNG differently.

The PriceChangeTypeCode ist set to MWSTAENDERUNG only for the public price and it has a ValidFromDate of 01.01.2024 whereas the price_exfactory is from 01.01.2020 and has as PriceChangeTypeCode SLAUFNAHME.
Probably the easiest is to use @price_public and @price_exfactory in the bsv_xml.rb instead of the @public.
But I am feeling confident to do this redesign as I have good unit tests.

What is important is, that we keep updating the price history together with the comment. Till now that worked very well:
https://generika.cc/de/generika/price_history/reg/54189/seq/02/pack/036

Pushed the commit ngiger@12e23d2 which should fix the whole bsv_import.
Unittest for bsv_import is also better and with little help it is now possible to add further XML-files to test whether the bsv_import handles corner cases.
TODO:

  • In src/custom/lookandfeelbase.rbwe should add a message for price changes via a new vat, eg.:sl_mutation_MWSTAENDERUNG -> Mehrwertsteuer geändert

Tests sind bei mir lokal durchgelaufen. PR kommt
Für das Problem wegen SL bitte separates Issue erstellen

Welches Problem mit der SL? Dieser Issue betrifft das SL Problem.

Nein. Titel ist Ex-Factory Preise sind nicht akutell. Das ist gefixed (auch für Public Preise)

The comparision whether the change_code for PPUB or PEXF has changed was wrong.

Also detected that an odba_store was too not necessary.

Found various instance of @app.update which are issued even when there is no change to commit. Fixed a few of them. But leaving in code four TODO remarks where we should also check, whether something has changed. But here it would take a couple of hours to fix the issue.

On my machine an import_bsv_only took about 54 minutes, between these two lines

2024-02-09 14:57:30 +0100: /opt/path_to_oddb/oddb.org/src/plugin/bsv_xml.rb:365:in `tag_end': 55560 006 set price_public 643.65 now 643.65 now MWSTAENDERUNG now 3JUEBERPRUEF
2024-02-09 14:03:00 +0100: /opt/path_to_oddb/oddb.org/ext/refdata/src/refdata.rb:45:in `<module:Archiver>': Refdata: Starting debugging using REFDATA_BASE_URI http://refdatabase.refdata.ch

great!

Also found out, that the amount has sometimes more than two digits. E.g.

seen in the debugger

2024-02-09 18:10:52 +0100: /opt/path_to_oddb/oddb.org/src/plugin/bsv_xml.rb:356:in `tag_end': 50358 062: set price_exfactory 33.03 now 33.03. AUSLANDPV now AUSLANDPV
(ruby) @price_exfactory.amount.to_s.eql?(@pack.price_exfactory.amount.to_s)
false
(ruby) @price_exfactory.amount.to_s
"33.03"
(ruby) @pack.price_exfactory.amount.to_s
"33.02801"

Changing the code to compare only the output of prices.to_s and not prices.amount.to_s