Skip to content

GiacomoSaccaggi/ProjectCompass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ProjectCompass

Analysis catalog, execution engine, and data exploration platform.

Overview

ProjectCompass is a Python-based tool for teams that produce data analyses. It solves three problems that emerge after the analytical work is done:

  1. Organization โ€” a tag-based catalog of all analyses with metadata, documentation, and version tracking
  2. Execution โ€” a unified environment to run structured analyses consistently, with scheduling
  3. Exploration โ€” SQL queries on local datasets via DuckDB, with visualization and LLM-powered chat

Features

Feature Description
๐Ÿ“‚ Catalog Tag-based analysis repository with search, filter, and pagination
๐Ÿ” Data Explorer SQL queries on CSV/SQLite via DuckDB
๐Ÿ“Š RAWGraphs Visualization Custom chart builder with 30+ chart types, drag-and-drop mapping, visual options, SVG/PNG export
โš™๏ธ Execution Engine Run structured analyses with dynamic forms and physical outputs
โฐ Scheduler Schedule analyses with cron/interval triggers (APScheduler + SQLite persistence)
๐Ÿค– AI Chat Ask questions about your data in natural language (Ollama)
๐Ÿ”— REST API JSON endpoints for all catalog, data, and query operations
๐Ÿณ Docker One-command deployment with Ollama LLM service

Quick Start with Docker

The fastest way to run ProjectCompass โ€” no cloning or building required:

# Download the compose file
curl -O https://raw.githubusercontent.com/GiacomoSaccaggi/ProjectCompass/main/docker-compose.public.yml

# Start
docker compose -f docker-compose.public.yml up -d

# Open browser
open http://localhost:8080

To enable AI chat (optional):

docker exec ollama ollama pull qwen3:0.6b
docker exec ollama ollama pull nomic-embed-text

To update to the latest version:

docker compose -f docker-compose.public.yml pull
docker compose -f docker-compose.public.yml up -d

Local Development

git clone https://github.com/GiacomoSaccaggi/ProjectCompass.git
cd ProjectCompass
uv sync

cp .env.example .env
# Edit .env with your settings

uv run python app.py

The app is available at http://127.0.0.1:5000

Running Tests

uv run pytest -v

Linting

uv run ruff check .
uv run ruff check --fix .  # auto-fix

Docker (Development)

To build and run from source:

docker compose up -d

This uses docker-compose.yml which builds the image locally. Services: ProjectCompass on :8080, Ollama on :11434.

See DOCKER.md for volumes, environment variables, health checks, and production settings.


Architecture

ProjectCompass/
โ”œโ”€โ”€ app.py                  # Application factory (Flask + APScheduler)
โ”œโ”€โ”€ config.py               # Configuration from environment
โ”œโ”€โ”€ logging_config.py       # Unified structured logging
โ”œโ”€โ”€ basefun.py              # Core ProjectCompass class
โ”œโ”€โ”€ blueprints/
โ”‚   โ”œโ”€โ”€ auth.py             # Authentication (hashed passwords, sessions)
โ”‚   โ”œโ”€โ”€ catalog.py          # Analysis CRUD, search, filter, scheduling
โ”‚   โ”œโ”€โ”€ data.py             # Query runner, data upload, RAWGraphs
โ”‚   โ”œโ”€โ”€ agent.py            # LLM chat with sandboxed execution
โ”‚   โ””โ”€โ”€ api.py              # REST API (JSON endpoints)
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ analysis_utils.py   # Analysis metadata management
โ”‚   โ”œโ”€โ”€ data_utils.py       # DuckDB SQL, file operations
โ”‚   โ”œโ”€โ”€ html_utils.py       # Template utilities
โ”‚   โ””โ”€โ”€ agent_utils.py      # LLM agent (lazy-loaded, sandboxed)
โ”œโ”€โ”€ templates/              # Jinja2 HTML templates
โ”œโ”€โ”€ static/                 # CSS, JS, images, fonts
โ”œโ”€โ”€ tests/                  # pytest test suite
โ”œโ”€โ”€ Analyses/               # Analysis storage (file-based)
โ”œโ”€โ”€ Saved_data/             # Uploaded datasets
โ”œโ”€โ”€ Saved_queries/          # Saved SQL queries
โ””โ”€โ”€ scheduler_jobs.db       # APScheduler job persistence (SQLite)

