Skip to main content
Version: 3.0.0

Repeat Sample Check Rule (WREP)

Version: v3.0.0 Status: Normative (text), Illustrative (diagrams only) Scope: Validates classification and quantitative consistency between repeat samples of the same mix Domain: RULES-REPEATSAMP Precedence: N/A (standalone validation rule)


Statement

The system shall execute the WREP rule to validate repeat sample consistency by verifying classification agreement and quantitative similarity between the current sample and previously tested samples for the same sample/mix combination.

When a sample/mix combination has been tested before, the rule compares classifications and (for positive samples) the Log(Quant) difference against a configurable threshold. First-time samples bypass validation. Classification mismatches or excessive quantitative differences trigger errors; consistent samples pass.


Quick Reference

IDCore BehaviorPriorityStatus
REQ-RULES-REPEATSAMP-001Validate classification and Log(Quant) consistency for repeat samplesHIGHDraft

Key Integration Points: Rules Engine, Sample Management, Analytics Engine

Rule Summary

PropertyValue
NameWREP
TriggersWhen same sample/mix combination tested multiple times
OutputPass, skip (first-time), or error (mismatch/threshold exceeded)

Rule Flowchart (Illustrative)

This diagram illustrates the core decision logic. The system uses the most recent previous sample when multiple exist.


Definitions

TermDefinition
WREPRule ID for the Repeat Sample Check rule
Sample/Mix CombinationA specific pairing of a sample identifier with a mix/batch context
ClassificationThe categorical result assigned to a sample (e.g., positive, negative)
Log(Quant)The logarithm (base 10) of the quantitative measurement value
Repeat SampleA sample that has been tested previously with the same mix

Assumptions

  • The rules engine provides the sample and mix context for rule execution
  • Historical sample data is accessible for comparison when evaluating repeat samples
  • Quantitative values are available for samples classified as positive
  • Classification results are available for all samples being validated

Requirements

Repeat Sample Validation (REQ-RULES-REPEATSAMP-001)

FR-REPEATSAMP-001: Validate Repeat Sample Consistency

The system shall execute the WREP rule to validate repeat sample consistency by verifying classification agreement and quantitative similarity between the current sample and previously tested samples for the same sample/mix combination.

Acceptance Criteria

First-Time Sample Handling:

  • Given a sample and mix combination that has never been tested before, when the WREP rule is executed, then the rule shall end without error (skip validation)
  • The system shall treat unavailable historical data as a first-time sample (skip validation)

Classification Matching:

  • Given a sample and mix combination that has been tested before, and the two samples have different classifications, when the WREP rule is executed, then the rule shall fail with error
  • Given a sample and mix combination that has been tested before, and the classifications match, and the sample is negative, when the WREP rule is executed, then the rule shall pass

Quantitative Consistency (Positive Samples Only):

  • The quantitative consistency check shall only be performed when the current sample is classified as positive
  • The system shall bypass the quantitative consistency check for negative samples
  • Given a sample and mix combination that has been tested before, and the current sample classification is positive, and the difference between Log(Quant) of the current sample and previous sample is greater than the configured threshold, when the WREP rule is executed, then the rule shall fail with error
  • Given a sample and mix combination that has been tested before, and the classifications match, and the Log(Quant) difference is within the configured threshold, when the WREP rule is executed, then the rule shall pass

Threshold Calculation:

  • The threshold comparison shall use the absolute difference in Log(Quant) values
  • The system shall calculate the Log(Quant) threshold comparison using the absolute difference formula: ABS(LOG(current.quant) - LOG(previous.quant))

History Selection:

  • The system shall use the most recent sample for comparison when multiple previous samples exist for the same mix

Error Handling

  • Classification mismatch between samples: Return error code WREP_CLASSIFICATION_MISMATCH
  • Log(Quant) difference exceeds threshold: Return error code WREP_QUANT_THRESHOLD_EXCEEDED
  • Historical data unavailable: Treat as first-time sample (skip validation)

