Module: Kiba::Extend::Mixins::IterativeCleanup::Jobs::Corrections

Defined in:
lib/kiba/extend/mixins/iterative_cleanup/jobs/corrections.rb

Overview

Since:

  • 4.0.0

Class Method Summary collapse

Class Method Details

.get_xforms(mod) ⇒ Object

Since:

  • 4.0.0



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/corrections.rb', line 23

def get_xforms(mod)
  base = []
  if mod.respond_to?(:corrections_pre_xforms)
    base << mod.corrections_pre_xforms
  end

  base << xforms(mod)

  if mod.respond_to?(:corrections_post_xforms)
    base << mod.corrections_post_xforms
  end
  base
end

.job(mod:) ⇒ Object

Since:

  • 4.0.0



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/corrections.rb', line 11

def job(mod:)
  return unless mod.cleanup_done?

  Kiba::Extend::Jobs::Job.new(
    files: {
      source: mod.returned_compiled_job_key,
      destination: mod.corrections_job_key
    },
    transformer: get_xforms(mod)
  )
end

.xforms(mod) ⇒ Object

Since:

  • 4.0.0



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/kiba/extend/mixins/iterative_cleanup/jobs/corrections.rb', line 37

def xforms(mod)
  Kiba.job_segment do
    transform FilterRows::FieldPopulated,
      action: :keep,
      field: :corrected
    transform Explode::RowsFromMultivalField,
      field: mod.collated_orig_values_id_field,
      delim: mod.collation_delim
    transform Rename::Field,
      from: mod.collated_orig_values_id_field,
      to: mod.orig_values_identifier
    transform CombineValues::FullRecord
    transform Deduplicate::Table,
      field: :index,
      delete_field: true
  end
end