STD: ADJ Rule (Cross Contamination)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-adj.md
Rule Name: ADJ (Adjacent CT Rule)
Domain: RULES-ADJ
Overview
This document specifies tests for the ADJ rule using decision tables and test vectors. The rule detects potential cross-contamination between adjacent wells on a thermocycler plate by comparing Ct or Quant values against configured thresholds.
Rule Characteristics:
- Pure business logic (no UI)
- Adjacency detection (8 positions around target well)
- Dual detection modes (Ct-based and Quant-based)
- Error persistence across export and re-analysis
- Configuration validation (missing thresholds)
Test Method: TM-API (per Test Plan section 3.3 - Rules use automated API tests)
Verification Approach:
Rule verification is performed using data-driven test vectors. Each row in a decision table represents a complete verification scenario with defined inputs and expected outputs. This format enables exhaustive condition coverage while remaining concise and auditable.
Coverage Summary
| REQ ID | Title | Conditions | Test Vectors | Coverage | Gaps | Automation Status |
|---|
| REQ-RULES-ADJ-001 | Cross-Contamination Detection | 8 | 12 | 100% | None | Automated (BT-5134, BT-5143, BT-5155) |
| REQ-RULES-ADJ-002 | Error Persistence | 3 | 4 | 100% | None | Automated (BT-5638) |
| REQ-RULES-ADJ-003 | Error Resolution | 3 | 3 | 100% | None | Automated (BT-5134, BT-5143) |
| REQ-RULES-ADJ-004 | Audit Logging | 2 | 4 | 0% | GAP-001 | Not identified |
| REQ-RULES-ADJ-005 | Quant-Based Detection | 5 | 6 | 100% | None | Automated (BT-5155, BT-5157) |
| REQ-RULES-ADJ-006 | Missing Configuration | 3 | 4 | 0% | GAP-002 | Not identified |
Totals: 6 REQs, 24 Conditions, 33 Test Vectors, 67% Coverage (4/6 REQs with identified tests)
| Variable | Type | Valid Values | Description |
|---|
well.position | string | A1-H12 | Well position on plate |
well.positive | bool | true, false | Whether well has positive result |
well.target | string | NCOV1, HEV, IC, ... | Target identifier |
well.is_ic | bool | true, false | Whether target is Internal Control |
well.ct | float? | null, numeric | Cycle threshold value |
well.quantity | float? | null, numeric | Quantification value |
config.potential_contaminated_ct | float? | null, numeric | Ct threshold for potentially contaminated well |
config.potential_contaminating_ct | float? | null, numeric | Ct threshold for potentially contaminating source |
config.potential_contaminated_quant | float? | null, numeric | Quant threshold for potentially contaminated well |
config.potential_contaminating_quant | float? | null, numeric | Quant threshold for potentially contaminating source |
config.quant_or_ct | string | Ct, Quant | Detection mode selection |
adjacent.wells[] | array | Well objects | Wells adjacent to target well |
Output Variables (Common)
| Variable | Type | Description |
|---|
well.error_code | string? | ADJ_CT or ADJ_LIMITS_MISSED or null |
well.error_message | string? | "Cross-contamination concern" or null |
audit.entry | object? | Audit log entry (for config changes) |
REQ-RULES-ADJ-001: Cross-Contamination Detection
Decision Table: Well Eligibility
Tests whether a well is evaluated for cross-contamination based on positive status and IC target exclusion.
| TV | well.positive | well.is_ic | evaluated | Covers |
|---|
| TV-001-001 | true | false | true | AC: Rule evaluates positive non-IC wells |
| TV-001-002 | true | true | false | AC: IC targets excluded |
| TV-001-003 | false | false | false | AC: Negative wells skipped |
| TV-001-004 | false | true | false | AC: Negative IC wells skipped |
Decision Table: Ct-Based Detection
Tests cross-contamination detection when a well has high Ct (potential contaminated) and adjacent well has low Ct (potential contaminating) for same target.
| TV | well.ct | config.contaminated_ct | well > threshold | adjacent.ct | config.contaminating_ct | adjacent < threshold | same_target | error_code | Covers |
|---|
| TV-001-005 | 38 | 35 | true | 20 | 25 | true | true | ADJ_CT | AC: Cross-contamination detected |
| TV-001-006 | 32 | 35 | false | 20 | 25 | true | true | null | AC: Well Ct below contaminated threshold |
| TV-001-007 | 38 | 35 | true | 28 | 25 | false | true | null | AC: Adjacent Ct above contaminating threshold |
| TV-001-008 | 38 | 35 | true | 20 | 25 | true | false | null | AC: Different targets - no detection |
Decision Table: Adjacent Well Positions
Tests that all 8 adjacent positions are evaluated correctly. Example: Well B2 should check A1, B1, C1, A2, C2, A3, B3, C3.
| TV | target_well | adjacent_wells | contaminating_well | error_on | Covers |
|---|
| TV-001-009 | B2 (Ct=38) | A1(Ct=20), B1(Ct=40), C1(Ct=40), A2(Ct=40), C2(Ct=40), A3(Ct=40), B3(Ct=40), C3(Ct=40) | A1 | B2 | AC: Diagonal adjacency detected |
| TV-001-010 | B2 (Ct=38) | A1(Ct=40), B1(Ct=40), C1(Ct=40), A2(Ct=20), C2(Ct=40), A3(Ct=40), B3(Ct=40), C3(Ct=40) | A2 | B2 | AC: Horizontal adjacency detected |
| TV-001-011 | B2 (Ct=38) | A1(Ct=40), B1(Ct=20), C1(Ct=40), A2(Ct=40), C2(Ct=40), A3(Ct=40), B3(Ct=40), C3(Ct=40) | B1 | B2 | AC: Vertical adjacency detected |
| TV-001-012 | A1 (Ct=38) | A2(Ct=40), B1(Ct=40), B2(Ct=40) | none | null | AC: Edge well with no contaminating adjacent |
REQ-RULES-ADJ-002: Error Persistence
Decision Table: Error Persistence After Export and Re-Analysis
| TV | initial_error | adjacent_exported | re_analyzed | final_error | Covers |
|---|
| TV-002-001 | ADJ_CT | true | true | ADJ_CT | AC: Error persists after export and re-analysis |
| TV-002-002 | ADJ_CT | true | false | ADJ_CT | AC: Error persists after export only |
| TV-002-003 | ADJ_CT | false | true | ADJ_CT | AC: Error persists after re-analysis only |
| TV-002-004 | null | false | true | null | AC: No false positives on re-analysis |
REQ-RULES-ADJ-003: Error Resolution
Decision Table: Resolution via Manage Outcomes
| TV | initial_error | resolution_action | config.resolution_codes | final_error | Covers |
|---|
| TV-003-001 | ADJ_CT | resolve | [RESOLVED_OK, REPEAT] | null | AC: Error resolvable via Manage Outcomes |
| TV-003-002 | ADJ_CT | resolve | [] | ADJ_CT | AC: No resolution codes configured |
| TV-003-003 | null | resolve | [RESOLVED_OK] | null | AC: No error to resolve |
REQ-RULES-ADJ-004: Audit Logging
Decision Table: Configuration Change Audit Entries
| TV | action | field_changed | value_before | value_after | audit.area | audit.change_type | audit.action | Covers |
|---|
| TV-004-001 | set | contaminating_ct | null | 25 | Configuration | Contamination | Set Contamination Ct | AC: New contaminating threshold logged |
| TV-004-002 | set | contaminated_ct | null | 35 | Configuration | Contamination | Set Contaminated Ct | AC: New contaminated threshold logged |
| TV-004-003 | update | contaminating_ct | 25 | 28 | Configuration | Contamination | Set Contamination Ct | AC: Updated contaminating threshold logged |
| TV-004-004 | update | contaminated_ct | 35 | 38 | Configuration | Contamination | Set Contaminated Ct | AC: Updated contaminated threshold logged |
REQ-RULES-ADJ-005: Quant-Based Detection
Decision Table: Quant-Based Cross-Contamination Detection
| TV | config.quant_or_ct | well.quantity | config.contaminated_quant | well < threshold | adjacent.quantity | config.contaminating_quant | adjacent > threshold | same_target | error_code | Covers |
|---|
| TV-005-001 | Quant | 100 | 200 | true | 600 | 400 | true | true | ADJ_CT | AC: Quant-based detection (HEV example) |
| TV-005-002 | Quant | 300 | 200 | false | 600 | 400 | true | true | null | AC: Well quant above contaminated threshold |
| TV-005-003 | Quant | 100 | 200 | true | 300 | 400 | false | true | null | AC: Adjacent quant below contaminating threshold |
| TV-005-004 | Quant | 100 | 200 | true | 600 | 400 | true | false | null | AC: Different targets - no detection |
| TV-005-005 | Ct | 100 | 200 | - | 600 | 400 | - | true | null | AC: Quant values ignored when mode is Ct |
| TV-005-006 | Quant | 100 | 200 | true | 600 | 400 | true | true | ADJ_CT | AC: ZIKA assay support verified |
REQ-RULES-ADJ-006: Missing Configuration Handling
Decision Table: Missing Threshold Detection
| TV | config.potential_contaminated_ct | config.potential_contaminating_ct | config.quant_or_ct | error_code | Covers |
|---|
| TV-006-001 | null | 25 | Ct | ADJ_LIMITS_MISSED | AC: Missing contaminated_ct |
| TV-006-002 | 35 | null | Ct | ADJ_LIMITS_MISSED | AC: Missing contaminating_ct |
| TV-006-003 | null | null | Ct | ADJ_LIMITS_MISSED | AC: Both thresholds missing |
| TV-006-004 | 35 | 25 | Ct | null | AC: Both thresholds present - no error |
Traceability to Existing Tests
| Requirement | Jira Tests | Status |
|---|
| REQ-RULES-ADJ-001 | BT-5134, BT-5143, BT-5155 | Existing |
| REQ-RULES-ADJ-002 | BT-5638 | Existing |
| REQ-RULES-ADJ-003 | BT-5134, BT-5143 | Existing |
| REQ-RULES-ADJ-004 | - | Gap (no audit-specific tests identified) |
| REQ-RULES-ADJ-005 | BT-5155, BT-5157 | Existing |
| REQ-RULES-ADJ-006 | - | Gap (no missing-config tests identified) |
Note: Prior references to BT-146, BT-226, BT-690-694, BT-4148, BT-4154, BT-4167, BT-4303, BT-4313 were requirement/story tickets, not test tickets. Actual test coverage mapped from feature catalogue.
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority |
|---|
| GAP-001 | REQ-RULES-ADJ-004 | No audit logging tests identified in existing test suite | Medium |
| GAP-002 | REQ-RULES-ADJ-006 | No missing configuration handling tests identified | Medium |
- GAP-001 (Audit Logging): Review BT-5134/BT-5143 fixtures for audit assertions or create dedicated audit verification tests
- GAP-002 (Missing Config): Create test scenarios with null threshold configurations to verify ADJ_LIMITS_MISSED error behavior