Module: V1::Shared::SourceIdentifierFilterable

Extended by:
ActiveSupport::Concern
Included in:
Ont::RequestResource, Pacbio::LibraryResource, Pacbio::RequestResource
Defined in:
app/resources/v1/shared/source_identifier_filterable.rb

Overview

SourceIdentifierFilterable

This module provides functionality for filtering records based on source identifiers. A source identifier can be a plate barcode, tube barcode, or a combination of plate barcode and well position. Models that include this module will have methods to filter records using these identifiers.

Methods:

  • apply_source_identifier_filter(records, value, joins: { plate: :plate, tube: :tube, well: :well })

  • Filters the given records based on the provided source identifiers.

  • Parameters:

    • records: The ActiveRecord relation to filter.

    • value: An array of source identifiers to filter by.

    • joins: A hash of join associations with default values.

    • plate: The association name for joining with the plate table (default: :plate).

    • tube: The association name for joining with the tube table (default: :tube).

    • well: The association name for joining with the well table (default: :well).

Example Usage:

class MyModel < ApplicationRecord include SourceIdentifierFilterable end

records = MyModel.all source_identifiers = [‘PLATE123’, ‘TUBE456’, ‘PLATE789:A1’] filtered_records = MyModel.apply_source_identifier_filter(records, source_identifiers)

# Custom join associations filtered_records = MyModel.apply_source_identifier_filter(records, source_identifiers, joins: { plate: :source_plate, tube: :source_tube, well: :source_well })