Class: TransferRequest
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- TransferRequest
- Extended by:
- Request::Statemachine::ClassMethods
- Includes:
- AASM, AASM::Extensions, Uuid::Uuidable
- Defined in:
- app/models/transfer_request.rb
Overview
The setting of submission_id and outer_request is quite complicated, and depends
Every request "moving" an asset from somewhere to somewhere else without really transforming it (chemically) as, cherrypicking, pooling, spreading on the floor etc
on the exact route by which the transfer request has been created. The preferred route is by setting outer_request explicitly. However much of the historic code handles it via submission_id, either set explicitly, (eg Transfer::BetweenPlates#calculate_location_submissions) or extracted from the pool_id attribute on well, which itself is populated as part of an sql query. (See #with_pool_id on the well association in Plate)
Constant Summary collapse
- ACTIVE_STATES =
States which are still considered to be processable (ie. not failed or cancelled)
%w[pending started passed qc_complete].freeze
Instance Attribute Summary collapse
-
#aliquot_attributes ⇒ Object
writeonly
Sets the attribute aliquot_attributes.
-
#keep_this_aliquot_when_deduplicating ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers.
-
#list_of_aliquot_attributes_to_consider_a_duplicate ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers.
-
#merge_equivalent_aliquots ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers.
Instance Method Summary collapse
- #outer_request ⇒ Object
-
#outer_request=(request) ⇒ Object
Set the outer request associated with this transfer request the outer request is the Request which is currently being processed, such as a LibraryCreationRequest.
- #outer_request_candidates_length ⇒ Object
-
#outer_request_id=(request_id) ⇒ Object
Sets the #outer_request from just a request_id.
-
#sibling_requests ⇒ Object
A sibling request is a customer request out of the same asset and in the same submission.
-
#source_and_target_assets_are_different ⇒ Object
validation method.
Methods included from AASM::Extensions
Methods included from Uuid::Uuidable
included, #unsaved_uuid!, #uuid
Methods inherited from ApplicationRecord
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Instance Attribute Details
#aliquot_attributes=(value) ⇒ Object
Sets the attribute aliquot_attributes
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/transfer_request.rb', line 27 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 |
#keep_this_aliquot_when_deduplicating ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers. list_of_aliquot_attributes_to_consider_a_duplicate is optional, and is used to determine which aliquots are equivalent for custom use cases. keep_this_aliquot_when_deduplicating is optional, and is used to determine which aliquot to keep from the duplicates in custom cases.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/transfer_request.rb', line 24 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 |
#list_of_aliquot_attributes_to_consider_a_duplicate ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers. list_of_aliquot_attributes_to_consider_a_duplicate is optional, and is used to determine which aliquots are equivalent for custom use cases. keep_this_aliquot_when_deduplicating is optional, and is used to determine which aliquot to keep from the duplicates in custom cases.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/transfer_request.rb', line 24 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 |
#merge_equivalent_aliquots ⇒ Object
merge_equivalent_aliquots determines if we attempt to filter out equivalent aliquots before performing transfers. list_of_aliquot_attributes_to_consider_a_duplicate is optional, and is used to determine which aliquots are equivalent for custom use cases. keep_this_aliquot_when_deduplicating is optional, and is used to determine which aliquot to keep from the duplicates in custom cases.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/transfer_request.rb', line 24 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 |
Instance Method Details
#outer_request ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'app/models/transfer_request.rb', line 168 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 |
#outer_request=(request) ⇒ Object
This is particularly important when transferring out of the initial
Set the outer request associated with this transfer request the outer request is the Request which is currently being processed, such as a LibraryCreationRequest. Setting this ensures that the transferred Aliquots are associated with the correct request, and that submission_id on transfer request is recorded correctly. Receptacle when there may be multiple active Receptacle#requests_as_source
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'app/models/transfer_request.rb', line 157 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 |
#outer_request_candidates_length ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'app/models/transfer_request.rb', line 183 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 |
#outer_request_id=(request_id) ⇒ Object
Sets the #outer_request from just a request_id
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'app/models/transfer_request.rb', line 164 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 |
#sibling_requests ⇒ Object
A sibling request is a customer request out of the same asset and in the same submission
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'app/models/transfer_request.rb', line 173 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 |
#source_and_target_assets_are_different ⇒ Object
validation method
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'app/models/transfer_request.rb', line 141 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 |