Skip to main content
Version: 3.0.1

Quantification Rules Design

Document Type: Rule Design (Tier 2) Domain: RULES-QUANT Domain Character: Algorithmic SRS Reference: rule-rquant.md, rule-quant-validation.md, rule-stdqt.md, rule-linear-regression-validation.md, rule-standard-curve-validation.md, rule-managing-quantities.md, rule-quantity-weight.md, rule-notts-quant-multiply.md, rule-reporting-qual.md, rule-reporting-quant-as-qual.md Status: Draft Last Updated: 2026-01-25


1. Overview

1.0 Rule Summary

PropertyValue
IntentCalculate, validate, format, and report quantities from PCR analysis using standard curve quantification, linear regression parameters, and configurable reporting thresholds. Supports tiered quantity formatting, specimen-type-specific configurations, and qualitative/quantitative outcome determination.
InputsWell observations (CT, quantity, classification), Standard curve parameters (slope, intercept, R2, efficiency), Quantification settings (thresholds, ranges), Reporting configurations (groups, boundaries, specimen types), Tissue weight, Concentration factor
OutputsCalculated quantities, Formatted reporting quantities, LIMS status codes (DETECTED, NOT DETECTED, DETECTED_QUANT, DETECTED_LOQ), Error codes (UNABLE_TO_QUANTIFY, RQUANT_LIMITS_MISSED, BAD_R2, BAD_GRADIENT, etc.)
PrecedenceQUANT_VALIDATION and LINEAR_REGRESSION_VALIDATION run early (during import); STDQT after CT calculation; RQUANT/RQUANTASQUAL/RQUAL after quantification; TISSUE_WEIGHT and NOTES_QUANT_MULTIPLY during analysis

1.1 Purpose

The Quantification Rules cluster handles all aspects of PCR quantity calculation, validation, formatting, and reporting. This encompasses:

  1. Standard Curve Validation - Validates CT values and R-squared correlation against standard curve parameters
  2. Linear Regression Validation - Calculates and validates regression parameters (slope, intercept, R2, efficiency) from standard controls
  3. Quantity Validation - Assigns known quantities to observations, validates standard controls, performs CT range validation
  4. Standard Quantity Calculation (STDQT) - Calculates patient sample quantities using standard curve parameters
  5. Quantity Formatting (RQUANT) - Applies tiered formatting rules (Groups 2-9) to quantities for LIMS export
  6. Qualitative Reporting (RQUAL) - Determines Detected/Not Detected outcomes by CT vs cutoff comparison
  7. Quant-as-Qual Reporting (RQUANTASQUAL) - Converts quantitative results to qualitative outcomes using LoD thresholds
  8. Quantity Weight Normalization (TISSUE_WEIGHT) - Normalizes quantities by tissue weight
  9. Quantity Multiplier (NOTES_QUANT_MULTIPLY) - Applies concentration factor as quantity multiplier
  10. Placeholder Substitution (Managing Quantities) - Substitutes {LOQ} and {QUANT} placeholders in LIMS messages

1.2 Requirements Covered

