Create hpo.py
Browse files- mcp/hpo.py +16 -0
mcp/hpo.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mcp/hpo.py
|
| 2 |
+
"""
|
| 3 |
+
Human Phenotype Ontology quick lookup.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import httpx
|
| 7 |
+
from typing import Dict
|
| 8 |
+
|
| 9 |
+
BASE = "https://hpo.jax.org/api/hpo/term/"
|
| 10 |
+
|
| 11 |
+
async def get_hpo(term_id: str) -> Dict:
|
| 12 |
+
"""Fetch HPO term details by ID (e.g., HP:0001250)."""
|
| 13 |
+
async with httpx.AsyncClient(timeout=15) as client:
|
| 14 |
+
r = await client.get(BASE + term_id)
|
| 15 |
+
r.raise_for_status()
|
| 16 |
+
return r.json()
|