Skip to content
cmxauPublic

About

Web-based AutoML workspace for no-code ML. Upload a dataset, get AI-powered analysis and cleaning suggestions, build pipelines visually, train models, and export results. Built with Next.js, FastAPI, and scikit-learn.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ML-AutoPilot

AI-assisted machine learning workspace for students, analysts, and no-code ML beginners.

Upload a dataset β†’ AI analyzes it β†’ clean it β†’ build a pipeline β†’ train a model β†’ download results.

Core rule: AI suggests β†’ system validates β†’ user approves β†’ engine executes. The AI layer never mutates data directly.


Table of Contents


Features

Area What it does
Dataset upload Upload CSV, XLSX, or JSON (up to 100 MB). Async profiling computes row count, column types, null rates, min/max/mean per column.
AI analysis GPT-4o-mini infers task type (classification vs regression), recommends target column, flags data quality issues, ranks model candidates.
EDA Distribution histograms, correlation matrix, missing value heatmap. AI writes plain-English commentary on each chart.
Cleaning 9 transform types (drop column, fill nulls, rename, cast type, filter rows, normalize, one-hot encode, clip outliers, drop duplicates). Natural-language command interface. Every action goes through preview β†’ confirm β†’ apply. Each applied transform creates an immutable new dataset version.
Pipeline builder React Flow drag-and-drop canvas. 8 node types: Input, Clean, Transform, Feature Engineering, Split, Train, Evaluate, Export. DAG validation before execute.
Model training 6 model types via scikit-learn/XGBoost: Logistic Regression, Random Forest, XGBoost (classification); Linear Regression, Random Forest Regressor, XGBoost Regressor. 80/20 train/test split. Async Celery worker. Metrics: accuracy, F1, precision, recall, ROC-AUC (classification); RΒ², RMSE, MAE, MSE (regression).
Feature importance Extracted from tree models via feature_importances_, from linear models via abs(coef_). Rendered as horizontal bar chart.
AI experiment summary GPT-4o-mini explains results, gives assessment (excellent/good/fair/poor), suggests 2–3 improvements. Loaded on demand.
Model download Presigned MinIO URL (5-minute TTL). Direct browser download of trained .joblib model file.
Error UX Backend 422 validation errors (bad target column, column count >500) surfaced in UI. Failed training runs show error detail.

Tech Stack

Layer Technology Version
Frontend Next.js (App Router) 14
Language TypeScript 5
Styling Tailwind CSS 3
Server state TanStack Query v5
Client state Zustand β€”
Charts Recharts β€”
Pipeline canvas React Flow β€”
Backend framework FastAPI 0.111
Backend language Python 3.11
ORM SQLAlchemy 2.0
Migrations Alembic 1.13
Schema validation Pydantic 2.7
Database PostgreSQL 16
Object storage MinIO (S3-compatible) β€”
Job queue broker Redis 7
Task queue Celery 5.4
ML scikit-learn 1.5
ML (boosting) XGBoost 2.0
Model serialization joblib 1.4
Data processing Pandas 2.2
AI OpenAI API (GPT-4o-mini) β€”
Auth JWT (python-jose) + bcrypt (passlib) β€”

Architecture Overview

Browser (Next.js)
    β”‚
    β”‚ HTTP/REST  Authorization: Bearer <jwt>
    β–Ό
FastAPI (port 8000)
    β”œβ”€β”€ Auth middleware β†’ validates JWT on every protected route
    β”œβ”€β”€ Routers β†’ thin HTTP layer, delegates to services
    β”œβ”€β”€ Services β†’ business logic (no HTTP concerns)
    β”‚    β”œβ”€β”€ storage_service.py  β†’ MinIO (boto3)
    β”‚    β”œβ”€β”€ ai_service.py       β†’ OpenAI
    β”‚    β”œβ”€β”€ training_service.py β†’ pure sklearn/XGBoost functions (unit tested)
    β”‚    └── ...
    β”œβ”€β”€ SQLAlchemy β†’ PostgreSQL (sync, psycopg2)
    └── Celery task dispatch β†’ Redis
            β”‚
            β–Ό
    Celery Worker (same Docker image as backend)
        β”œβ”€β”€ profile_dataset_task   β†’ runs pandas profiling, writes DatasetProfile to DB
        β”œβ”€β”€ ai_analysis_task       β†’ calls OpenAI, writes AIInsight to DB
        β”œβ”€β”€ eda_task               β†’ computes chart data, writes EDAResult to DB
        β”œβ”€β”€ cleaning_worker_task   β†’ applies transform, writes new DatasetVersion to MinIO + DB
        └── train_model_task       β†’ trains model, writes TrainingRun + metrics + artifact to DB/MinIO

Object Storage (MinIO, port 9000)
    Bucket: automl-files
    β”œβ”€β”€ datasets/{project_id}/{uuid}/{filename}          raw uploads and cleaned versions
    └── artifacts/{project_id}/models/{run_id}/model.joblib

Key design decisions:

  • Every heavy operation (profiling, AI analysis, EDA, cleaning, training) is async. The API returns a job_id immediately. The frontend polls GET /jobs/{jobId} or waits for data to appear.
  • Dataset versioning: raw upload = version 0. Every applied cleaning action creates a new immutable version. Training runs reference a specific version.
  • The AI layer only produces JSON proposals. It never writes to the database directly.
  • The Celery worker defers all imports inside the task function body to avoid forked-process import issues.

