Skip to content

rahulapjs/EasyDiagno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EasyDiagno

A Flutter application designed to assist users with symptom checking and locating nearby hospitals.

Features

  • Symptom Checker (AI-Powered Chatbot): Users can input their symptoms into an interactive chatbot that provides a possible diagnosis based on a machine learning model. The chatbot can also suggest relevant hospital departments.
  • Hospital Locator: Users can find hospitals near their location, filtered by specialization or department.
  • User Authentication: Secure user registration and login functionality.
  • Hospital Registration: Hospitals can register their services and details on the platform.
  • Admin Module: A dedicated module for administrators to manage registered users and hospitals, including approval/rejection of hospital registration requests.
  • User Profiles: Users can manage their profiles within the application.

Tech Stack

  • Frontend: Flutter (Dart)
  • Backend: Flask (Python API), Firebase (Authentication)
  • Database: MySQL
  • Machine Learning: Python (k-Nearest Neighbors model)
  • Location Services: Integration for finding nearby hospitals.
  • HTTP: For API communication.

System Architecture

High-Level Overview

graph TD
    User((User))
    HospitalAdmin((Hospital Admin))
    SystemAdmin((System Admin))
    
    subgraph "EasyDiagno System"
        MobileApp["Flutter Mobile Application"]
        FlaskBackend["Flask Python API"]
        MySQL[(MySQL Database)]
        MLModel["kNN Disease Model"]
        Firebase[(Firebase Auth)]
    end
    
    User <--> MobileApp
    HospitalAdmin <--> MobileApp
    SystemAdmin <--> MobileApp
    
    MobileApp <--> FlaskBackend
    MobileApp <--> Firebase
    FlaskBackend <--> MySQL
    FlaskBackend <--> MLModel
Loading

Symptom Check Workflow

sequenceDiagram
    participant User
    participant App as Flutter App
    participant API as Flask Backend
    participant ML as ML Model
    
    User->>App: Inputs symptoms (text)
    App->>API: GET /check?sym=symptoms
    API->>ML: make_pred(knn, symptoms)
    ML-->>API: Predicted Disease
    API-->>App: { 'task': 'disease_name' }
    App-->>User: Displays Diagnosis & Suggestions
Loading

Hospital Registration Process

graph LR
    H[Hospital Submits Details] --> P[Status: Pending]
    P --> A{Admin Review}
    A -->|Approve| AP[Status: Approved / Login Active]
    A -->|Reject| RJ[Status: Rejected]
Loading

Authentication Flow

sequenceDiagram
    participant U as User
    participant A as Flutter App
    participant F as Firebase Auth
    participant B as Flask Backend
    participant D as MySQL Database

    U->>A: Enter Email & Password
    A->>F: signInWithEmailAndPassword()
    F-->>A: User Credential / Error
    alt success
        A->>F: check emailVerified
        alt verified
            A->>B: GET /login_check
            B->>D: SELECT user type
            D-->>B: User Data
            B-->>A: { 'task': 'success', 'type': 'user/hospital/admin' }
            A->>U: Redirect to Dashboard
        else not verified
            A->>U: Show Verification Message
        end
    else failure
        A->>U: Show Error (Invalid Credentials)
    end
Loading

Hospital Locator Flow

graph TD
    Start([User opens Hospital Finder]) --> FetchSpecs[Fetch Specializations from Backend]
    FetchSpecs --> ShowList[Display Specialization Cards]
    ShowList --> SelectSpec{User selects Specialization?}
    SelectSpec -->|Yes| FetchHosp[Request Hospitals by Specialization]
    FetchHosp --> ShowHospitals[Display Filtered Hospital List]
    ShowHospitals --> ViewDetail[View Hospital Details & Doctors]
    ViewDetail --> End([End])
Loading

Data Model (ER Diagram)

