STD: Quantity Standard Validation Rule (QUANT_VALIDATION)
Version: v1.0.0
Status: Draft
SRS Source: docusaurus/docs/srs/rules/rule-quant-validation.md
Rule Name: QUANT_VALIDATION
Domain: RULES-QUANTVAL
Overview
This document specifies tests for the Quantity Standard Validation rule using decision tables and test vectors. The rule validates quantitative standard controls and calculates linear regression parameters for PCR-based sample quantification workflows.
Rule Characteristics:
- Pure business logic (no UI)
- Quantity assignment from configuration
- Observation exclusion filtering
- Linear regression calculation (gradient, intercept, R2, efficiency)
- Multi-threshold validation with error generation
- CT range boundary validation
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-QUANTVAL-001 | Known Quantity Assignment | 6 | 8 | 100% | None |
| REQ-RULES-QUANTVAL-002 | Observation Filtering | 4 | 6 | 100% | None |
| REQ-RULES-QUANTVAL-003 | Linear Regression Calculation | 5 | 6 | 100% | None |
| REQ-RULES-QUANTVAL-004 | Standard Controls Validation | 14 | 18 | 100% | None |
| REQ-RULES-QUANTVAL-005 | CT Range Validation | 7 | 9 | 100% | None |
| REQ-RULES-QUANTVAL-006 | Error Resolution Support | 2 | 3 | 100% | None |
Totals: 6 REQs, 38 Conditions, 50 Test Vectors, 100% Coverage
REQ-RULES-QUANTVAL-001: Known Quantity Assignment
| Variable | Type | Valid Values | Description |
|---|
obs.quantity | float? | null, numeric | Quantity from runfile |
obs.target | string | Target A, Target B, ... | Observation target |
obs.role | string | Role A, Role B, ... | Observation role |
obs.role_type | string | Quantification, Quantification & PC, ... | Role type classification |
config.target | string | Target A, Target B, ... | Known Quantity config target |
config.role | string | Role A, Role B, ... | Known Quantity config role |
config.known_quantity | float | numeric | Configured quantity value |
Output Variables
| Variable | Type | Description |
|---|
obs.quantity | float? | Assigned quantity value |
Decision Table: Quantity Source Priority
| TV | obs.quantity | config_exists | expected_quantity | Covers |
|---|
| TV-001-001 | null | true (qty=1000) | 1000 | AC: Assign from config when runfile lacks quantity |
| TV-001-002 | 500 | true (qty=1000) | 500 | AC: Runfile quantity takes precedence |
| TV-001-003 | null | false | null | AC: No config match, quantity remains null |
Decision Table: Configuration Matching
| TV | obs.target | obs.role | config.target | config.role | matched | Covers |
|---|
| TV-001-004 | Target A | Role A | Target A | Role A | true | AC: Both target AND role match |
| TV-001-005 | Target A | Role B | Target A | Role A | false | AC: Role mismatch |
| TV-001-006 | Target B | Role A | Target A | Role A | false | AC: Target mismatch |
Decision Table: Role Type Handling
| TV | obs.role_type | expected_behavior | Covers |
|---|
| TV-001-007 | Quantification & PC | Quantity assigned | AC: "Quantification & PC" receives assignment |
| TV-001-008 | Quantification | Quantity assigned | AC: Standard quantification role |
REQ-RULES-QUANTVAL-002: Observation Filtering
| Variable | Type | Valid Values | Description |
|---|
obs.target_type | string | IC, Standard, ... | Target type classification |
obs.classification | string | Positive, Negative, ... | Classification result |
obs.role_type | string | Quantification, Quantification & PC, NTC, ... | Role type |
Output Variables
| Variable | Type | Description |
|---|
excluded | bool | Whether observation is excluded from processing |
obs.quantity | float? | Remains null if excluded |
Decision Table: Exclusion Criteria
| TV | target_type | classification | role_type | excluded | Covers |
|---|
| TV-002-001 | IC | Positive | Quantification | true | AC: IC target excluded |
| TV-002-002 | Standard | Negative | Quantification | true | AC: Negative classification excluded |
| TV-002-003 | Standard | Positive | NTC | true | AC: Non-quantifiable role excluded |
| TV-002-004 | Standard | Positive | Quantification | false | AC: Quantifiable observation processed |
| TV-002-005 | Standard | Positive | Quantification & PC | false | AC: Quantification & PC processed |
| TV-002-006 | IC | Negative | NTC | true | AC: Multiple exclusion criteria (any triggers) |
REQ-RULES-QUANTVAL-003: Linear Regression Calculation
| Variable | Type | Valid Values | Description |
|---|
controls | array | Well observations | Quantitative control wells |
control.quantity | float | numeric | Control quantity (log transformed for X) |
control.ct | float | numeric | Control CT value (Y coordinate) |
control.role_type | string | Quantification, Quantification & PC | Role type |
Output Variables
| Variable | Type | Description |
|---|
run_target.gradient | float | Slope of regression line |
run_target.intercept | float | Y-intercept of regression line |
run_target.r2 | float | Squared Pearson correlation coefficient |
run_target.efficiency | float | PCR efficiency: -1 + 10^(-1/slope) |
Decision Table: Regression Calculation
| TV | controls | expected_gradient | expected_intercept | expected_r2 | expected_efficiency | Covers |
|---|
| TV-003-001 | [qty=10000,ct=30], [qty=1000,ct=31] | -1 | 34 | 1 | 9 | AC: Linear regression from controls |
| TV-003-002 | [qty=10000,ct=30], [qty=1000,ct=31], [qty=100,ct=32] | -1 | 34 | 1 | 9 | AC: Multiple controls |
Decision Table: Role Type Inclusion
| TV | control.role_type | included_in_regression | Covers |
|---|
| TV-003-003 | Quantification | true | AC: Standard quantification included |
| TV-003-004 | Quantification & PC | true | AC: Quantification & PC included |
| TV-003-005 | NTC | false | AC: Non-quantifiable excluded |
| TV-003-006 | PC | false | AC: PC-only excluded |
REQ-RULES-QUANTVAL-004: Standard Controls Validation
| Variable | Type | Valid Values | Description |
|---|
obs.machine_quantity | float? | null, numeric | Quantity from machine |
obs.known_quantity | float? | null, numeric | Quantity from configuration |
control_count | int | 0, 1, 2, ... | Unique quantitative controls |
config.min_controls | int | 2 (default), numeric | Minimum required controls |
calculated.r2 | float | 0.0-1.0 | Calculated R2 value |
config.min_r2 | float? | null, numeric | Minimum R2 threshold |
calculated.gradient | float | numeric | Calculated slope |
config.min_slope | float? | null, numeric | Minimum slope threshold |
config.max_slope | float? | null, numeric | Maximum slope threshold |
calculated.efficiency | float | numeric | Calculated efficiency |
config.min_efficiency | float? | null, numeric | Minimum efficiency threshold |
config.max_efficiency | float? | null, numeric | Maximum efficiency threshold |
Output Variables
| Variable | Type | Description |
|---|
well.error_code | string? | Validation error code |
regression_stored | bool | Whether regression parameters stored on run_target |
Decision Table: Missing Quantity Validation
| TV | machine_quantity | known_quantity | error_code | obs.quantity | Covers |
|---|
| TV-004-001 | null | null | STANDARD_WITHOUT_QUANT | null | AC: Both quantities absent |
| TV-004-002 | 1000 | null | null | 1000 | AC: Machine quantity present |
| TV-004-003 | null | 1000 | null | 1000 | AC: Known quantity present |
Decision Table: Minimum Controls Validation
| TV | control_count | min_controls | error_code | regression_stored | Covers |
|---|
| TV-004-004 | 1 | 2 (default) | INSUFFICIENT_STANDARD_CONTROLS | false | AC: Below default minimum |
| TV-004-005 | 2 | 2 (default) | null | true | AC: Meets default minimum |
| TV-004-006 | 2 | 3 | INSUFFICIENT_STANDARD_CONTROLS | false | AC: Below configured minimum |
| TV-004-007 | 3 | 3 | null | true | AC: Meets configured minimum |
Decision Table: R2 Validation
| TV | calculated.r2 | config.min_r2 | error_code | regression_stored | Covers |
|---|
| TV-004-008 | 0.964 | 1.0 | BAD_R2 | true | AC: R2 below threshold, regression still stored |
| TV-004-009 | 1.0 | 1.0 | null | true | AC: R2 meets threshold |
| TV-004-010 | 0.98 | null | null | true | AC: No threshold configured |
Decision Table: Gradient Validation
| TV | calculated.gradient | min_slope | max_slope | error_code | regression_stored | Covers |
|---|
| TV-004-011 | -1 | 0 | null | BAD_GRADIENT | true | AC: Below min_slope, regression stored |
| TV-004-012 | -1 | null | -2 | BAD_GRADIENT | true | AC: Above max_slope, regression stored |
| TV-004-013 | -1.5 | -2 | -1 | null | true | AC: Within range |
Decision Table: Efficiency Validation
| TV | calculated.efficiency | min_efficiency | max_efficiency | error_code | regression_stored | Covers |
|---|
| TV-004-014 | 9 | 10 | null | BAD_EFFICIENCY | true | AC: Below min, regression stored |
| TV-004-015 | 9 | null | 8 | BAD_EFFICIENCY | true | AC: Above max, regression stored |
| TV-004-016 | 9 | 8 | 10 | null | true | AC: Within range |
Decision Table: Error Propagation
| TV | error_type | applied_to | Covers |
|---|
| TV-004-017 | BAD_R2 | All same-target quantitative control wells | AC: Errors propagate to all controls |
| TV-004-018 | INSUFFICIENT_STANDARD_CONTROLS | All same-target quantitative control wells | AC: Error propagation |
REQ-RULES-QUANTVAL-005: CT Range Validation
| Variable | Type | Valid Values | Description |
|---|
obs.final_ct | float | numeric | Observation CT value |
config.low_bound | float? | null, numeric | Lower CT limit |
config.upper_bound | float? | null, numeric | Upper CT limit |
config_exists | bool | true, false | Whether Curve Control Range Settings exist |
Output Variables
| Variable | Type | Description |
|---|
well.error_code | string? | STANDARD_OUTSIDE_CT_RANGE or null |
Decision Table: CT Boundary Validation
| TV | final_ct | low_bound | upper_bound | error_code | Covers |
|---|
| TV-005-001 | 31 | 28 | 30 | STANDARD_OUTSIDE_CT_RANGE | AC: CT above upper_bound |
| TV-005-002 | 30 | 28 | 30 | null | AC: CT equals upper_bound (inclusive) |
| TV-005-003 | 29 | 28 | 30 | null | AC: CT within range |
| TV-005-004 | 28 | 28 | 30 | null | AC: CT equals low_bound (inclusive) |
| TV-005-005 | 27 | 28 | 30 | STANDARD_OUTSIDE_CT_RANGE | AC: CT below low_bound |
Decision Table: Configuration Absence
| TV | config_exists | final_ct | error_code | Covers |
|---|
| TV-005-006 | false | 27 | null | AC: No config, low CT - no error |
| TV-005-007 | false | 31 | null | AC: No config, high CT - no error |
| TV-005-008 | false | 29 | null | AC: No config, normal CT - no error |
| TV-005-009 | true | 29 | null | AC: Config present, within range |
REQ-RULES-QUANTVAL-006: Error Resolution Support
| Variable | Type | Valid Values | Description |
|---|
error_code | string | STANDARD_OUTSIDE_CT_RANGE, STANDARD_WITHOUT_QUANT, ... | Error type |
Output Variables
| Variable | Type | Description |
|---|
resolvable | bool | Whether error supports resolution |
Decision Table: Error Resolvability
| TV | error_code | resolvable | resolution_applied | Covers |
|---|
| TV-006-001 | STANDARD_OUTSIDE_CT_RANGE | true | yes | AC: Resolvable error accepts resolution |
| TV-006-002 | STANDARD_WITHOUT_QUANT | false | blocked | AC: Non-resolvable error prevents resolution |
| TV-006-003 | BAD_R2 | N/A | N/A | AC: Other errors not specified as resolvable |
Traceability to Existing Tests
| Requirement | Jira Tests | Status |
|---|
| REQ-RULES-QUANTVAL-001 | BT-3452 | Existing |
| REQ-RULES-QUANTVAL-002 | Pending | Gap |
| REQ-RULES-QUANTVAL-003 | Pending | Gap |
| REQ-RULES-QUANTVAL-004 | BT-3527, BT-3529, BT-3530, BT-3531 | Existing |
| REQ-RULES-QUANTVAL-005 | Pending | Gap |
| REQ-RULES-QUANTVAL-006 | Pending | Gap |
Gap Analysis
Identified Gaps
| Gap | Requirement | Description | Priority | Owner |
|---|
| GAP-001 | REQ-RULES-QUANTVAL-002 | No Jira test ticket for observation filtering | High | TBD |
| GAP-002 | REQ-RULES-QUANTVAL-003 | No Jira test ticket for regression calculation verification | High | TBD |
| GAP-003 | REQ-RULES-QUANTVAL-005 | No Jira test ticket for CT range validation | Medium | TBD |
| GAP-004 | REQ-RULES-QUANTVAL-006 | No Jira test ticket for error resolution behavior | Low | TBD |
- GAP-001: Create test ticket covering TV-002-001 through TV-002-006 (exclusion criteria)
- GAP-002: Create test ticket covering TV-003-001 through TV-003-006 (regression calculation)
- GAP-003: Create test ticket covering TV-005-001 through TV-005-009 (CT boundaries)
- GAP-004: Create test ticket covering TV-006-001 through TV-006-003 (resolution support)
Automation Status
| Requirement | Status | Notes |
|---|
| REQ-RULES-QUANTVAL-001 | Automated | Existing test BT-3452 |
| REQ-RULES-QUANTVAL-002 | Automated | Needs coverage verification |
| REQ-RULES-QUANTVAL-003 | Automated | Needs coverage verification |
| REQ-RULES-QUANTVAL-004 | Automated | Existing tests BT-3527, BT-3529, BT-3530, BT-3531 |
| REQ-RULES-QUANTVAL-005 | Automated | Needs test ticket creation |
| REQ-RULES-QUANTVAL-006 | Automated | Needs test ticket creation |