Prerequisites

Docker setup (recommended)

  • Docker Desktop 4.x or later (includes Docker Compose v2)
  • OpenAI API key β€” required for AI features (dataset analysis, EDA commentary, experiment summary)

That's it. Python and Node.js are not required on the host.

Native setup

  • Python 3.11 (exact β€” python3.11 --version)
  • Node.js 20+ (node --version)
  • Docker (for Postgres, Redis, MinIO only)
  • OpenAI API key

Environment Setup

The project uses a single .env file at the repo root. This file is read by:

  • The backend FastAPI app (via pydantic-settings)
  • docker compose (to resolve ${VARIABLE} substitutions in docker-compose.yml)
  • The Celery worker (same process as backend, same .env)

The .env file is gitignored β€” it is never committed. .env.example is the source of truth for what variables are needed.

Step 1: Copy the example file

cp .env.example .env

Step 2: Set your OpenAI API key

Open .env in any editor and replace the placeholder:

OPENAI_API_KEY=sk-your-openai-api-key-here

with your real key:

OPENAI_API_KEY=sk-proj-abc123...

Get a key at https://platform.openai.com/api-keys

All other values in .env work as-is for local development. The only variable you must change is OPENAI_API_KEY.

The complete .env for local development looks like this:

DATABASE_URL=postgresql://automl:automl@localhost:5432/automl
REDIS_URL=redis://localhost:6379/0
MINIO_ENDPOINT=localhost:9000
MINIO_PUBLIC_ENDPOINT=localhost:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_BUCKET=automl-files
MINIO_USE_SSL=false
SECRET_KEY=change-me-in-production-min-32-chars
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
ENVIRONMENT=development
MAX_UPLOAD_SIZE_MB=100
OPENAI_API_KEY=sk-your-key-here
OPENAI_MODEL=gpt-4o-mini
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1

Running Locally β€” Docker (Recommended)

All 5 services (Postgres, Redis, MinIO, backend, frontend) and the Celery worker run in containers. Nothing needs to be installed on the host beyond Docker.

Step 1: Complete environment setup

Follow Environment Setup above. The .env file must exist with your OPENAI_API_KEY before starting Docker services.

Step 2: Start infrastructure services

Start the three stateful services first and wait for them to be healthy before proceeding:

docker compose up -d postgres redis minio

Check health status (all three should show healthy):

docker compose ps

Expected output:

NAME                STATUS
automl-minio-1   Up 30 seconds (healthy)
automl-postgres-1 Up 30 seconds (healthy)
automl-redis-1    Up 30 seconds (healthy)

If any service shows starting instead of healthy, wait another 10–15 seconds and check again. MinIO takes the longest.

Step 3: Run database migrations

This creates all 10 tables (users, projects, datasets, dataset_versions, dataset_profiles, dataset_column_profiles, cleaning_actions, pipelines, training_runs, artifacts, etc.):

make migrate

This runs alembic upgrade head inside the backend container, applying all 5 migration files in order (001 β†’ 005).

You should see output like:

INFO  [alembic.runtime.migration] Running upgrade  -> 001, initial schema
INFO  [alembic.runtime.migration] Running upgrade 001 -> 002, add ai_insights and eda_results
INFO  [alembic.runtime.migration] Running upgrade 002 -> 003, add cleaning and pipeline tables
INFO  [alembic.runtime.migration] Running upgrade 003 -> 004, add training tables
INFO  [alembic.runtime.migration] Running upgrade 004 -> 005, add error_message to training_runs

Step 4: Create the MinIO bucket

MinIO is running but the storage bucket does not yet exist. Create it:

make create-bucket

This sets up a automl-files bucket. All dataset uploads and trained model artifacts are stored here.

Note: The backend also attempts to create this bucket automatically at startup (via storage.ensure_bucket() in lifespan). The make create-bucket step is a safety net in case the automatic creation fails.

Step 5: Start all services

docker compose up -d

This starts the backend API server, the Celery worker, and the Next.js frontend.

Wait about 20 seconds for the frontend to compile (Next.js dev mode compiles on first request):

docker compose logs -f frontend
# Wait until you see: "Ready - started server on 0.0.0.0:3000"

Step 6: Open the app

Service URL Notes
Frontend http://localhost:3000 Main application
Backend API http://localhost:8000 FastAPI
OpenAPI docs http://localhost:8000/docs Interactive API explorer
ReDoc http://localhost:8000/redoc Alternative API docs
MinIO console http://localhost:9001 Object storage browser

MinIO console credentials: minioadmin / minioadmin

Register a new account at http://localhost:3000/register, then log in.

Useful commands

# View logs from backend and Celery worker
make logs

# View logs from a specific service
docker compose logs -f backend
docker compose logs -f worker
docker compose logs -f frontend

# Open a shell inside the running backend container
make shell-backend

# Run all backend tests inside the container (requires running Postgres)
make test-backend

# Stop all services (data is preserved in Docker volumes)
make down

# Stop all services and delete all data (volumes)
docker compose down -v

# Rebuild images after changing requirements.txt or package.json
docker compose build
docker compose up -d

