Sha256: cdce184965134f3a74139253de285f24a49b71f1f061dac4036539ed04405d6a

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require_relative 'temporal_operator'

module ConceptQL
  module Operators
    class After < TemporalOperator
      desc <<-EOF
Compares all results on a person-by-person basis between the left hand results (LHR) and the right hand resuls (RHR).
For any result in the LHR whose start_date occurs after the earliest end_date of the RHR, that result is passed through.
All other results are discarded, including all results in the RHR.
L-------N-------L
R-----R
   R-----R
        L-----Y----L
      EOF
      def right_stream(db)
        right.evaluate(db).from_self.group_by(:person_id).select(:person_id, Sequel.function(:min, :end_date).as(:end_date)).as(:r)
      end

      def where_clause
        Proc.new { l__start_date > r__end_date }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conceptql-0.2.0 lib/conceptql/operators/after.rb