erDiagram
    LOGIN ||--o| USER_PROFILE : "has"
    LOGIN ||--o| HOSPITAL_DETAILS : "has"
    HOSPITAL_DETAILS ||--o{ DOCTOR_DETAILS : "contains"
    SPECIALISATION ||--o{ DOCTOR_DETAILS : "categorizes"

    LOGIN {
        int id PK
        string email
        string password
        string type "user/hospital/admin/pending"
    }

    USER_PROFILE {
        int id PK
        int login_id FK
        string name
        string phone
        string gender
        float height
        float weight
        string pincode
        string address
    }

    HOSPITAL_DETAILS {
        int id PK
        int login_id FK
        string hospital_name
        string licence_number
        string phone
        string address
        string city
        string state
        string country
        string image_path
    }

    DOCTOR_DETAILS {
        int id PK
        int hospital_id FK
        int specialisation_id FK
        string doctor_name
        string qualification
        string available_days
    }

    SPECIALISATION {
        int id PK
        string name
        string description
    }
Loading

Getting Started

  1. Clone the repository:
    git clone https://github.com/zccott/EasyDiagno.git
  2. Install dependencies:
    flutter pub get
  3. Run the app:
    flutter run
    Note: Ensure you have Flutter and Dart SDKs installed and configured.

Project Structure

├───README.md
├───.git/...
├───ai/
│   ├───Deasease.ipynb
│   ├───DentalDux.zip
│   └───Symptom2Disease.csv
├───backend/
│   ├───.idea/
│   │   ├───.gitignore
│   │   ├───Easydiagno.iml
│   │   ├───misc.xml
│   │   ├───modules.xml
│   │   └───inspectionProfiles/
│   │       └───profiles_settings.xml
│   └───src/
│       ├───__init__.py
│       ├───easydiagnoapp.py
│       ├───mainfile.py
│       ├───Symptom2Disease.csv
│       ├───__pycache__/
│       │   ├───__init__.cpython-312.pyc
│       │   └───mainfile.cpython-312.pyc
│       └───static/
│           ├───20240307_155541.jpg
│           ├───20240309_114339.jpg
│           ├───20240309_114729.jpg
│           ├───20240309_114802.jpg
│           ├───20240309_114854.jpg
│           ├───20240309_114938.jpg
│           └───20240309_115036.jpg
└───mobile/
    ├───.gitignore
    ├───.metadata
    ├───analysis_options.yaml
    ├───pubspec.lock
    ├───pubspec.yaml
    ├───android/
    │   ├───.gitignore
    │   ├───build.gradle
    │   ├───gradle.properties
    │   ├───settings.gradle
    │   ├───app/
    │   │   ├───build.gradle
    │   │   └───src/
    │   │       ├───google-services.json
    │   │       ├───debug/
    │   │       ├───main/
    │   │       └───profile/
    │   └───gradle/
    │       └───wrapper/
    │           └───gradle-wrapper.properties
    ├───assets/
    │   └───images/
    │       ├───bg.jpg
    │       ├───loading.png
    │       ├───loading1.gif
    │       └───welcome_image.svg
    ├───ios/
    │   ├───.gitignore
    │   ├───Flutter/
    │   │   ├───AppFrameworkInfo.plist
    │   │   ├───Debug.xcconfig
    │   │   └───Release.xcconfig
    │   ├───Runner/
    │   │   ├───AppDelegate.swift
    │   │   ├───Info.plist
    │   │   ├───Runner-Bridging-Header.h
    │   │   ├───Assets.xcassets/
    │   │   │   ├───AppIcon.appiconset/
    │   │   │   └───LaunchImage.imageset/
    │   │   └───Base.lproj/
    │   │       ├───LaunchScreen.storyboard
    │   │       └───Main.storyboard
    │   ├───Runner.xcodeproj/
    │   │   ├───project.pbxproj
    │   │   ├───project.xcworkspace/
    │   │   │   ├───contents.xcworkspacedata
    │   │   │   └───xcshareddata/
    │   │   └───xcshareddata/
    │   │       └───xcschemes/
    │   ├───Runner.xcworkspace/
    │   │   ├───contents.xcworkspacedata
    │   │   └───xcshareddata/
    │   │       ├───IDEWorkspaceChecks.plist
    │   │       └───WorkspaceSettings.xcsettings
    │   └───RunnerTests/
    │       └───RunnerTests.swift
    ├───lib/
    │   ├───halo.py
    │   ├───main.dart
    │   ├───map.dart
    │   ├───Constants/
    │   │   ├───Colors.dart
    │   │   └───constants.dart
    │   ├───Models/
    │   │   ├───constantShared.dart
    │   │   ├───AdminModel/
    │   │   │   ├───allHospitalModel.dart
    │   │   │   ├───hospitalReqModel.dart
    │   │   │   └───usersByAdminModel.dart
    │   │   ├───HospitalModel/
    │   │   │   ├───getSpecialisation.dart
    │   │   │   ├───HospitalAllDetails.dart
    │   │   │   ├───hospitalBaseModel.dart
    │   │   │   ├───hospitalReg1Model.dart
    │   │   │   ├───registrationDB.dart
    │   │   │   ├───regscreen1/
    │   │   │   └───regscreen2/
    │   │   └───UserModel/
    │   │       ├───chatReplayModel.dart
    │   │       ├───loginModel.dart
    │   │       ├───loginResponce.dart
    │   │       ├───userCompleteModel.dart
    │   │       └───userRegistration.dart
    │   ├───screens/
    │   │   ├───Admin/
    │   │   │   ├───AdminHome.dart
    │   │   │   ├───HospitalRegistered.dart
    │   │   │   ├───HospitalRequested.dart
    │   │   │   └───UserRegistered.dart
    │   │   ├───AdminModule/
    │   │   │   ├───AdminHome.dart
    │   │   │   ├───HospitalsRegistered.dart
    │   │   │   └───HospitalsRequested.dart
    │   │   │   └───...
    │   │   ├───AppHome/
    │   │   ├───HospitalRegistration/
    │   │   └───Login_Signup/
    │   ├───Services/
    │   │   ├───AdminModule/
    │   │   ├───hospital Module/
    │   │   └───UserModule/
    │   └───widgets/
    │       └───Textfields/
    ├───linux/
    │   ├───.gitignore
    │   ├───CMakeLists.txt
    │   ├───main.cc
    │   ├───my_application.cc
    │   ├───my_application.h
    │   └───flutter/
    │       ├───CMakeLists.txt
    │       ├───generated_plugin_registrant.cc
    │       ├───generated_plugin_registrant.h
    │       └───generated_plugins.cmake
    ├───macos/
    │   ├───.gitignore
    │   ├───Flutter/
    │   │   ├───Flutter-Debug.xcconfig
    │   │   ├───Flutter-Release.xcconfig
    │   │   └───GeneratedPluginRegistrant.swift
    │   ├───Runner/
    │   │   ├───AppDelegate.swift
    │   │   ├───DebugProfile.entitlements
    │   │   ├───Info.plist
    │   │   ├───MainFlutterWindow.swift
    │   │   ├───Release.entitlements
    │   │   ├───Assets.xcassets/
    │   │   ├───Base.lproj/
    │   │   └───Configs/
    │   ├───Runner.xcodeproj/
    │   │   ├───project.pbxproj
    │   │   ├───project.xcworkspace/
    │   │   └───xcshareddata/
    │   ├───Runner.xcworkspace/
    │   │   ├───contents.xcworkspacedata
    │   │   └───xcshareddata/
    │   └───RunnerTests/
    │       └───RunnerTests.swift
    ├───test/
    │   └───widget_test.dart
    ├───web/
    │   ├───favicon.png
    │   ├───index.html
    │   ├───manifest.json
    │   └───icons/
    │       ├───Icon-192.png
    │       ├───Icon-512.png
    │       ├───Icon-maskable-192.png
    │       └───Icon-maskable-512.png
    └───windows/
        ├───.gitignore
        ├───CMakeLists.txt
        ├───flutter/
        │   ├───CMakeLists.txt
        │   ├───generated_plugin_registrant.cc
        │   ├───generated_plugin_registrant.h
        │   └───generated_plugins.cmake
        └───runner/
            ├───CMakeLists.txt
            ├───flutter_window.cpp
            ├───flutter_window.h
            ├───main.cpp
            ├───resource.h
            ├───runner.exe.manifest
            ├───Runner.rc
            ├───utils.cpp
            ├───utils.h
            ├───win32_window.cpp
            ├───win32_window.h
            └───resources/

API Reference

The application communicates with a backend API for various functionalities. The base URL for the API is not specified in the provided code, but the following endpoints are used:

Authentication:

  • User Login: http://localhost:5000/api/user/login
  • User Registration: http://localhost:5000/api/user/register
  • User Profile Completion: http://localhost:5000/api/user/complete/profile

Admin:

  • Get All Users: http://localhost:5000/api/admin/users
  • Get All Hospitals: http://localhost:5000/api/admin/hospitals
  • Get Hospital Requests: http://localhost:5000/api/admin/hospital/requests
  • Approve Hospital Request: http://localhost:5000/api/admin/hospital/approve
  • Reject Hospital Request: http://localhost:5000/api/admin/hospital/reject
  • Delete User: http://localhost:5000/api/admin/user/delete
  • Delete Hospital: http://localhost:5000/api/admin/hospital/delete

Hospital:

  • Register Hospital: http://localhost:5000/api/hospital/register
  • Get Hospital by ID: http://localhost:5000/api/hospital/
  • Get Hospital by Specialization: http://localhost:5000/api/hospital/specialization/
  • Get All Specializations: http://localhost:5000/api/specializations
  • Add Doctor: http://localhost:5000/api/hospital/add/doctor

Chatbot:

  • Get Chatbot Reply: http://localhost:5000/api/chatbot/reply

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details. Comment

About

EasyDiagno is a Flutter-based healthcare application that provides AI-powered symptom checking and nearby hospital discovery. Built with Firebase and a Python ML backend, it supports user authentication, hospital registration, and an admin management system.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors