# HMG_QLine

HMG_QLine is a Flutter-based application designed for efficient patient management and queue handling in healthcare environments. It features multiple screens for patient display, robust logging, and
background service integration to ensure reliability and uptime.

## Features

- Patient queue management across all screens
- Foreground service to monitor app state and auto-reopen if terminated or backgrounded
- SignalR integration for real-time updates
- Persistent logging with automatic log file rotation
- Dynamic app versioning
- Modular architecture with ViewModels and Services

## Getting Started

### Prerequisites

- Flutter SDK (>=3.0.0)
- Dart (>=2.17.0)
- Android Studio or Xcode for platform-specific builds

### Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/your-org/HMG_QLine.git
   cd HMG_QLine
   ```
2. Install dependencies:
   ```bash
   flutter pub get
   ```
3. Run the app:
   ```bash
   flutter run
   ```

## Project Structure

- `lib/` - Main source code
    - `api/` - API integration
    - `config/` - Configuration files
    - `constants/` - App-wide constants
    - `models/` - Data models
    - `repositories/` - Data repositories
    - `services/` - Business logic and background services
    - `utilities/` - Utility functions
    - `view_models/` - State management
    - `views/` - UI screens
- `assets/` - Fonts, images, icons, and tones
- `android/`, `ios/`, `macos/`, `linux/`, `windows/` - Platform-specific code

## Logging

- Logs are saved in the device's external storage under `/logs/`
- Log files are rotated every 48 hours
- Each log entry includes a timestamp, source, and type

## Foreground Service

- Monitors app lifecycle
- Automatically reopens or restarts the app if terminated or sent to background
- Checks app status every minute

## SignalR Integration

- Reconnects automatically after disconnection
- Ensures real-time updates for patient queues

## Debugging

- Debuggable builds can be enabled in `android/app/build.gradle` for troubleshooting

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License

This project is licensed under the MIT License.