Class: AQI::Outcome

Inherits:
Object
  • Object
show all
Defined in:
lib/aqi/outcome.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Outcome

Returns a new instance of Outcome.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/aqi/outcome.rb', line 5

def initialize(options)
  self.time_date          = options.delete(:time_date)
  self.time_frame         = options.delete(:time_frame)
  self.severity_code      = options.delete(:severity_code)
  self.category_code      = options.delete(:category_code)
  self.sub_category_code  = options.delete(:sub_category_code)
  self.location_type_code = options.delete(:location_type_code)
  self.name               = options.delete(:name)
  self.description        = options.delete(:description)
  self.value              = options.delete(:value)
  self.range_min          = options.delete(:range_min)
  self.range_max          = options.delete(:range_max)
  self.notes              = options.delete(:notes)
end

Instance Attribute Details

#category_codeObject

Returns the value of attribute category_code.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def category_code
  @category_code
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def description
  @description
end

#location_type_codeObject

Returns the value of attribute location_type_code.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def location_type_code
  @location_type_code
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def name
  @name
end

#notesObject

Returns the value of attribute notes.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def notes
  @notes
end

#range_maxObject

Returns the value of attribute range_max.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def range_max
  @range_max
end

#range_minObject

Returns the value of attribute range_min.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def range_min
  @range_min
end

#severity_codeObject

Returns the value of attribute severity_code.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def severity_code
  @severity_code
end

#sub_category_codeObject

Returns the value of attribute sub_category_code.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def sub_category_code
  @sub_category_code
end

#time_dateObject

Returns the value of attribute time_date.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def time_date
  @time_date
end

#time_frameObject

Returns the value of attribute time_frame.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def time_frame
  @time_frame
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/aqi/outcome.rb', line 3

def value
  @value
end

Class Method Details

.categoriesObject



28
29
30
# File 'lib/aqi/outcome.rb', line 28

def self.categories
  ["PatientSurvey", "Outcome", "OTHER", "UNKNOWN"]
end

.location_codesObject



36
37
38
# File 'lib/aqi/outcome.rb', line 36

def self.location_codes
  ["In-Patient", "Post In-Patient", "Out-Patient", "Post Out-Patient", "Obstetrics", "Surgery Center", "Surgery Center Post Out-Patient", "Office", "Home", "Ambulatory Surgical Center", "Pharmacy", "Skilled Nursing Facility", "Ambulance - Land", "Emergency Room Hospital", "Urgent Care Facility", "Inpatient Psychiatric Facility", "School", "Custodial Care Facility", "Residential Substance Abuse Treatment Facility", "Military Treatment Facility", "OTHER", "UNKNOWN"]
end

.severitiesObject



24
25
26
# File 'lib/aqi/outcome.rb', line 24

def self.severities
  ["NoEffect", "PotentialHazard", "LossOfTime", "LossOfMoney", "HarmToPatient", "SevereHarmToPatient", "PermanentDisability", "Death"]
end

.sub_categoriesObject



32
33
34
# File 'lib/aqi/outcome.rb', line 32

def self.sub_categories
  ["MEDICAL DEVICE/EQUIPMENT", "MEDICATION", "INFRASTRUCTURE/SYSTEM", "ASSESSMENT/DOCUMENTATION", "RESPIRATORY/AIRWAY", "CARDIOVASCULAR", "PROCEDURE RELATED", "OTHER", "UNKNOWN"]
end

.time_framesObject



20
21
22
# File 'lib/aqi/outcome.rb', line 20

def self.time_frames
  ["PreOp", "IntraOp", "PACU", "24h", "48h", "Week", "Month"]
end

Instance Method Details

#to_xmlObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/aqi/outcome.rb', line 40

def to_xml
  builder = Builder::XmlMarkup.new
  builder.Outcome do |o|
    o.OutcomeTimeDate(time_date.strftime('%FT%T'))                 if time_date
    o.OutcomeTimeFrame(validate_time_frames(time_frame))           if time_frame
    o.OutcomeSeverity(validate_severity(severity_code))            if severity_code
    o.OutcomeCategory(validate_category(category_code))            if category_code
    o.OutcomeSubcategory(validate_sub_category(sub_category_code)) if sub_category_code
    o.OutcomeLocation(validate_location_code(location_type_code))  if location_type_code
    o.OutcomeName(name)                                            if name
    o.OutcomeDesciption(description)                               if description
    o.OutcomeValue(value)                                          if value
    o.OutcomeRangeMin(range_min)                                   if range_min
    o.OutcomeRangeMax(range_max)                                   if range_max
    o.OutcomeNotes(notes)                                          if notes
  end
end