How Docker Compose handles environment variables

docker-compose.yml hardcodes most values for local development. The only variable it reads from your .env file is OPENAI_API_KEY, using the ${OPENAI_API_KEY} syntax. Docker Compose automatically reads .env from the project root.

This means: you only need the .env file for OPENAI_API_KEY when using Docker. All database, Redis, and MinIO credentials are hardcoded in docker-compose.yml for local dev.


Running Locally β€” Native (No Docker for App Services)

Run Postgres, Redis, and MinIO via Docker. Run the backend API, Celery worker, and frontend directly on the host. Best for active backend or frontend development.

Step 1: Start infrastructure only

docker compose up -d postgres redis minio

Verify all three are healthy:

docker compose ps

Step 2: Configure environment

cp .env.example .env

Edit .env:

  • Set OPENAI_API_KEY to your real key
  • The default DATABASE_URL, REDIS_URL, MINIO_ENDPOINT all point to localhost which is correct for native mode

Step 3: Backend setup

cd backend

# Create and activate Python virtual environment
python3.11 -m venv venv
source venv/bin/activate        # macOS/Linux
# venv\Scripts\activate         # Windows

# Install all dependencies
pip install -r requirements.txt

Run database migrations:

# Still inside backend/ with venv active
alembic upgrade head

Start the API server:

uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

The --reload flag restarts the server automatically when Python files change.

You should see:

INFO:     Started server process
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000

Step 4: Start the Celery worker

Open a second terminal, activate the same virtualenv, and start the worker:

cd backend
source venv/bin/activate

celery -A app.workers.celery_app worker --loglevel=info -Q profiling,training,export

The worker handles all async jobs: profiling, AI analysis, EDA, cleaning transforms, and model training. Without the worker running, uploads will appear to hang.

You should see:

[tasks]
  . app.workers.profiling_worker.profile_dataset_task
  . app.workers.ai_worker.run_ai_analysis_task
  . app.workers.eda_worker.compute_eda_task
  . app.workers.cleaning_worker.apply_cleaning_task
  . app.workers.training_worker.train_model_task

[celery@hostname] ready.

Step 5: Frontend setup

Open a third terminal:

cd frontend
npm install
npm run dev

The Next.js dev server starts on http://localhost:3000.

Step 6: Create the MinIO bucket (one-time)

The backend will attempt to auto-create the bucket on startup, but if it fails:

Option A: Via MinIO web console

  1. Open http://localhost:9001
  2. Log in: minioadmin / minioadmin
  3. Click "Create Bucket"
  4. Name: automl-files
  5. Click "Create Bucket"

Option B: Via mc CLI (if installed)

mc alias set local http://localhost:9000 minioadmin minioadmin
mc mb local/automl-files

Environment Variables Reference

These variables must be present in .env (native setup) or are hardcoded / passed via docker-compose.yml (Docker setup).

Variable Required Default Description
DATABASE_URL Yes postgresql://automl:automl@localhost:5432/automl PostgreSQL connection string. In Docker, this points to the postgres service hostname.
REDIS_URL Yes redis://localhost:6379/0 Redis connection string. Used by Celery as both broker and result backend. In Docker, points to the redis service hostname.
MINIO_ENDPOINT Yes localhost:9000 MinIO address without protocol. Used by the backend and worker for server-side operations (upload, download, bucket creation). In Docker, this is minio:9000 (internal hostname).
MINIO_PUBLIC_ENDPOINT Yes localhost:9000 MinIO address used when generating presigned download URLs for the browser. Must be reachable from the user's browser. In Docker local dev, this is localhost:9000. In production, set to your public CDN or domain (e.g., storage.yourdomain.com). If empty, falls back to MINIO_ENDPOINT.
MINIO_ACCESS_KEY Yes minioadmin MinIO access key (username).
MINIO_SECRET_KEY Yes minioadmin MinIO secret key (password).
MINIO_BUCKET No automl-files Storage bucket name. Created automatically at backend startup.
MINIO_USE_SSL No false Set to true if MinIO is behind HTTPS.
SECRET_KEY Yes β€” JWT signing key. Must be at least 32 characters. Never use the default in production. Generate one: openssl rand -hex 32
ALGORITHM No HS256 JWT signing algorithm.
ACCESS_TOKEN_EXPIRE_MINUTES No 1440 JWT token lifetime (24 hours).
ENVIRONMENT No development Used for logging and behavior flags.
MAX_UPLOAD_SIZE_MB No 100 Maximum dataset file size. Files larger than this are rejected at upload.
OPENAI_API_KEY Yes* β€” OpenAI API key. Required for AI analysis, cleaning suggestions, EDA commentary, and experiment summary. Without it, AI features return empty results but the rest of the app works. Get a key at platform.openai.com
OPENAI_MODEL No gpt-4o-mini OpenAI model to use for all AI features.
NEXT_PUBLIC_API_URL Yes http://localhost:8000/api/v1 The URL the browser uses to reach the backend API. Must be reachable from the user's browser. In Docker, the frontend container uses this to build API requests that run in the browser (not in Node.js).

