What is NeuroScope AI?
NeuroScope AI is a multi-cancer clinical decision support platform built for NHS and international hospitals. It combines 7 validated ONNX model pipelines with Microsoft Entra ID SSO, federated learning, and full FHIR R4 export β all in a single FastAPI deployment on HuggingFace Spaces.
Quickstart
Get access to NeuroScope AI in three steps.
Register your institution
Complete the hospital registration form at /register. Your application is reviewed within 2 business days.
Sign in with Microsoft SSO
Once approved, sign in at /ui using your institutional Microsoft account.
Upload a scan and analyze
import requests res = requests.post( "https://tejansree-neuroscope-ai.hf.space/scan", headers={"Authorization": "Bearer YOUR_TOKEN"}, files={"file": open("brain_mri.jpg", "rb")}, data={"cancer_type": "brain", "patient_id": "PT-001"} ) print(res.json()["verdict"]) # CANCER_DETECTED / NORMAL / REVIEW
Architecture
NeuroScope AI is a single FastAPI service on HuggingFace Spaces, serving 7 ONNX models with Microsoft Entra ID SSO and Supabase (primary) + JSON file fallback data layer.
Tech Stack
| Layer | Technology | Purpose |
|---|---|---|
| API | FastAPI + Uvicorn | 30+ REST endpoints |
| Auth | Microsoft Entra ID | SSO, RBAC, token validation |
| Models | ONNX Runtime (INT8) | 7 quantised cancer detection models |
| Database | Supabase + JSON fallback | Scan results, hospitals, audit logs |
| Hosting | HuggingFace Spaces | Production deployment |
| Privacy | Opacus DP-SGD | Federated learning with Ξ΅<10 |
Models & Performance
Seven ONNX INT8 quantised models loaded at startup. All trained on publicly available datasets and validated on held-out test sets.
| Model Key | Cancer Type | Architecture | Modality | Performance |
|---|---|---|---|---|
| brain_cls | Brain | EfficientNet-B4 | MRI | AUC 0.9882 |
| brain_seg | Brain Segmentation | SegResNet | MRI | Dice 0.8351 |
| lung_det | Lung Nodule | ResNet3D | CT | AUC 0.9816 |
| breast_det | Breast | EfficientNet-B5 | Ultrasound | AUC 0.8693 |
| liver_seg | Liver | ResUNet | CT | Dice 0.5773 β |
| skin_cls | Skin | EfficientNet-B4 | Dermoscopy | MelAUC 0.8995 |
| spine_cls | Spine | HybridSpineNet | MRI | MeanAUC 0.7112 |
Authentication
NeuroScope AI uses Microsoft Entra ID (formerly Azure AD) for SSO. All API endpoints (except /health, /register, /tos, /dpa, /docs) require a valid Bearer token.
Authorization: Bearer <microsoft_access_token>
Tokens are obtained via the Microsoft OAuth2 flow. The UI handles this automatically via the Sign in with Microsoft button.
Roles & Access Control
| Role | Access Level | Permissions |
|---|---|---|
| superadmin | Global | All endpoints, all hospitals, system config |
| admin | Hospital | Approve users, view all hospital scans, manage settings |
| clinician | Hospital | Upload scans, view results, export FHIR, provide feedback |
| viewer | Hospital | View scan results only β read-only access |
Core Endpoints
Base URL: https://tejansree-neuroscope-ai.hf.space
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /health | None | API status, model count, version |
| GET | /models | None | List all loaded models and status |
| GET | /ui | None | Main dashboard HTML |
| GET | /register | None | Hospital registration form |
| GET | /tos | None | Terms of Service |
| GET | /dpa | None | Data Processing Agreement |
| GET | /docs | None | This documentation page |
Scan Analysis
| Method | Endpoint | Description |
|---|---|---|
| POST | /scan | Upload and analyze a single medical scan |
| POST | /scan/batch | Batch analyze multiple scans |
| GET | /scan/{scan_id} | Retrieve a previous scan result |
| GET | /scan/{scan_id}/fhir | FHIR R4 DiagnosticReport export |
| GET | /patient/{id}/history | All scans for a patient |
| GET | /scan/{id}/feedback | Get clinician feedback on a scan |
| POST | /scan/{id}/feedback | Submit clinician feedback |
POST /scan β Example
res = requests.post(
"https://tejansree-neuroscope-ai.hf.space/scan",
headers={"Authorization": "Bearer TOKEN"},
files={"file": open("scan.jpg", "rb")},
data={
"cancer_type": "brain", # brain|lung|breast|liver|skin|spine
"patient_id": "PT-2024-001",
"patient_age": "52",
"patient_sex": "female",
}
)
data = res.json()
print(data["verdict"]) # CANCER_DETECTED / NORMAL / REVIEW_REQUIRED
print(data["confidence"]) # 0.934
print(data["icd10"]) # C71.9
Hospital Management
| Method | Endpoint | Role | Description |
|---|---|---|---|
| POST | /hospital/register | Public | Submit hospital registration |
| GET | /hospital/approval | Any | Check registration status |
| POST | /hospital/approve | Superadmin | Approve a pending hospital |
| POST | /hospital/reject | Superadmin | Reject a pending hospital |
| GET | /hospital/list | Superadmin | List all hospitals |
| GET | /hospital/stats | Admin+ | Hospital usage statistics |
Admin Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /auth/audit | Audit log (last N entries) |
| GET | /auth/users | List users for current hospital |
| GET | /admin/stats | Platform-wide statistics |
| POST | /federated/submit | Submit federated learning update |
| GET | /federated/status | Federated learning round status |
FHIR Export
Every scan can be exported as a FHIR R4 DiagnosticReport with ICD-10 coding and NCCN treatment recommendations.
{
"resourceType": "DiagnosticReport",
"status": "final",
"code": { "text": "NeuroScope AI Analysis β Brain MRI" },
"conclusion": "CANCER_DETECTED: Glioblastoma (93.4%)",
"conclusionCode": [{
"coding": [{ "system": "http://hl7.org/fhir/sid/icd-10", "code": "C71.9" }]
}]
}
Cancer Pipelines
| Pipeline | cancer_type value | Input | ICD-10 | Status |
|---|---|---|---|---|
| Brain | brain | MRI (JPEG/NIfTI) | C71.x | Production |
| Lung | lung | CT scan (JPEG) | C34.x | Production |
| Breast | breast | Ultrasound (JPEG) | C50.x | Production |
| Liver | liver | CT scan (JPEG) | C22.x | Research Preview |
| Skin | skin | Dermoscopy (JPEG) | C43.x | Production |
| Spine | spine | MRI (JPEG) | C41.2 | Production |