Class: BB::GenerateReportRequestForm

Inherits:
Common::Form show all
Includes:
SentryLogging
Defined in:
lib/bb/generate_report_request_form.rb

Constant Summary collapse

ELIGIBLE_DATA_CLASSES =
%w[ seiactivityjournal seiallergies seidemographics
familyhealthhistory seifoodjournal healthcareproviders healthinsurance
seiimmunizations labsandtests medicalevents militaryhealthhistory
seimygoalscurrent seimygoalscompleted treatmentfacilities
vitalsandreadings prescriptions medications vaallergies
vaadmissionsanddischarges futureappointments pastappointments
vademographics vaekg vaimmunizations vachemlabs vaprogressnotes
vapathology vaproblemlist varadiology vahth wellness dodmilitaryservice ].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Constructor Details

#initialize(client, attributes = {}) ⇒ GenerateReportRequestForm

Returns a new instance of GenerateReportRequestForm.



36
37
38
39
# File 'lib/bb/generate_report_request_form.rb', line 36

def initialize(client, attributes = {})
  super(attributes)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



22
23
24
# File 'lib/bb/generate_report_request_form.rb', line 22

def client
  @client
end

Instance Method Details

#eligible_data_classesObject (private)



49
50
51
# File 'lib/bb/generate_report_request_form.rb', line 49

def eligible_data_classes
  @eligible_data_classes ||= client.get_eligible_data_classes.members.map(&:name)
end

#overridden_data_classesObject

TODO: eventually this should be reenabled, TODO: See: github.com/department-of-veterans-affairs/vets.gov-team/issues/3777 validate :data_classes_belongs_to_eligible_data_classes



32
33
34
# File 'lib/bb/generate_report_request_form.rb', line 32

def overridden_data_classes
  eligible_data_classes & data_classes
end

#paramsObject

TODO: change this back to data_classes when hack can be properly removed. TODO: See: github.com/department-of-veterans-affairs/vets.gov-team/issues/3777



43
44
45
# File 'lib/bb/generate_report_request_form.rb', line 43

def params
  { from_date: from_date.try(:httpdate), to_date: to_date.try(:httpdate), data_classes: overridden_data_classes }
end