MINIO_ENDPOINT vs MINIO_PUBLIC_ENDPOINT: These solve a Docker networking problem. Inside Docker, the backend talks to MinIO at minio:9000 (Docker internal hostname). But presigned download URLs are opened by the user's browser, which doesn't know about minio:9000. MINIO_PUBLIC_ENDPOINT=localhost:9000 tells the backend to rewrite the host in presigned URLs before returning them to the frontend, so the browser can actually reach MinIO.


Running Tests

Backend unit tests (no database required)

These tests cover pure business logic functions and do not need Postgres running:

cd backend
source venv/bin/activate   # or activate your venv

pytest tests/test_training_service.py -v     # 20 tests: prepare_features, build_model, metrics, feature importance
pytest tests/test_profiling_service.py -v    # profiling pure functions
pytest tests/test_cleaning_service.py -v     # 9 transform types
pytest tests/test_eda_service.py -v          # chart data computation
pytest tests/test_ai_service.py -v           # OpenAI response parsing (mocked)
pytest tests/test_pipeline_service.py -v     # DAG validation

Run all pure unit tests at once:

pytest tests/test_training_service.py tests/test_profiling_service.py \
       tests/test_cleaning_service.py tests/test_eda_service.py \
       tests/test_ai_service.py tests/test_pipeline_service.py -v

Expected: 77 tests, all passing, in ~3 seconds.

Backend integration tests (requires Postgres)

These tests require a running PostgreSQL instance. They use a separate test database automl_test (defined in conftest.py):

# Create the test database first (one-time)
docker compose exec postgres createdb -U automl automl_test
# or natively:
psql -U automl -h localhost -c "CREATE DATABASE automl_test;"

# Run integration tests
pytest tests/test_auth.py tests/test_projects.py tests/test_datasets.py -v

Run all tests with coverage:

pytest tests/ -v --cov=app --cov-report=term-missing

Via Docker (no test database setup needed, uses the main DB):

make test-backend

Frontend type checking

cd frontend
npx tsc --noEmit   # 0 errors expected

Frontend build check

cd frontend
npm run build      # production build, catches any compilation errors

Project Structure