REQ IDTitlePrioritySource Rule
REQ-RULES-RQUANT-001Evaluate and Format Sample QuantitiesMustRQUANT
REQ-RULES-RQUANT-002Handle Missing ConfigurationMustRQUANT
REQ-RULES-RQUANT-003Select Reporting Configuration by Specimen TypeShouldRQUANT
REQ-RULES-QUANTVAL-001Assign Known Quantities to ObservationsMustQUANT_VALIDATION
REQ-RULES-QUANTVAL-002Exclude Non-Quantifiable ObservationsMustQUANT_VALIDATION
REQ-RULES-QUANTVAL-003Calculate Linear Regression ParametersMustQUANT_VALIDATION
REQ-RULES-QUANTVAL-004Validate Standard Controls Against ThresholdsMustQUANT_VALIDATION
REQ-RULES-QUANTVAL-005Validate CT Values Against Range BoundsMustQUANT_VALIDATION
REQ-RULES-QUANTVAL-006Support Error ResolutionShouldQUANT_VALIDATION
REQ-RULES-LINREG-001Calculate Linear Regression ParametersMustLINEAR_REGRESSION_VALIDATION
REQ-RULES-LINREG-002Exclude Error Wells from Regression CalculationMustLINEAR_REGRESSION_VALIDATION
REQ-RULES-LINREG-003Classify Insufficient Standard Control ErrorsMustLINEAR_REGRESSION_VALIDATION
REQ-RULES-LINREG-004Apply Resolutions to Linear Regression ErrorsShouldLINEAR_REGRESSION_VALIDATION
REQ-RULES-LINREG-005Propagate Series-Level ResolutionsShouldLINEAR_REGRESSION_VALIDATION
REQ-RULES-LINREG-006Exclude Wells from Regression via ResolutionShouldLINEAR_REGRESSION_VALIDATION
REQ-RULES-STDQT-001Calculate Standard QuantityMustSTDQT
REQ-RULES-STDQT-002Apply Quantity MultiplierShouldSTDQT
REQ-RULES-STDQT-003Use Fallback Standard ControlsShouldSTDQT
REQ-RULES-STDQT-004Propagate Run Target Quantification ErrorsMustSTDQT
REQ-RULES-STDQT-005Configure Well Failure ScopeShouldSTDQT
REQ-RULES-STDCURVE-001Validate CT Values Against Standard CurveMustSTDQT
REQ-RULES-QTYWEIGHT-001Normalize Quantity Using Tissue WeightMustTISSUE_WEIGHT
REQ-RULES-QTYWEIGHT-002Generate Error for Invalid Tissue WeightMustTISSUE_WEIGHT
REQ-RULES-NOTTSQM-001Set Quantity Multiplier from Concentration FactorMustNOTES_QUANT_MULTIPLY
REQ-RULES-QUANTITIES-001Support Quantity Placeholders in LIMS ExportMustRQUANTASQUAL
REQ-RULES-RQUAL-001Qualitative Reporting Outcome DeterminationMustRQUAL
REQ-RULES-RQUAL-002Specimen-Specific Reporting Configuration SelectionShouldRQUAL
REQ-RULES-RQUANTQUAL-001Report Quantitative Results as Qualitative OutcomesMustRQUANTASQUAL
REQ-RULES-RQUANTQUAL-002Select LoD Threshold Based on Specimen TypeShouldRQUANTASQUAL

1.3 Constraints

Tier 2 Constraint: This document describes ownership, patterns, and design rationale. It links to reference docs for full schemas.

1.4 Dependencies

DirectionComponentPurpose
ConsumesWell + ObservationsCT values, classifications, quantities
Kit ConfigurationStandard curves, reporting configs, thresholds
Runfile DataMachine quantities, tissue weights
RelatedWDCLS RuleClassification for eligibility checks
Combined Outcome RuleMay set outcomes before RQUANT
PrecedesLIMS ExportFormatted quantities exported

2. Component Architecture

2.1 Component Diagram

2.2 Component Responsibilities

ComponentFileResponsibilityREQ Trace
QuantValidationRuleAnalyzer/Rules/QuantValidationRule.phpKnown quantity assignment, CT range validationQUANTVAL-001 to 006
LinearRegressionValidationRuleAnalyzer/Rules/LinearRegressionValidationRule.phpRegression calculation and validationLINREG-001 to 006
StdqtRuleAnalyzer/Rules/StdqtRule.phpPatient quantity calculationSTDQT-001 to 005
RquantRuleAnalyzer/Rules/RquantRule.phpTiered quantity formattingRQUANT-001 to 003
RqualRuleAnalyzer/Rules/RqualRule.phpQualitative outcome determinationRQUAL-001, 002
RquantasqualRuleAnalyzer/Rules/RquantasqualRule.phpQuant-to-qual conversionRQUANTQUAL-001, 002
QuantityWeightRuleAnalyzer/Rules/QuantityWeightRule.phpTissue weight normalizationQTYWEIGHT-001, 002
NotesQuantMultiplyRuleAnalyzer/Rules/NotesQuantMultiplyRule.phpConcentration factor multiplierNOTTSQM-001
FillObservationQuantityConcerns/QuantValidationRule/FillObservationQuantity.phpAssigns known quantitiesQUANTVAL-001
ValidateCTConcerns/QuantValidationRule/ValidateCT.phpCT range validationQUANTVAL-005
ValidateCoordinatesConcerns/QuantValidationRule/ValidateCoordinates.phpStandard control count validationLINREG-002, 003
ValidateSlopeConcerns/QuantValidationRule/ValidateSlope.phpSlope range validationLINREG-001
ValidateR2Concerns/QuantValidationRule/ValidateR2.phpR-squared threshold validationLINREG-001
ValidateEfficiencyConcerns/QuantValidationRule/ValidateEfficiency.phpPCR efficiency validationLINREG-001
LinearRegressionGeneratorSupport/LinearRegressionGenerator.phpMath: slope, intercept, R2 calculationLINREG-001
CalculateQuantityUsingInterceptAndSlopeConcerns/CalculateQuantityUsingInterceptAndSlope.phpMath: quantity from CTSTDQT-001
SetErrorToSeriesWellsConcerns/QuantValidationRule/SetErrorToSeriesWells.phpError propagation to seriesQUANTVAL-004, LINREG-003
HandleResolutionsConcerns/QuantValidationRule/HandleResolutions.phpResolution managementQUANTVAL-006, LINREG-004 to 006

