Class: BroadcastEvent::PlateCherrypicked

Inherits:
BroadcastEvent show all
Includes:
Helpers::ExternalSubjects
Defined in:
app/models/broadcast_event/plate_cherrypicked.rb

Overview

Declares the event of a destination plate created from a list of source plates. It requires the following subjects: - Robot - the robot that acted in the cherrypicking process (Beckman) - Samples - all samples that were cherrypicked to build this plate - Source Plates - all source plates that were the source of the cherrypicking - Destination plate NOT REQUIRED- the plate that has been cherrypicked into If any of these subjects is missing the instance will be considered invalid The destination plate subject, if not specified, will be generated from the seed as the seed is considered the destination plate.

Constant Summary collapse

EVENT_TYPE =
'lh_beckman_cp_destination_created'
ROBOT_ROLE_TYPE =
'robot'
SOURCE_PLATES_ROLE_TYPE =
'cherrypicking_source_labware'
SAMPLE_ROLE_TYPE =
'sample'
DESTINATION_PLATE_ROLE_TYPE =
'cherrypicking_destination_labware'

Constants inherited from BroadcastEvent

EVENT_JSON_ROOT, UNKNOWN_USER_IDENTIFIER

Instance Method Summary collapse

Methods included from Helpers::ExternalSubjects

#build_subjects, #check_subject_role_type, #subjects, #subjects_with_role_type, #subjects_with_role_type?

Methods inherited from BroadcastEvent

#event_type, #json_root, #metadata, #routing_key, set_event_type, #subjects

Methods included from SubjectHelpers::SubjectableClassMethods

#has_subject, #has_subjects, #seed_class, #seed_subject, #subject_associations

Methods included from MetadataHelpers::MetadatableClassMethods

#has_metadata, #metadata_finders

Methods included from RenderHelpers::RenderableClassMethods

#render_class

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

extended

Constructor Details

#initialize(args) ⇒ PlateCherrypicked

It adds the destination plate subject from the plate seed if the destination plate subject has not been provided on initialization



32
33
34
35
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 32

def initialize(args)
  super(args)
  _add_destination_plate
end

Instance Method Details

#default_destination_plate_subjectObject

Default destination plate subject definition using the seeding plate. It won’t be used if another subject is provided on initialization



60
61
62
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 60

def default_destination_plate_subject
  BroadcastEvent::SubjectHelpers::Subject.new(DESTINATION_PLATE_ROLE_TYPE, seed).as_json
end

#destination_presentObject



54
55
56
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 54

def destination_present
  check_subject_role_type(:destination_plate, DESTINATION_PLATE_ROLE_TYPE)
end

#robot_presentObject



42
43
44
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 42

def robot_present
  check_subject_role_type(:robot, ROBOT_ROLE_TYPE)
end

#samples_presentObject



50
51
52
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 50

def samples_present
  check_subject_role_type(:samples, SAMPLE_ROLE_TYPE)
end

#source_plates_presentObject



46
47
48
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 46

def source_plates_present
  check_subject_role_type(:source_plates, SOURCE_PLATES_ROLE_TYPE)
end

#user_identifierObject



37
38
39
40
# File 'app/models/broadcast_event/plate_cherrypicked.rb', line 37

def user_identifier
  # allows for user identifiers that aren't in the SS db
  properties[:user_identifier].presence || super
end