automl/
β”‚
β”œβ”€β”€ .env                          ← your local config (gitignored, copy from .env.example)
β”œβ”€β”€ .env.example                  ← template with all required variables
β”œβ”€β”€ docker-compose.yml            ← all 6 services: postgres, redis, minio, backend, worker, frontend
β”œβ”€β”€ Makefile                      ← shortcuts: up, down, logs, migrate, test-backend, shell-backend
β”œβ”€β”€ .gitignore
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ Dockerfile                ← python:3.11-slim, installs requirements, copies app
β”‚   β”œβ”€β”€ requirements.txt          ← all Python dependencies pinned to exact versions
β”‚   β”œβ”€β”€ alembic.ini               ← points Alembic to migrations/ directory
β”‚   β”‚
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py               ← FastAPI app factory; mounts all routers; creates MinIO bucket at startup
β”‚   β”‚   β”œβ”€β”€ config.py             ← pydantic-settings Settings class; reads from .env
β”‚   β”‚   β”œβ”€β”€ database.py           ← SQLAlchemy engine (sync, psycopg2); get_db() session dependency
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ security.py       ← create_access_token(), verify_token(), hash_password(), verify_password()
β”‚   β”‚   β”‚   └── deps.py           ← get_current_user() FastAPI dependency (validates JWT, loads User from DB)
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ models/               ← SQLAlchemy ORM models (mapped_column / Mapped style)
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py           ← Base, TimestampMixin (created_at, updated_at), new_uuid()
β”‚   β”‚   β”‚   β”œβ”€β”€ user.py           ← User (id, email, hashed_password, is_active)
β”‚   β”‚   β”‚   β”œβ”€β”€ project.py        ← Project (id, user_id, name, description)
β”‚   β”‚   β”‚   β”œβ”€β”€ dataset.py        ← Dataset (id, project_id, name, file_format, status) + DatasetVersion
β”‚   β”‚   β”‚   β”œβ”€β”€ profile.py        ← DatasetProfile + DatasetColumnProfile (per-column stats)
β”‚   β”‚   β”‚   β”œβ”€β”€ job.py            ← Job (id, project_id, job_type, status, input_json, output_json, error_message)
β”‚   β”‚   β”‚   β”œβ”€β”€ ai_insight.py     ← AIInsight (analysis results, model recommendations)
β”‚   β”‚   β”‚   β”œβ”€β”€ eda_result.py     ← EDAResult (chart data as JSONB)
β”‚   β”‚   β”‚   β”œβ”€β”€ cleaning.py       ← CleaningAction + CleaningExecution
β”‚   β”‚   β”‚   β”œβ”€β”€ pipeline.py       ← Pipeline + PipelineNode + PipelineEdge
β”‚   β”‚   β”‚   └── training.py       ← TrainingRun + TrainingMetric + Artifact
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ schemas/              ← Pydantic v2 request/response models
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py
β”‚   β”‚   β”‚   β”œβ”€β”€ project.py
β”‚   β”‚   β”‚   β”œβ”€β”€ dataset.py
β”‚   β”‚   β”‚   β”œβ”€β”€ cleaning.py
β”‚   β”‚   β”‚   β”œβ”€β”€ pipeline.py
β”‚   β”‚   β”‚   └── training.py
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ routers/              ← FastAPI route handlers (thin HTTP layer only)
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py           ← POST /auth/register, POST /auth/login, GET /auth/me
β”‚   β”‚   β”‚   β”œβ”€β”€ projects.py       ← POST/GET/PATCH/DELETE /projects, GET /projects/{id}
β”‚   β”‚   β”‚   β”œβ”€β”€ datasets.py       ← POST /datasets/upload, GET /datasets/{id}/preview, /profile, /versions
β”‚   β”‚   β”‚   β”œβ”€β”€ ai.py             ← POST /ai/datasets/{id}/analyze, GET /ai/datasets/{id}/insights
β”‚   β”‚   β”‚   β”œβ”€β”€ eda.py            ← GET /eda/datasets/{id}
β”‚   β”‚   β”‚   β”œβ”€β”€ cleaning.py       ← POST /cleaning/propose, /apply, GET /cleaning/actions
β”‚   β”‚   β”‚   β”œβ”€β”€ pipeline.py       ← POST/GET/PATCH /projects/{id}/pipelines, /validate, /execute
β”‚   β”‚   β”‚   β”œβ”€β”€ training.py       ← POST /training/start, GET /training/runs/{id}, /download, /metrics, /summary, POST /training/compare
β”‚   β”‚   β”‚   └── jobs.py           ← GET /jobs, GET /jobs/{id}
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ services/             ← Business logic. No FastAPI imports. No HTTP concerns.
β”‚   β”‚   β”‚   β”œβ”€β”€ auth_service.py   ← register_user(), authenticate_user()
β”‚   β”‚   β”‚   β”œβ”€β”€ project_service.py ← get_project() (with ownership check)
β”‚   β”‚   β”‚   β”œβ”€β”€ dataset_service.py ← create_dataset_with_version(), validate_extension()
β”‚   β”‚   β”‚   β”œβ”€β”€ storage_service.py ← StorageService: upload_file(), download_file(), get_presigned_url()
β”‚   β”‚   β”‚   β”œβ”€β”€ profiling_service.py ← profile_dataframe() β†’ pure pandas, no DB/network, unit tested
β”‚   β”‚   β”‚   β”œβ”€β”€ ai_service.py     ← OpenAI agents: analyze_dataset(), suggest_cleaning(), summarize_training_results()
β”‚   β”‚   β”‚   β”œβ”€β”€ eda_service.py    ← compute_eda() β†’ chart data as dicts, unit tested
β”‚   β”‚   β”‚   β”œβ”€β”€ cleaning_service.py ← apply_action() β†’ dispatches to 9 transform functions, unit tested
β”‚   β”‚   β”‚   β”œβ”€β”€ pipeline_service.py ← validate_dag() β†’ topological sort, cycle detection, unit tested
β”‚   β”‚   β”‚   └── training_service.py ← prepare_features(), build_model(), compute_*_metrics(), extract_feature_importance(), serialize_model() β€” all pure functions, unit tested
β”‚   β”‚   β”‚
β”‚   β”‚   └── workers/              ← Celery tasks. All imports deferred inside task bodies.
β”‚   β”‚       β”œβ”€β”€ celery_app.py     ← Celery instance; broker=Redis; queues: profiling, training, export
β”‚   β”‚       β”œβ”€β”€ profiling_worker.py ← profile_dataset_task(job_id): reads file from MinIO, runs profiling_service, writes DatasetProfile to DB
β”‚   β”‚       β”œβ”€β”€ ai_worker.py      ← run_ai_analysis_task(job_id): calls ai_service, writes AIInsight to DB
β”‚   β”‚       β”œβ”€β”€ eda_worker.py     ← compute_eda_task(job_id): calls eda_service, writes EDAResult to DB
β”‚   β”‚       β”œβ”€β”€ cleaning_worker.py ← apply_cleaning_task(job_id): reads version from MinIO, applies transform, writes new DatasetVersion
β”‚   β”‚       └── training_worker.py ← train_model_task(job_id): loads dataset, trains model, writes metrics + uploads .joblib to MinIO
β”‚   β”‚
β”‚   β”œβ”€β”€ migrations/
β”‚   β”‚   β”œβ”€β”€ env.py                ← Alembic env; imports all ORM models so autogenerate works
β”‚   β”‚   └── versions/
β”‚   β”‚       β”œβ”€β”€ 001_initial_schema.py         ← users, projects, datasets, dataset_versions, dataset_profiles, dataset_column_profiles, jobs
β”‚   β”‚       β”œβ”€β”€ 002_add_ai_insights_eda_results.py ← ai_insights, eda_results
β”‚   β”‚       β”œβ”€β”€ 003_add_cleaning_pipeline.py  ← cleaning_actions, cleaning_executions, pipelines, pipeline_nodes, pipeline_edges
β”‚   β”‚       β”œβ”€β”€ 004_add_training_tables.py    ← training_runs, training_metrics, artifacts
β”‚   β”‚       └── 005_add_training_run_error_message.py ← adds error_message column to training_runs
β”‚   β”‚
β”‚   └── tests/
β”‚       β”œβ”€β”€ conftest.py           ← session-scoped engine on automl_test DB; per-test transaction rollback
β”‚       β”œβ”€β”€ test_auth.py          ← register, login, JWT validation (integration)
β”‚       β”œβ”€β”€ test_projects.py      ← project CRUD (integration)
β”‚       β”œβ”€β”€ test_datasets.py      ← upload, profile, preview (integration)
β”‚       β”œβ”€β”€ test_profiling_service.py ← pure unit tests, no DB
β”‚       β”œβ”€β”€ test_cleaning_service.py  ← pure unit tests, no DB
β”‚       β”œβ”€β”€ test_eda_service.py       ← pure unit tests, no DB
β”‚       β”œβ”€β”€ test_ai_service.py        ← pure unit tests, no DB
β”‚       β”œβ”€β”€ test_pipeline_service.py  ← pure unit tests, no DB
β”‚       └── test_training_service.py  ← pure unit tests, no DB (20 tests)
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ Dockerfile                ← node:20-alpine, npm ci, EXPOSE 3000
β”‚   β”œβ”€β”€ next.config.mjs
β”‚   β”œβ”€β”€ tailwind.config.ts
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   β”œβ”€β”€ package.json
β”‚   β”‚
β”‚   └── src/
β”‚       β”œβ”€β”€ app/                  ← Next.js App Router pages
β”‚       β”‚   β”œβ”€β”€ layout.tsx        ← root layout; wraps with QueryClientProvider + AuthProvider
β”‚       β”‚   β”œβ”€β”€ (auth)/
β”‚       β”‚   β”‚   β”œβ”€β”€ login/page.tsx
β”‚       β”‚   β”‚   └── register/page.tsx
β”‚       β”‚   β”œβ”€β”€ dashboard/page.tsx ← project grid; lists all user projects
β”‚       β”‚   └── projects/[projectId]/
β”‚       β”‚       β”œβ”€β”€ page.tsx      ← project overview: dataset list, pipeline list, recent training runs
β”‚       β”‚       β”œβ”€β”€ datasets/
β”‚       β”‚       β”‚   β”œβ”€β”€ upload/page.tsx          ← file upload form
β”‚       β”‚       β”‚   └── [datasetId]/page.tsx     ← dataset workspace: 6 tabs (Profile, EDA, Clean, Train, Data Preview, Pipeline)
β”‚       β”‚       β”œβ”€β”€ pipelines/
β”‚       β”‚       β”‚   └── [pipelineId]/page.tsx    ← React Flow canvas
β”‚       β”‚       └── training/
β”‚       β”‚           β”œβ”€β”€ page.tsx                 ← training run list + start form
β”‚       β”‚           └── [runId]/page.tsx         ← run detail: metrics, feature importance chart, AI summary, download
β”‚       β”‚
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ layout/
β”‚       β”‚   β”‚   β”œβ”€β”€ AppShell.tsx  ← top nav + side nav wrapper
β”‚       β”‚   β”‚   β”œβ”€β”€ TopNav.tsx
β”‚       β”‚   β”‚   └── SideNav.tsx
β”‚       β”‚   β”œβ”€β”€ dataset/
β”‚       β”‚   β”‚   β”œβ”€β”€ DatasetUploadCard.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ PreviewTable.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ ProfileSummaryPanel.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ CleaningSuggestionList.tsx
β”‚       β”‚   β”‚   └── CleaningCommandBox.tsx       ← natural-language cleaning input
β”‚       β”‚   β”œβ”€β”€ ai/
β”‚       β”‚   β”‚   β”œβ”€β”€ AIInsightCard.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ AIAssistantSidebar.tsx
β”‚       β”‚   β”‚   └── ConfidenceBadge.tsx
β”‚       β”‚   β”œβ”€β”€ eda/
β”‚       β”‚   β”‚   β”œβ”€β”€ ChartCard.tsx
β”‚       β”‚   β”‚   β”œβ”€β”€ CorrelationMatrix.tsx
β”‚       β”‚   β”‚   └── MissingHeatmap.tsx
β”‚       β”‚   β”œβ”€β”€ pipeline/
β”‚       β”‚   β”‚   β”œβ”€β”€ PipelineCanvas.tsx           ← React Flow wrapper
β”‚       β”‚   β”‚   β”œβ”€β”€ NodePalette.tsx
β”‚       β”‚   β”‚   └── NodeInspector.tsx
β”‚       β”‚   β”œβ”€β”€ training/
β”‚       β”‚   β”‚   β”œβ”€β”€ MetricsCard.tsx              ← grid of metric values with color coding
β”‚       β”‚   β”‚   β”œβ”€β”€ FeatureImportanceChart.tsx   ← horizontal Recharts bar chart
β”‚       β”‚   β”‚   └── RunComparisonTable.tsx       ← side-by-side metrics for multiple runs
β”‚       β”‚   └── shared/
β”‚       β”‚       β”œβ”€β”€ JobStatusBadge.tsx           ← queued/running/succeeded/failed badge
β”‚       β”‚       └── ErrorBanner.tsx              ← dismissible red error banner
β”‚       β”‚
β”‚       └── lib/
β”‚           β”œβ”€β”€ api/
β”‚           β”‚   β”œβ”€β”€ client.ts     ← single axios instance; attaches Bearer token from localStorage; base URL from NEXT_PUBLIC_API_URL
β”‚           β”‚   β”œβ”€β”€ auth.ts       ← authApi: login(), register(), me()
β”‚           β”‚   β”œβ”€β”€ projects.ts   ← projectsApi: list(), get(), create(), update(), delete()
β”‚           β”‚   β”œβ”€β”€ datasets.ts   ← datasetsApi: upload(), list(), get(), preview(), profile(), versions()
β”‚           β”‚   β”œβ”€β”€ ai.ts         ← aiApi: analyze(), getInsights()
β”‚           β”‚   β”œβ”€β”€ eda.ts        ← edaApi: get()
β”‚           β”‚   β”œβ”€β”€ cleaning.ts   ← cleaningApi: propose(), apply(), listActions()
β”‚           β”‚   β”œβ”€β”€ pipeline.ts   ← pipelineApi: create(), get(), save(), validate(), execute()
β”‚           β”‚   └── training.ts   ← trainingApi: start(), get(), listForProject(), download(), compare(), getSummary()
β”‚           β”œβ”€β”€ hooks/
β”‚           β”‚   β”œβ”€β”€ useAuth.ts
β”‚           β”‚   β”œβ”€β”€ useProjects.ts
β”‚           β”‚   β”œβ”€β”€ useDatasets.ts
β”‚           β”‚   β”œβ”€β”€ useJobPoller.ts  ← polls GET /jobs/{id} every 2s while status is queued/running
β”‚           β”‚   β”œβ”€β”€ useAI.ts
β”‚           β”‚   β”œβ”€β”€ useEDA.ts
β”‚           β”‚   β”œβ”€β”€ useCleaning.ts
β”‚           β”‚   β”œβ”€β”€ usePipeline.ts
β”‚           β”‚   └── useTraining.ts   ← useTrainingRun polls every 3s while queued/running
β”‚           └── store/
β”‚               └── authStore.ts    ← Zustand: token + user stored in localStorage; hydrated on mount
β”‚
└── docs/
    β”œβ”€β”€ design/                   ← original design documents
    β”‚   β”œβ”€β”€ spec_doc.md           ← product requirements and user stories
    β”‚   β”œβ”€β”€ system_design.md      ← architecture decisions
    β”‚   β”œβ”€β”€ database_design.md    ← full schema with all fields, indexes, constraints
    β”‚   β”œβ”€β”€ api-spec.md           ← REST API contract
    β”‚   β”œβ”€β”€ ai_orchestration.md   ← AI agent roles and prompting strategy
    β”‚   β”œβ”€β”€ frontend_architecture.md ← component hierarchy and UX rules
    β”‚   └── implementation_plan.md ← phased build plan
    └── superpowers/
        β”œβ”€β”€ plans/                ← task-level implementation plans per phase
        └── specs/                ← phase design specs

