Class: RecordLoader::PipelineLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::PipelineLoader
- Defined in:
- lib/record_loader/pipeline_loader.rb
Overview
Creates the specified pipelines if they are not present. They require a list of request_type_keys to be present
Instance Method Summary collapse
- #add_loading_event(workflow) ⇒ Object
- #add_spiked_in_control_event(workflow) ⇒ Object
- #create_or_update!(name, options) ⇒ Object
- #workflow(options) ⇒ Object
Methods inherited from ApplicationRecordLoader
Instance Method Details
#add_loading_event(workflow) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/record_loader/pipeline_loader.rb', line 27 def add_loading_event(workflow) SetDescriptorsTask .create_with(name: 'Loading', sorted: 1, lab_activity: true, workflow: workflow) .find_or_create_by!(pipeline_workflow_id: workflow.pipeline_id) do |task| task.descriptors.build( [ { kind: 'Text', sorter: 4, name: 'Pre-Load Buffer lot #' }, { kind: 'Text', sorter: 5, name: 'Pre-Load Buffer RGT #' }, { kind: 'Text', sorter: 6, name: 'Pipette Carousel' }, { kind: 'Text', sorter: 7, name: 'PhiX lot #' }, { kind: 'Text', sorter: 8, name: 'PhiX %' }, { kind: 'Text', sorter: 9, name: 'Lane loading concentration (pM)' }, { kind: 'Text', sorter: 10, name: 'iPCR batch #' }, { kind: 'Text', sorter: 11, name: 'Comment' } ] ) end end |
#add_spiked_in_control_event(workflow) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/record_loader/pipeline_loader.rb', line 18 def add_spiked_in_control_event(workflow) AddSpikedInControlTask.create_with( name: 'Add Spiked in control', sorted: 0, lab_activity: true, workflow: workflow ).find_or_create_by!(pipeline_workflow_id: workflow.pipeline_id) end |
#create_or_update!(name, options) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/record_loader/pipeline_loader.rb', line 46 def create_or_update!(name, ) obj = .dup wf = workflow(obj) request_type_keys = obj.delete('request_type_keys') raise 'Request type keys not found' if request_type_keys.blank? request_types = RequestType.where(key: request_type_keys) Pipeline.create_with(obj.merge(workflow: wf, request_types: request_types)).find_or_create_by!(name:) return unless name == 'NovaSeqX PE' add_spiked_in_control_event(wf) add_loading_event(wf) end |
#workflow(options) ⇒ Object
13 14 15 16 |
# File 'lib/record_loader/pipeline_loader.rb', line 13 def workflow() raise 'Workflow not defined' unless ['workflow'] Workflow.create_with(['workflow']).find_or_create_by!(name: ['workflow']['name']) end |