Sha256: 8e8a1c4454a310743c50943913496f8a69d1081a1d5e167372252e054aa34025

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

module Renalware
  module PD
    class MDMPatientsQuery
      include ModalityScopes
      MODALITY_NAMES = "PD".freeze
      attr_reader :q, :relation

      def initialize(relation: PD::Patient.all, q:)
        @q = q
        @relation = relation
      end

      def call
        search.result
      end

      def search
        @search ||= begin
          relation
            .extending(ModalityScopes)
            .extending(Scopes)
            .with_current_modality_matching(MODALITY_NAMES)
            .with_current_key_pathology
            .search(q)
        end
      end

      module Scopes
        def with_current_key_pathology
          includes(:current_key_observation_set) # . joins(:current_key_observation)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc1 app/models/renalware/pd/mdm_patients_query.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/pd/mdm_patients_query.rb