Skip to main content
Version: Next

STD: Standard Quantity Rule (STDQT)

Version: v1.0.0 Status: Draft SRS Source: docusaurus/docs/srs/rules/rule-stdqt.md Rule Name: STDQT Domain: RULES-STDQT


Overview

This document specifies tests for the Standard Quantity (STDQT) rule using decision tables and test vectors. The rule calculates patient sample quantities using standard curve quantification parameters (gradient and intercept) derived from quantitative standard controls on each run.

Rule Characteristics:

  • Pure business logic (no UI)
  • Formula-based calculation: quantity = 10^((CT - intercept) / gradient)
  • Post-calculation multiplier application
  • Fallback control support for missing standards
  • Error propagation from run target quantification failures
  • Configurable well failure scope

Test Method: TM-API (per Test Plan - 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 IDTitleConditionsTest VectorsCoverageGapsAutomation Status
REQ-RULES-STDQT-001Calculate Standard Quantity1218100%NoneAutomated
REQ-RULES-STDQT-002Apply Quantity Multiplier34100%NoneAutomated
REQ-RULES-STDQT-003Use Fallback Standard Controls44100%NoneAutomated
REQ-RULES-STDQT-004Propagate Run Target Errors67100%NoneAutomated
REQ-RULES-STDQT-005Configure Well Failure Scope68100%NoneAutomated

Totals: 5 REQs, 31 Conditions, 41 Test Vectors, 100% Coverage


REQ-RULES-STDQT-001: Calculate Standard Quantity

Input Variables

VariableTypeValid ValuesDescription
obs.rolestringSample, Extraction Control, Control, Quantitative Control, IgnoreObservation role
obs.classificationstringPositive, Negative, AmbiguousObservation classification
obs.ctfloatnumeric, nullCycle threshold value
obs.quantityfloat?numeric, nullPre-existing quantity (from runfile)
run_target.gradientfloat?numeric, nullStandard curve slope
run_target.interceptfloat?numeric, nullStandard curve y-intercept

Output Variables

VariableTypeDescription
obs.quantityfloat?Calculated or preserved quantity
obs.error_codestring?Error code (UNABLE_TO_QUANTIFY or null)

Decision Table: Role Eligibility

TVobs.roleeligibleCovers
TV-001-001SampletrueAC: Calculate for role=Sample
TV-001-002Extraction ControlfalseAC: Exclude Extraction Control
TV-001-003ControlfalseAC: Exclude Control
TV-001-004Quantitative ControlfalseAC: Exclude Quantitative Control
TV-001-005IgnorefalseAC: Exclude Ignore

Decision Table: Classification Eligibility

TVobs.roleobs.classificationquantity_resulterror_codeCovers
TV-001-006SamplePositivecalculatednullAC: Calculate for Positive
TV-001-007SampleNegativenullnullAC: Set null for Negative (no error)
TV-001-008SampleAmbiguousnullnullAC: Set null for Ambiguous (no error)

Decision Table: Calculation Formula

TVgradientinterceptctexpected_quantityCovers
TV-001-009-133271,000,000AC: Basic formula (10^6)
TV-001-010-1333210AC: Formula yields 10^1
TV-001-011-3.340301,000AC: Non-integer gradient

Decision Table: Existing Quantity Override

TVgradientinterceptctexisting_qtyfinal_qtyCovers
TV-001-012-13327null1,000,000AC: Calculate when no existing
TV-001-013-133271001,000,000AC: Replace existing with calculated

Decision Table: Missing Parameters

TVgradientinterceptexisting_qtyfinal_qtyerror_codeCovers
TV-001-014null33nullnullUNABLE_TO_QUANTIFYAC: Missing gradient, no existing
TV-001-015-1nullnullnullUNABLE_TO_QUANTIFYAC: Missing intercept, no existing
TV-001-016nullnullnullnullUNABLE_TO_QUANTIFYAC: Both missing, no existing
TV-001-017null3310001000UNABLE_TO_QUANTIFYAC: Missing gradient, preserve existing
TV-001-018nullnull10001000UNABLE_TO_QUANTIFYAC: Both missing, preserve existing

REQ-RULES-STDQT-002: Apply Quantity Multiplier

Input Variables

VariableTypeValid ValuesDescription
well.quantity_multiplierfloatnumeric (default 1.0)Scaling factor for quantity
calculated_quantityfloatnumericBase quantity from STDQT-001

Output Variables

VariableTypeDescription
obs.quantityfloatFinal quantity after multiplier

Decision Table: Multiplier Application

TVgradientinterceptctmultiplierbase_qtyfinal_qtyCovers
TV-002-001-13332160101,600AC: Multiply base by multiplier
TV-002-002-133271.01,000,0001,000,000AC: Default multiplier (no change)
TV-002-003-133320.5105AC: Fractional multiplier
TV-002-004-1333210001010,000AC: Large multiplier

REQ-RULES-STDQT-003: Use Fallback Standard Controls

Input Variables

VariableTypeValid ValuesDescription
use_fallback_shared_controlsbooltrue, falseFeature toggle
primary_mix.has_standardsbooltrue, falseWhether primary mix has standard controls
control_mappingobjectconfiguredDefines backup control relationships
alternate_mix.has_standardsbooltrue, falseWhether alternate mix has standard controls

Output Variables

VariableTypeDescription
quantification_sourcestringprimary, fallback, none
obs.quantityfloat?Calculated quantity or null

Decision Table: Fallback Controls

TVfeature_enabledprimary_has_standardsfallback_availablequantification_sourceCovers
TV-003-001truefalsetruefallbackAC: Use backup when enabled and no primary
TV-003-002falsefalsetruenoneAC: No quantification when disabled
TV-003-003truetruetrueprimaryAC: Prefer primary when available
TV-003-004truefalsefalsenoneAC: No quantification without any standards

REQ-RULES-STDQT-004: Propagate Run Target Quantification Errors

Input Variables

VariableTypeValid ValuesDescription
run_target.error_codesarraysee tableRun target quantification errors
well.role_aliasstringPatient, NEC, PEC, ...Well role

Output Variables

VariableTypeDescription
well.error_codestring?UNABLE_TO_QUANTIFY or null

Decision Table: Error Propagation by Error Type

TVrun_target_errorpatient_well_receives_errorCovers
TV-004-001INSUFFICIENT_STANDARD_CONTROLSUNABLE_TO_QUANTIFYAC: Insufficient controls
TV-004-002STANDARD_WITHOUT_QUANTUNABLE_TO_QUANTIFYAC: Standard without quantity
TV-004-003BAD_R2UNABLE_TO_QUANTIFYAC: Bad R-squared
TV-004-004BAD_GRADIENTUNABLE_TO_QUANTIFYAC: Bad gradient
TV-004-005BAD_EFFICIENCYUNABLE_TO_QUANTIFYAC: Bad efficiency
TV-004-006nonenullAC: No error, no propagation

Decision Table: Error Propagation Scope

TVrun_target_errorwell.role_aliaswell_receives_errorCovers
TV-004-007BAD_R2PatientUNABLE_TO_QUANTIFYAC: Error propagates to patient wells

REQ-RULES-STDQT-005: Configure Well Failure Scope

Input Variables

VariableTypeValid ValuesDescription
only_fail_positive_wellsbooltrue, falseConfiguration option
well.classificationstringPositive, Negative, AmbiguousWell classification
associated_control.outcomestringPassed, FailedControl outcome

Output Variables

VariableTypeDescription
well.error_codestring?UNABLE_TO_QUANTIFY or null

Decision Table: Failure Scope (only_fail_positive = true)

TVonly_fail_positiveclassificationcontrol_failedreceives_errorCovers
TV-005-001truePositivetrueUNABLE_TO_QUANTIFYAC: Positive receives error
TV-005-002trueNegativetruenullAC: Negative protected
TV-005-003trueAmbiguoustruenullAC: Ambiguous protected
TV-005-004truePositivefalsenullAC: No error when control passes

Decision Table: Failure Scope (only_fail_positive = false)

TVonly_fail_positiveclassificationcontrol_failedreceives_errorCovers
TV-005-005falsePositivetrueUNABLE_TO_QUANTIFYAC: Positive receives error
TV-005-006falseNegativetrueUNABLE_TO_QUANTIFYAC: Negative receives error
TV-005-007falseAmbiguoustrueUNABLE_TO_QUANTIFYAC: Ambiguous receives error
TV-005-008falsePositivefalsenullAC: No error when control passes

Boundary Value Analysis

CT Values

TVct_valuecontextCovers
TC-BVA-0010Minimum CTEdge: Zero CT
TC-BVA-00245Maximum typical CTEdge: High CT
TC-BVA-00333CT equals interceptEdge: Log result = 0, quantity = 1

Quantity Multiplier

TVmultipliercontextCovers
TC-BVA-0040.001Very small multiplierEdge: Fractional result
TC-BVA-00510000Very large multiplierEdge: Large scaling

Traceability to Existing Tests

RequirementJira TestsStatusNotes
REQ-RULES-STDQT-001BT-5355, BT-5687ExistingBT-5355 (v2), BT-5687 (v3) - STDQT calculation
REQ-RULES-STDQT-002BT-5359ExistingNOTES_QUANT_MULTIPLY (v2)
REQ-RULES-STDQT-003BT-5250ExistingMINEXTRACT/FALLBACK (v3)
REQ-RULES-STDQT-004BT-5000, BT-5001, BT-4999, BT-5072, BT-5083, BT-5002, BT-5081ExistingLINEAR_REGRESSION error propagation
REQ-RULES-STDQT-005PendingGapNo valid test found (BT-4931 does not exist)

Gap Analysis

Identified Gaps

GapRequirementDescriptionPriorityOwner
GAP-001REQ-RULES-STDQT-005No valid test for well failure scope configurationMediumTBD

Remediation Plan

  1. GAP-001: Create test ticket covering TV-005-001 through TV-005-008 (well failure scope)

Resolved Gaps

  • GAP-001 (old): REQ-RULES-STDQT-002 now covered by BT-5359
  • GAP-002 (old): REQ-RULES-STDQT-003 now covered by BT-5250
  • GAP-003 (old): REQ-RULES-STDQT-004 now covered by BT-5000/5001/4999/5072/5083/5002/5081