class ConceptQL::Operators::PlaceOfServiceFilter

Filters the incoming stream of events to only those that have a an associated visit_occurrence with the matching place_of_service

Provenance related concepts are the ones found in the xxx_type_concept_id field.

If the event has NULL for the provenance-related field, they are filtered out.

Multiple provenances can be specified at once

Public Instance Methods

query(db) click to toggle source
# File lib/conceptql/operators/place_of_service_filter.rb, line 32
def query(db)
  db.from(stream.evaluate(db))
    .where(place_of_service_concept_id: place_of_service_concept_ids(db))
end

Private Instance Methods

place_of_service_concept_ids(db) click to toggle source
# File lib/conceptql/operators/place_of_service_filter.rb, line 39
def place_of_service_concept_ids(db)
  db.from(:concept)
    .where(concept_code: arguments.map(&:to_s))
    .where(vocabulary_id: 14)
    .select(:concept_id)
end