compliance / USEME.MD
lucifer7210's picture
Upload 2 files
820abda verified
# Indian Financial Compliance System - Usage Guide
## Overview
The Indian Financial Compliance System is a comprehensive tool for analyzing financial data of Indian companies against regulatory compliance requirements. It consists of a FastAPI backend and a Streamlit frontend.
## Prerequisites
- Python 3.8+
- API key for Swarms API (set in environment variables)
## Setup Instructions
### 1. Clone the Repository
```bash
git clone <repository-url>
cd indian-compliance-system
```
### 2. Install Dependencies
```bash
# Create virtual environment
python -m venv venv
# Activate virtual environment (Windows)
venv\Scripts\activate
# Activate virtual environment (Linux/Mac)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
```
### 3. Environment Configuration
Create a `.env` file in the root directory:
```env
SWARMS_API_KEY=your_swarms_api_key_here
```
### 4. Run the Backend (FastAPI)
```bash
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```
The API will be available at `http://localhost:8000` with documentation at `http://localhost:8000/docs`.
### 5. Run the Frontend (Streamlit)
```bash
streamlit run streamlit_app.py
```
The Streamlit app will be available at `http://localhost:8501`.
## API Endpoints
### 1. Get Stock Data
**Endpoint:** `POST /api/v1/stock-data`
**Request Body:**
```json
{
"symbol": "RELIANCE"
}
```
**Response:**
```json
{
"success": true,
"data": { ... },
"formatted_data": "COMPANY INFORMATION: ..."
}
```
### 2. Run Compliance Analysis
**Endpoint:** `POST /api/v1/compliance-analysis`
**Request Body:**
```json
{
"financial_data": "Balance Sheet as at 31st March 2023: ...",
"company_info": "Public Limited Company in the Oil & Gas sector...",
"data_source": "NSE Listed Company (Live Data)",
"accounting_standards": "Indian Accounting Standards (Ind AS)",
"regulatory_frameworks": [
"Companies Act 2013",
"SEBI LODR Regulations"
]
}
```
**Response:**
```json
{
"success": true,
"result": {
"response": "Compliance analysis completed successfully...",
"analysis_details": { ... }
}
}
```
### 3. Generate CSV Report
**Endpoint:** `POST /api/v1/generate-csv`
**Request Body:**
```json
{
"data_source": "NSE Listed Company (Live Data)",
"company_info": "Public Limited Company in the Oil & Gas sector...",
"accounting_standards": "Indian Accounting Standards (Ind AS)",
"regulatory_frameworks": [
"Companies Act 2013",
"SEBI LODR Regulations"
],
"result": {
"response": "Compliance analysis completed successfully...",
"analysis_details": { ... }
}
}
```
**Response:** Returns a downloadable CSV file.
### 4. Get Popular Stocks
**Endpoint:** `GET /api/v1/popular-stocks`
**Response:**
```json
{
"stocks": ["RELIANCE", "TATA", "INFY", ...]
}
```
## Example Usage
### Using curl to Test Endpoints
1. **Get Stock Data:**
```bash
curl -X POST "http://localhost:8000/api/v1/stock-data" \
-H "Content-Type: application/json" \
-d '{"symbol": "RELIANCE"}'
```
2. **Run Compliance Analysis:**
```bash
curl -X POST "http://localhost:8000/api/v1/compliance-analysis" \
-H "Content-Type: application/json" \
-d '{
"financial_data": "Balance Sheet as at 31st March 2023: ...",
"company_info": "Public Limited Company in the Oil & Gas sector...",
"data_source": "NSE Listed Company (Live Data)",
"accounting_standards": "Indian Accounting Standards (Ind AS)",
"regulatory_frameworks": ["Companies Act 2013", "SEBI LODR Regulations"]
}'
```
3. **Generate CSV Report:**
```bash
curl -X POST "http://localhost:8000/api/v1/generate-csv" \
-H "Content-Type: application/json" \
-d '{
"data_source": "NSE Listed Company (Live Data)",
"company_info": "Public Limited Company in the Oil & Gas sector...",
"accounting_standards": "Indian Accounting Standards (Ind AS)",
"regulatory_frameworks": ["Companies Act 2013", "SEBI LODR Regulations"],
"result": {
"response": "Compliance analysis completed successfully...",
"analysis_details": { ... }
}
}' \
--output compliance_report.csv
```
## Features
1. **Live NSE Data Fetching:** Get real-time financial data for Indian companies listed on NSE
2. **Multi-Agent Analysis:** Three specialized AI agents analyze different aspects of compliance:
- Documentation Analyzer
- Accounting Standards Expert
- Regulatory Compliance Specialist
3. **Comprehensive Reporting:** Generate detailed compliance reports in CSV format
4. **Risk Assessment:** Visualize and assess regulatory risks specific to Indian companies
5. **Historical Analysis:** Track and compare compliance analyses over time
## Supported Regulations
- Indian Accounting Standards (Ind AS)
- Companies Act 2013
- SEBI LODR Regulations
- SEBI ICDR Regulations
- RBI Guidelines
- FEMA Regulations
- Income Tax Act 1961
- GST Regulations
- RERA (Real Estate)
- Insurance Regulatory Act
- Banking Regulation Act
## Troubleshooting
1. **API Key Issues:** Ensure your SWARMS_API_KEY is correctly set in the .env file
2. **Port Conflicts:** Change ports if 8000 or 8501 are already in use
3. **Dependency Issues:** Reinstall requirements if facing module import errors
4. **Data Fetching Errors:** Check internet connection and stock symbol validity
## Support
For issues or questions:
1. Check the API documentation at `http://localhost:8000/docs`
2. Verify environment variables are correctly set
3. Ensure all dependencies are installed
## License
This project is for educational and demonstration purposes. Ensure you comply with the terms of service of the Swarms API and any data providers when using this system in production.