Class: Renalware::PD::DashboardPresenter

Inherits:
Object
  • Object
show all
Includes:
PresenterHelper
Defined in:
app/presenters/renalware/pd/dashboard_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PresenterHelper

#present

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

#patientObject

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_regimesObject



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

#assessmentsObject



44
45
46
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 44

def assessments
  @assessments ||= Assessment.for_patient(patient).ordered
end

#capd_regimesObject



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_regimeObject



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_infectionsObject



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_eventsObject



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_episodesObject



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_adequaciesObject



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_sessionsObject



48
49
50
# File 'app/presenters/renalware/pd/dashboard_presenter.rb', line 48

def training_sessions
  @training_sessions ||= TrainingSession.for_patient(patient).ordered
end