Module: UnderRepWellCommentsToBroadcast
- Included in:
- Batch
- Defined in:
- app/models/under_rep_well_comments_to_broadcast.rb
Overview
This module encapsulates logic for identifying and generating comment data related to “under-represented” wells within a released batch. Works for pipelines where all requests (library prep, multiplexing, sequencing) share a single submission (e.g., WGS). Other pipelines may differ, as they can involve multiple submissions at different stages. Left as-is for this WGS proof of concept; future extensions may require refactoring.
It: - Extracts requests containing “under_represented” metadata. - Builds structured UnderRepWellComment objects that represent per-well comments to be serialized or broadcasted. - Provides a comments method used by CommentIO for serialization.
Defined Under Namespace
Classes: UnderRepWellComment
Constant Summary collapse
- UNDER_REPRESENTED_KEY =
'under_represented'
Instance Method Summary collapse
-
#comments ⇒ Array<UnderRepWellComment>
Entry point used by CommentIO to retrieve the comments to serialize.
-
#request_with_under_represented_wells ⇒ Array<Request>
Returns all requests related to the batch that include a poly_metadatum entry with the
UNDER_REPRESENTEDkey. -
#under_represented_well_comments ⇒ Array<UnderRepWellComment>
Builds all
UnderRepWellCommentobjects for requests within the batch that have under-represented wells.
Instance Method Details
#comments ⇒ Array<UnderRepWellComment>
Entry point used by CommentIO to retrieve the comments to serialize.
68 69 70 |
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 68 def comments under_represented_well_comments || [] end |
#request_with_under_represented_wells ⇒ Array<Request>
Returns all requests related to the batch that include a poly_metadatum entry with the UNDER_REPRESENTED key.
46 47 48 49 50 |
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 46 def request_with_under_represented_wells submissions.flat_map(&:requests).select do |r| r..any? { |pol| pol.key == UNDER_REPRESENTED_KEY } end end |
#under_represented_well_comments ⇒ Array<UnderRepWellComment>
Builds all UnderRepWellComment objects for requests within the batch that have under-represented wells. The resulting list aggregates comments across multiple requests and associated assets.
59 60 61 62 63 |
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 59 def under_represented_well_comments request_with_under_represented_wells.flat_map do |request| build_comments_for_request(request) end.compact end |