3. Data Design

3.1 Entities

EntityOwnerRead/WriteFields Used
wellsRUNRPTRead/Writeobservations, error_code, lims_status, reporting_quantity, quantity_multiplier, tissue_weight, concentration_factor
observationsRUNRPTRead/Writefinal_ct, final_cls, quantity, target_id, role
run_targetsRUNRPTRead/Writeslope, intercept, r2, efficiency
known_quantitiesKITCFGReadtarget_id, role, known_quantity
calculated_quantification_settingsKITCFGReadtarget, role, min_controls, min_r2, min_slope, max_slope, min_efficiency, max_efficiency
curve_control_range_settingsKITCFGReadlow_bound, upper_bound
reportingsKITCFGReadgroup_id, upper_boundary, specimen_type

See Database Reference for full schema.

3.2 Key Data Structures

// Linear Regression Parameters
interface LinearRegression {
slope: number; // Gradient of log(qty) vs CT
intercept: number; // Y-intercept
r2: number; // Correlation coefficient (0-1)
efficiency: number; // PCR efficiency: -1 + 10^(-1/slope)
}

// Quantity Group Configuration (RQUANT)
interface ReportingGroup {
group_id: number; // 1-9
upper_boundary: number; // Quantity threshold
specimen_type?: string; // Optional specimen filter
last_modified: Date; // For fallback selection
}

// Quantification Settings
interface QuantificationSettings {
target_id: string;
role: string;
min_controls: number; // Default: 2
min_r2: number; // R2 threshold
min_slope: number; // Slope range lower bound
max_slope: number; // Slope range upper bound
min_efficiency: number; // Efficiency range lower bound
max_efficiency: number; // Efficiency range upper bound
}

// Standard Control Coordinate
interface Coordinate {
quantity: number; // Known quantity (log scale)
ct: number; // Cycle threshold
}

4. Interface Design

4.1 Rule Interface

All quantification rules implement AnalyzerRuleContract:

interface AnalyzerRuleContract {
public function handle(
ConfigurationRepository $config,
AnalyzableObservation $observation,
RunMix $runMix,
RunTarget $runTarget,
AnalyzableWell $well,
WellCollection $wells,
PatientWellCollection $previousPatientWells,
PecWellCollection $previousPecWells,
RunTargetsCollection $runTargets
): void;
}

4.2 Internal APIs

MethodClassPurpose
shouldNotBeQuantified(obs)QuantValidationRuleCheck IC target, negative CLS, non-quant role
mapCoordinatesFromQuantitativeObservations(obs)WellCollectionExtract coordinates for regression
generate(coordinates)LinearRegressionGeneratorCalculate slope, intercept, R2
calculateEfficiency(runTarget)LinearRegressionValidationRuleCompute PCR efficiency from slope
roundFromSignificant(number, sigFigs)RquantRuleRound to N significant figures
getAllGroupReportingsForObservation(obs)ConfigurationRepositoryGet reporting groups
getFirstGroupReportingForObservation(obs)ConfigurationRepositoryGet LoD threshold

5. Behavioral Design

5.1 Standard Quantity Calculation (REQ-RULES-STDQT-001)

Algorithm: Calculate Standard Quantity

