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

Instance Method Details

#commentsArray<UnderRepWellComment>

Entry point used by CommentIO to retrieve the comments to serialize.

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 68

 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

#request_with_under_represented_wellsArray<Request>

Returns all requests related to the batch that include a poly_metadatum entry with the UNDER_REPRESENTED key.

Returns:

  • (Array<Request>)

    an array of requests that contain under-represented metadata.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 46

 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

#under_represented_well_commentsArray<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.

Returns:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 59

 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