Health Tracker Application Documentation

Introduction

Our Health Tracker Application is designed to run locally, helping users track their mental well-being by responding to a series of questions. The application utilizes the Mistral model for processing responses and is built with a React.js front-end and a Flask back-end.

Features

  • User-friendly interface built with React.js
  • Backend powered by Flask
  • AI-driven insights using the Mistral model
  • Local storage and processing for enhanced privacy
  • Emotional state tracking based on user responses

Installation

Requirements

  • Node.js (for React front-end)
  • Python 3.x (for Flask back-end)
  • pip (Python package manager)
  • Virtual Environment (recommended for Python dependencies)

Setup

1. Clone the repository

$ git clone https://github.com/your-repo/health-tracker.git
$ cd health-tracker

2. Backend Setup (Flask)

$ cd backend
$ python3 -m venv venv
$ source venv/bin/activate  # On Windows use `venv\Scripts\activate`
$ pip install -r requirements.txt
$ python app.py

3. Frontend Setup (React.js)

$ cd frontend
$ npm install
$ npm start

Usage

User Interaction

Users answer the following mental health questions:

1. How often did you feel nervous, anxious, or on edge?
2. How often did you struggle to stop or control your worries?
3. How often did you feel afraid as if something awful might happen?
4. How often did you have trouble relaxing?
5. How often did you feel so restless that it was hard to sit still?
6. How often did you lack interest in doing things?
7. How often did you feel down, depressed, or hopeless?
8. How often did you have trouble sleeping?
9. How often did you feel tired or have little energy?
10. How often did you find yourself in a state of nervous tension?

Response Processing

  • User responses are analyzed by the Mistral model.
  • The system provides feedback, cognitive distortion identification, and reframing suggestions.

Data Structure

User Entry Format

{
    "entry_id": "entry123",
    "date": "2023-01-01",
    "text": "Today was productive!",
    "emotions": [
        "happy",
        "motivated"
    ],
    "categories": null,
    "ai": "Generated AI feedback",
    "user_id": "3449fc77-410d-49f3-954f-31ea69266b13"
}

API Endpoints

1. Submit Response

  • Endpoint: /api/submit
  • Method: POST
  • Payload: json { "user_id": "3449fc77-410d-49f3-954f-31ea69266b13", "responses": [ {"question": "How often did you feel nervous?", "answer": "Often"}, {"question": "How often did you struggle to stop worrying?", "answer": "Sometimes"} ] }
  • Response: json { "status": "success", "message": "Response recorded", "analysis": "AI-generated insights" }

2. Get User Entries

  • Endpoint: /api/entries/<user_id>
  • Method: GET
  • Response: json { "entries": [ { "entry_id": "101112", "date": "2/16/2025", "text": "I am very stressed", "emotions": [ {"name": "confident", "icon": "😎"} ], "categories": ["love", "friends", "sleep"] } ] }

Conclusion

The Health Tracker Application provides a simple yet powerful way to track mental health and gain AI-driven insights. The combination of React.js, Flask, and the Mistral model ensures a seamless and private experience for users.

Built With

Share this project:

Updates