How hamzicodes/ids_project-srs_classification works
Purpose and Entry Points
Vertex IDS classifies software-requirement text as functional, non-functional (with NFR categories), or irrelevant. Main operational entry points are batch training via PROJECT/RUN_PIPELINE_TRAINING.py, browser testing via PROJECT/streamlit_ui.py, API serving via backend/app/main.py (or deployment wrapper run.py), and the Flutter client via vertex_app/lib/main.dart.
Training Pipeline
The numbered Python pipeline builds reproducible artifacts from CSV datasets. It trains an outlier gate, merges source data, filters irrelevant text, analyzes and cleans requirements, creates TF-IDF features, then trains/exports classifiers.
• PROJECT/0_Outlier_Training.py
• PROJECT/1_Load_and_Merge.py
• PROJECT/2_Outlier_Gate.py
• PROJECT/4_Data_Cleaning.py
• PROJECT/5_Feature_Engineering.py
• PROJECT/6_Model_Training_and_Export.py
Shared preprocessing/pipeline conventions reside in PROJECT/pipeline_common.py; input and intermediate datasets are persisted under DATASETS/.
Model and Artifact Boundary
Training outputs serialized scikit-learn-compatible artifacts consumed unchanged by UIs and APIs. The principal boundary is trained_models/: FR/NFR model, NFR-type model, vectorizer, labels, metadata, plus independent outlier models.
• trained_models/FR_NFRTrained_models/model_fr_nfr.pkl
• trained_models/FR_NFRTrained_models/vectorizer_combined.pkl
• trained_models/outlierTrained_model/outlier_classifier.pkl
Changing source data or cleaning/vectorization requires retraining so artifact schemas remain compatible with serving.
Inference Service
FastAPI is the server-side inference contract. backend/app/main.py exposes health, prediction, and model-information endpoints; request/response shapes are defined in backend/app/schemas.py. backend/app/model_loader.py loads the persisted artifacts, while backend/app/predictor.py applies item splitting, outlier checks, preprocessing/vectorization, FR/NFR prediction, NFR-category prediction, and result grouping.
The repository also contains a deployment-adjacent backend copy at vertex_app/backend/app/main.py; it should be treated as a synchronization risk if backend logic evolves.
Prediction Flow
Input text may contain multiple requirement items. Each item crosses an eligibility boundary: outlier rules/model can return “neither”; valid items are normalized and vectorized; the FR/NFR model determines top-level class; NFR items receive one or more category predictions. Results are grouped into functional, non-functional, neither, item details, and aggregate counts before returning through API/UI boundaries.
Client Layers
The Streamlit interface directly exercises trained inference behavior for quick manual testing: PROJECT/streamlit_ui.py. The Flutter application is the primary product client, with routing/app composition in vertex_app/lib/app/app.dart and vertex_app/lib/app/router.dart. Its chat feature owns API/repository/controller flow:
• vertex_app/lib/features/chat/data/chat_api.dart
• vertex_app/lib/features/chat/data/chat_repository.dart
• vertex_app/lib/features/chat/presentation/controller/chat_controller.dart
It also exposes model information, diagnostics, CSV export, and PDF sharing.
Runtime and Infrastructure
Python runtime uses Pandas/NumPy/SciPy, NLTK, scikit-learn, Streamlit, FastAPI/Uvicorn, and Pydantic; dependency scopes are in PROJECT/requirements.txt and backend/requirements.txt. Flutter/Dart provides Android, iOS, desktop, and web clients, configured by vertex_app/pubspec.yaml. No database or external ML service is indicated: persistence is CSV datasets and local pickle/NPZ artifacts, while client-to-server communication is HTTP with a configurable API base URL.
Main entry points: RUN_PIPELINE_TRAINING.py Training runner · 6_Model_Training_and_Export.py Model training and export · main.py FastAPI endpoints · 4_Data_Cleaning.py Data cleaning
Components 24
Training pipeline
Builds compatible local inference artifacts from CSV data.
- Training runner
PROJECT/RUN_PIPELINE_TRAINING.py - CSV datasets · Input and intermediate datasets persist locally.
DATASETS/combined_stage1.csv - Outlier training
PROJECT/0_Outlier_Training.py - Load and merge
PROJECT/1_Load_and_Merge.py - Outlier gate · Filters irrelevant requirement text.
PROJECT/2_Outlier_Gate.py - Data cleaning
PROJECT/4_Data_Cleaning.py - TF-IDF features
PROJECT/5_Feature_Engineering.py - Model training and export
PROJECT/6_Model_Training_and_Export.py - Pipeline conventions
PROJECT/pipeline_common.py - Trained artifacts · Serving requires schemas compatible with cleaning and vectorization.
trained_models/FR_NFRTrained_models/model_metadata.pkl - FR/NFR classifier
trained_models/FR_NFRTrained_models/model_fr_nfr.pkl - Combined vectorizer
trained_models/FR_NFRTrained_models/vectorizer_combined.pkl - Outlier classifier
trained_models/outlierTrained_model/outlier_classifier.pkl
Inference service
FastAPI contract and item-level prediction flow.
- FastAPI endpoints · Provides health, prediction, and model-information endpoints.
backend/app/main.py - API schemas
backend/app/schemas.py - Artifact loader
backend/app/model_loader.py - Prediction pipeline · Splits items, gates outliers, classifies FR/NFR and NFR categories, then groups results.
backend/app/predictor.py - Deployment backend copy · A separate backend copy can diverge from the primary service.
vertex_app/backend/app/main.py
Client applications
Manual and product-facing inference clients.
- Streamlit tester · Direct manual interface for trained inference behavior.
PROJECT/streamlit_ui.py - Flutter application · Cross-platform client with app routing and composition.
vertex_app/lib/app/app.dart - Flutter router
vertex_app/lib/app/router.dart - Chat API client
vertex_app/lib/features/chat/data/chat_api.dart - Chat repository
vertex_app/lib/features/chat/data/chat_repository.dart - Chat controller
vertex_app/lib/features/chat/presentation/controller/chat_controller.dart
Connections 30
- Training runner → Outlier training: runs
- Training runner → Load and merge: runs
- Training runner → Outlier gate: runs
- Training runner → Data cleaning: runs
- Training runner → TF-IDF features: runs
- Training runner → Model training and export: runs
- CSV datasets → Load and merge: source CSVs
- Outlier training → Outlier classifier: exports
- Load and merge → Outlier gate: merged text
- Outlier gate → Data cleaning: eligible items
- Data cleaning → TF-IDF features: normalized text
- TF-IDF features → Model training and export: feature matrix
- Pipeline conventions → Data cleaning: shared conventions
- Pipeline conventions → TF-IDF features: shared conventions
- Model training and export → FR/NFR classifier: exports
- Model training and export → Combined vectorizer: exports
- FR/NFR classifier → Trained artifacts: stored with metadata
- Combined vectorizer → Trained artifacts: stored with metadata
- Outlier classifier → Trained artifacts: stored with metadata
- FastAPI endpoints → API schemas: uses contracts
- FastAPI endpoints → Prediction pipeline: serves predictions
- Artifact loader → Trained artifacts: loads
- Prediction pipeline → Artifact loader: uses loaded artifacts
- Streamlit tester → Prediction pipeline: exercises inference
- Flutter application → Flutter router: routes with
- Flutter router → Chat controller: opens chat
- Chat controller → Chat repository: requests predictions
- Chat repository → Chat API client: delegates HTTP
- Chat API client → FastAPI endpoints: HTTP
- Deployment backend copy → FastAPI endpoints: must stay synchronized