Tech Stack

  • Backend: Flask 3.0, Gunicorn, Python 3.13
  • Data: DuckDB (in-memory SQL on CSV), pandas
  • Visualization: RAWGraphs via CDN (@rawgraphs/rawgraphs-core + @rawgraphs/rawgraphs-charts)
  • Scheduling: APScheduler with SQLite persistence
  • AI: Ollama + qwen3 (optional, lazy-loaded)
  • Frontend: W3.CSS, Chart.js, jQuery
  • Security: werkzeug password hashing, AST-validated code sandbox, CORS
  • CI/CD: GitHub Actions (ruff + pytest on tags), Docker image auto-published to ghcr.io

Configuration

All configuration is via environment variables (.env file):

Variable Default Description
SECRET_KEY random Flask session encryption key
ADMIN_USERNAME admin Login username
ADMIN_PASSWORD_HASH (empty) Werkzeug-hashed password
PORT 5000 Server port
FLASK_DEBUG False Debug mode
USE_GITLAB_REPO False GitLab integration
OLLAMA_HOST http://localhost:11434 Ollama LLM endpoint
ALLOWED_ORIGINS * CORS allowed origins

Generate a password hash

uv run python -c "from werkzeug.security import generate_password_hash; print(generate_password_hash('your-password'))"

REST API

All endpoints return JSON. Authentication is session-based (same as web UI).

Method Endpoint Description
GET /api/health Health check
GET /api/analyses List analyses (supports ?q=, ?product=, ?owner=, ?page=, ?per_page=)
GET /api/analyses/<name> Get single analysis details
GET /api/data List available datasets
GET /api/data/<name>/preview?limit=10 Preview dataset rows
POST /api/query Execute SQL query ({"sql": "SELECT ..."})
GET /health Application health check

Example

# List all analyses
curl http://localhost:8080/api/analyses

# Search analyses
curl http://localhost:8080/api/analyses?q=marketing&product=Research

# Query data
curl -X POST http://localhost:8080/api/query \
  -H "Content-Type: application/json" \
  -d '{"sql": "SELECT * FROM wine_quality LIMIT 5"}'

Web Routes

Route Description
/ Dashboard with statistics
/overview Project documentation page
/analysis Analysis catalog with search/filter
/load_analysis/ Create or edit an analysis
/create_investigations Run structured analysis with dynamic form
/outputs/ View analysis outputs (per run, with delete)
/schedules/ View and manage scheduled analyses
/query_runner/ SQL query editor
/all_data/ Browse uploaded datasets
/upload_data/ Upload new data files
/rawgraphs RAWGraphs visualization (30+ chart types)
/graph_analysis/ Open query results in RAWGraphs
/chat AI data assistant
/todo Notes/todo page

Structured Analyses & Scheduling

Create analyses that can be run on-demand or scheduled:

Analyses/My Analysis/
โ”œโ”€โ”€ metadata.yaml                          # Catalog metadata
โ”œโ”€โ”€ readme.md                              # Description
โ”œโ”€โ”€ output_versions.yaml                   # Version tracking
โ””โ”€โ”€ analysis/
    โ”œโ”€โ”€ metadata_automatic_report.yaml     # Form definition (inputs)
    โ””โ”€โ”€ structured_analysis_main.py        # Execution script (run function)

Schedule options: Every day at HH:MM, Every hour, Every Monday, Every Friday, Custom cron expression.

Jobs persist across restarts via SQLite.


Contributing

See CONTRIBUTING.md for development workflow, code style, and testing guidelines.


Security

  • Authentication: Session-based with werkzeug-hashed passwords
  • Code Execution: AST-validated sandbox blocks import, open(), exec(), eval()
  • CORS: Restricted to configured origins for API routes
  • Secrets: Environment variables, never in code or YAML
  • Input Sanitization: HTML cleaning on query editor input

License

Copyright ยฉ2024 ProjectCompass. All rights reserved.


ProjectCompass โ€” Organization Is Everythingยฎ

About

Analysis catalog, execution engine, and data exploration platform. Organize analyses with tags and metadata, run them on schedule via APScheduler, query local datasets with DuckDB SQL, visualize with RAWGraphs (30+ chart types), and chat with your data using Ollama LLMs. Flask + Docker.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors