Class: BioscanControlLocationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- BioscanControlLocationsController
- 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
-
#create ⇒ void
Handles post requests to /bioscan_control_locations to get the locations of the positive and negative controls on the plate with the given barcode.
Methods inherited from ApplicationController
#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!
Methods included from AuthenticatedSystem
Methods included from FlashTruncation
#max_flash_size, #truncate_flash, #truncate_flash_array
Instance Method Details
#create ⇒ void
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/bioscan_control_locations_controller.rb', line 70 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |