Sha256: 61479fb1557dc0bb7872a95f72cfbceec99beb756d108656f9c1909efd9c0006

Contents?: true

Size: 712 Bytes

Versions: 10

Compression:

Stored size: 712 Bytes

Contents

require_relative '../all_jobs_shared'

class DateDiffJob
  include AllJobsShared

  define_param :measure, :days
  define_source :source_data, Remi::DataSource::DataFrame,
    fields: {
      :date1 => { type: :date, format: '%Y-%m-%d' },
      :date2 => { type: :date, format: '%Y-%m-%d' }
    }
  define_target :target_data, Remi::DataTarget::DataFrame

  define_transform :main, sources: :source_data, targets: :target_data do
    Remi::SourceToTargetMap.apply(source_data.df, target_data.df) do
      map source(:date1, :date2) .target(:difference)
        .transform(->(d1,d2) { [Date.strptime(d1), Date.strptime(d2)] })
        .transform(Remi::Transform::DateDiff.new(params[:measure]))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
remi-0.2.37 jobs/transforms/date_diff_job.rb
remi-0.2.36 jobs/transforms/date_diff_job.rb
remi-0.2.35 jobs/transforms/date_diff_job.rb
remi-0.2.34 jobs/transforms/date_diff_job.rb
remi-0.2.33 jobs/transforms/date_diff_job.rb
remi-0.2.32 jobs/transforms/date_diff_job.rb
remi-0.2.31 jobs/transforms/date_diff_job.rb
remi-0.2.30 jobs/transforms/date_diff_job.rb
remi-0.2.29 jobs/transforms/date_diff_job.rb
remi-0.2.28 jobs/transforms/date_diff_job.rb