Module: ODDB::FiParse

Defined in:
ext/fiparse/src/minifi.rb,
ext/fiparse/src/fiparse.rb,
ext/fiparse/src/fiwriter.rb,
ext/fiparse/src/indications.rb,
ext/fiparse/test/minifi_test.rb,
ext/fiparse/src/fachinfo_pdf.rb,
ext/fiparse/src/fachinfo_doc.rb,
ext/fiparse/src/patinfo_hpricot.rb,
ext/fiparse/src/fachinfo_writer.rb,
ext/fiparse/src/fachinfo_hpricot.rb,
ext/fiparse/src/textinfo_hpricot.rb,
ext/fiparse/test/indications_test.rb,
ext/fiparse/test/fachinfo_pdf_test.rb,
ext/fiparse/test/test_patinfo_hpricot.rb,
ext/fiparse/test/test_fachinfo_hpricot.rb,
ext/fiparse/test/test_fachinfo_doc_parser.rb

Defined Under Namespace

Modules: FachinfoWriterMethods, Indications, MiniFi Classes: FachinfoDocWriter, FachinfoHpricot, FachinfoPDFWriter, FachinfoSubDocumentHandler, FachinfoTableHandler, FachinfoTextHandler, FachinfoWriter, PatinfoHpricot, TestFachinfoHpricot, TestFachinfoHpricotAlcaCDe, TestFachinfoHpricotPonstanDe, TestFachinfoPDFAssCardioSandoz, TestFachinfoPDFCiprofloxacinSandoz, TestFachinfoPDFHBVAXPRO, TestFachinfoPDFMagnevist, TestFachinfoPDFWriter, TestFachinfoPDFWriterCetrin, TestFachinfoPDFWriterFursol, TestFachinfoPDFWriterFursolFr, TestFachinfoPDFWriterLyrica, TestFachinfoPDFWriterPre, TestFachinfoPDFWriterTrileptal, TestFachinfoPDFWriterValcyte, TestFachinfoPDFWriterVelcade, TestIndicationsHandler, TestMiniFiHandler, TestPatinfoHpricot, TestPatinfoHpricotCimifeminDe, TestPatinfoHpricotCimifeminFr, TestPatinfoHpricotInderalDe, TestPatinfoHpricotNasivinDe, TestPatinfoHpricotPonstanDe, TextinfoHpricot, Writer

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) extract_indications(path)



27
28
29
# File 'ext/fiparse/src/fiparse.rb', line 27

def FiParse.extract_indications(path)
  Indications.extract(path)
end

+ (Object) extract_minifi(path)



30
31
32
# File 'ext/fiparse/src/fiparse.rb', line 30

def FiParse.extract_minifi(path)
  MiniFi.extract(path)
end

Instance Method Details

- (Object) parse_fachinfo_doc(src)



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/fiparse/src/fiparse.rb', line 33

def parse_fachinfo_doc(src)
  parser = Rwv2.create_parser_from_content(src)
  handler = FachinfoTextHandler.new
  parser.set_text_handler(handler)
  parser.set_table_handler(handler.table_handler)
  parser.parse
  if(handler.writers.empty?)
    ## Product-Name was not written large enough - retry with whatever was 
    #  the largest fontsize
    handler.cutoff_fontsize = handler.max_fontsize
    parser.parse
  end
  handler.writers.collect { |wt| wt.to_fachinfo }.compact.first
end

- (Object) parse_fachinfo_html(src)



47
48
49
50
51
52
53
# File 'ext/fiparse/src/fiparse.rb', line 47

def parse_fachinfo_html(src)
  if File.exist?(src)
    src = File.read src
  end
  writer = FachinfoHpricot.new
  writer.extract(Hpricot(src))
end

- (Object) parse_fachinfo_pdf(src)



54
55
56
57
58
59
# File 'ext/fiparse/src/fiparse.rb', line 54

def parse_fachinfo_pdf(src)
  writer = FachinfoPDFWriter.new
  parser = Rpdf2txt::Parser.new(src, 'UTF-8')
  parser.extract_text(writer)
  writer.to_fachinfo
end

- (Object) parse_patinfo_html(src)



60
61
62
63
64
65
66
# File 'ext/fiparse/src/fiparse.rb', line 60

def parse_patinfo_html(src)
  if File.exist?(src)
    src = File.read src
  end
  writer = PatinfoHpricot.new
  writer.extract(Hpricot(src))
end

- (Object) storage=(storage)



24
25
26
# File 'ext/fiparse/src/fiparse.rb', line 24

def storage=(storage)
  ODBA.storage = storage
end