No description
  • Python 69.3%
  • JavaScript 19%
  • HTML 7%
  • CSS 4.2%
  • Dockerfile 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
openclaw b0afb6aa70 fix: match runner label (ubuntu-latest) instead of unregistered docker label
The ct125-runner only advertises ubuntu-latest/24.04/22.04 labels, so jobs
declaring runs-on: docker were never picked up and got auto-cancelled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 14:12:58 +00:00
.forgejo/workflows fix: match runner label (ubuntu-latest) instead of unregistered docker label 2026-10-21 14:12:58 +00:00
app feat: add behavioral insights (avg interval between points, average time of day, most common weekday, hour/weekday histograms) 2026-10-11 23:16:34 +00:00
data fix: allow committing data/.gitkeep despite data/ being ignored 2026-10-11 18:28:31 +00:00
scripts test: pytest suite for API, stats bucketing, chart export and mocked bot interactions 2026-10-11 18:28:21 +00:00
static feat: add top performance card with selectable period (hour/day/week/month/year) 2026-10-21 13:30:08 +00:00
tests feat: add behavioral insights (avg interval between points, average time of day, most common weekday, hour/weekday histograms) 2026-10-11 23:16:34 +00:00
.env.example chore: scaffold project config, env template, pytest and gitignore 2026-10-11 18:28:21 +00:00
.gitignore fix: allow committing data/.gitkeep despite data/ being ignored 2026-10-11 18:28:31 +00:00
dev.md feat: add behavioral insights (avg interval between points, average time of day, most common weekday, hour/weekday histograms) 2026-10-11 23:16:34 +00:00
Dockerfile chore: Dockerfile, Pterodactyl egg and Forgejo Actions CI workflow 2026-10-11 18:28:21 +00:00
egg-graph-profiles.json fix: egg deploy via archive download (DNS/git issues), pin numpy for CPU baseline, install deps at startup 2026-10-11 20:08:19 +00:00
pytest.ini chore: scaffold project config, env template, pytest and gitignore 2026-10-11 18:28:21 +00:00
README.md fix: egg deploy via archive download (DNS/git issues), pin numpy for CPU baseline, install deps at startup 2026-10-11 20:08:19 +00:00
requirements.txt fix: egg deploy via archive download (DNS/git issues), pin numpy for CPU baseline, install deps at startup 2026-10-11 20:08:19 +00:00

Graph Profiles

