How yashlad009/ai-powered-chronic-risk-detection-and-explanation-assistant- works
This WIP skeleton presents a chronic-disease risk assistant. Its demonstrated user workflow is a patient entering vitals in the frontend, which submits them to the prediction API; the API validates the request, runs the ANN pipeline, converts its score to a fuzzy risk band, and returns the result for display. Training, authentication, patient and explanation routes, guardrails, and RAG are present in the tree but their runtime wiring is not established by the excerpts. The frontend form’s fields also differ from the API schema. Unsampled subsystem links are therefore omitted.
Main entry points: predictions.py Prediction route · predict.ts Prediction client · pipeline.py Prediction pipeline · App.tsx Risk form
Components 22
Patient interface
- Risk form
frontend/src/App.tsx - Prediction client
frontend/src/api/predict.ts
Prediction API
- API application
backend/app/main.py - Prediction route
backend/app/api/v1/predictions.py - Vitals schema
backend/app/schemas/predict.py - Authentication routes
backend/app/api/v1/auth.py - Patient routes
backend/app/api/v1/patients.py - Explanation routes
backend/app/api/v1/explanations.py
Risk modeling
- Prediction pipeline
backend/app/ml/pipeline.py - ANN classifier
backend/app/ml/ann/model.py - Fuzzy risk bands
backend/app/ml/fis/risk_bands.py - SHAP explainer
backend/app/ml/shap_explainer.py - Hyperparameter tuning
backend/app/ml/ga/tune_hyperparams.py
Assistant capabilities
- Guardrail checks
backend/app/guardrail/checks.py - Guardrail rules
backend/app/guardrail/rules.py - Knowledge embedding
backend/app/rag/embed.py - Knowledge retrieval
backend/app/rag/retriever.py - Response generation
backend/app/rag/generator.py - Database session
backend/app/db/session.py
Model training
- ANN training
backend/app/ml/ann/train.py - Saved model artifacts
ml-training/saved_models
Other components
- Patient
Connections 12
- Patient → Risk form: enters vitals
frontend/src/App.tsx - Risk form → Prediction client: submits vitals
frontend/src/App.tsx - Prediction client → Prediction route: POSTs request
frontend/src/api/predict.ts - API application → Prediction route: registers route
backend/app/main.py - Prediction route → Vitals schema: validates request
backend/app/api/v1/predictions.py - Prediction route → Prediction pipeline: runs prediction
backend/app/api/v1/predictions.py - Prediction route → Fuzzy risk bands: classifies score
backend/app/api/v1/predictions.py - Prediction pipeline → ANN classifier: predicts probability
backend/app/ml/pipeline.py - Prediction pipeline → Saved model artifacts: loads model and scaler
backend/app/ml/pipeline.py - ANN training → ANN classifier: trains classifier
backend/app/ml/ann/train.py - ANN training → Saved model artifacts: saves model and scaler
backend/app/ml/ann/train.py - Prediction client → Risk form: returns response
frontend/src/App.tsx