Standalone Python GUI for simulating heart rate data and sending it to the Flask backend. Fully separate from the backend — uses only Python stdlib (tkinter, urllib). No pip install required.
| Control | Behavior |
|---|---|
| Current BPM | Large readout, updates every 1 second when running |
| Start / Stop | Toggle; when started, sends heart rate every 1 second |
| +5 / −5 | Increase or decrease base BPM by 5 |
| +10 / −10 | Increase or decrease base BPM by 10 |
| Stress | Checkbox; when checked, adds a +40–50 BPM spike (decays when unchecked) |
Two independent processes. Run in any order:
-
Backend (optional; required to persist data):
cd backend .\.venv\Scripts\Activate.ps1 # Windows flask --app app run --debug
Backend runs at
http://127.0.0.1:5000. -
Controller (standalone):
cd controller python app.pyA native window opens. No browser or npx serve needed.
-
Use Start, adjust BPM with +/- buttons, enable Stress for spikes, then Stop when done.
To drive the app's displayed heartbeat with the controller:
- Start a focus session in the app first (Start Session) — the backend writes the session ID to a file.
- Start the controller and click Start. The controller reads the session from the file each tick (no HTTP polling).
- The app will show the controller's heart rate. Without the controller, the app uses mock HR.
If the backend is not running, the controller UI still updates but requests will fail. A status message shows success or error.
The controller sends POST http://127.0.0.1:39762/api/heart-rate with:
{ "session_id": "...", "bpm": 72 }