1. System Overview
The project extends beyond training machine learning models by implementing a complete end-to-end intelligent medical diagnostic system, integrating:
Flutter Mobile Application (UI/UX + Logic)
Firebase Authentication
Flask Backend API
MongoDB Database
Deployed MLP Machine Learning Model
This advanced system allows users to enter symptoms, receive real-time predictions, store history, and manage profiles seamlessly.
---
2. System Architecture
High-Level Architecture Diagram (Text Description)
[ Flutter App ]
|
| HTTPS Requests
v
[ Flask Backend API ] -----> [ ML Model (MLP) ]
|
v
[ MongoDB Database ]
|
v
[ User Profiles & History ]
Components:
Flutter App → UI, input handling, displaying results, profile editing.
Firebase Authentication → secure login (Google + email/password).
Flask API → routes for prediction, profile, and history.
MLP Model → disease prediction from symptoms.
MongoDB → persistent storage for user profiles and diagnosis history.
---
3. Workflow / Data Flow
User Flow Diagram (Text Description)
User → Login (Firebase)
→ Enter Symptoms
→ Flutter sends request to /predict
→ Backend preprocesses + runs MLP model
→ Backend sends result back to Flutter
→ Flutter displays result on ResultScreen
→ App auto-saves diagnosis to MongoDB (/history/save)
→ User can view Search History
→ User can edit Profile (/profile/update)
---
4. Advanced Backend Implementation
4.1 Machine Learning Model Deployment
Best-performing MLP model exported as .keras.
Tokenizer loaded from JSON.
Preprocessing pipeline replicated from training:
Lowercasing
Cleaning special characters
Tokenizing
Padding sequences
Prediction returned as:
{
"prediction": "Disease Name",
"confidence": 0.92,
"index": 14
}
4.2 Flask API Modules
The backend includes three functional modules:
1. /predict
Receives symptoms as text.
Preprocesses input.
Runs the MLP model.
Returns diagnosis and confidence.
2. /profile
Supports:
Create Profile
Get Profile
Update Profile (UPsert Logic)
Automatically creates profile if missing.
Stores: name, phone, email, gender, photoUrl.
3. /history
Saves every prediction automatically.
Retrieves sorted history items for each user.
---
5. Firebase Authentication Integration
Features:
Google Sign-In using Firebase Auth Web SDK.
Email/Password registration & login.
Retrieves FirebaseAuth.instance.currentUser.uid.
UID used as the unique key across MongoDB collections.
Why this is advanced:
Integrated authentication with backend securely.
Ensured all user actions & data are linked to the authenticated identity.
---
6. Flutter Mobile Application (Advanced UI + Logic)
6.1 Functional Screens
✔ Home Screen
User greeting
Symptom input
Shortcuts and health tips
✔ Result Screen
Displays model prediction
Shows confidence %
Recommended actions
Fixed overflow issues with responsive layout
✔ Search History Screen
Loads history from MongoDB
Displays symptoms + predictions
✔ Profile Screen
Loads data from backend
Edits profile with UPsert behavior
Supports photoUrl
---
7. Advanced Features Implemented
7.1 UPsert Profile System
Instead of requiring accounts to be created manually:
If profile exists → update
If profile does not exist → auto-create
This ensures the user profile is always valid and avoids errors like 404 - profile not found.
---
7.2 Automatic Diagnosis History Logging
Every prediction automatically triggers:
POST /history/save
This enables:
User tracking
Model usage analytics
Better user experience (no need to manually save)
---
7.3 Error Handling and UI Feedback
Loading indicators
Network error messages
Automatic UI updates
Overflow fixes using SingleChildScrollView + dynamic constraints
---
7.4 Fully Responsive Layout
Header redesigned with dynamic height
Works on small devices and web
Avoids RenderFlex overflow warnings
---
8. UML – Logical Components
8.1 Use Case Diagram (Text Form)
User
├── Login
├── Enter Symptoms
├── View Prediction
├── View History
├── Edit Profile
└── Logout
8.2 Backend Component Diagram
[Predict Controller] → ML Model Loader
[Profile Controller] → MongoDB profiles collection
[History Controller] → MongoDB history collection
---
9. Summary of Advanced Work
This system demonstrates strong full-stack engineering capabilities:
✔ Machine Learning Model Deployment
✔ Custom Backend Implementation with Flask
✔ Real Database Integration (MongoDB)
✔ Modern Authentication (Firebase)
✔ Complete Mobile App with Flutter
✔ Advanced UI, state management, and API layers
✔ Fully integrated medical diagnostic system
All modules work together seamlessly to deliver a production-like, intelligent medical assistant application.