Skip to content

Quick Start

Nick edited this page Nov 18, 2025 · 4 revisions

Quick Start Guide

This guide will help you get PATAS up and running quickly.


Prerequisites

  • Python 3.10 or higher
  • SQLite (included) or PostgreSQL
  • Optional: OpenAI API key for semantic pattern mining

Installation

Using Poetry (Recommended)

# Clone repository
git clone https://github.com/kiku-jw/PATAS-core.git
cd PATAS-core

# Install dependencies
poetry install

# Activate virtual environment
poetry shell

Using pip

# Clone repository
git clone https://github.com/kiku-jw/PATAS-core.git
cd PATAS-core

# Install dependencies
pip install -e .

Configuration

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env with your settings:
# Database (SQLite by default)
DATABASE_URL=sqlite:///./data/patas.db

# Safety Profile
AGGRESSIVENESS_PROFILE=conservative

# LLM (optional, for semantic pattern mining)
LLM_PROVIDER=openai
OPENAI_API_KEY=your-key-here

See Configuration for complete configuration options.


Basic Usage

1. Ingest Messages

Load messages from logs or CSV:

# From Telegram logs (example)
patas ingest-logs --source=telegram --since-days=7

# From CSV file
patas ingest-logs --source=csv --input=spam_logs.csv

2. Discover Patterns

Run pattern mining to discover spam patterns:

patas mine-patterns

This will:

  • Analyze ingested messages
  • Discover recurring patterns
  • Generate candidate rules
  • Store patterns and rules in database

3. Evaluate Rules

Evaluate rules in shadow mode (safe, non-production):

patas eval-rules

This evaluates all shadow rules against historical data and computes metrics.

4. Promote Rules

Promote good rules to active status:

patas promote-rules

This promotes rules that meet safety thresholds based on your aggressiveness profile.


Telegram Integration

Run PoC (Proof of Concept)

patas-tg poc --input=examples/sample_telegram_logs.jsonl --out=./report

This will:

  • Load Telegram log format
  • Run pattern mining
  • Evaluate rules
  • Generate a report in the output directory

See Telegram Integration for detailed integration guide.


API Server

Start the API server:

# Using Poetry
poetry run patas-api

# Or directly
patas-api

# Or with uvicorn
uvicorn app.api.main:app --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000.

See API Quickstart for API usage examples.


Safety Evaluation

Before deploying to production, always run safety evaluation:

patas safety-eval

This validates all profiles against safety thresholds. Do not deploy if this command fails.


Next Steps


Troubleshooting

See Troubleshooting for common issues and solutions.

Clone this wiki locally