Sha256: 0255464c671a0d4747f92124e3da8f566706f403a50483058a9d5179919b7bbe

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

require_relative '../all_jobs_shared'

class DataFrameSieveJob < Remi::Job

  source :source_data do
    fields(
      {
        :id      => {},
        :level   => {},
        :program => {},
        :contact => {}
      }
    )
  end

  source :sieve do
    fields(
      {
        :level   => {},
        :program => {},
        :contact => {},
        :group   => {}
      }
    )
  end

  target :target_data

  transform :main do
    # Hack to convert example to regex
    sieve.df[:program].recode! { |v| (v || '').match(/\A\/.*\/\Z/) ? /#{v[1...-1]}/ : v }

    target_data.df = source_data.df.dup
    Remi::SourceToTargetMap.apply(source_data.df, target_data.df) do
      map source(:level, :program, :contact) .target(:group)
        .transform(Remi::Transform::DataFrameSieve.new(sieve.df))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
remi-0.3.3 jobs/transforms/data_frame_sieve_job.rb
remi-0.3.2 jobs/transforms/data_frame_sieve_job.rb
remi-0.3.1 jobs/transforms/data_frame_sieve_job.rb
remi-0.3.0 jobs/transforms/data_frame_sieve_job.rb