Skip to content

lidork/Pain_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pain Project

A comprehensive Android application designed to empower users in managing their pain through tracking, prediction, and motivation. The app combines machine learning with Firebase backend services to provide personalized pain level predictions and visual analytics.

Overview

Pain Project is a pain management application that helps users:

  • Track pain entries with symptoms and severity levels
  • Receive AI-powered pain predictions based on historical data
  • Visualize pain trends through interactive charts and analytics
  • Maintain motivation with inspirational quotes and mood tracking
  • Monitor daily streaks and progress

Key Features

1. User Management

  • Secure user registration with email and password
  • Profile creation with personal and location information
  • Firebase Authentication and Firestore for data persistence
  • Session management with logout functionality

2. Pain Logging

  • Log pain entries with customizable date and time
  • Select from a comprehensive symptom list
  • Rate pain levels on an intuitive slider (0-100 scale)
  • All entries automatically saved to Firestore

3. AI-Powered Pain Prediction

  • TensorFlow Lite model trained on real pain data
  • Predicts pain levels based on:
    • Day of the week
    • Month
    • Symptom type
  • Instant predictions displayed on the home screen
  • Lightweight on-device inference for privacy and speed

4. Dashboard & Home Screen

  • Personalized greeting with user's name
  • Current pain prediction for selected symptoms
  • Mood tracking with four mood states (Sad, Neutral, Happy, Amazing)
  • Daily streak counter to encourage consistency
  • Quick navigation to other features

5. Data Analytics

  • Interactive charts visualizing pain trends over time
  • Filter pain data by:
    • Date range selection
    • Specific symptoms
  • AAChart powered visualization
  • Historical data analysis to identify patterns

6. Motivation & Support

  • Inspirational quote display
  • Random motivational messages to encourage users
  • Dedicated motivation screen accessible from home

Tech Stack

Core Technologies

  • Language: Java
  • Platform: Android
  • Min SDK: 24
  • Target SDK: 36
  • Gradle: Build automation with dependency management

Backend & Database

  • Firebase Authentication: Secure user login
  • Firebase Firestore: Cloud database for user profiles and pain entries
  • Google Play Services: Credentials and authentication

Machine Learning

  • TensorFlow Lite (v2.1.1): On-device ML inference
  • Pre-trained Model: pain_predictor_real_data.tflite
  • Privacy-first approach with local model execution

UI & Visualization

  • Material Design: Modern Material 3 components
  • Android Material Library: Native UI elements
  • AAChartCore: Advanced charting and analytics
  • MPAndroidChart: Alternative charting library
  • Jetpack: Navigation, Fragment management, Constraint Layout
  • Bottom Navigation: Multi-screen navigation

Navigation

  • Jetpack Navigation: Screen-to-screen navigation
  • Fragment-based architecture with NavGraph
  • Bottom navigation with 4 main screens

Project Structure

Pain_Project/
├── app/
│   ├── src/
│   │   ├── main/
│   │   │   ├── java/com/example/pain_project/
│   │   │   │   ├── MainActivity.java                  # Main activity & nav host
│   │   │   │   ├── PainApplication.java              # App initialization & symptom loading
│   │   │   │   ├── PainPredictor.java                # TensorFlow Lite model loader & predictor
│   │   │   │   ├── HomeScreen.java                   # Dashboard with prediction & mood tracking
│   │   │   │   ├── PainLog.java                      # Pain entry logging screen
│   │   │   │   ├── ChartFragment.java                # Data visualization & analytics
│   │   │   │   ├── MotivationFragment.java           # Motivational quotes screen
│   │   │   │   ├── logIn.java                        # User login screen
│   │   │   │   ├── Register.java                     # User registration screen
│   │   │   │   └── PainEntry.java                    # Data model for pain entries
│   │   │   ├── res/                                   # UI resources
│   │   │   └── assets/
│   │   │       ├── pain_predictor_real_data.tflite   # TensorFlow Lite model
│   │   │       └── symptoms_map.json                 # Symptom code mappings
│   │   ├── test/                                      # Unit tests
│   │   └── androidTest/                               # Instrumented tests
│   ├── build.gradle                                   # App-level dependencies
│   └── google-services.json                           # Firebase configuration
├── gradle/
│   └── libs.versions.toml                             # Centralized dependency versions
├── build.gradle                                       # Project-level configuration
└── README.md                                          # This file

