STD: BPEC Rule (Bad Positive Expected Control)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-bpec.md
Rule Name: BPEC
Domain: RULES-BPEC
Overview
This document specifies tests for the BPEC (Bad Positive Expected Control) rule using decision tables and test vectors. The rule validates positive control wells by detecting unexpected negative classification results and failing such wells with appropriate error codes.
Rule Characteristics:
- Pure business logic (no UI)
- Extends PEC (Positive Expected Control) rule
- Binary classification validation (positive/negative)
- Assay-agnostic logic with multi-assay compatibility
- QC report exclusion behavior
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 |
|---|
| REQ-RULES-BPEC-001 | Validate Positive Control Classification | 18 | 22 | 100% | None |
Totals: 1 REQ, 18 Conditions, 22 Test Vectors, 100% Coverage
REQ-RULES-BPEC-001: Validate Positive Control Classification
| Variable | Type | Valid Values | Description |
|---|
well.type | string | positive_control, sample, NEC, ... | Well type classification |
well.classification | string | positive, negative | Classification result from engine |
assay.type | string | Viracor, COVID, HCOVID, PCOVID, QCOVID | Assay type identifier |
assay.targets | array | [NCOV1, NCOV3], [NCOV3] | Target genes for COVID assays |
error.level | string | well, target | Granularity of failure |
Output Variables
| Variable | Type | Description |
|---|
validation.result | string | pass, fail |
well.error_code | string? | FAILED_POS_WELL, FAILED_POS_TARGET, or null |
well.analysis_blocked | bool | Whether further analysis is prevented |
report.westgard_visible | bool | Whether result appears in Westgard/LJ report |
Decision Table: Core Classification Validation
| TV | well.type | well.classification | validation.result | error_assigned | Covers |
|---|
| TV-001-001 | positive_control | negative | fail | true | AC: Negative classification fails well |
| TV-001-002 | positive_control | positive | pass | false | AC: Positive classification passes BPEC |
| TV-001-003 | sample | negative | N/A | false | AC: Rule only applies to positive controls |
| TV-001-004 | NEC | negative | N/A | false | AC: Rule only applies to positive controls |
Decision Table: Error Code Assignment
| TV | error.level | well.classification | well.error_code | Covers |
|---|
| TV-001-005 | well | negative | FAILED_POS_WELL | AC: Well-level failure code |
| TV-001-006 | target | negative | FAILED_POS_TARGET | AC: Target-level failure code |
| TV-001-007 | well | positive | null | AC: No error on pass |
| TV-001-008 | target | positive | null | AC: No error on pass |
Decision Table: Analysis Blocking
| TV | validation.result | well.analysis_blocked | Covers |
|---|
| TV-001-009 | fail | true | AC: Failure prevents further analysis |
| TV-001-010 | pass | false | AC: Pass allows rule chain to continue |
Decision Table: Viracor Assay Compatibility
| TV | assay.type | well.classification | validation.result | Covers |
|---|
| TV-001-011 | Viracor | negative | fail | AC: Viracor negative fails |
| TV-001-012 | Viracor | positive | pass | AC: Viracor positive passes |
Decision Table: COVID Assay Compatibility (NCOV1 + NCOV3)
| TV | assay.type | assay.targets | well.classification | validation.result | Covers |
|---|
| TV-001-013 | COVID | [NCOV1, NCOV3] | negative | fail | AC: COVID dual-target negative fails |
| TV-001-014 | COVID | [NCOV1, NCOV3] | positive | pass | AC: COVID dual-target positive passes |
| TV-001-015 | HCOVID | [NCOV1, NCOV3] | negative | fail | AC: HCOVID dual-target negative fails |
| TV-001-016 | PCOVID | [NCOV1, NCOV3] | negative | fail | AC: PCOVID dual-target negative fails |
| TV-001-017 | QCOVID | [NCOV1, NCOV3] | negative | fail | AC: QCOVID dual-target negative fails |
Decision Table: COVID Assay Compatibility (NCOV3 Only)
| TV | assay.type | assay.targets | well.classification | validation.result | Covers |
|---|
| TV-001-018 | COVID | [NCOV3] | negative | fail | AC: COVID NCOV3-only negative fails |
| TV-001-019 | HCOVID | [NCOV3] | negative | fail | AC: HCOVID NCOV3-only negative fails |
| TV-001-020 | PCOVID | [NCOV3] | negative | fail | AC: PCOVID NCOV3-only negative fails |
| TV-001-021 | QCOVID | [NCOV3] | negative | fail | AC: QCOVID NCOV3-only negative fails |
Decision Table: Westgard/LJ Report Exclusion
| TV | validation.result | report.westgard_visible | standard_results_visible | Covers |
|---|
| TV-001-022 | fail | false | true | AC: BPEC failures excluded from Westgard/LJ but visible in standard results |
Test File Locations
| Requirement | Test File | Method | Automation Status |
|---|
| REQ-RULES-BPEC-001 | tests/Unit/Rules/BpecRuleTest.php | TM-API | Automated |
Traceability to Existing Tests
| Requirement | Jira Tests | Status |
|---|
| REQ-RULES-BPEC-001 | BT-1360, BT-1575, BT-1576, BT-1577, BT-1578, BT-1579, BT-1580, BT-1581, BT-1582 | Existing |
Jira Test Mapping
| Jira Ticket | Test Vectors Covered | Description |
|---|
| BT-1360 | TV-001-011, TV-001-012 | Viracor assay compatibility |
| BT-1575 | TV-001-013, TV-001-014 | COVID dual-target (NCOV1+NCOV3) |
| BT-1576 | TV-001-015 | HCOVID dual-target (NCOV1+NCOV3) |
| BT-1577 | TV-001-016 | PCOVID dual-target (NCOV1+NCOV3) |
| BT-1578 | TV-001-017 | QCOVID dual-target (NCOV1+NCOV3) |
| BT-1579 | TV-001-018 | COVID NCOV3-only |
| BT-1580 | TV-001-019 | HCOVID NCOV3-only |
| BT-1581 | TV-001-020 | PCOVID NCOV3-only |
| BT-1582 | TV-001-021 | QCOVID NCOV3-only |
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority | Owner |
|---|
| None | - | All acceptance criteria covered by test vectors | - | - |
Coverage Notes
- Core classification logic (TV-001-001 through TV-001-004) exercises the fundamental pass/fail decision
- Error code assignment (TV-001-005 through TV-001-008) verifies both well-level and target-level error handling
- Assay compatibility tests (TV-001-011 through TV-001-021) ensure rule works across all supported assay configurations
- Report exclusion (TV-001-022) verifies the QC reporting constraint