Class: ODDB::FiParse::PatinfoHpricot

Inherits:
TextinfoHpricot show all
Defined in:
ext/fiparse/src/patinfo_hpricot.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from TextinfoHpricot

#chapter, #extract

Instance Attribute Details

- (Object) amendments (readonly)

Returns the value of attribute amendments



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def amendments
  @amendments
end

- (Object) amzv (readonly)

Returns the value of attribute amzv



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def amzv
  @amzv
end

- (Object) composition (readonly)

Returns the value of attribute composition



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def composition
  @composition
end

- (Object) contra_indications (readonly)

Returns the value of attribute contra_indications



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def contra_indications
  @contra_indications
end

- (Object) date (readonly)

Returns the value of attribute date



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def date
  @date
end

- (Object) distribution (readonly)

Returns the value of attribute distribution



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def distribution
  @distribution
end

- (Object) effects (readonly)

Returns the value of attribute effects



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def effects
  @effects
end

- (Object) fabrication (readonly)

Returns the value of attribute fabrication



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def fabrication
  @fabrication
end

- (Object) galenic_form (readonly)

Returns the value of attribute galenic_form



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def galenic_form
  @galenic_form
end

- (Object) general_advice (readonly)

Returns the value of attribute general_advice



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def general_advice
  @general_advice
end

- (Object) iksnrs (readonly)

Returns the value of attribute iksnrs



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def iksnrs
  @iksnrs
end

- (Object) packages (readonly)

Returns the value of attribute packages



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def packages
  @packages
end

- (Object) precautions (readonly)

Returns the value of attribute precautions



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def precautions
  @precautions
end

- (Object) pregnancy (readonly)

Returns the value of attribute pregnancy



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def pregnancy
  @pregnancy
end

- (Object) unwanted_effects (readonly)

Returns the value of attribute unwanted_effects



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def unwanted_effects
  @unwanted_effects
end

- (Object) usage (readonly)

Returns the value of attribute usage



10
11
12
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 10

def usage
  @usage
end

Instance Method Details

- (Object) identify_chapter(code, chapter)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 14

def identify_chapter(code, chapter)
  case code
  when '7600'
    @amzv = chapter
  when '2000', '7620'
    @effects = chapter
  when '2500', '7640'
    @amendments = chapter
  when '3000', '7625', '7660', '7680'
    @contra_indications = chapter
  when '3500', '7700'
    @precautions = chapter
  when '4000', '7720'
    @pregnancy = chapter
  when '4500', '7740'
    @usage = chapter
  when '5000', '7760'
    @unwanted_effects = chapter
  when '5500', '7780'
    @general_advice = chapter
  when '6000', '7840'
    @composition = chapter
  when '7860'
    @iksnrs = chapter
  when '6500', '7880'
    @packages = chapter
  when '7000', '7900'
    @distribution = chapter
  when '7920'
    @fabrication = chapter
  when '7930'
    @delivery = chapter
  when '7520', '7940', '7950'
    if(@date) # we are overwriting an existing @date
      chapter.sections = @date.sections
    end
    @date = chapter
  when nil # special chapers without heading
    case chapter.to_s
    when /^\d{5}/u
      @iksnrs = chapter
    when /\b\d{4}\b/u
      @date = chapter
    end
  else
    raise "Unknown chapter-code #{code}, while parsing #{@name}"
  end
end

- (Object) to_textinfo



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'ext/fiparse/src/patinfo_hpricot.rb', line 62

def to_textinfo
  pat = if(@amzv)
    pat = PatinfoDocument2001.new
    pat.amzv = @amzv
    pat.iksnrs = @iksnrs
    pat
  else
    pat = PatinfoDocument.new
    pat
  end
  pat.name = @name
  pat.company = @company
  pat.galenic_form = @galenic_form
  pat.effects = @effects
  pat.amendments = @amendments
  pat.contra_indications = @contra_indications
  pat.precautions = @precautions
  pat.pregnancy = @pregnancy
  pat.usage = @usage
  pat.unwanted_effects = @unwanted_effects
  pat.general_advice  = @general_advice
  #pat.other_advice = @other_advice ## not identified yet.
  pat.composition = @composition
  pat.packages = @packages
  pat.distribution = @distribution
  pat.fabrication = @fabrication
  pat.date = @date
  pat
end