Skip to content

hackfest-dev/Hackfest25-23

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RedactLy.AI

A document redaction system that helps protect sensitive information in your documents using AI-powered redaction techniques.

🏗️ Architecture Overview

Backend Architecture (server/)

The backend is built with Flask and consists of several key components:

Core Components (server/src/)

  1. app.py - Main Application Entry Point

    • Handles all HTTP routes and API endpoints
    • Manages file uploads and document processing
    • Implements email notifications
    • Key endpoints:
      • /email/send - Sends notification emails
      • /document/add - Handles document uploads
      • /documents - Lists all documents
      • /document/hash/<hash> - Retrieves documents by hash
      • /structured - Processes structured data
      • /redact - Handles document redaction
  2. redaction_service.py

    • Core redaction logic implementation
    • Handles PDF processing and text extraction
    • Manages redaction patterns and rules
  3. ocr_redaction.py

    • OCR (Optical Character Recognition) implementation
    • Processes scanned documents
    • Extracts text from images within PDFs
  4. ollamahandler.py

    • Integration with Ollama AI model
    • Handles AI-powered text analysis
    • Manages model interactions and responses
  5. preprocessor.py

    • Document preprocessing utilities
    • Text cleaning and normalization
    • Format conversion helpers
  6. auto_emailer.py

    • Email notification system
    • Template management
    • Email sending utilities
  7. config.py

    • Configuration management
    • Environment variables
    • System settings
  8. model.py

    • Database models
    • Data structures
    • Schema definitions

Database Structure (server/database/)

  • SQLite database implementation
  • Document storage and retrieval
  • Hash management for documents

Storage Directories

  • temp_uploads/ - Temporary file storage
  • document_storage/ - Permanent document storage

Frontend Architecture (client/)

The frontend is built with React, TypeScript, and Vite, featuring a modern component-based architecture.

Core Components (client/src/)

  1. App.tsx - Root Component

    • Application routing
    • Theme management
    • Global state setup
    • Toast notifications
  2. Components Directory (components/)

    • Reusable UI components
    • Theme toggle
    • Form elements
    • Layout components
  3. Pages Directory (pages/)

    • Route-based components
    • Main application views
    • Error pages
  4. Hooks Directory (hooks/)

    • Custom React hooks
    • API integration hooks
    • State management hooks
  5. Types Directory (types/)

    • TypeScript type definitions
    • Interface declarations
    • Type utilities
  6. Lib Directory (lib/)

    • Utility functions
    • API clients
    • Helper functions

🚀 Getting Started

Prerequisites

  • Docker
  • Docker Compose
  • Ollama

Exposing Ollama

Ollama running with llama3.2:latest default model.

Running with Docker

  1. Clone the repository:
git clone [your-repo-url]
cd Hackfest25-23
  1. Start the application:
docker-compose up --build

The application will be available at:

📝 API Documentation

Document Management

  1. Upload Document
POST /document/add
Content-Type: multipart/form-data
Body:
  - file: PDF file
  - email: [email protected]
  1. List Documents
GET /documents?[email protected]
  1. Get Document by Hash
GET /document/hash/<hash>
  1. Process Document
POST /redact
Content-Type: multipart/form-data
Body:
  - files: PDF file(s)
  - method: redaction method

Email Notifications

POST /email/send
Content-Type: application/json
Body:
{
  "email": "[email protected]",
  "subject": "Document Verification",
  "contents": "Please verify the redacted document"
}

🔐 Security Features

  • File upload validation
  • Secure file storage
  • Hash-based document retrieval
  • Rate limiting
  • CORS protection
  • Input sanitization

🛠️ Development Guidelines

Backend Development

  1. Follow PEP 8 style guide
  2. Add docstrings to all functions
  3. Implement error handling
  4. Write unit tests for new features

Frontend Development

  1. Use TypeScript for type safety
  2. Follow React best practices
  3. Implement responsive design
  4. Maintain component reusability

📄 License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •