How akhildharmavarapu/bug_prediction_from_code works
The product is a bug-risk assessment application with two input paths: source code is analyzed into software metrics, while users can also submit metrics directly; both paths feed a Random Forest prediction and a risk-oriented report. The graph includes the documented model-training capability and the richer frontend/src UI alongside the parallel frontend app. Several backend and UI relationships are supported by excerpts; documented API/model behavior uses the README where implementation details were not shown.
Main entry points: main.py FastAPI routes · src/App.js Application workflow · frontend/App.js Application workflow · train_model.py Train classifier
Components 20
Model training
- Train classifier
train_model.py - KC1 metrics data
data/kc1_clean.csv - Serialized classifier
model/model.pkl - Feature names
model/feature_names.pkl
Analysis and prediction API
- FastAPI routes
backend/main.py - Code metrics extraction
backend/code_analyzer.py - Prediction utilities
backend/utils.py
Current React interface
- Application workflow
frontend/src/App.js - API URL configuration
frontend/src/config.js - Code input
frontend/src/components/CodeInput.js - Metrics entry
frontend/src/components/MetricsInput.js - Analysis results
frontend/src/components/AnalysisResult.js - Prediction results
frontend/src/components/PredictionResult.js - Risk breakdown
frontend/src/components/RiskBreakdown.js
Parallel React interface
- Application workflow
frontend/App.js - Code input
frontend/components/CodeInput.js - Metrics entry
frontend/components/MetricsInput.js - Analysis results
frontend/components/AnalysisResult.js - Prediction results
frontend/components/PredictionResult.js
Other components
- Developer
Connections 21
- Developer → Train classifier: trains
README.md - KC1 metrics data → Train classifier: supplies data
README.md - Train classifier → Serialized classifier: saves model
README.md - Train classifier → Feature names: saves features
README.md - Application workflow → Code input: renders
frontend/src/App.js - Application workflow → Metrics entry: renders
frontend/src/App.js - Application workflow → Analysis results: renders
frontend/src/App.js - Application workflow → Prediction results: renders
frontend/src/App.js - Application workflow → API URL configuration: uses URL
frontend/src/App.js - Application workflow → FastAPI routes: requests analysis and prediction
frontend/src/App.js - Metrics entry → FastAPI routes: requests analysis
frontend/src/components/MetricsInput.js - Prediction results → Risk breakdown: renders
frontend/src/components/PredictionResult.js - FastAPI routes → Code metrics extraction: extracts metrics
backend/main.py - FastAPI routes → Serialized classifier: loads and predicts
README.md - FastAPI routes → Feature names: loads features
README.md - FastAPI routes → Prediction utilities: uses helpers
- Application workflow → Code input: renders
frontend/App.js - Application workflow → Metrics entry: renders
frontend/App.js - Application workflow → Analysis results: renders
frontend/App.js - Application workflow → Prediction results: renders
frontend/App.js - Application workflow → FastAPI routes: requests analysis and prediction
frontend/App.js