Skip to main content
Version: Next

Filters

Version: v3.0.0 Status: Normative (text), Illustrative (diagrams only) Scope: Constraining displayed data using filter criteria Domain: FILTERS


Statement

The system shall allow users to constrain displayed data using filter criteria that limit records to those matching specified conditions.

Filtering provides reusable functionality across multiple screens and data views. Users can combine multiple filter criteria (AND logic), use different filter types (text, date, categorical), and toggle filter visibility without losing their selections. Available filter values update dynamically based on current selections in other filters.


Behavior Overview (Illustrative)

This diagram illustrates the high-level behavior. It does not specify UI layout, styling, or interaction details.


Definitions

TermDefinition
Filter CriteriaA constraint applied to a dataset that limits displayed records to those matching specified conditions
Filter StateThe current configuration of all active filter selections
Dynamic RefinementAutomatic update of available filter values based on selections in other filters
Exact MatchFilter mode requiring complete equality between filter value and data value
Prefix MatchFilter mode matching data values that begin with the filter value

Functional Requirements

Data Filtering (REQ-FILTERS-001)

FR-FILTERS-001 Filter Data by Criteria

The system shall allow users to constrain displayed data using filter criteria.

Acceptance Criteria:

Core Filtering:

  • Filter criteria shall constrain the dataset deterministically
  • Multiple filter criteria may be combined (AND logic)
  • Clearing all criteria shall restore the unfiltered dataset
  • When no data matches the applied criteria, the system shall indicate an empty result set

Filter Types:

  • Supported filter types shall include text, date, and categorical (dropdown)
  • Text matching modes shall include exact match (full equality) and prefix match (starts-with)
  • Date selection shall support single date or contiguous date range
  • Categorical selection shall support multi-select from available values

Filter Behavior:

  • Text filter criteria shall be applied as user input changes (real-time filtering)
  • Date and categorical filter criteria shall be applied upon user confirmation
  • Available filter values shall update based on current selections in other filters (dynamic refinement)

Filter State Management:

  • Filter state shall be preserved when toggling filter visibility
  • Filter section visibility shall be toggleable without clearing active filters
  • Bulk clear operation shall be available to reset all filters simultaneously

Convenience Operations:

  • Date navigation shall be limited to periods containing data values
  • Categorical filter values shall support "select all" and "clear all" operations

Error Handling:

  • Filter operation timeout: The system shall display "Filter operation timed out. Please refine your criteria."
  • Invalid date range (end before start): The system shall prevent selection of invalid date ranges

Trace: Source: 3.0.0-Filters (Rows 1-31) | Jira: BT-2415 | Tests: BT-2720


Configuration Options

OptionDefaultDescriptionAffects
default_filter_visibilityper-screenDefault visibility state for filter sectionREQ-FILTERS-001
default_text_match_modeprefixDefault matching mode for text filters (exact or prefix)REQ-FILTERS-001
dynamic_refinement_enabledtrueWhether filters auto-refine based on other selectionsREQ-FILTERS-001
filter_apply_debounce_ms300Debounce delay for text filter inputREQ-FILTERS-001

Assumptions

  • Users accessing filter functionality have appropriate role permissions for the underlying data
  • Data columns designated as filterable are identified in screen configurations
  • Filter criteria are applied server-side for large datasets
  • Network connectivity is available for filter operations

UI Notes (Illustrative)

FR-FILTERS-001 UI Specifications

Text Filter Layout:

  • Text input field with immediate filtering behavior
  • Clear icon within field to remove entered text

Date Filter Layout:

  • Calendar picker displaying one month at a time
  • Year selector dropdown in header
  • Month navigation controls (forward/backward)
  • Days with data values displayed in normal font
  • Days without data values displayed in greyed style
  • Today's date circled regardless of data availability
  • Selected date/range displayed below filter name
  • Apply button to confirm selection
  • Clear dates button to remove selection
  • Reference implementation: vcalendar.io

Dropdown Filter Layout:

  • List of available values with checkboxes
  • Select all button
  • Clear filter button
  • Apply button to confirm selection
  • Selected values shown as comma-separated list below filter name
  • Long selection lists truncated with ellipsis ("...")

Filter Section Layout:

  • Show/Hide toggle control
  • Reset filters button for bulk clear
  • Unavailable filters display no-entry symbol on hover

Visual States:

  • Active filter: filter name with selected value(s) displayed
  • Empty result: column headers with "no data found" message centered
  • Disabled filter: grayed appearance with no-entry symbol on hover

Screenshots

The following screenshots illustrate the design specifications:

  • Empty table state: No runs available
  • Date filter month view: Calendar
  • Today indicator: Today circled
  • Single date selection: Single date
  • Date range selection: Date range
  • Selection display: Selection below filter
  • Dropdown selection: Targets selected
  • Long list truncation: Ellipsis
  • Reset filters button: Reset

Implementation (Illustrative)