Inputs:
- ct: number - Well's final CT value
- intercept: number - Standard curve intercept
- slope: number - Standard curve slope (gradient)
- multiplier: number - Quantity multiplier (default: 1)

Outputs:
- quantity: number - Calculated quantity

Assumptions:
- Slope and intercept are non-null and valid
- CT is a valid numeric value
- Slope is non-zero (prevents division by zero)

Steps:
1. Calculate log quantity: log_qty = (ct - intercept) / slope
2. Calculate base quantity: base_qty = 10^log_qty
3. Apply multiplier: final_qty = base_qty * multiplier
4. Return final_qty

Notes:
- Slope is typically negative (higher CT = lower quantity)
- Example: CT=27, intercept=33, slope=-1 yields 10^((27-33)/-1) = 10^6 = 1,000,000

5.2 Linear Regression Calculation (REQ-RULES-LINREG-001)

Algorithm: Calculate Linear Regression Parameters

Inputs:
- coordinates: Coordinate[] - Array of {quantity, ct} from standard controls

Outputs:
- slope: number - Regression slope
- intercept: number - Regression intercept
- r2: number - R-squared correlation coefficient

Assumptions:
- Coordinates use log(quantity) as X, CT as Y
- At least 2 valid coordinates exist

Steps:
1. Calculate means:
- x_mean = sum(log(qty)) / n
- y_mean = sum(ct) / n

2. Calculate slope:
- numerator = sum((log(qty) - x_mean) * (ct - y_mean))
- denominator = sum((log(qty) - x_mean)^2)
- slope = numerator / denominator

3. Calculate intercept:
- intercept = y_mean - slope * x_mean

4. Calculate R-squared:
- SS_res = sum((ct - predicted_ct)^2) where predicted_ct = slope * log(qty) + intercept
- SS_tot = sum((ct - y_mean)^2)
- R2 = 1 - (SS_res / SS_tot)

5. Return {slope, intercept, r2}

Notes:
- Efficiency is calculated separately: efficiency = -1 + 10^(-1/slope)
- Typical R2 threshold is 0.99 for high-quality standard curves

5.3 RQUANT Tiered Formatting (REQ-RULES-RQUANT-001)

Algorithm: Format Quantity for LIMS Export

Inputs:
- quantity: number - Calculated quantity
- reportings: ReportingGroup[] - Sorted by group_id ascending

Outputs:
- reporting_quantity: string - Formatted quantity
- lims_status: string - LIMS status code

Steps:
1. IF negative classification: RETURN status = 'NOT DETECTED'

2. IF no reportings configured: SET error = 'RQUANT_LIMITS_MISSED', RETURN

3. Iterate through groups (sorted by group_id):

Group 1 (LoD):
- IF quantity < upper_boundary: RETURN status = 'NOT DETECTED'

Group 2 (LOQ):
- IF quantity < upper_boundary:
- reporting_quantity = format(upper_boundary)
- RETURN status = 'DETECTED_LOQ'

Group 3 (No Rounding):
- IF quantity < upper_boundary:
- reporting_quantity = format(quantity)
- RETURN status = 'DETECTED_QUANT'

Group 4 (Boundary Value):
- IF quantity < upper_boundary:
- reporting_quantity = format(upper_boundary)
- RETURN status = 'DETECTED_QUANT'

Group 5 (1 Sig Fig):
- IF quantity < upper_boundary:
- reporting_quantity = roundSignificant(quantity, 1)
- RETURN status = 'DETECTED_QUANT'

Group 6 (2 Sig Figs):
- IF quantity < upper_boundary:
- reporting_quantity = roundSignificant(quantity, 2)
- RETURN status = 'DETECTED_QUANT'

Group 7 (3 Sig Figs):
- IF quantity < upper_boundary:
- reporting_quantity = roundSignificant(quantity, 3)
- RETURN status = 'DETECTED_QUANT'

Group 8 (2 Sig Figs):
- IF quantity < upper_boundary:
- reporting_quantity = roundSignificant(quantity, 2)
- RETURN status = 'DETECTED_QUANT'

Group 9 (Scientific):
- IF quantity < upper_boundary:
- reporting_quantity = scientific(quantity, 2)
- RETURN status = 'DETECTED_QUANT'
- IF quantity >= upper_boundary:
- reporting_quantity = scientific(upper_boundary, 2)
- RETURN status = 'DETECTED_HIQ'

