Skip to content

Public Home

Nick edited this page Mar 10, 2026 · 1 revision

PATAS - Pattern-Adaptive Anti-Spam System

Automatically discovers spam patterns and creates blocking rules


🎯 What is PATAS?

PATAS is a system that automatically analyzes your messages, finds similar spam patterns, and creates blocking rules that can be immediately used in your system.

The Problem PATAS Solves

Before PATAS:

  • ❌ Moderators manually review thousands of complaints
  • ❌ Blocking rules are written manually and quickly become outdated
  • ❌ New spam patterns emerge faster than they can be blocked
  • ❌ No understanding of why messages are similar

With PATAS:

  • βœ… Automatically groups similar spam messages
  • βœ… Explains why messages are similar
  • βœ… Creates ready-to-use SQL queries for blocking
  • βœ… Works 24/7, never tires, never misses patterns

πŸš€ Quick Start

1. Try the CLI Demo (Simplified Version)

Want to quickly understand how PATAS works?

Try our educational CLI demo β€” a simplified version that demonstrates the basic concept:

# Install from GitHub Release
pip install patas_demo_cli-0.1.0-py3-none-any.whl

# Or from Git
pip install git+https://github.com/KikuAI-Lab/PATAS.git#subdirectory=apps/demo-cli

# Usage
patas-demo analyze

⚠️ Important: This is a simplified version for educational purposes. See CLI Demo for details.

2. Try the Full Demo

Interactive demo β€” drag and drop a file with messages and see pattern analysis:

πŸ‘‰ Run Demo

3. Use the API

If you're a developer, integrate PATAS via the API:

# Send a batch of messages
curl -X POST https://api.patas.com/api/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"id": "1", "text": "Buy now! http://spam.com", "is_spam": true},
      {"id": "2", "text": "Click here: http://spam.com", "is_spam": true}
    ],
    "run_mining": true
  }'

Result:

{
  "patterns": [
    {
      "group_size": 2,
      "similarity_reason": "Messages contain the same suspicious URL: http://spam.com",
      "sql_query": "SELECT id FROM reports WHERE message_content LIKE '%http://spam.com%'"
    }
  ]
}

πŸ“š Documentation

For Developers

General Documents

Specialized Topics


🎯 Key Features

Pattern Discovery

  • Automatically identifies spam patterns from your data
  • Supports multiple pattern types (URLs, keywords, signatures, semantic)
  • Uses LLM for intelligent pattern recognition (optional)

Safe Rule Lifecycle

  • Candidate β†’ Shadow β†’ Active β†’ Deprecated
  • Shadow evaluation prevents false positives
  • Automatic rollback for degrading rules

Metrics & Evaluation

  • Tracks precision, recall, coverage
  • Monitors false positives
  • Performance metrics for each rule

Production-Ready

  • RESTful API for integration
  • Batch processing for large datasets
  • Configurable aggressiveness profiles (conservative/balanced/aggressive)

πŸ“Š API Endpoints

PATAS provides 9 RESTful endpoints:

  1. GET /api/v1/health β€” Health check
  2. POST /api/v1/messages/ingest β€” Message ingestion
  3. POST /api/v1/patterns/mine β€” Run pattern mining
  4. GET /api/v1/patterns β€” List patterns
  5. GET /api/v1/rules β€” List rules
  6. POST /api/v1/rules/eval-shadow β€” Evaluate shadow rules
  7. POST /api/v1/rules/promote β€” Promote/deprecate rules
  8. GET /api/v1/rules/export β€” Export active rules
  9. POST /api/v1/analyze ⭐ β€” Batch analysis (main endpoint)

See API Reference for details.


πŸ’» CLI Commands

PATAS provides 7 CLI commands:

  • patas ingest-logs β€” Ingest from external API or storage
  • patas mine-patterns β€” Run pattern mining
  • patas eval-rules β€” Evaluate shadow rules
  • patas promote-rules β€” Promote and monitor rules
  • patas safety-eval β€” Safety evaluation
  • patas demo-telegram β€” Demo for Telegram engineers
  • patas explain-rule β€” Explain a rule with examples

πŸ”’ Security

  • SQL injection protection
  • Whitelist for tables/columns
  • Input data validation
  • PII redaction
  • Privacy modes (STANDARD/STRICT)

πŸ“„ License

MIT License β€” see LICENSE


🀝 Contributing

We welcome contributions! See CONTRIBUTING for details.


Version: 2.0.0
Status: Production Ready

Clone this wiki locally