Class: Renalware::PD::DashboardPresenter
- Inherits:
-
Object
- Object
- Renalware::PD::DashboardPresenter
- Includes:
- PresenterHelper
- Defined in:
- app/presenters/renalware/pd/dashboard_presenter.rb
Instance Attribute Summary collapse
-
#patient ⇒ Object
Returns the value of attribute patient.
Instance Method Summary collapse
- #apd_regimes ⇒ Object
- #assessments ⇒ Object
- #capd_regimes ⇒ Object
- #current_regime ⇒ Object
- #exit_site_infections ⇒ Object
-
#initialize(patient) ⇒ DashboardPresenter
constructor
A new instance of DashboardPresenter.
- #latest_pd_line_change_events ⇒ Object
- #peritonitis_episodes ⇒ Object
- #pet_adequacies ⇒ Object
- #training_sessions ⇒ Object
Methods included from PresenterHelper
Constructor Details
#initialize(patient) ⇒ DashboardPresenter
Returns a new instance of DashboardPresenter.
13 14 15 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 13 def initialize(patient) @patient = patient end |
Instance Attribute Details
#patient ⇒ Object
Returns the value of attribute patient.
11 12 13 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 11 def patient @patient end |
Instance Method Details
#apd_regimes ⇒ Object
25 26 27 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 25 def apd_regimes @apd_regimes ||= APDRegime.for_patient(patient).with_bags.ordered end |
#assessments ⇒ Object
44 45 46 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 44 def assessments @assessments ||= Assessment.for_patient(patient).ordered end |
#capd_regimes ⇒ Object
21 22 23 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 21 def capd_regimes @capd_regimes ||= CAPDRegime.for_patient(patient).with_bags.ordered end |
#current_regime ⇒ Object
17 18 19 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 17 def current_regime patient.pd_regimes.any? && patient.pd_regimes.current end |
#exit_site_infections ⇒ Object
36 37 38 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 36 def exit_site_infections @exit_site_infections ||= ExitSiteInfection.for_patient(patient).ordered end |
#latest_pd_line_change_events ⇒ Object
52 53 54 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 52 def latest_pd_line_change_events @latest_pd_line_change_events ||= Events::LineChangeEventQuery.new(patient).call(limit: 1) end |
#peritonitis_episodes ⇒ Object
29 30 31 32 33 34 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 29 def peritonitis_episodes @peritonitis_episodes ||= begin episodes = PeritonitisEpisode.for_patient(patient).ordered.includes(:episode_types) present(episodes, PeritonitisEpisodePresenter) end end |
#pet_adequacies ⇒ Object
40 41 42 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 40 def pet_adequacies @pet_adequacies ||= PETAdequacyResult.for_patient(patient).ordered end |
#training_sessions ⇒ Object
48 49 50 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 48 def training_sessions @training_sessions ||= TrainingSession.for_patient(patient).ordered end |