Sha256: 0cf29d9e6bccfe3a21833081d0d2e6dfcf97ae14706971694b16dd4ec4041ca9

Contents?: true

Size: 711 Bytes

Versions: 21

Compression:

Stored size: 711 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[:date_diff].(params[:measure]))
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
remi-0.2.27 jobs/transforms/date_diff_job.rb
remi-0.2.26 jobs/transforms/date_diff_job.rb
remi-0.2.25 jobs/transforms/date_diff_job.rb
remi-0.2.24 jobs/transforms/date_diff_job.rb
remi-0.2.23 jobs/transforms/date_diff_job.rb
remi-0.2.22 jobs/transforms/date_diff_job.rb
remi-0.2.21 jobs/transforms/date_diff_job.rb
remi-0.2.20 jobs/transforms/date_diff_job.rb
remi-0.2.19 jobs/transforms/date_diff_job.rb
remi-0.2.18 jobs/transforms/date_diff_job.rb
remi-0.2.17 jobs/transforms/date_diff_job.rb
remi-0.2.16 jobs/transforms/date_diff_job.rb
remi-0.2.15 jobs/transforms/date_diff_job.rb
remi-0.2.14 jobs/transforms/date_diff_job.rb
remi-0.2.13 jobs/transforms/date_diff_job.rb
remi-0.2.12 jobs/transforms/date_diff_job.rb
remi-0.2.11 jobs/transforms/date_diff_job.rb
remi-0.2.10 jobs/transforms/date_diff_job.rb
remi-0.2.9 jobs/transforms/date_diff_job.rb
remi-0.2.8 lib/remi/project/jobs/transforms/date_diff_job.rb