Remplace les diagrammes Mermaid par DBML (via kroki-dbml) pour une meilleure expressivité des schémas de base de données : - Ajout support notes, contraintes et indexes détaillés - Migration de tous les schémas d'entités partagées - Ajout fichier exemple dbml-example.md - Configuration plugin mkdocs-kroki pour rendu DBML
67 lines
2.2 KiB
Markdown
67 lines
2.2 KiB
Markdown
# Location History
|
|
|
|
📖 Historique de géolocalisation avec anonymisation automatique
|
|
|
|
## Diagramme
|
|
|
|
```kroki-dbml
|
|
Table users {
|
|
id uuid [primary key]
|
|
}
|
|
|
|
Table location_history {
|
|
id uuid [primary key]
|
|
user_id uuid [not null, ref: > users.id]
|
|
location geography [note: 'PostGIS geography type: POINT with SRID 4326 (WGS84)']
|
|
geohash varchar(12) [note: 'Precision 5 geohash (~5km²) after anonymization']
|
|
anonymized boolean [not null, default: false, note: 'true after 24h auto-anonymization']
|
|
context location_context_enum [not null]
|
|
speed_kmh float [note: 'GPS speed in km/h (NULL if stationary)']
|
|
accuracy_meters float [not null, note: 'GPS accuracy radius in meters']
|
|
created_at timestamp [not null, default: `now()`]
|
|
anonymized_at timestamp [note: 'When precise location was replaced by geohash']
|
|
|
|
indexes {
|
|
(user_id, created_at) [note: 'User location timeline']
|
|
(created_at, anonymized) [note: 'Daily anonymization job (WHERE anonymized = false AND created_at < NOW() - 24h)']
|
|
(location) [type: gist, note: 'PostGIS spatial index for proximity queries']
|
|
(geohash) [note: 'Analytics queries on anonymized data']
|
|
}
|
|
}
|
|
|
|
Enum location_context_enum {
|
|
listening [note: 'Position pendant écoute de contenu']
|
|
search [note: 'Position lors d une recherche']
|
|
background [note: 'Tracking en arrière-plan']
|
|
manual [note: 'Position partagée manuellement']
|
|
}
|
|
```
|
|
|
|
## Légende
|
|
|
|
**Anonymisation progressive** :
|
|
|
|
- Données précises conservées **24h** (recommandation personnalisée)
|
|
- Après 24h : conversion en **geohash précision 5** (~5km²)
|
|
- Coordonnées originales supprimées définitivement
|
|
- Job quotidien PostGIS automatique
|
|
|
|
**Exceptions** :
|
|
|
|
- Historique personnel visible (liste trajets) : conservation intégrale tant que compte actif
|
|
- Analytics globales : uniquement geohash anonyme
|
|
- Suppression complète si suppression du compte
|
|
|
|
**Contexte** :
|
|
|
|
- `listening` : Position pendant écoute de contenu
|
|
- `search` : Position lors d'une recherche
|
|
- `background` : Tracking en arrière-plan
|
|
- `manual` : Position partagée manuellement
|
|
|
|
**Conformité RGPD** :
|
|
|
|
- Vraie anonymisation (CNIL compliant)
|
|
- Permet analytics agrégées (heatmaps trafic)
|
|
- PostGIS natif, 0€
|