Class: LabwareCreators::CommonFileHandling::CsvFileForTubeRack
- Inherits:
-
CommonFileHandling::CsvFileBase
- Object
- CommonFileHandling::CsvFileBase
- LabwareCreators::CommonFileHandling::CsvFileForTubeRack
- Defined in:
- app/models/labware_creators/common_file_handling/csv_file_for_tube_rack.rb
Overview
This is an abstract class for handling tube rack csv files.
Takes the user uploaded tube rack scan csv file, validates the content and extracts the information.
This version of the rack scan file contains 2 columns, the first is the tube location (coordinate within rack) and the second is the tube barcode.
Example of file content (NB. no header line): A1,FX05653780 A2,NO READ etc.
Direct Known Subclasses
Constant Summary collapse
- NO_TUBE_TEXTS =
['NO READ', 'NOSCAN', 'EMPTY', ''].freeze
- NO_DUPLICATE_RACK_POSITIONS_MSG =
'contains duplicate rack positions (%s)'
- NO_DUPLICATE_TUBE_BARCODES_MSG =
'contains duplicate tube barcodes (%s)'
Instance Method Summary collapse
-
#location_by_barcode_details ⇒ Hash
This hash is useful when we want to know the location of a tube barcode within the rack.
-
#position_details ⇒ Hash
Extracts tube details by rack location from the uploaded csv file.
Instance Method Details
#location_by_barcode_details ⇒ Hash
This hash is useful when we want to know the location of a tube barcode within the rack.
42 43 44 45 |
# File 'app/models/labware_creators/common_file_handling/csv_file_for_tube_rack.rb', line 42 def @location_by_barcode_details ||= position_details.each_with_object({}) { |(position, details), hash| hash[details['tube_barcode']] = position } end |
#position_details ⇒ Hash
Extracts tube details by rack location from the uploaded csv file. This hash is useful when we want the details for a rack location.
33 34 35 |
# File 'app/models/labware_creators/common_file_handling/csv_file_for_tube_rack.rb', line 33 def position_details @position_details ||= generate_position_details_hash end |