Sha256: dccad7526c9f88942b3c7636c09b4e0266c95ff2494106e2a586e79d380f5668

Contents?: true

Size: 553 Bytes

Versions: 1

Compression:

Stored size: 553 Bytes

Contents

require_relative 'operator'

module ConceptQL
  module Operators
    class ToSeerVisits < Operator
      def type
        :visit_occurrence
      end

      def query(db)
        query = options.map do |k, v|
          next if v.nil?
          db[:observation]
            .where(observation_source_value: k.to_s.upcase, value_as_string: v)
            .select(:visit_occurrence_id)
            .from_self
        end.compact.inject { |q, i| i.intersect(q) }
        db[:visit_occurrence].where(visit_occurrence_id: query)
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

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