Class: Robots::SplittingRobot

Inherits:
Robot
  • Object
show all
Defined in:
app/models/robots/splitting_robot.rb

Overview

A splitting robot takes one parent labware, and transfers it to multiple children Child labwares are numbered based on the order in which they first appear when transfers are sorted in column order.

Direct Known Subclasses

PlateToTubeRacksRobot

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#relationships=(value) ⇒ Object (writeonly)

Sets the attribute relationships

Parameters:

  • value

    the value to set the attribute relationships to.



8
9
10
# File 'app/models/robots/splitting_robot.rb', line 8

def relationships=(value)
  @relationships = value
end

Instance Method Details

#bed_classObject



38
39
40
# File 'app/models/robots/splitting_robot.rb', line 38

def bed_class
  Robots::Bed::Splitting
end

#valid_relationshipsHash<String => Boolean>

Returns a hash of bed barcodes and their valid state Also adds any errors describing invalid bed states

Returns:

  • (Hash<String => Boolean>)

    Hash of boolean indexed by bed barcode

Raises:

  • (StandardError)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/robots/splitting_robot.rb', line 19

def valid_relationships # rubocop:todo Metrics/AbcSize
  raise StandardError, "Relationships for #{name} are empty" if @relationships.empty?

  @relationships.each_with_object({}) do |relationship, validations|
    parent_bed = relationship.dig('options', 'parent')
    child_beds = relationship.dig('options', 'children')

    validations[parent_bed] = beds[parent_bed].child_labware.present?
    error(beds[parent_bed], 'should not be empty.') if beds[parent_bed].empty?
    error(beds[parent_bed], 'should have children.') if beds[parent_bed].child_labware.empty?

    expected_children = beds[parent_bed].child_labware
    expected_children.each_with_index do |expected_child, index|
      child_bed = child_beds[index]
      validations[child_bed] = check_labware_identity([expected_child], child_bed)
    end
  end
end

#well_orderObject



10
11
12
# File 'app/models/robots/splitting_robot.rb', line 10

def well_order
  :quadrant_index
end