File size: 2,555 Bytes
e76888b
d763be0
bf50c62
 
d763be0
 
bf50c62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# genesis/biosecurity.py
"""
Biosecurity Risk Assessment Module for GENESIS-AI
Analyzes potential dual-use or misuse risks of synthetic biology research.
"""

import logging

logging.basicConfig(level=logging.INFO)

def analyze_biosecurity_risks(entity_name: str, description: str = ""):
    """
    Analyze biosecurity risks for a given entity (gene, protein, organism, or technology).
    Returns a structured dictionary of risks, severity, and mitigation suggestions.
    
    Args:
        entity_name (str): Name of the biological entity.
        description (str, optional): Additional context or description.
    
    Returns:
        dict: Biosecurity risk profile.
    """
    logging.info(f"[Biosecurity] Assessing risks for: {entity_name}")

    # Simple keyword-based heuristic
    high_risk_keywords = ["smallpox", "anthrax", "ebola", "h5n1", "plague", "ricin", "botulinum"]
    medium_risk_keywords = ["viral vector", "gain-of-function", "CRISPR", "dual-use"]

    risk_level = "Low"
    risk_factors = []

    text_to_check = f"{entity_name} {description}".lower()

    for kw in high_risk_keywords:
        if kw in text_to_check:
            risk_level = "High"
            risk_factors.append(f"Contains high-risk keyword: {kw}")

    if risk_level != "High":
        for kw in medium_risk_keywords:
            if kw in text_to_check:
                risk_level = "Medium"
                risk_factors.append(f"Contains medium-risk keyword: {kw}")

    # If no match, still return low risk baseline
    if not risk_factors:
        risk_factors.append("No known high/medium risk indicators detected.")

    mitigation_suggestions = []
    if risk_level == "High":
        mitigation_suggestions = [
            "Engage institutional biosecurity committee immediately.",
            "Restrict access to authorized personnel.",
            "Perform BSL-3/BSL-4 lab containment assessment.",
            "Consult WHO guidance for dangerous pathogens."
        ]
    elif risk_level == "Medium":
        mitigation_suggestions = [
            "Review project with bioethics board.",
            "Use gene synthesis screening services.",
            "Ensure compliance with NIH and WHO guidelines."
        ]
    else:
        mitigation_suggestions = [
            "Maintain good laboratory practices.",
            "Continue monitoring for any emerging risks."
        ]

    return {
        "entity": entity_name,
        "risk_level": risk_level,
        "risk_factors": risk_factors,
        "mitigation": mitigation_suggestions
    }