How vietphu01/medical_expert_system works
This is a Flask medical risk-assessment application. A user opens the web interface, submits disease-specific measurements, and receives an ensemble probability plus fuzzy and expert-rule conclusions; the application records diagnoses for later history queries. At startup it generates synthetic disease data and trains models, which are also used to expose model metrics and decision-tree rules. The excerpts show the backend routes and template rendering, but not the template’s client-side behavior or the contents of the knowledge base and SQLite database.
Main entry points: app.py Flask routes · inference_engine.py Expert inference · medical_history.db Medical history · index.html Diagnosis page
Components 10
Web interface
- Flask routes
app.py - Diagnosis page
templates/index.html
Diagnosis pipeline
- Disease configuration
diseases_config.py - Fuzzy facts
fuzzy_engine.py - Expert inference
inference_engine.py
Modeling
- Synthetic training data
diseases_config.py - ML algorithms
math_ml_from_scratch.py
Rules and history
- Rule knowledge base
knowledge_base.json - Medical history
medical_history.db
Other components
- User
Connections 11
- User → Flask routes: submits requests
app.py - Flask routes → Diagnosis page: renders
app.py - Flask routes → User: returns JSON
app.py - Flask routes → Disease configuration: reads configuration
app.py - Flask routes → Synthetic training data: generates datasets
app.py - Flask routes → ML algorithms: trains and predicts
app.py - Flask routes → Fuzzy facts: computes fuzzy facts
app.py - Flask routes → Expert inference: runs inference
app.py - Expert inference → Rule knowledge base: loads rules
inference_engine.py - Flask routes → Medical history: writes diagnoses
app.py - Flask routes → Medical history: reads recent history
app.py