API Reference

Base URL: http://localhost:8000/api/v1

All protected endpoints require: Authorization: Bearer <token>

Response envelope:

{ "success": true, "data": { ... } }

Error response:

{ "success": false, "detail": "Error message here" }

Async operations return immediately with a job_id. Poll GET /jobs/{jobId} until status is succeeded or failed.

Auth

Method Path Body Description
POST /auth/register {email, password} Create account. Returns {token, user}
POST /auth/login {email, password} Login. Returns {token, user}
GET /auth/me β€” Get current user

Projects

Method Path Description
POST /projects Create project
GET /projects List all user projects
GET /projects/{id} Get project
PATCH /projects/{id} Update name/description
DELETE /projects/{id} Delete project

Datasets

Method Path Description
POST /datasets/upload Upload file (multipart). Body: project_id + file. Returns {dataset_id, job_id}.
GET /projects/{id}/datasets List datasets for project
GET /datasets/{id} Get dataset metadata
GET /datasets/{id}/versions List all versions (v0 = raw, v1+ = after cleaning)
GET /datasets/{id}/preview First 100 rows of latest version as JSON
GET /datasets/{id}/profile Profiling results (column stats)

AI Analysis

Method Path Description
POST /ai/datasets/{id}/analyze Trigger AI analysis. Returns {job_id}.
GET /ai/datasets/{id}/insights Get analysis results (task type, target column, cleaning suggestions, model recommendations)

EDA

Method Path Description
POST /eda/datasets/{id}/compute Trigger EDA computation. Returns {job_id}.
GET /eda/datasets/{id} Get chart data (distributions, correlation matrix, missing heatmap)

Cleaning

Method Path Description
POST /cleaning/datasets/{id}/propose Propose a cleaning action (preview only, no data change). Body: {action_type, parameters}
POST /cleaning/actions/{id}/apply Apply an approved action. Creates new DatasetVersion. Returns {job_id}.
GET /cleaning/datasets/{id}/actions List all cleaning actions and their status

Pipelines

Method Path Description
POST /projects/{id}/pipelines Create pipeline
GET /projects/{id}/pipelines List pipelines
GET /pipelines/{id} Get pipeline with nodes and edges
PUT /pipelines/{id} Save pipeline (nodes + edges)
POST /pipelines/{id}/validate Validate DAG (checks for cycles, disconnected nodes, missing required ports)
POST /pipelines/{id}/execute Execute pipeline. Returns {job_id}.

Training

Method Path Description
POST /training/start Start training. Body: {dataset_version_id, model_type, target_column, task_type}. Validates target column exists before queuing. Returns {training_run_id, job_id}.
GET /projects/{id}/training/runs List all training runs for a project
GET /training/runs/{id} Get run with embedded metrics
GET /training/runs/{id}/metrics Get all metric records
GET /training/runs/{id}/feature-importance Get feature importance list (sorted descending)
GET /training/runs/{id}/summary Get AI experiment summary (calls OpenAI)
GET /training/runs/{id}/download Get presigned download URL for trained model .joblib file (5-minute TTL)
POST /training/compare Compare multiple runs. Body: {run_ids: [...]} (2–5 runs).