Trace: Source: 3.0.0-Repeat Sample check / Requirements Table (Rows 1, 2, 3) | Jira: BT-5680 | Tests: See scenarios | Epic: BT-674 - Rules


Configuration Options

OptionDefaultDescriptionAffects
wrep_log_quant_threshold0.5Maximum allowable absolute difference in Log(Quant) values for positive samplesREQ-RULES-REPEATSAMP-001

UI Notes (Illustrative)

REQ-RULES-REPEATSAMP-001 UI Specifications

  • Rule execution results display in the standard rules result panel
  • Classification mismatch errors highlight the differing classification values
  • Quantitative threshold errors display the actual Log(Quant) difference value
  • Rule flow diagram available at: media/image164.png

Implementation (Illustrative)

ComponentLocation
Rule ClassAnalyzer/Rules/WrepRule.php
Error SetterAnalyzer/Rules/Concerns/SetErrorToWell.php

Traceability Matrix

RequirementTitleVerificationImplementationTest CasesStatus
REQ-RULES-REPEATSAMP-001Validate Repeat Sample ConsistencyTestWrepRule.handle()See scenariosDraft

Notes

  • Rule ID: WREP
  • The 0.5 default threshold applies to the absolute difference in Log(Quant) values
  • The rule is part of the BT-674 Rules epic
  • First-time samples (no previous test record) automatically pass validation as there is no baseline for comparison

Acceptance Tests

Test: REQ-RULES-REPEATSAMP-001

↑ Back to requirement

Test: First-time sample bypasses validation

Given: A sample and mix combination that has never been tested before
When: The WREP rule is executed
Then: The rule shall end without error
And: No comparison checks shall be performed

Test: Classification mismatch triggers error

Given: A sample and mix combination that has been tested before
And: The current sample classification differs from the previous sample classification
When: The WREP rule is executed
Then: The rule shall fail with error code WREP_CLASSIFICATION_MISMATCH

Test: Positive sample with excessive quantitative difference triggers error

Given: A sample and mix combination that has been tested before
And: The current sample classification is Positive
And: The previous sample classification is Positive
And: The absolute difference between Log(Quant) of current and previous sample is greater than 0.5
When: The WREP rule is executed
Then: The rule shall fail with error code WREP_QUANT_THRESHOLD_EXCEEDED

Test: Positive sample within quantitative threshold passes

Given: A sample and mix combination that has been tested before
And: The current sample classification is Positive
And: The previous sample classification is Positive
And: The absolute difference between Log(Quant) of current and previous sample is less than or equal to 0.5
When: The WREP rule is executed
Then: The rule shall pass

Test: Negative sample bypasses quantitative check

Given: A sample and mix combination that has been tested before
And: The current sample classification is Negative
And: The previous sample classification is Negative
When: The WREP rule is executed
Then: The rule shall pass
And: No Log(Quant) comparison shall be performed

Test: Boundary condition at threshold

Given: A sample and mix combination that has been tested before
And: The current sample classification is Positive
And: The previous sample classification is Positive
And: The absolute difference between Log(Quant) values is exactly 0.5
When: The WREP rule is executed
Then: The rule shall pass

Design DocumentRelevant Sections
SDD AlgorithmsWREP Rule Algorithm

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

No Consolidation Required

This domain contains a single requirement (REQ-RULES-REPEATSAMP-001) representing the complete WREP rule capability. No consolidation was performed as the source material appropriately captured this as a single, cohesive rule.

Source Preservation:

  • All four Given/When/Then scenarios from source preserved as grouped acceptance criteria
  • Additional acceptance criteria extracted from source notes to clarify threshold application
  • Threshold value (0.5) moved to Configuration Options per SRS template guidance

Reversibility: To review original structure, reference:

  • Source: output/pilot/rules/rule-repeat-sample/rule-repeat-sample-restructured.md
  • SDD: output/pilot/rules/rule-repeat-sample/sdd/rule-repeat-sample-design.md
  • Confluence: 3.0.0-Repeat Sample check (Rows 1-3)