5.3.1 RQUANT Group Decision Table

GroupConditionRoundingFormatExample InputExample Output
1 (LoD)qty < thresholdN/AN/A50 < 100NOT DETECTED
2 (LOQ)qty < thresholdNonethreshold150 < 200"200"
3qty < thresholdNoneraw250"250"
4qty < thresholdNonethreshold400"500"
5qty < threshold1 sigrounded1,040"1,000"
6qty < threshold2 sigrounded2,123"2,100"
7qty < threshold3 sigrounded12,927"12,900"
8qty < threshold2 sigrounded1,565,323"1,600,000"
9qty < threshold2 sigscientific9,982,000"1.00E+07"
9+qty >= threshold2 sigscientific15,000,000">1.00E+07"

Precedence: Groups evaluated in ascending order (1 through 9); first match wins. Default: If quantity exceeds all thresholds, Group 9+ applies.

5.4 Tissue Weight Normalization (REQ-RULES-QTYWEIGHT-001)

Algorithm: Normalize Quantity by Tissue Weight

Inputs:
- quantity: number|null - Observation quantity
- tissue_weight: number|null|string - Well tissue weight

Outputs:
- quantity: number|null - Normalized quantity (or unchanged)

Steps:
1. IF tissue_weight is null: RETURN original quantity (skip)
2. IF tissue_weight is non-numeric: SET error = 'INVALID_TISSUE_WEIGHT', RETURN
3. IF tissue_weight == 0: RETURN original quantity (skip, avoid division by zero)
4. IF quantity is null: RETURN null (skip)
5. normalized_quantity = quantity / (2 * tissue_weight)
6. RETURN normalized_quantity

Notes:
- Multiplier of 2 is a fixed domain-specific constant
- Example: quantity=100, tissue_weight=0.1 yields 100/(2*0.1) = 500

5.5 Qualitative Outcome Determination (REQ-RULES-RQUAL-001)

Algorithm: Determine Qualitative Outcome (RQUAL)

Inputs:
- ct: number - Well's CT value
- cutoff: number - Upper boundary from reporting config
- use_sample_type: boolean - Whether to match by specimen type

Outputs:
- lims_status: string - 'DETECTED' or 'NOT DETECTED'

Steps:
1. Select reporting configuration:
- IF use_sample_type enabled: match by specimen type
- ELSE: use most recently modified reporting config

2. Get cutoff from selected reporting's upper_boundary

3. Compare CT against cutoff:
- IF ct < cutoff: RETURN 'NOT DETECTED' (error condition)
- IF ct >= cutoff: RETURN 'DETECTED'

Notes:
- Counter-intuitive: lower CT indicates NOT DETECTED
- Boundary is inclusive (ct == cutoff yields DETECTED)

5.6 Standard Control Validation Decision Logic (REQ-RULES-LINREG-003)

Valid Well Countmin_controls ConfigError Code
count = 1AnyONE_STANDARD_CONTROL
1 < count < min_controlse.g., 3INSUFFICIENT_STANDARD_CONTROLS
count >= min_controlse.g., 3No error (proceed)

Precedence: Evaluated before regression calculation. Default: min_controls defaults to 2. Note: ONE_STANDARD_CONTROL is NOT resolvable; INSUFFICIENT_STANDARD_CONTROLS is resolvable.

5.7 Error Propagation from Run Target (REQ-RULES-STDQT-004)

Run Target ErrorPatient Well Effect
INSUFFICIENT_STANDARD_CONTROLSUNABLE_TO_QUANTIFY
STANDARD_WITHOUT_QUANTUNABLE_TO_QUANTIFY
BAD_R2UNABLE_TO_QUANTIFY
BAD_GRADIENTUNABLE_TO_QUANTIFY
BAD_EFFICIENCYUNABLE_TO_QUANTIFY

Scope: Configurable via only_fail_positive_wells:

  • true: Only positive-classified wells receive error
  • false: All patient wells receive error

6. Error Handling