REQ-FILTERS-001: Filter Data by Criteria

ComponentTypeLocationPurpose
FilterableTraitcode/app/Filterable.phpEnables Eloquent models to apply filter criteria via scopeFilter()
BaseFiltersClasscode/app/Filters/BaseFilters.phpBase class providing request-to-query filter dispatch infrastructure
RunFiltersClasscode/app/Filters/RunFilters.phpRun-specific filter methods (dates, statuses, mixes, sites)
AuditFiltersClasscode/app/Filters/AuditFilters.phpAudit entry filter methods
ObservationFiltersClasscode/app/Filters/ObservationFilters.phpObservation filter methods
WellFiltersClasscode/app/Filters/WellFilters.phpWell filter methods
MixFiltersClasscode/app/Filters/MixFilters.phpMix filter methods
TargetFiltersClasscode/app/Filters/TargetFilters.phpTarget filter methods
ReportingFiltersClasscode/app/Filters/ReportingFilters.phpReporting-specific filter methods
ReportFiltersMixesControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersMixesController.phpDynamic refinement: mixes by site
ReportFiltersTargetsControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersTargetsController.phpDynamic refinement: targets by mix
ReportFiltersExtractionInstrumentsControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersExtractionInstrumentsController.phpDynamic refinement: extraction instruments
ReportFiltersRoleToMixMappingsControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersRoleToMixMappingsController.phpDynamic refinement: role-mix mappings
ReportFiltersRoleToTargetMappingsControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersRoleToTargetMappingsController.phpDynamic refinement: role-target mappings
ReportFiltersThermocyclersControllerControllercode/app/Http/Controllers/ReportFilters/ReportFiltersThermocyclersController.phpDynamic refinement: thermocyclers
ListRunsActionActioncode/app/Actions/Runs/ListRunsAction.phpCombines filtering with pagination

Architecture Notes

Filter Infrastructure Pattern:

  1. Models use Filterable trait to gain scopeFilter() method
  2. Domain-specific filter classes extend BaseFilters
  3. Filter classes define methods matching request parameter names
  4. BaseFilters::apply() iterates request params and calls matching methods
  5. Each method modifies the Eloquent query builder to add WHERE clauses

Dynamic Refinement (AC-05):

  • ReportFilters*Controller classes provide endpoints that return filter values
  • Filter values are constrained by current selections in other filters
  • Example: ReportFiltersTargetsController returns targets filtered by selected mix_ids

Frontend Note:

  • Filter UI components (text input, calendar picker, dropdown) are implemented in Vue.js
  • Real-time filtering, confirmation behavior, and visibility toggle are frontend concerns
  • Backend provides the data filtering infrastructure only

Frontend Components

Component TypeLocation
Viewsviews/Runs.vue, views/Audits.vue, views/LjReport.vue, views/TrendsReport.vue
Componentscomponents/RunFilters.vue, components/AuditFilters.vue, components/WellFilters.vue

Traceability Matrix

RequirementTitleVerificationImplementationTest CasesStatus
REQ-FILTERS-001Filter Data by CriteriaTestSee Implementation section (16+ components)BT-2720Draft

Notes

  • Filter behavior is consistent across all screens where filters are enabled
  • Individual screens may configure which filter types are available
  • Performance optimization for large datasets may require server-side filtering
  • Legacy filter state migration may be required for existing user preferences

Open Questions

IDQuestionOwnerDate RaisedStatusResolution
OQ-01Should filter state persist across user sessions?--ResolvedNo, filter state persists only within the same session
OQ-02What is the maximum number of concurrent filter criteria supported?--ResolvedAll visible and available filters on the given page may be used concurrently

Acceptance Tests

Test: REQ-FILTERS-001

Back to requirement

Test: Text filter applies criteria deterministically

Given: User is on a screen with text filter enabled
And: Data exists that matches the filter criteria
When: User enters text in the filter input
Then: The system shall display only records matching the criteria
And: The result set shall be consistent for the same criteria

Test: Empty result set indication

Given: User is on a screen with filter enabled
When: User applies filter criteria that matches no data
Then: The system shall indicate an empty result set
And: The filter criteria shall remain applied

Test: Multiple filters combine with AND logic

Given: User is on a screen with multiple filters
When: User applies criteria to filter A
And: User applies criteria to filter B
Then: The system shall display only records matching both criteria

Test: Clear all filters restores unfiltered dataset

Given: User has one or more filters applied
When: User clears all filter criteria
Then: The system shall display the complete unfiltered dataset

Test: Filter state preserved during visibility toggle

Given: User has filter criteria applied
When: User hides the filter section
Then: The applied filter criteria shall remain active
And: The filtered data shall continue to display
When: User shows the filter section
Then: The filter state shall reflect the previously applied criteria

Test: Dynamic refinement updates available values

