<< | Index | >>
@app.patinfos has also old patinfo.
I added this method for effective (new and active) patinfo.
In Browser, We can get always new patinfo. Because it seems that user specify registration code and sequence code.
Sequence has correct connection to newest patinfo object
In exported yaml hat all patinfo.(alte and invalid one, too)
in src/util/oddbapp.rb
def effective_patinfos # return only active patinfos via active sequence. # @patinfos has also old patinfos. _patinfos = [] @registrations.values.compact.map do |reg| reg.sequences.values.compact.map do |seq| _patinfo = seq.patinfo if seq.active? if !_patinfo.nil? and _patinfo.valid? _patinfos << _patinfo end end end _patinfos.uniq.compact end
http://oddb.yasuhiro.org/de/gcc/patinfo/reg/31706/seq/01
in src/drugs/global.rb
def patinfo if (iksnr = @session.user_input(:reg) || @session.user_input(:swissmedicnr)) \ && (seqnr = @session.user_input(:seq)) \ && (reg = @session.app.registration(iksnr)) \ && (seq = reg.sequence(seqnr)) \ && (patinfo = seq.patinfo) \ && (!patinfo.descriptions.empty?) State::Drugs::Patinfo.new(@session, patinfo) else Http404.new(@session, nil) end end
alte patinfo has gone.
ch.oddb> patinfos.length -> 4172 ch.oddb> effective_patinfos.length -> 2996
But some invalid patinfos belongs to alte sequences are in patinfo.yaml.
tried Sequence model to check by Sequence#pubilc
def public? !@export_flag && @registration.respond_to?(:public?) && @registration.public? && active? end
Then
ch.oddb> effective_patinfos.length -> 2909
Some Patinfo has invaild link to other Sequence object.
z.B.
ch.oddb> registration('58094').sequence('01')
ch.oddb> ODBA.cache.fetch(1749).article_codes.last -> {:article_ean13=>"7680384230298", :article_pcode=>"2237640", :article_size=>"100 Tablette(n)", :article_dose=>"369 mg"} ch.oddb> ODBA.cache.fetch(1749).article_codes.first -> {:article_ean13=>"7680384230106", :article_pcode=>"669921", :article_size=>"40 Tablette(n)", :article_dose=>"369 mg"}
in patinfo.yaml
1780323 article_codes: 1780324 - :article_ean13: "7680550240014" 1780325 :article_pcode: "2242836" 1780326 :article_size: 10 Tablette(n) 1780327 :article_dose: 12.5 mg 1780328 - :article_ean13: "7680550240038" 1780329 :article_pcode: "2242842" 1780330 :article_size: 20 Tablette(n) 1780331 :article_dose: 12.5 mg ## ↓ article codes from invalid sequence link 1780332 - :article_ean13: "7680580940014" 1780333 :article_pcode: "3617899" 1780334 :article_size: "10 Drag\xC3\xA9e(s)" 1780335 :article_dose: 25 mg
checked with 2 targets
in src/util/oddbapp.rb
def effective_patinfos [ registration('58094').sequence('01').patinfo, registration('55024').sequence('01').patinfo ] end
create fachinfo_now.yaml
from focused active fachinfos by expiration_date
ch.oddb> registration('50421').expiration_date -> 2013-12-16
ch.oddb> fachinfos.length -> 4731 ch.oddb> registrations.values.map {|reg| reg.fachinfo if reg.public? and reg.has_fachinfo?}.uniq.length -> 3489