Class: Renalware::Renal::Registry::PreflightChecks::DeathsQuery
- Inherits:
-
Object
- Object
- Renalware::Renal::Registry::PreflightChecks::DeathsQuery
- Includes:
- ModalityScopes
- Defined in:
- app/models/renalware/renal/registry/preflight_checks/deaths_query.rb
Instance Attribute Summary collapse
-
#query_params ⇒ Object
readonly
Returns the value of attribute query_params.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #default_relation ⇒ Object
-
#initialize(relation: nil, query_params: {}) ⇒ DeathsQuery
constructor
A new instance of DeathsQuery.
- #search ⇒ Object
Methods included from ModalityScopes
#with_current_modality_matching, #with_current_modality_of_class
Constructor Details
#initialize(relation: nil, query_params: {}) ⇒ DeathsQuery
Returns a new instance of DeathsQuery.
14 15 16 17 18 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 14 def initialize(relation: nil, query_params: {}) @relation = relation || default_relation @query_params = query_params @query_params[:s] = "modality_descriptions_name ASC" if @query_params[:s].blank? end |
Instance Attribute Details
#query_params ⇒ Object (readonly)
Returns the value of attribute query_params.
12 13 14 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 12 def query_params @query_params end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
12 13 14 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 12 def relation @relation end |
Class Method Details
.missing_data_for(_patient) ⇒ Object
37 38 39 40 41 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 37 def self.missing_data_for(_patient) [ :cause_of_death ] end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 24 def call search .result .extending(ModalityScopes) .preload(current_modality: [:description]) .with_current_modality_of_class(Renalware::Deaths::ModalityDescription) .where("patients.first_cause_id is NULL AND renal_profiles.esrf_on IS NOT NULL") end |
#default_relation ⇒ Object
20 21 22 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 20 def default_relation Renalware::Renal::Patient.left_outer_joins(:profile) end |
#search ⇒ Object
33 34 35 |
# File 'app/models/renalware/renal/registry/preflight_checks/deaths_query.rb', line 33 def search @search ||= relation.ransack(query_params) end |