# Online Neuropathy Calculator (2026-01-03)

## Purpose
Public-facing, English-only calculator to estimate hereditary vs inflammatory demyelinating neuropathy risk using the finalized ENMG feature set. Center is never used as a model feature.

## App Location
- Code: `neuropathy_calculator/`
- Model: `neuropathy_calculator/model/extra_trees_model.joblib`
- UI: `neuropathy_calculator/static/`

## Feature Set (11)
- age_at_exam_years
- sex_encoded (0 = Female, 1 = Male)
- sensory_responses_absent_encoded (0 = present, 1 = absent)
- median_distal_latency_ms (any-side)
- median_ncv_mean_ms (any-side)
- median_cmap_amplitude_mean_mv (any-side)
- ulnar_distal_latency_ms (any-side)
- ulnar_ncv_mean_ms (any-side)
- ulnar_cmap_amplitude_mean_mv (any-side)
- median_ulnar_cmap_amplitude_ratio (derived)
- median_ulnar_ncv_diff_gt_10 (derived from NCV)

## Model
ExtraTrees with winsorization (1-99%) + median imputation + center-balanced sample weights.

## Hosting
Traefik route configured for: `predictneuropathy.tpfbrain.com`

## Deployment (safe, isolated)
```bash
cd /root/AI_neuropathy_code/neuropathy_calculator

docker-compose build --no-cache
# Starts only this container; does not touch other apps

docker-compose up -d
```

## Health Check
```bash
curl -I http://localhost:8000/health
```

## Notes
- This tool is for research/educational use; it does not replace clinical judgement.
- Input fields allow blank values; missing values are handled by the model.
- No data is stored by the service.
- Derived fields are computed server-side from the provided median/ulnar amplitudes and NCV values.
