File size: 603 Bytes
311fafd
0d14a0e
311fafd
 
0d14a0e
2689723
311fafd
2689723
311fafd
 
 
 
2689723
311fafd
0d14a0e
311fafd
0d14a0e
311fafd
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# genesis/safety.py
"""
Biosecurity & Safety Analysis for GENESIS-AI
Checks biosecurity risks using NSABB guidelines + BWC frameworks.
"""

import re

DUAL_USE_KEYWORDS = [
    "pathogen", "toxin", "gain of function", "bioweapon",
    "select agent", "lethal", "infectious dose", "virulence"
]

def assess_biosecurity_risk(text):
    """
    Returns a biosecurity risk score (0–10) and flagged terms.
    """
    flagged = [kw for kw in DUAL_USE_KEYWORDS if re.search(rf"\b{kw}\b", text, re.IGNORECASE)]
    score = min(10, len(flagged) * 2)
    return {"risk_score": score, "flagged_terms": flagged}