API + site web + bot Discord pour suivre et visualiser des profils de graphiques temporels (habitudes, compteurs d'actions, mesures...).

Installation locale

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Édite .env si besoin (port, fuseau horaire, token Discord...).

Lancement

uvicorn app.main:app --host 0.0.0.0 --port ${SERVER_PORT:-8000}

Le bot Discord ne démarre que si DISCORD_TOKEN est défini dans l'environnement. Sinon l'API tourne normalement sans lui.

Données de démo

python scripts/seed.py

Crée deux profils ("Pompes", "Lecture") avec ~60 jours de points et un marqueur.

Lancer les tests

pytest -v

Aperçu de l'API

Préfixe /api. Doc complète et interactive sur /docs.

  • Profils : GET/POST /profiles, GET/PUT/PATCH/DELETE /profiles/{id}
  • Points : GET/POST /profiles/{id}/points, POST /profiles/{id}/points/bulk, PATCH/DELETE /points/{id}, DELETE /profiles/{id}/points
  • Marqueurs : GET/POST /profiles/{id}/markers, PATCH/DELETE /markers/{id}
  • Stats : GET /profiles/{id}/stats?granularity=hour|day|week|month|year&from=&to=&tz=
  • Export image : GET /profiles/{id}/chart.png?period=24h|7d|30d|1y|all (ou from/to)
  • Santé : GET /health

Voir dev.md pour le détail de l'implémentation (architecture, bucketing des stats, rendu matplotlib partagé API/bot, etc.).

Bot Discord

Créer l'application Discord

  1. Va sur https://discord.com/developers/applications → New Application.
  2. Onglet Bot → crée le bot, copie le token → DISCORD_TOKEN dans .env.
  3. Dans Bot, active au minimum les intents par défaut (aucun intent privilégié n'est requis par ce bot).
  4. Onglet OAuth2 → URL Generator :
    • Scopes : bot et applications.commands
    • Permissions bot : Send Messages, Embed Links, Attach Files, Use Slash Commands
  5. Ouvre l'URL générée pour inviter le bot sur ton serveur.

Variables d'environnement du bot

  • DISCORD_TOKEN — token du bot (requis pour l'activer)
  • DISCORD_GUILD_ID — ID d'un serveur de test pour synchroniser les commandes instantanément (sinon sync globale, peut prendre jusqu'à 1h)
  • DISCORD_ALLOWED_ROLE_ID — si défini, seul ce rôle peut utiliser les commandes
  • PUBLIC_BASE_URL — URL publique du site, utilisée pour les liens dans les embeds (ex: https://graph.perso.auto-system.fr)

Commandes

  • /point ajouter profil valeur note date — ajoute un point (autocomplétion sur profil)
  • /point annuler — supprime (avec confirmation) le dernier point ajouté par toi via Discord
  • /profil liste — liste les profils et leurs numéros
  • /profil info profil — nombre de points, dernier point, moyennes jour/semaine/mois
  • /marqueur ajouter profil label date — ajoute un marqueur
  • /graphique profil periode — génère et envoie le graphique du profil en image PNG

Déploiement

Forgejo

Le dépôt est initialisé localement sur la branche main. Pour le publier :

git remote add origin <url-du-depot-forgejo>
git push -u origin main

Un workflow Forgejo Actions (.forgejo/workflows/ci.yml) lance automatiquement les tests à chaque push.

Pterodactyl

Deux options sont fournies :

  1. Dockerfile (Dockerfile) — image python:3.12-slim, utilisateur non-root, volume /home/container/data pour la persistance SQLite. Utilisable avec n'importe quel moteur Docker, y compris en nodes Pterodactyl basés sur des images Docker custom.
  2. Egg Pterodactyl (egg-graph-profiles.json) — installation native Pterodactyl qui télécharge une archive du dépôt Forgejo (/archive/<branche>.tar.gz) à la création du serveur, plutôt qu'un git clone (plus simple à faire fonctionner sans outils git dans le conteneur d'installation).

Pour importer l'egg :

  1. Panel Pterodactyl → Admin → Eggs → Import Egg → sélectionner egg-graph-profiles.json.
  2. Créer un serveur avec cet egg.
  3. Renseigner la variable d'egg Repository URL avec l'URL HTTPS du dépôt Forgejo (ex: https://forge.perso.auto-system.fr/Louis_292/graph-profiles.git), et les autres variables (TZ, DISCORD_TOKEN, etc.) selon besoin.
    • Si le dépôt n'est pas accessible en téléchargement anonyme, renseigne Git Token (GIT_TOKEN) avec un token Forgejo ayant accès en lecture.
    • Si le domaine du dépôt ne résout pas en DNS depuis le conteneur d'installation (cas d'un domaine interne derrière un reverse proxy, comme *.perso.auto-system.fr sur ce homelab), renseigne Git Resolve IP (GIT_RESOLVE_IP) avec l'IP du reverse proxy qui sert ce domaine en HTTPS.
  4. Lancer l'installation puis démarrer le serveur. La commande de démarrage utilise automatiquement le port alloué par Pterodactyl ({{SERVER_PORT}}) et installe les dépendances Python à chaque démarrage (pip install --user, car le conteneur d'installation et le conteneur d'exécution sont des images différentes — seul /home/container persiste entre les deux).
  5. Le volume de données du serveur (/home/container/data) persiste la base SQLite entre redémarrages/réinstallations (tant que le serveur n'est pas supprimé).