Class: Query
- Inherits:
-
Object
- Object
- Query
- Defined in:
- lib/ruby_astm/query.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#sample_id ⇒ Object
Returns the value of attribute sample_id.
Instance Method Summary collapse
-
#build_response(variables = nil) ⇒ Object
each query will build one patient and one order inside it.
-
#initialize(args) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(args) ⇒ Query
Returns a new instance of Query.
7 8 9 10 11 12 13 |
# File 'lib/ruby_astm/query.rb', line 7 def initialize(args) line = args[:line] unless line.fields[2].empty? fields = line.fields[2].split(/\^/) self.sample_id = fields[1].strip end end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/ruby_astm/query.rb', line 5 def response @response end |
#sample_id ⇒ Object
Returns the value of attribute sample_id.
3 4 5 |
# File 'lib/ruby_astm/query.rb', line 3 def sample_id @sample_id end |
Instance Method Details
#build_response(variables = nil) ⇒ Object
each query will build one patient and one order inside it. the order can have many tests.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ruby_astm/query.rb', line 17 def build_response(variables=nil) variables ||= { :sequence_number => "0", :patient_id => "abcde", :specimen_id => self.sample_id, :tests => ["TRIG"], :priority => "R" } patient = Patient.new({:sequence_number => "0", :patient_id => "abcde"}) order = Order.new({:sequence_number => patient.sequence_number, :specimen_id => variables[:specimen_id], :tests => variables[:tests], :priority => variables[:priority]}) return patient.build_response + order.build_response end |