# AI Powered MF Portfolio File Converter

Processes Indian mutual fund portfolio disclosure files from Excel to standardized text format. Uses AI-powered schema detection with multi-model validation, ISIN mapping enrichment, and cross-model discrepancy highlighting.

## Links
- App: https://mf.tigzig.com
- Docs: https://tigzig.com/app-documentation/mf-files-ai.html
- GitHub (Frontend): https://github.com/amararun/shared-mf-portfolio-allocation
- GitHub (Backend Proxy): https://github.com/amararun/shared-rtWebrtc-fastAPI-ephemeral

## Tags
mutual-funds, isin, ai-processing, fastapi

## Architecture

```
HTML/CSS/JS Frontend → FastAPI Proxy Server → OpenRouter → Multiple AI Models
                                                          ├── OpenAI GPT
                                                          ├── Google Gemini
                                                          └── Anthropic Claude
```

- Frontend: Single-page HTML/CSS/JavaScript with modular JS architecture
- Libraries: Tailwind CSS, XLSX.js (Excel reading), SQL.js, jsPDF
- Backend: FastAPI proxy server for AI model API calls via OpenRouter
- No database - all processing in-memory

## Features

- AI-powered schema detection from Excel files using dual AI models
- Cross-model validation comparing results from different AI providers
- Manual override for schema configuration when AI detection needs adjustment
- ISIN mapping enrichment with BSE/NSE symbols and standardized company names
- File Appender: Combine multiple text files maintaining headers
- File Transposer: Pivot holdings data by NSE symbol across schemes and dates
- Validation diagnostics with T-NAV comparisons, record counts, warning indicators
- Output formats: pipe-delimited, comma-separated, or tab-delimited

## Data Processing Flow

1. Excel file upload and sheet selection
2. AI-powered schema detection using dual models (primary + validation)
3. Data extraction with ISIN mapping enrichment from built-in mapping file
4. Cross-model validation and discrepancy highlighting
5. File generation with configurable delimiters

## Setup

```bash
# Frontend - serve from any web server
git clone https://github.com/amararun/shared-mf-portfolio-allocation.git
# Update RT_ENDPOINT in assets/js/config.js to point to your proxy server

# Backend proxy
git clone https://github.com/amararun/shared-rtWebrtc-fastAPI-ephemeral.git
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port $PORT
```

No environment variables required for frontend - all configuration in `config.js`. Backend needs OpenRouter API credentials.

## Sample Files
Test files available on Google Drive: https://drive.google.com/drive/u/1/folders/1by38u0925OKq0f7afCQG9pr521G4lGKR
Monthly disclosure files are from AMC (Asset Management Company) compliance sections.
