Download utils/rules.py from mostafa-atef21/Epilepsy-Management-AI-Agent: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/mostafa-atef21/Epilepsy-Management-AI-Agent/resolve/main/utils/rules.py
- Command line
-
hf download hf://spaces/mostafa-atef21/Epilepsy-Management-AI-Agent/utils/rules.py
-
curl -L -o rules.py https://huggingface.co/spaces/mostafa-atef21/Epilepsy-Management-AI-Agent/resolve/main/utils/rules.py
770 Bytes
| from typing import List, Dict, Any | |
| def apply_rules(candidates: List[Dict[str, Any]], require_approvals: str = "", avoid_invasive: bool = False) -> List[Dict[str, Any]]: | |
| req = {t.strip().upper() for t in require_approvals.replace(";", ",").split(",") if t.strip()} | |
| out = [] | |
| for d in candidates: | |
| if avoid_invasive and d.get("invasiveness","").lower() == "invasive": | |
| continue | |
| if req: | |
| dev_apps = {t.strip().upper() for t in str(d.get("approvals","")).replace(";", ",").split(",") if t.strip()} | |
| # OLD (AND): if not req.issubset(dev_apps): continue | |
| # NEW (OR) — pass if there is any overlap: | |
| if req.isdisjoint(dev_apps): | |
| continue | |
| out.append(d) | |
| return out | |