Class: ODDB::VaccinePlugin::ParsedRegistration

Inherits:
Object
  • Object
show all
Defined in:
src/plugin/vaccines.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ParsedRegistration) initialize

A new instance of ParsedRegistration



42
43
44
# File 'src/plugin/vaccines.rb', line 42

def initialize
  @sequences = []
end

Instance Attribute Details

- (Object) company

Returns the value of attribute company



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def company
  @company
end

- (Object) expiration_date

Returns the value of attribute expiration_date



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def expiration_date
  @expiration_date
end

- (Object) ikscat

Returns the value of attribute ikscat



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def ikscat
  @ikscat
end

- (Object) iksnr

Returns the value of attribute iksnr



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def iksnr
  @iksnr
end

- (Object) indication

Returns the value of attribute indication



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def indication
  @indication
end

- (Object) out_of_trade

Returns the value of attribute out_of_trade



39
40
41
# File 'src/plugin/vaccines.rb', line 39

def out_of_trade
  @out_of_trade
end

- (Object) sequences (readonly)

Returns the value of attribute sequences



41
42
43
# File 'src/plugin/vaccines.rb', line 41

def sequences
  @sequences
end

Instance Method Details

- (Object) assign_seqnrs(reg = nil)



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'src/plugin/vaccines.rb', line 45

def assign_seqnrs(reg = nil)
  offset = 1
  if(reg)
    @sequences.each { |seq|
      seq.assign_seqnr_by_ikscd(reg)
    }
    offset = @sequences.collect { |seq| 
      seq.seqnr.to_i 
    }.max.next
  end
  @sequences.select { |seq| seq.seqnr.nil? }.sort_by { |seq|
    seq.ikscds.sort
  }.each_with_index { |seq, idx|
    seq.seqnr = sprintf("%02d", idx + offset)
  }
end

- (Object) data



61
62
63
64
65
66
67
68
69
70
71
# File 'src/plugin/vaccines.rb', line 61

def data
  data = {
    :vaccine => true, 
  }
  [:indication, :company, :ikscat, :expiration_date].each { |key|
    if(val = self.send(key))
      data.store(key, val)
    end
  }
  data
end