Class: Renalware::PD::DashboardPresenter
- Inherits:
-
Object
- Object
- Renalware::PD::DashboardPresenter
- Includes:
- PresenterHelper, Concerns::Pageable
- 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.
14 15 16 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 14 def initialize(patient) @patient = patient end |
Instance Attribute Details
#patient ⇒ Object
Returns the value of attribute patient.
12 13 14 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 12 def patient @patient end |
Instance Method Details
#apd_regimes ⇒ Object
26 27 28 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 26 def apd_regimes @apd_regimes ||= APDRegime.for_patient(patient).with_bags.ordered.page(1).per(5) end |
#assessments ⇒ Object
53 54 55 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 53 def assessments @assessments ||= Assessment.for_patient(patient).ordered end |
#capd_regimes ⇒ Object
22 23 24 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 22 def capd_regimes @capd_regimes ||= CAPDRegime.for_patient(patient).with_bags.ordered.page(1).per(5) end |
#current_regime ⇒ Object
18 19 20 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 18 def current_regime patient.pd_regimes.any? && patient.pd_regimes.current end |
#exit_site_infections ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 40 def exit_site_infections @exit_site_infections ||= begin ExitSiteInfection .for_patient(patient) .includes(infection_organisms: :organism_code) .ordered end end |
#latest_pd_line_change_events ⇒ Object
61 62 63 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 61 def latest_pd_line_change_events @latest_pd_line_change_events ||= Events::LineChangeEventQuery.new(patient).call(limit: 1) end |
#peritonitis_episodes ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 30 def peritonitis_episodes @peritonitis_episodes ||= begin episodes = PeritonitisEpisode .for_patient(patient) .ordered .includes(:episode_types, infection_organisms: :organism_code) present(episodes, PeritonitisEpisodePresenter) end end |
#pet_adequacies ⇒ Object
49 50 51 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 49 def pet_adequacies @pet_adequacies ||= PETAdequacyResult.for_patient(patient).ordered end |
#training_sessions ⇒ Object
57 58 59 |
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 57 def training_sessions @training_sessions ||= TrainingSession.for_patient(patient).ordered end |