Technical documentation and software tools for PMEGP project analysis
- Clone Repository:
git clone <repo-url> - Navigate to Scripts:
cd scripts - Install Dependencies:
pip install -r requirements.txt - Configure Analysis: Edit
../config.yml - Download Data:
python automation/pdf_downloader.py - Generate Reports: Choose analysis type and run corresponding script
Raw Data → Processing → Analysis → Report Generation → docs/ folder
- Python: Data processing (pandas, numpy, scipy)
- Visualization: matplotlib, plotly, seaborn
- PDF Processing: PyPDF2, pdfplumber
- Automation: requests, concurrent.futures
- Configuration: PyYAML
- Reports: Markdown with embedded visualizations
- Diagrams: SVG format (Excalidraw/Tldraw compatible)
- Data: CSV, JSON exports
- Charts: PNG, SVG, HTML interactive
| Script | Purpose | Usage |
|---|---|---|
pdf_downloader.py |
Download PMEGP project PDFs | python automation/pdf_downloader.py |
pdf_extractor.py |
Extract text and data from PDFs | python automation/pdf_extractor.py |
data_cleaner.py |
Clean and preprocess CSV data | python automation/data_cleaner.py |
| Script | Purpose | Input | Output |
|---|---|---|---|
industry_analyzer.py |
Sector-wise analysis | CSV + PDFs | Industry insights |
investment_analyzer.py |
Financial pattern analysis | Investment data | Financial reports |
geographic_analyzer.py |
Regional distribution | Location data | Geographic insights |
trend_analyzer.py |
Market trend analysis | Time-series data | Trend reports |
| Script | Purpose | Output Format |
|---|---|---|
chart_generator.py |
Statistical charts | PNG, SVG |
map_generator.py |
Geographic visualizations | HTML, SVG |
diagram_builder.py |
Process flowcharts | SVG (Excalidraw compatible) |
# Data Source
data_source:
csv_file: "scripts/data/source/projects_output_clean.csv"
pdf_base_url: "https://www.kviconline.gov.in/pmegp/pmegpweb/docs/commonprojectprofile/"
pdf_download_dir: "scripts/data/source/pdfs/"
# Investment Brackets (in INR)
investment_brackets:
micro: [0, 500000] # Up to 5L
small: [500001, 2500000] # 5L to 25L
medium: [2500001, 10000000] # 25L to 1Cr
large: [10000001, 50000000] # Above 1Cr
# Processing Settings
processing:
max_concurrent_downloads: 5
retry_attempts: 3
timeout_seconds: 30# Python 3.8+
python --version
# Required packages
pip install pandas numpy matplotlib plotly seaborn
pip install requests PyPDF2 pdfplumber pyyaml
pip install jupyter folium openpyxl# Navigate to scripts directory
cd scripts
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Verify installation
python -c "import pandas, numpy, matplotlib; print('Setup complete!')"#!/usr/bin/env python3
"""
PMEGP Analysis Script Template
"""
import pandas as pd
import yaml
from pathlib import Path
class PMEGPAnalyzer:
def __init__(self, config_path='config.yml'):
with open(config_path, 'r') as f:
self.config = yaml.safe_load(f)
def load_data(self):
"""Load and return project data"""
return pd.read_csv(self.config['data_source']['csv_file'])
def analyze(self):
"""Main analysis logic"""
df = self.load_data()
# Your analysis here
return results
def save_results(self, results, output_dir):
"""Save analysis results"""
Path(output_dir).mkdir(parents=True, exist_ok=True)
# Save your results
if __name__ == "__main__":
analyzer = PMEGPAnalyzer()
results = analyzer.analyze()
analyzer.save_results(results, "docs/my-analysis/")import matplotlib.pyplot as plt
import seaborn as sns
def create_analysis_chart(data, output_path):
"""Create and save analysis chart"""
plt.figure(figsize=(12, 8))
# Your visualization code
plt.savefig(output_path, dpi=300, bbox_inches='tight')
plt.close()
def create_svg_diagram(data, output_path):
"""Create SVG diagram compatible with Excalidraw"""
# SVG generation code
with open(output_path, 'w') as f:
f.write(svg_content)# Download all PDFs (production)
python automation/pdf_downloader.py
# Test with limited downloads
python automation/pdf_downloader.py --limit 10
# Check download status
python automation/pdf_downloader.py --status# Run complete industry analysis
python analysis/industry_analyzer.py
# Generate visualizations
python visualization/chart_generator.py --solution industry-analysis
# Create comprehensive report
python analysis/report_generator.py --template industry --solution industry-analysis# Data validation tests
python -m pytest tests/test_data_quality.py
# Analysis logic tests
python -m pytest tests/test_analysis_engines.py
# Integration tests
python -m pytest tests/test_full_pipeline.py# Code formatting
black scripts/
# Linting
flake8 scripts/
# Type checking
mypy scripts/mkdir -p ../docs/your-analysis-name
mkdir -p data/solutions/your-analysis-name/{processed-reports,insights,visualizations}# Use template from data/templates/
cp data/templates/analyzer_template.py analysis/your_analyzer.py
# Implement your analysis logic
# Test with sample data
# Generate outputs in ../docs/your-analysis-name/# Generate charts
python visualization/chart_generator.py --solution your-analysis-name
# Create SVG diagram
python visualization/diagram_builder.py --solution your-analysis-name- Add entry to main README.md table (in parent directory)
- Link to your analysis.md and diagrams.svg
- Update this developer README if needed
PDF Download Fails
# Check internet connection and retry
python automation/pdf_downloader.py --retry 5Analysis Script Crashes
# Validate data first
python automation/data_cleaner.py --validate
# Check logs
tail -f logs/analysis.logVisualization Not Generating
# Check matplotlib backend
python -c "import matplotlib; print(matplotlib.get_backend())"
# Install GUI backend if needed (for development)
pip install tkinter# Run with debug logging
export DEBUG=1
python scripts/analysis/your_analyzer.py- Follow PEP 8 for Python code
- Use type hints where possible
- Include docstrings for all functions
- Add logging for debugging
- Create feature branch:
git checkout -b feature/new-analysis - Develop and test your script
- Update documentation
- Submit PR with clear description
*_analyzer.py- Analysis engines*_generator.py- Output generators*_processor.py- Data processors*_downloader.py- Data collectors
For analysis report creation, see the main README
For project structure details, see SIMPLIFIED_STRUCTURE.md