Sha256: 9743c1df03c48a9ee6f5f3cc03673b2e270943ad8c054ccee6a56316d6603212
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require_dependency "renalware/renal" module Renalware module Renal module Registry module PreflightChecks class DeathsQuery include ModalityScopes MODALITY_NAMES = %w(Death).freeze attr_reader :relation, :query_params def initialize(relation: nil, query_params: {}) @relation ||= default_relation @query_params = query_params @query_params[:s] = "modality_descriptions_name ASC" if @query_params[:s].blank? end def default_relation Renalware::Patient .preload(current_modality: [:description]) .all .order(family_name: :asc) end def call search .result .extending(ModalityScopes) .with_current_modality_matching(MODALITY_NAMES) .joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id") .where("patients.first_cause_id is NULL AND renal_profiles.esrf_on IS NOT NULL") end def search @search ||= relation.ransack(query_params) end def self.missing_data_for(patient) [ :cause_of_death ] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.0.0.pre.beta12 | app/models/renalware/renal/registry/preflight_checks/deaths_query.rb |