Given: User is on a screen with multiple filters
And: Filter A has criteria applied
When: User opens filter B
Then: Filter B shall display only values compatible with filter A selection

Test: Text filter exact match mode

Given: User is on a screen with exact match text filter
And: Data contains values "ABC123" and "ABC456"
When: User enters "ABC123" in the filter
Then: The system shall display only the exact match "ABC123"
And: "ABC456" shall not be displayed

Test: Text filter prefix match mode

Given: User is on a screen with prefix match text filter
And: Data contains values "ABC123" and "ABC456"
When: User enters "ABC" in the filter
Then: The system shall display both "ABC123" and "ABC456"

Test: Date filter single date selection

Given: User is on a screen with date filter
When: User selects a single date
And: User confirms the selection
Then: The system shall display only records matching the selected date

Test: Date filter range selection

Given: User is on a screen with date filter
When: User selects a start date
And: User selects an end date
And: User confirms the selection
Then: The system shall display records within the date range (inclusive)

Test: Categorical filter multi-select

Given: User is on a screen with categorical filter
When: User selects multiple values
And: User confirms the selection
Then: The system shall display records matching any of the selected values (OR logic within filter)

Test: Date and categorical filters require confirmation

Given: User is on a screen with date or categorical filter
When: User makes a selection
Then: The filter shall not be applied until user confirms
When: User confirms the selection
Then: The filter criteria shall be applied to the dataset

Test: Text filters apply without confirmation

Given: User is on a screen with text filter
When: User enters text in the filter input
Then: The filter criteria shall be applied immediately
And: No explicit confirmation action shall be required

Design DocumentRelevant Sections
STD UI TestabilityHTML Attributes (filter attributes for automated testing)

Appendix: Process Artifacts

Completion Checklist

  • All requirements are capability-level (describe behavior, not UI)
  • Requirement variants consolidated (no requirement explosion)
  • UI details are fully demoted to Illustrative section
  • Configuration options are not encoded as requirements
  • Acceptance criteria describe behavior, not UI mechanics
  • Every requirement has acceptance criteria and source traceability
  • Error handling addressed for I/O, validation, and external system requirements
  • Open questions documented with owners assigned
  • Consolidations documented in Reviewer Notes with reversibility info
  • Module can survive a full UI redesign unchanged
  • Refinements do not introduce new capabilities
  • Traceability matrix is complete

Reviewer Notes

Consolidation: REQ-FILTERS-001

The following items from the source were consolidated into a single capability-level requirement:

Original ItemSource ReferenceDisposition
REQ-FILTERS-001 (Exact match text filter)3.0.0-Filters Rows 1-4Merged into REQ-FILTERS-001 Statement; exact match demoted to AC
REQ-FILTERS-002 (Partial match text filter)3.0.0-Filters Rows 5-7Merged into REQ-FILTERS-001 Statement; prefix match demoted to AC
REQ-FILTERS-003 (Date filter with calendar)3.0.0-Filters Rows 8-19Merged into REQ-FILTERS-001 Statement; date selection demoted to AC; calendar UI moved to UI Notes
REQ-FILTERS-004 (Dropdown multi-select filter)3.0.0-Filters Rows 20-24Merged into REQ-FILTERS-001 Statement; categorical selection demoted to AC; dropdown UI moved to UI Notes
REQ-FILTERS-005 (Dynamic refinement)3.0.0-Filters Row 25Merged into AC
REQ-FILTERS-006 (Reset all filters)3.0.0-Filters Row 26Merged into AC (bulk clear operation)
REQ-FILTERS-007 (Show/hide filter section)3.0.0-Filters Rows 27-31Merged into AC (visibility toggle); disabled indicator moved to UI Notes

Rationale:

These seven items represented variants of a single filtering capability, not separate system responsibilities. The core capability is "constrain displayed data using filter criteria" - the specific filter types (text, date, dropdown), matching modes (exact, prefix), and interaction conveniences (reset, show/hide) are implementation variants, not distinct capabilities.

Consolidation aligns with Phase 0 guidance on avoiding requirement explosion for UI mechanics and ensures the requirement specification remains stable under UI redesign.

AC Transformations Applied:

Original (UI-centric)Transformed (Behavior-centric)
"Click Apply button""User confirms selection"
"Dropdown is hidden"Removed - UI mechanic
"Calendar shows one month"Moved to UI Notes
"Table is cleared and system searches""Filter criteria shall constrain the dataset deterministically"
"No data found message displayed""System shall indicate an empty result set"
"Click Reset filters button""Clearing all criteria shall restore the unfiltered dataset"
"Show/Hide filters toggles visibility""Filter state shall be preserved when toggling filter visibility"

Reversibility:

To restore original structure, reference:

  • Source: /home/aron/code/req_docs/output/pilot/restructured/filters.md
  • Design: /home/aron/code/req_docs/output/pilot/restructured/sdd/filters-design.md
  • Confluence: 3.0.0-Filters (Rows 1-31)