# ai-admin-algorithm **Repository Path**: captainwilson/ai-admin-algorithm ## Basic Information - **Project Name**: ai-admin-algorithm - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-02 - **Last Updated**: 2026-01-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Financial Data Analysis API This service provides FastAPI endpoints for analyzing financial journal Excel files. ## Installation ```bash pip install -r requirements.txt ``` ## Running the Service ```bash python run.py ``` The API will be available at `http://localhost:6113` ## API Endpoints ### POST /analyze_journal Analyzes an uploaded Excel file containing financial journal data. **Request:** - Method: POST - Content-Type: multipart/form-data - Body: file (Excel file: .xlsx, .xls, or .csv) **Response:** ```json { "success": true, "data": { "expense_by_category": [ {"name": "Category1", "value": 1000.0}, {"name": "Category2", "value": 500.0} ], "income_by_category": [ {"name": "Category1", "value": 2000.0}, {"name": "Category2", "value": 1500.0} ], "timeline_data": { "dates": ["2024-01-01", "2024-01-02"], "expenses": [100.0, 200.0], "incomes": [500.0, 600.0], "capitals": [0.0, 0.0] } } } ``` ### GET /health Health check endpoint. **Response:** ```json { "status": "ok" } ``` ## Excel File Format The service automatically detects columns in the Excel file. It looks for: - **Date column**: Contains dates (columns named: date, 日期, 时间, time) - **Amount column**: Contains numeric amounts (columns named: amount, 金额, 收入, 支出) - **Category column**: Contains category descriptions (columns named: category, 类别, 分类, 项目, description, 描述, 摘要) - **Type column** (optional): Contains transaction type (expense/income/capital, 支出/收入/资本) If type column is not found, the service infers the type from: 1. The amount sign (negative = expense, positive = income) 2. Category name keywords (expense/income/capital related keywords) ## Notes - The service supports .xlsx, .xls, and .csv file formats - Date parsing is flexible and handles various date formats - Amounts are normalized (expenses are always positive values) - Categories are grouped and summed for visualization