Finnrick stringent
Stringent analysis set using Python with stricter quality control rules (98/95 purity, ±15% quantity, catastrophic endotoxin failures)
pythonFinnrick
Created: Thu 27 Nov 2025 05:15
Updated: Thu 27 Nov 2025 05:15
Analysis Rules (4)
identity
Identity confirmation test
Python Code:
def analyze(result, sample, test):
"""Identity test: Pass if measure_flag is 'Pass', else Catastrophic"""
if result["measure_flag"] == "Pass":
return "Pass"
return "Catastrophic"
purity
Purity percentage measurement
Python Code:
def analyze(result, sample, test):
"""Purity test: >98% Pass, <95% Catastrophic, between is Fail"""
value = result["measure_value"]
if value is None:
return "Neutral"
if value > 98:
return "Pass"
if value < 95:
return "Catastrophic"
return "Fail"
quantity
Quantity measurement in mg
Python Code:
def analyze(result, sample, test):
"""Quantity test: compare measure_value vs reference quantity.
Within ±15% Pass, ±30% Fail, beyond Catastrophic.
Uses batch_quantity if available, falls back to label_quantity.
"""
value = result["measure_value"]
if value is None:
return "Neutral"
# Determine reference quantity (batch_quantity preferred)
ref_qty = sample["batch_quantity"]
if ref_qty is None:
ref_qty = sample["label_quantity"]
if ref_qty is None:
return "Neutral"
# Calculate deviation percentage
lower_pass = ref_qty * 0.85 # -15%
upper_pass = ref_qty * 1.15 # +15%
lower_fail = ref_qty * 0.7 # -30%
upper_fail = ref_qty * 1.3 # +30%
if lower_pass <= value <= upper_pass:
return "Pass"
if lower_fail <= value <= upper_fail:
return "Fail"
return "Catastrophic"
endotoxins
Endotoxin test
Python Code:
def analyze(result, sample, test):
"""Endotoxins test: Pass only if measure_flag is 'Negative', 'Below LOQ' is Fail, any other flag is Catastrophic"""
flag = result["measure_flag"]
if flag == "Positive":
return "Catastrophic"
if flag == "Below LOQ":
return "Fail"
if flag == "Negative":
return "Pass"
return "Neutral"Python Data Context
The analyze(result, sample, test) function receives these objects:
result
• .measure_value (number | null)
• .measure_flag (string | null)
• .result_date (string)
• .unit (string | null)
• .notes (string | null)
• .exception (string | null)
• .loq (number | null)
• .method (string | null)
sample
• .batch_quantity (number | null)
• .label_quantity (number | null)
• .registered_date (string)
• .batch_id (string | null)
• .batch_source (string | null)
• .storage_location (string | null)
test
• .tested_date (string | null)
• .coa_date (string | null)
• .coa_url (string | null)
• .coa_id (string | null)
Valid Return Values
• "Pass"
• "Fail"
• "Catastrophic"
• "Neutral"
Python code runs in a sandboxed environment with restricted builtins. Must define analyze(result, sample, test) function.