A comprehensive COBOL analysis platform with AI-powered code understanding, dependency mapping, and knowledge management capabilities.
- File Upload & Processing: Upload individual COBOL files or ZIP archives
- Code Analysis: Parse COBOL programs and extract structure, dependencies, and complexity metrics
- AI Chat Interface: Ask questions about your COBOL code using AI
- Analytics Dashboard: View complexity metrics, dependency graphs, and code statistics
- Dependency Visualization: Interactive network graphs showing program relationships
- Search & Discovery: Find programs by content, dependencies, or patterns
- Python 3.11 or higher
- PostgreSQL database
- Git
git clone <your-repository-url>
cd cobol-analysis-platform# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Install PostgreSQL (varies by OS)
# Create database
createdb cobol_analysis
# Set environment variable
export DATABASE_URL="postgresql://username:password@localhost/cobol_analysis"docker run --name cobol-postgres -e POSTGRES_DB=cobol_analysis -e POSTGRES_USER=cobol -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:13
export DATABASE_URL="postgresql://cobol:password@localhost:5432/cobol_analysis"Create a .env file in the project root:
# Database
DATABASE_URL=postgresql://username:password@localhost/cobol_analysis
# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True
SESSION_SECRET=your-secret-key-change-in-production
# Optional: AI Features (provide if you want AI chat functionality)
OPENAI_API_KEY=your-openai-api-key-here
# Optional: Advanced Features
WEAVIATE_URL=http://localhost:8080
COGNEE_API_KEY=your-cognee-api-key
CUSTOM_LLM_ENDPOINT=your-custom-llm-endpoint
CUSTOM_LLM_TOKEN=your-custom-llm-token# Run database migrations
python -c "from app import app, db; app.app_context().push(); db.create_all(); print('Database initialized')"# Development server
python main.py
# Or using Gunicorn (production-like)
gunicorn --bind 0.0.0.0:5000 --reload main:appThe application will be available at: http://localhost:5000
cobol-analysis-platform/
├── app.py # Flask application factory
├── main.py # Application entry point
├── models.py # Database models
├── routes.py # URL routes and handlers
├── config.py # Configuration settings
├── cobol_parser.py # COBOL file parsing logic
├── utils.py # Utility functions
├── analytics_service.py # Analytics and reporting
├── database_setup.py # Database configuration
├── knowledge.py # Knowledge management
├── llm_integration.py # AI/LLM integration
├── ingest.py # Data ingestion pipeline
├── static/ # CSS, JavaScript, assets
├── templates/ # HTML templates
├── uploads/ # File upload directory
└── requirements.txt # Python dependencies
- Navigate to the Upload page
- Drag and drop COBOL files (.cob, .cbl, .cobol, .cpy) or ZIP archives
- Files are automatically parsed and stored in the database
- Visit the Analysis page to view parsed programs
- See program structure, complexity metrics, and dependencies
- Search for specific programs or patterns
- Go to the AI Chat page
- Ask questions about your COBOL code
- Try commands like:
- "dependencies of PROGRAM-NAME"
- "explain PROGRAM-NAME"
- "find similar to [code pattern]"
- "what does [code] do?"
- Check the Analytics dashboard for:
- Complexity distribution
- Dependency graphs
- Code statistics
- Refactoring opportunities
- Use the Dependencies page to visualize program relationships
- Interactive network graph shows how programs connect
POST /api/search- Search programsGET /api/program/<id>- Get program detailsPOST /api/rebuild-knowledge-graph- Rebuild knowledge graphGET /api/analytics/overview- Get analytics overviewGET /api/analytics/relationships- Get relationship analysis
# Check PostgreSQL is running
pg_isready
# Test connection
psql $DATABASE_URL -c "SELECT 1;"# Reinstall packages
pip install --upgrade -r requirements.txt# Check uploads directory exists and is writable
mkdir -p uploads
chmod 755 uploads- Ensure
OPENAI_API_KEYis set in environment - Check API key validity
- Review application logs for detailed error messages
- Update models in
models.py - Add routes in
routes.py - Create templates in
templates/ - Add static assets in
static/
# After model changes
python -c "from app import app, db; app.app_context().push(); db.create_all()"# Install test dependencies
pip install pytest pytest-flask
# Run tests
pytestFLASK_ENV=production
FLASK_DEBUG=False
SESSION_SECRET=strong-random-secret-key
DATABASE_URL=postgresql://user:pass@host:port/db# Build image
docker build -t cobol-analysis .
# Run container
docker run -p 5000:5000 -e DATABASE_URL=$DATABASE_URL cobol-analysisgunicorn --bind 0.0.0.0:5000 --workers 4 main:appFor issues and questions:
- Check the application logs for error details
- Verify all environment variables are set correctly
- Ensure database connectivity
- Check file permissions for uploads directory
This project is licensed under the MIT License.