ConditionDetectionResponseResolvable
No reporting configurationreportings.isEmpty()RQUANT_LIMITS_MISSEDNo
Target ID nullobservation.getTargetId() == nullRQUANT_LIMITS_MISSEDNo
Missing known quantityNo config match for target/roleSTANDARD_WITHOUT_QUANTNo
Below min controls (count=1)coordinates.length == 1ONE_STANDARD_CONTROLNo
Below min controls (count>1)coordinates.length < min_controlsINSUFFICIENT_STANDARD_CONTROLSYes
R2 below thresholdr2 < min_r2BAD_R2Yes
Slope outside rangeslope < min_slope OR slope > max_slopeBAD_GRADIENTYes
Efficiency outside rangeeff < min_eff OR eff > max_effBAD_EFFICIENCYYes
CT outside boundsct < low_bound OR ct > upper_boundSTANDARD_OUTSIDE_CT_RANGEYes
Missing slope/interceptslope == null OR intercept == nullUNABLE_TO_QUANTIFYNo
Non-numeric tissue weight!is_numeric(tissue_weight)INVALID_TISSUE_WEIGHTNo

7. Configuration

SettingPathDefaultEffectREQ
min_controlsCalculated Quantification Settings2Minimum standard controlsLINREG-003
min_r2Calculated Quantification Settings-R2 thresholdLINREG-001
min_slope / max_slopeCalculated Quantification Settings-Slope rangeLINREG-001
min_efficiency / max_efficiencyCalculated Quantification Settings-Efficiency rangeLINREG-001
low_bound / upper_boundCurve Control Range Settings-CT validation boundsQUANTVAL-005
use_sample_typeSystem SettingsfalseSpecimen-type-specific reportingRQUANT-003, RQUAL-002
use_fallback_shared_controlsSystem SettingsfalseBackup controls from alternate mixesSTDQT-003
only_fail_positive_wellsSystem SettingstrueLimit error propagation scopeSTDQT-005
round_ninth_reporting_groupSystem SettingsfalseRound Group 9 scientific notationRQUANT-001

See Configuration Reference for full documentation.


8. Implementation Mapping

8.1 Code Locations

ComponentPath
QUANT_VALIDATION EntryAnalyzer/Rules/QuantValidationRule.php
LINEAR_REGRESSION_VALIDATION EntryAnalyzer/Rules/LinearRegressionValidationRule.php
STDQT EntryAnalyzer/Rules/StdqtRule.php
RQUANT EntryAnalyzer/Rules/RquantRule.php
RQUAL EntryAnalyzer/Rules/RqualRule.php
RQUANTASQUAL EntryAnalyzer/Rules/RquantasqualRule.php
TISSUE_WEIGHT EntryAnalyzer/Rules/QuantityWeightRule.php
NOTES_QUANT_MULTIPLY EntryAnalyzer/Rules/NotesQuantMultiplyRule.php
Fill QuantityAnalyzer/Rules/Concerns/QuantValidationRule/FillObservationQuantity.php
CT ValidationAnalyzer/Rules/Concerns/QuantValidationRule/ValidateCT.php
Coordinate ValidationAnalyzer/Rules/Concerns/QuantValidationRule/ValidateCoordinates.php
Slope ValidationAnalyzer/Rules/Concerns/QuantValidationRule/ValidateSlope.php
R2 ValidationAnalyzer/Rules/Concerns/QuantValidationRule/ValidateR2.php
Efficiency ValidationAnalyzer/Rules/Concerns/QuantValidationRule/ValidateEfficiency.php
Regression MathSupport/LinearRegressionGenerator.php
Quantity CalculationAnalyzer/Rules/Concerns/CalculateQuantityUsingInterceptAndSlope.php
Resolution HandlingAnalyzer/Rules/Concerns/QuantValidationRule/HandleResolutions.php
Series Error SettingAnalyzer/Rules/Concerns/QuantValidationRule/SetErrorToSeriesWells.php

8.2 Requirement Traceability

