Class: AQI::Procedure
- Inherits:
-
Object
- Object
- AQI::Procedure
- Defined in:
- lib/aqi/procedure.rb
Instance Attribute Summary collapse
-
#admission_date ⇒ Object
Returns the value of attribute admission_date.
-
#admission_status ⇒ Object
Returns the value of attribute admission_status.
-
#cpt_set ⇒ Object
Returns the value of attribute cpt_set.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#facility_id ⇒ Object
Returns the value of attribute facility_id.
-
#location ⇒ Object
Returns the value of attribute location.
-
#location_details ⇒ Object
Returns the value of attribute location_details.
-
#location_type ⇒ Object
Returns the value of attribute location_type.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#procedure_id ⇒ Object
Returns the value of attribute procedure_id.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#status ⇒ Object
Returns the value of attribute status.
-
#transfer_status ⇒ Object
Returns the value of attribute transfer_status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Procedure
constructor
A new instance of Procedure.
- #to_xml ⇒ Object
- #validate_admission_status(value) ⇒ Object
- #validate_status(value) ⇒ Object
- #validate_transfer_status(value) ⇒ Object
Constructor Details
#initialize(options) ⇒ Procedure
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aqi/procedure.rb', line 21 def initialize() self.procedure_id = [:procedure_id] self.facility_id = [:facility_id] self.start_time = [:start_time] self.end_time = [:end_time] self.admission_status = validate_admission_status([:admission_status]) self.status = validate_status([:status]) self.transfer_status = validate_transfer_status([:transfer_status]) self.admission_date = [:admission_date] self.notes = [:notes] self.cpt_set = [:cpt_set] || [] self.location = [:location] || ProcedureLocation.new(type: [:location_type], details: [:location_details]) end |
Instance Attribute Details
#admission_date ⇒ Object
Returns the value of attribute admission_date.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def admission_date @admission_date end |
#admission_status ⇒ Object
Returns the value of attribute admission_status.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def admission_status @admission_status end |
#cpt_set ⇒ Object
Returns the value of attribute cpt_set.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def cpt_set @cpt_set end |
#end_time ⇒ Object
Returns the value of attribute end_time.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def end_time @end_time end |
#facility_id ⇒ Object
Returns the value of attribute facility_id.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def facility_id @facility_id end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def location @location end |
#location_details ⇒ Object
Returns the value of attribute location_details.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def location_details @location_details end |
#location_type ⇒ Object
Returns the value of attribute location_type.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def location_type @location_type end |
#notes ⇒ Object
Returns the value of attribute notes.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def notes @notes end |
#procedure_id ⇒ Object
Returns the value of attribute procedure_id.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def procedure_id @procedure_id end |
#start_time ⇒ Object
Returns the value of attribute start_time.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def start_time @start_time end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def status @status end |
#transfer_status ⇒ Object
Returns the value of attribute transfer_status.
3 4 5 |
# File 'lib/aqi/procedure.rb', line 3 def transfer_status @transfer_status end |
Class Method Details
.admission_statuses ⇒ Object
7 8 9 |
# File 'lib/aqi/procedure.rb', line 7 def self.admission_statuses %w{Emergency Inpatient Outpatient Urgent OTHER UNKNOWN} end |
.statuses ⇒ Object
11 12 13 |
# File 'lib/aqi/procedure.rb', line 11 def self.statuses %w{Emergent Urgent Elective OTHER UNKNOWN} end |
.transfer_statuses ⇒ Object
15 16 17 18 19 |
# File 'lib/aqi/procedure.rb', line 15 def self.transfer_statuses ["Floor bed", "Observation unit", "Telemetry/step-down unit", "Home with services", "Died", "Operating Room", "Intensive Care Unit", "Home without services", "Left against medical advice", "Transferred to another hospital", "OTHER", "UNKNOWN"] end |
Instance Method Details
#to_xml ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/aqi/procedure.rb', line 49 def to_xml builder = Builder::XmlMarkup.new builder.Procedure do |p| p.ProcedureID(procedure_id) p.FacilityID(facility_id) p << location.to_xml p.ProcStartTime(start_time.strftime('%FT%T')) if start_time p.ProcEndTime(end_time.strftime('%FT%T')) if end_time p.AdmissionStatus(admission_status) p.ProcStatus(status) p.TransferStatus(transfer_status) p.AdmissionDate(admission_date.strftime('%FT%T')) if admission_date p.ProcedureNotes(notes) if notes p.CPTSet do |c| cpt_set.each do |cpt| c << cpt.to_xml end end end end |
#validate_admission_status(value) ⇒ Object
37 38 39 |
# File 'lib/aqi/procedure.rb', line 37 def validate_admission_status(value) self.class.admission_statuses.include?(value) ? value : 'UNKNOWN' end |
#validate_status(value) ⇒ Object
41 42 43 |
# File 'lib/aqi/procedure.rb', line 41 def validate_status(value) self.class.statuses.include?(value) ? value : 'UNKNOWN' end |
#validate_transfer_status(value) ⇒ Object
45 46 47 |
# File 'lib/aqi/procedure.rb', line 45 def validate_transfer_status(value) self.class.transfer_statuses.include?(value) ? value : 'UNKNOWN' end |