Spaces:
Sleeping
Sleeping
Update genesis/biosecurity.py
Browse files- genesis/biosecurity.py +70 -26
genesis/biosecurity.py
CHANGED
@@ -1,30 +1,74 @@
|
|
1 |
# genesis/biosecurity.py
|
2 |
"""
|
3 |
-
Biosecurity
|
4 |
-
|
5 |
"""
|
6 |
|
7 |
-
import
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
"
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# genesis/biosecurity.py
|
2 |
"""
|
3 |
+
Biosecurity Risk Assessment Module for GENESIS-AI
|
4 |
+
Analyzes potential dual-use or misuse risks of synthetic biology research.
|
5 |
"""
|
6 |
|
7 |
+
import logging
|
8 |
+
|
9 |
+
logging.basicConfig(level=logging.INFO)
|
10 |
+
|
11 |
+
def analyze_biosecurity_risks(entity_name: str, description: str = ""):
|
12 |
+
"""
|
13 |
+
Analyze biosecurity risks for a given entity (gene, protein, organism, or technology).
|
14 |
+
Returns a structured dictionary of risks, severity, and mitigation suggestions.
|
15 |
+
|
16 |
+
Args:
|
17 |
+
entity_name (str): Name of the biological entity.
|
18 |
+
description (str, optional): Additional context or description.
|
19 |
+
|
20 |
+
Returns:
|
21 |
+
dict: Biosecurity risk profile.
|
22 |
+
"""
|
23 |
+
logging.info(f"[Biosecurity] Assessing risks for: {entity_name}")
|
24 |
+
|
25 |
+
# Simple keyword-based heuristic
|
26 |
+
high_risk_keywords = ["smallpox", "anthrax", "ebola", "h5n1", "plague", "ricin", "botulinum"]
|
27 |
+
medium_risk_keywords = ["viral vector", "gain-of-function", "CRISPR", "dual-use"]
|
28 |
+
|
29 |
+
risk_level = "Low"
|
30 |
+
risk_factors = []
|
31 |
+
|
32 |
+
text_to_check = f"{entity_name} {description}".lower()
|
33 |
+
|
34 |
+
for kw in high_risk_keywords:
|
35 |
+
if kw in text_to_check:
|
36 |
+
risk_level = "High"
|
37 |
+
risk_factors.append(f"Contains high-risk keyword: {kw}")
|
38 |
+
|
39 |
+
if risk_level != "High":
|
40 |
+
for kw in medium_risk_keywords:
|
41 |
+
if kw in text_to_check:
|
42 |
+
risk_level = "Medium"
|
43 |
+
risk_factors.append(f"Contains medium-risk keyword: {kw}")
|
44 |
+
|
45 |
+
# If no match, still return low risk baseline
|
46 |
+
if not risk_factors:
|
47 |
+
risk_factors.append("No known high/medium risk indicators detected.")
|
48 |
+
|
49 |
+
mitigation_suggestions = []
|
50 |
+
if risk_level == "High":
|
51 |
+
mitigation_suggestions = [
|
52 |
+
"Engage institutional biosecurity committee immediately.",
|
53 |
+
"Restrict access to authorized personnel.",
|
54 |
+
"Perform BSL-3/BSL-4 lab containment assessment.",
|
55 |
+
"Consult WHO guidance for dangerous pathogens."
|
56 |
+
]
|
57 |
+
elif risk_level == "Medium":
|
58 |
+
mitigation_suggestions = [
|
59 |
+
"Review project with bioethics board.",
|
60 |
+
"Use gene synthesis screening services.",
|
61 |
+
"Ensure compliance with NIH and WHO guidelines."
|
62 |
+
]
|
63 |
+
else:
|
64 |
+
mitigation_suggestions = [
|
65 |
+
"Maintain good laboratory practices.",
|
66 |
+
"Continue monitoring for any emerging risks."
|
67 |
+
]
|
68 |
+
|
69 |
+
return {
|
70 |
+
"entity": entity_name,
|
71 |
+
"risk_level": risk_level,
|
72 |
+
"risk_factors": risk_factors,
|
73 |
+
"mitigation": mitigation_suggestions
|
74 |
+
}
|