Application Overview

v1.0

AI-Powered Document Processing System

TransferLog PHP is an intelligent document processing application that uses artificial intelligence to automatically extract structured data from educational documents (PDFs and Excel files) and generate professional receipts.

Key Features

AI Processing

OpenAI GPT integration for intelligent data extraction

Multi-Format Support

Process PDF and Excel documents seamlessly

Automated Processing

Background processing with real-time status updates

Processing Pipeline

1. Document Upload

Secure file upload with validation

2. Text Extraction

Extract readable text from PDFs/Excel

3. AI Analysis

OpenAI GPT processes chunks for structured data

4. Data Merging

Combine results into final dataset

5. Receipt Generation

Create professional Excel receipts

System Requirements

  • PHP: 8.1 or higher
  • Database: MySQL 5.7+
  • Storage: 500MB+ free space
  • OpenAI API: Valid API key required

Installation & Setup

Automated Installation

The easiest way to install TransferLog PHP is using the automated installer:

# Download and extract the application cd /path/to/web/root/ unzip transferlog-php.zip # Run the automated installer php install.php

The installer will:

Manual Installation

If you prefer manual setup:

Step 1: Database Setup
# Create database mysql -u root -p CREATE DATABASE transferlog_db; GRANT ALL PRIVILEGES ON transferlog_db.* TO 'transferlog_user'@'localhost' IDENTIFIED BY 'your_password'; FLUSH PRIVILEGES; EXIT; # Import schema mysql -u transferlog_user -p transferlog_db < database/database.sql
Step 2: Configuration

Edit config/database.php with your database credentials:

return [ 'host' => 'localhost', 'dbname' => 'transferlog_db', 'username' => 'transferlog_user', 'password' => 'your_password' ];
Step 3: OpenAI Setup

Add your OpenAI API key to config/config.php:

'openai' => [ 'api_key' => 'your-openai-api-key-here' ]
Step 4: Permissions
chmod 755 uploads/ receipts_generated/ logs/ temp/
Step 5: Run Migrations
php migrate.php run

Installation Complete!

Access your application at: https://yourdomain.com/transferlog-php/

Getting Started

Logging In

Access the application login page and use your credentials:

Default Admin Account:
  • Username: admin
  • Password: admin123

Change the default password after first login!

Navigation

After login, you'll see the main dashboard with:

  • Upload: Upload new documents
  • Jobs: Monitor processing status
  • Results: View extracted data
  • Receipts: Download generated receipts

Uploading Documents

Supported File Types

PDF Files
  • Scanned documents
  • Text-based PDFs
  • Up to 50MB per file
  • OCR support for scanned content
Excel Files (.xlsx, .xls)
  • Structured spreadsheets
  • Educational data tables
  • Up to 50MB per file
  • Multiple worksheet support

Upload Process

1. Navigate to Upload Page

Click "Upload" in the main navigation or go to /upload

2. Select File

Choose your PDF or Excel file using the file picker

3. Add Description (Optional)

Provide a description to help identify the document

4. Click Upload

The system will validate and queue your file for processing

5. Monitor Progress

Check the Jobs page to see processing status

Upload Guidelines

  • File Size: Maximum 50MB per file
  • Content: Educational documents with school/distribution data
  • Format: Clear, readable documents work best
  • Language: Portuguese content optimized

Processing Pipeline

TransferLog PHP uses a sophisticated multi-stage processing pipeline:

Stage 1: Text Extraction

Extract readable text from PDF/Excel files

Stage 2: Document Chunking

Split text into manageable chunks for AI processing

Stage 3: AI Analysis

OpenAI GPT extracts structured educational data

Stage 4: Result Merging

Combine all chunk results into final dataset

Stage 5: Receipt Generation

Create professional Excel receipts automatically

Processing Time

Typical processing times:

Background Processing

All processing happens automatically in the background. You can upload multiple files and check their status anytime from the Jobs page.

Viewing Results

Accessing Results

Navigate to the "Results" page to view processed documents:

Results List
  • Job ID: Unique identifier for each processing job
  • Original Filename: Name of uploaded file
  • Status: Processing status (pending, processing, completed)
  • Created Date: When the job was submitted
  • Actions: View details, download data
Result Details

Click "View" to see extracted data:

  • Schools: List of educational institutions found
  • Modalities: Teaching programs and student counts
  • Distribution Data: Weekly food distribution amounts
  • Supplier Info: Provider and CNPJ information
  • Metadata: Additional document information

Exporting Data

From the results page, you can:

Data Quality

The AI processing includes confidence scores and validation to ensure data accuracy. Review results before using in production.

Managing Receipts

Receipt Overview

TransferLog PHP automatically generates professional Excel receipts for each school found in your documents.

Receipt Features
  • Professional Format: Pre-designed Excel template
  • Per School: Individual receipt for each school
  • Complete Data: All distribution information included
  • Portuguese Formatting: Localized dates and formatting
Receipt Contents
  • School Information: Name, address, regional
  • Distribution Details: Products, quantities, modalities
  • Supplier Data: Provider name and CNPJ
  • Weekly Breakdown: Distribution per week
  • Official Formatting: Ready for official use

Finding Receipts

Use the Receipts page to:

Automatic Generation

Receipts are generated automatically:

Receipt Storage

Generated receipts are stored in the receipts_generated/ directory and are permanently available for download.

Troubleshooting

Upload Issues

Problem Solution
"File too large" error Check PHP upload limits in php.ini (max 50MB)
"Invalid file type" error Only PDF and Excel files (.pdf, .xlsx, .xls) are supported
Upload hangs or fails Check server timeout settings and network connection

Processing Issues

Problem Solution
Job stuck in "processing" Check background workers are running (cron jobs)
OpenAI API errors Verify API key is valid and has sufficient credits
Processing takes too long Large documents may take 30+ minutes to process
No results generated Check document content is readable and contains educational data

Database Issues

Problem Solution
Database connection failed Check credentials in config/database.php
Migration errors Run php migrate.php status to check migration state
Permission denied Ensure web server can write to required directories

Receipt Issues

Problem Solution
No receipts generated Ensure job completed successfully and receipt worker is running
Receipt download fails Check file permissions on receipts_generated/ directory
Receipt has wrong data Review source document and AI extraction results

Getting Help

If you encounter issues not covered here:

  • Check the logs/ directory for error messages
  • Review the application logs for detailed error information
  • Contact system administrator with specific error messages

Technical Details

System Architecture

TransferLog PHP uses a modern PHP application architecture:

Backend Components
  • PHP 8.1+: Core application logic
  • MySQL 5.7+: Data persistence
  • OpenAI API: AI processing engine
  • PhpSpreadsheet: Excel file handling
  • Monolog: Logging system
Processing Workers
  • worker.php: File processing and chunking
  • chunk_worker.php: AI analysis of text chunks
  • merger.php: Result aggregation
  • generate_receipts_new.php: Receipt creation

Database Schema

The application uses 9 core tables:

Table Purpose
users User authentication and sessions
files Uploaded document metadata
jobs Processing job tracking
chunks Document text chunks for AI processing
chunk_results AI processing results per chunk
results Final merged processing results
migrations Database schema change tracking
system_config Application configuration settings

AI Processing Details

The system uses OpenAI GPT models for intelligent data extraction:

Security Features

Background Processing

The application uses cron jobs for automated processing:

# Recommended cron configuration * * * * * /usr/bin/php /path/to/auto_run_workers.php # Every minute */5 * * * * /usr/bin/php /path/to/generate_receipts_new.php # Every 5 minutes

This ensures continuous processing without manual intervention.