Class: Hl7Observation

Inherits:
Result
  • Object
show all
Defined in:
lib/ruby_astm/HL7/hl7_observation.rb

Instance Attribute Summary

Attributes inherited from Result

#dilution, #flags, #machine_name, #name, #reference_ranges, #report_name, #timestamp, #units, #value

Instance Method Summary collapse

Methods inherited from Result

#initialize, #lookup_mapping, #lookup_report_name, #lookup_transform, #set_machine_name

Constructor Details

This class inherits a constructor from Result

Instance Method Details

#set_dilution(args) ⇒ Object



46
47
48
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 46

def set_dilution(args)
	
end

#set_flags(args) ⇒ Object



20
21
22
23
24
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 20

def set_flags(args)
	if line = args[:line]
		self.flags = line.fields[8].strip unless line.fields[8].blank?
	end 
end

#set_name(args) ⇒ Object

first we start with the name.



4
5
6
7
8
9
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 4

def set_name(args)
	if line = args[:line]
		self.name = lookup_mapping(line.fields[3].strip)
		self.report_name = lookup_report_name(line.fields[3].strip)
	end
end

#set_reference_ranges(args) ⇒ Object



40
41
42
43
44
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 40

def set_reference_ranges(args)
	if line = args[:line]
		self.reference_ranges = line.fields[7].strip unless line.fields[7].blank?
	end
end

#set_timestamp(args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 32

def set_timestamp(args)
	if line = args[:line]
		line.fields[19].strip.scan(/(?<year>\d{4})(?<month>\d{2})(?<day>\d{2})(?<hours>\d{2})(?<minutes>\d{2})(?<seconds>\d{2})/) {|year,month,day,hours,minutes,seconds|
			self.timestamp = Time.new(year,month,day,hours,minutes,seconds)
		}
	end
end

#set_units(args) ⇒ Object



26
27
28
29
30
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 26

def set_units(args)
	if line = args[:line]
		self.units = line.fields[6].strip unless line.fields[6].blank?
	end
end

#set_value(args) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/ruby_astm/HL7/hl7_observation.rb', line 11

def set_value(args)
	if line = args[:line]
		self.value = line.fields[5].strip
		if transform_expression = lookup_transform(line.fields[5].strip)
			self.value = eval(transform_expression)
		end
	end
end