Jobs

Method Path Description
GET /jobs List all jobs for current user
GET /jobs/{id} Get job status: queued, running, succeeded, failed

Full interactive docs at http://localhost:8000/docs


Database Schema

5 migrations, 15 tables total.

users
└── projects
    β”œβ”€β”€ datasets
    β”‚   └── dataset_versions           ← v0 = raw upload; v1+ = post-cleaning
    β”‚       β”œβ”€β”€ dataset_profiles       ← async profiling results
    β”‚       β”‚   └── dataset_column_profiles  ← per-column stats
    β”‚       β”œβ”€β”€ cleaning_actions       ← proposed/approved/applied/rejected
    β”‚       β”‚   └── cleaning_executions
    β”‚       └── (referenced by training_runs)
    β”œβ”€β”€ pipelines
    β”‚   β”œβ”€β”€ pipeline_nodes
    β”‚   └── pipeline_edges
    β”œβ”€β”€ training_runs                  ← one per model training job
    β”‚   └── training_metrics           ← one row per metric (accuracy, f1, rmse, etc.)
    β”œβ”€β”€ artifacts                      ← model .joblib files stored in MinIO
    β”œβ”€β”€ jobs                           ← tracks all async operations
    └── ai_insights                    ← stores OpenAI analysis results

JSONB columns used for: profiling summaries, column profile distributions, AI metadata, cleaning parameters, pipeline node configs, model hyperparameters, feature importance lists.


Troubleshooting

Services won't start

# Check what's wrong
docker compose ps
docker compose logs postgres
docker compose logs redis
docker compose logs minio

Port conflicts: If 5432, 6379, 9000, 8000, or 3000 are in use on your machine, stop whatever is using them or edit the port mappings in docker-compose.yml.

"automl-files" bucket not found

The backend tries to create the bucket at startup but may fail if MinIO isn't ready yet. Run:

make create-bucket

Then restart the backend:

docker compose restart backend worker

AI features return empty / no suggestions

Check that OPENAI_API_KEY is set correctly in .env:

grep OPENAI_API_KEY .env

In Docker, the compose file reads this from the host shell environment. Verify it reached the container:

docker compose exec backend env | grep OPENAI

If empty, restart after setting the key:

docker compose up -d backend worker

Training jobs fail immediately

Check the worker logs:

docker compose logs worker

Common causes:

  • Target column name typo β€” the backend now validates this before queuing, but old runs may have failed silently
  • Dataset format issue β€” open the dataset workspace and check the preview tab
  • MinIO connectivity β€” verify make create-bucket succeeded

Model download button opens unreachable URL

This happens when MINIO_PUBLIC_ENDPOINT is not set. The presigned URL uses the internal Docker hostname minio:9000 which the browser can't reach.

Verify .env has:

MINIO_PUBLIC_ENDPOINT=localhost:9000

Then restart:

docker compose restart backend

Frontend shows "Network Error" or blank pages

Check NEXT_PUBLIC_API_URL in .env:

NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1

Verify the backend is running:

curl http://localhost:8000/health
# Expected: {"status": "ok"}

Database migration errors

If migrations fail (e.g., table already exists):

make shell-backend
alembic current       # see current revision
alembic history       # see all revisions
alembic upgrade head  # retry

To reset the database completely (destroys all data):

docker compose down -v     # removes volumes
docker compose up -d postgres redis minio
make migrate
make create-bucket

Build Phases

Phase Status Contents
Phase 1 βœ… Complete Auth, project management, dataset upload, async profiling, dataset workspace
Phase 2 βœ… Complete AI analysis (OpenAI gpt-4o-mini), EDA charts, AI sidebar
Phase 3A βœ… Complete Cleaning engine (9 transforms), NL command interface, preview/confirm/apply
Phase 3B βœ… Complete Pipeline builder (React Flow canvas, 8 node types, DAG validation)
Phase 4 βœ… Complete Model training (6 model types), metrics dashboard, feature importance, AI experiment summary
Phase 5 βœ… Complete Model download (presigned URL), input validation, frontend error UX

Known Limitations (MVP)

  • No SHAP explainability β€” feature importance (from feature_importances_ / coef_) is available; SHAP requires a separate worker pass
  • No hyperparameter tuning UI β€” sensible defaults are used for all model types
  • No cleaned dataset export β€” only the trained model artifact can be downloaded
  • Single train/test split β€” 80/20, no cross-validation
  • No rate limiting β€” not needed at local/demo scale
  • No audit log β€” job history is available but not a dedicated audit trail
  • CORS locked to localhost:3000 β€” change allow_origins in main.py for other origins

About

Web-based AutoML workspace for no-code ML. Upload a dataset, get AI-powered analysis and cleaning suggestions, build pipelines visually, train models, and export results. Built with Next.js, FastAPI, and scikit-learn.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages