Hydrological time series error analysis toolkit with FastAPI backend, React frontend, and advanced time series processing tools.
Quick Steps:
- Click "Deploy to Render" β deploys backend + database
- Copy your Render URL (e.g.,
https://ts-errors-api.onrender.com) - Click "Deploy to Vercel" β deploys frontend
- Set environment variable
VITE_API_URLto your Render URL - Done! Your app is live π
Full Guide: See DEPLOYMENT.md
- 28+ metrics: RMSE, NSE/NSC, KGE (2009, 2012), correlation, RΒ², PBIAS, sMAPE, Index of Agreement
- Persistence baseline: Compare against naive lag-1 forecast
- Hydrology-focused: Metrics designed for hydrological applications
- Interpolation: Cubic, quadratic, linear splines
- Smoothing: Moving average, Savitzky-Golay, exponential
- Decomposition: Trend + seasonal + residual components
- Outlier detection: Z-score and IQR methods
- Resampling: Change sampling rate with interpolation
- Dashboard: System overview with statistics
- Analyze: Upload data, get instant results with charts
- Tools: Interactive time series processing
- History: Browse past analyses
- Stats: User and system statistics
- RESTful API with automatic OpenAPI docs (
/docs) - Docker containerized for easy deployment
- Database tracking of all analyses (SQLite/PostgreSQL)
- Session management with user statistics
- CORS enabled for frontend integration
git clone https://github.com/corzogac/TS-ErrorsAnalysis.git
cd TS-ErrorsAnalysis
# Build and run
make build
make run
# Access the app
# Frontend: http://localhost:3000
# Backend API: http://localhost:8000
# API Docs: http://localhost:8000/docs# Backend
pip install -r requirements.txt -r api/requirements.txt
uvicorn api.main:app --reload --host 0.0.0.0 --port 8000
# Frontend (separate terminal)
cd frontend
npm install
npm run devcurl -X POST http://localhost:8000/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{
"predicted": [1.0, 2.5, 3.2, 4.1, 5.0],
"target": [1.2, 2.3, 3.5, 3.9, 4.8],
"user_id": "researcher_123",
"analysis_name": "River Discharge Model"
}'curl -X POST http://localhost:8000/api/v1/timeseries/smooth \
-H "Content-Type: application/json" \
-d '{
"values": [1.0, 2.5, 3.2, 4.1, 5.0, 4.2, 3.8],
"method": "savitzky_golay",
"window_size": 5
}'curl http://localhost:8000/api/v1/stats/systemBackend:
- FastAPI (Python 3.11+)
- SQLAlchemy (ORM)
- NumPy, SciPy (numerical computing)
- Pydantic (validation)
Frontend:
- React 18 + Vite
- Tailwind CSS
- Recharts (visualization)
- Axios (API client)
Database:
- PostgreSQL (production)
- SQLite (development)
Deployment:
- Docker + docker-compose
- Vercel (frontend)
- Render/Railway (backend)
- DEPLOYMENT.md - Complete deployment guide (Vercel, Render, Railway)
- DOCKER.md - Docker setup and commands
- CLAUDE.md - AI assistant development guide
- API Docs - Interactive API documentation (when running)
# Run comprehensive test suite
python test_all_stages.py
# Tests cover:
# - All API endpoints
# - Database operations
# - Time series tools
# - Error handling
# - Integration workflowsTS-ErrorsAnalysis/
βββ api/ # FastAPI backend
β βββ main.py # API endpoints
β βββ database.py # Database models
β βββ stats.py # Statistics functions
β βββ timeseries.py # Time series processing
βββ frontend/ # React frontend
β βββ src/
β β βββ pages/ # Dashboard, Analyze, Tools, History, Stats
β β βββ services/ # API client
β β βββ App.jsx # Main app component
β βββ package.json
βββ src/ # Core Python modules
β βββ errors.py # Error metrics computation
β βββ plots.py # Visualization
βββ matlab/ # MATLAB implementation
β βββ Error1.m
βββ Dockerfile # Container image
βββ docker-compose.yml # Local development
βββ render.yaml # Render deployment config
βββ test_all_stages.py # Test suite
- RMSE, MAE, SSE, NRMSE
- NSC/NSE (Nash-Sutcliffe)
- Correlation (Pearson r)
- RΒ² (Coefficient of determination)
- RSR (RMSE-to-StdDev ratio)
- PBIAS (Percent Bias)
- sMAPE (Symmetric MAPE)
- MARE (Mean Absolute Relative Error)
- KGE2009, KGE2012 (Kling-Gupta Efficiency)
- d, d1 (Index of Agreement)
- PERS (Coefficient of persistence)
- RMSEN (Naive forecast RMSE)
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
python test_all_stages.py - Submit a pull request
MIT License - See LICENSE
Gerald Augusto Corzo PΓ©rez IHE Delft β Hydroinformatics Department of Coastal & Urban Risk & Resilience
@software{corzo2025errors,
author = {Corzo PΓ©rez, Gerald Augusto},
title = {TS-ErrorsAnalysis: Hydrological Time Series Error Analysis},
year = {2025},
publisher = {GitHub},
url = {https://github.com/corzogac/TS-ErrorsAnalysis}
}- π Check DEPLOYMENT.md for deployment issues
- π Open an issue
- π§ Contact the author
Made with β€οΈ for the hydrology community