REQ IDDesign SectionPrimary Code
REQ-RULES-RQUANT-001§5.3RquantRule.php
REQ-RULES-RQUANT-002§6RquantRule.php:56-60
REQ-RULES-RQUANT-003§5.3ConfigurationRepository.getAllGroupReportingsForObservation()
REQ-RULES-QUANTVAL-001§5.1FillObservationQuantity.php
REQ-RULES-QUANTVAL-002§2.2QuantValidationRule.shouldNotBeQuantified()
REQ-RULES-QUANTVAL-003§5.2LinearRegressionGenerator.php
REQ-RULES-QUANTVAL-004§6SetErrorToSeriesWells.php
REQ-RULES-QUANTVAL-005§5.4ValidateCT.php
REQ-RULES-QUANTVAL-006§6HandleResolutions.php
REQ-RULES-LINREG-001§5.2LinearRegressionValidationRule.php, LinearRegressionGenerator.php
REQ-RULES-LINREG-002§5.6ValidateCoordinates.php
REQ-RULES-LINREG-003§5.6ValidateCoordinates.php
REQ-RULES-LINREG-004§6HandleResolutions.php
REQ-RULES-LINREG-005§6HandleResolutions.updateAllWellsWithSeriesResolution()
REQ-RULES-LINREG-006§6HandleResolutions.php
REQ-RULES-STDQT-001§5.1StdqtRule.php, CalculateQuantityUsingInterceptAndSlope.php
REQ-RULES-STDQT-002§5.1StdqtRule.php:68-71
REQ-RULES-STDQT-003§2.2StdqtRule.getMatchingRunTarget()
REQ-RULES-STDQT-004§5.7StdqtRule.hasQuantificationError()
REQ-RULES-STDQT-005§5.7StdqtRule.shouldGetError()
REQ-RULES-STDCURVE-001§5.2, §5.5ValidateCT.php, StdqtRule.php
REQ-RULES-QTYWEIGHT-001§5.4QuantityWeightRule.php
REQ-RULES-QTYWEIGHT-002§6QuantityWeightRule.php
REQ-RULES-NOTTSQM-001§2.2NotesQuantMultiplyRule.php
REQ-RULES-QUANTITIES-001§5.3RquantRule.php (placeholder in reporting)
REQ-RULES-RQUAL-001§5.5RqualRule.php
REQ-RULES-RQUAL-002§5.5ConfigurationRepository.getFirstGroupReportingForObservation()
REQ-RULES-RQUANTQUAL-001§5.5RquantasqualRule.php
REQ-RULES-RQUANTQUAL-002§5.5ConfigurationRepository.getFirstGroupReportingForObservation()

9. Design Decisions

DecisionRationaleAlternatives Considered
Separate validation and calculation rulesClear separation of concerns; validation can fail independentlySingle monolithic rule (rejected: too complex)
Series-level error propagationStandard curve issues affect all wells using that curvePer-well errors only (rejected: misleading)
Tiered formatting with 9 groupsLab-specific precision requirements vary by magnitudeSingle format (rejected: insufficient precision control)
Specimen-type config selectionDifferent sample matrices have different detection thresholdsSingle config per target (rejected: insufficient flexibility)
Fixed 2x multiplier in tissue weightDomain-specific constant from assay protocolConfigurable multiplier (rejected: no business need)
Resolvable vs non-resolvable errorsSome errors can be manually overridden; others cannotAll resolvable (rejected: ONE_STANDARD_CONTROL is fundamentally unresolvable)

10. Performance Considerations

ScenarioConcernMitigation
Large number of standard controlsRegression calculation overheadLinear time algorithm O(n)
Many reporting groupsIteration overheadEarly exit on first match
Series-level resolution propagationWell collection iterationFiltered iteration on target match
Historical run lookups (fallback controls)Database queriesIndexed queries, limited to run-level data

DocumentRelevant Sections
SRS: rule-rquant.mdRQUANT requirements
SRS: rule-quant-validation.mdQUANT_VALIDATION requirements
SRS: rule-linear-regression-validation.mdLINEAR_REGRESSION_VALIDATION requirements
SRS: rule-stdqt.mdSTDQT requirements
SRS: rule-standard-curve-validation.mdStandard curve validation
SRS: rule-reporting-qual.mdRQUAL requirements
SRS: rule-reporting-quant-as-qual.mdRQUANTASQUAL requirements
SRS: rule-quantity-weight.mdTISSUE_WEIGHT requirements
SRS: rule-notts-quant-multiply.mdNOTES_QUANT_MULTIPLY requirements
SRS: rule-managing-quantities.mdPlaceholder substitution
SDS: Rules EngineFramework overview
SDS: Classification RulesClassification inputs to quantification