App Navigation

The app uses a bottom navigation bar with 3 main screens:

  1. Home Screen: Dashboard with pain prediction and mood tracking
  2. Pain Log: Entry form for logging new pain data
  3. Charts: Analytics and visualization of historical pain data

Authentication screens (Login/Register) are shown before the main app and do not display the bottom navigation.

Getting Started

Prerequisites

  • Android Studio (latest version recommended)
  • Java 11 or higher
  • Firebase project with Firestore database
  • Android device or emulator (SDK 24+)

Setup Instructions

  1. Clone the repository

    git clone <repository-url>
    cd Pain_Project
  2. Open in Android Studio

    • File → Open and select the Pain_Project folder
  3. Configure Firebase

    • Create a Firebase project in the Firebase Console
    • Generate a google-services.json file for your project
    • Place it in the app/ directory
  4. Sync Gradle

    • Android Studio will prompt you to sync Gradle files
    • Ensure all dependencies resolve successfully
  5. Build & Run

    • Build → Build Bundle(s) / Build APK(s)
    • Run on an emulator or connected device

Firebase Setup

Firestore Database Structure

users/
  └── {userId}
      ├── name: string
      ├── email: string
      ├── phone: string
      ├── address: object
      │   ├── state: string
      │   ├── city: string
      │   ├── street: string
      │   └── houseNumber: string
      └── painEntries/
          └── {entryId}
              ├── year: number
              ├── month: number
              ├── day: number
              ├── hour: number
              ├── minute: number
              ├── symptomCode: number
              ├── painLevel: number
              └── mood: string

Model Information

The pain prediction model uses TensorFlow Lite and expects input in the following format:

  • Input shape: [1, 3]
  • Input features:
    1. Day of week (0-6, where 0 = Monday)
    2. Month (0-11, where 0 = January)
    3. Symptom code (from symptoms_map.json)
  • Output: Predicted pain level (0.0-100.0)

Dependencies

Key Libraries

  • androidx.appcompat:appcompat - Backward compatibility
  • com.google.android.material:material - Material Design components
  • androidx.navigation:navigation-* - Navigation framework
  • com.google.firebase:firebase-auth - Firebase Authentication
  • com.google.firebase:firebase-firestore - Firebase Database
  • org.tensorflow:tensorflow-lite:2.1.1 - TensorFlow Lite model inference
  • com.github.AAChartModel:AAChartCore - Advanced charting library

For complete dependency list, see gradle/libs.versions.toml and app/build.gradle.

Usage Example

Logging a Pain Entry

  1. Navigate to the Pain Log screen via bottom navigation
  2. Select a date and time using the provided pickers
  3. Choose a symptom from the symptom list
  4. Adjust the pain level slider
  5. Submit to save to Firestore

Getting a Pain Prediction

  1. From the Home Screen, tap "Pick Symptom"
  2. Select a symptom from the dialog
  3. The app instantly shows a predicted pain level using the TensorFlow Lite model

Viewing Pain Analytics

  1. Navigate to the Charts screen
  2. Optionally filter by date range or symptom
  3. View trends and patterns in the interactive chart

Future Enhancements

  • Multi-language support
  • Push notifications for pain tracking reminders
  • Advanced analytics with trend detection
  • Export pain data as PDF/CSV
  • Wearable device integration
  • Enhanced ML models with additional input features
  • Dark mode support
  • Offline mode with sync

Troubleshooting

Firebase Connection Issues

  • Verify google-services.json is in the app/ directory
  • Check Firebase project settings and API keys
  • Ensure internet permission is granted

Model Loading Errors

  • Confirm pain_predictor_real_data.tflite exists in assets/
  • Check file permissions in the build process

Symptom List Empty

  • Verify symptoms_map.json is in assets/
  • Check JSON format and encoding (UTF-8)

License

MIT

Contact & Support

For questions or issues, please submit an issue on the project repository.


Last Updated: February 2026

Authors

  • Lidor Kalfon
  • Dana Mund
  • Shaked Avdar

About

An Android application designed for pain tracking. Developed for HIT Android Frontend 1 Course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages