Class: BioscanControlLocationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/bioscan_control_locations_controller.rb

Overview

Handles POST requests to /bioscan_control_locations. This action has been migrated from the Lighthouse /pickings endpoint. The robot uses POST requests to get the locations of the positive and negative controls on the plate with the given barcode.

Request JSON: { “barcode”: “plate_barcode”, “user”: “robot_user”, “robot”: “robot_name” }

Response JSON: { “barcode”: “plate_barcode”, “positive_control”: “well_description”, “negative_control”: “well_description” }

Error responses are returned as: { “errors”: [“error message”] }

The controller validates: - Plate existence - Plate purpose - Plate has samples - Exactly one positive and one negative control

If any validation fails, a JSON error response is returned. Error responses use the same format and HTTP 400 status codes as the original Lighthouse endpoint.

Constant Summary collapse

NO_PLATE_DATA =

Error messages

"There is no plate data for barcode '%<barcode>s'"
INCORRECT_PURPOSE =
"Incorrect purpose '%<purpose_name>s' for barcode '%<barcode>s'"
NO_SAMPLES =
"There are no samples for barcode '%<barcode>s'"
INCORRECT_CONTROLS =
'There should be only one positive and one negative control ' \
"for barcode '%<barcode>s'"
MISSING_CONTROLS =
"Missing positive or negative control for barcode '%<barcode>s'"
MISSING_PARAMS =
"POST request needs 'barcode', 'user' and 'robot' in body"
BIOSCAN_PLATE_PURPOSE =

Expected plate purpose

'LBSN-96 Lysate'
PCR_POSITIVE =

Control types

'pcr positive'
PCR_NEGATIVE =
'pcr negative'
ROBOT =

JSON keys

'robot'
USER =
'user'
BARCODE =

=> plate barcode

'barcode'
POSITIVE_CONTROL =

=> well description

'positive_control'
NEGATIVE_CONTROL =

=> well description

'negative_control'

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createvoid

This method returns an undefined value.

Handles post requests to /bioscan_control_locations to get the locations of the positive and negative controls on the plate with the given barcode.



70
71
72
# File 'app/controllers/bioscan_control_locations_controller.rb', line 70

def create
  control_locations
end