Class: Kiba::Extend::Transforms::Fingerprint::MergeCorrected
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Fingerprint::MergeCorrected
- Defined in:
- lib/kiba/extend/transforms/fingerprint/merge_corrected.rb
Overview
Note:
If you are giving custom target fields via the fieldmap
parameter, or your source table does not already contain the target
fields, you will need to run the Clean::EnsureConsistentFields
transform after running this, and before writing output.
With a lookup table derived from a job using FlagChanged, and a source table having a fingerprint field which can be used as a keycolumn for the lookup table, apply corrections from the lookup table to the source table. If multiple matching correction rows are found in the lookup table, they will be applied in the order they are returned from the lookup table.
Instance Method Summary collapse
-
#initialize(keycolumn:, lookup:, todofield:, fieldmap: {}, tag_affected_in: nil) ⇒ MergeCorrected
constructor
A new instance of MergeCorrected.
-
#process(row) ⇒ Object
Constructor Details
#initialize(keycolumn:, lookup:, todofield:, fieldmap: {}, tag_affected_in: nil) ⇒ MergeCorrected
Returns a new instance of MergeCorrected.
141 142 143 144 145 146 147 148 |
# File 'lib/kiba/extend/transforms/fingerprint/merge_corrected.rb', line 141 def initialize(keycolumn:, lookup:, todofield:, fieldmap: {}, tag_affected_in: nil) @keycolumn = keycolumn @lookup = lookup @todofield = todofield @fieldmap = fieldmap @tag_affected_in = tag_affected_in end |
Instance Method Details
#process(row) ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/kiba/extend/transforms/fingerprint/merge_corrected.rb', line 151 def process(row) row[tag_affected_in] = "n" if tag_affected_in correction_steps = get_correction_steps(row) return row if correction_steps.blank? do_correction_steps(row, correction_steps) row[tag_affected_in] = "y" if tag_affected_in row end |