feat: Update documentation and API for face identification and people management

This commit enhances the README with detailed instructions on the automatic database initialization and schema compatibility between the web and desktop versions. It also introduces new API endpoints for managing unidentified faces and people, including listing, creating, and identifying faces. The schemas for these operations have been updated to reflect the new data structures. Additionally, tests have been added to ensure the functionality of the new API features, improving overall coverage and reliability.
This commit is contained in:
tanyar09
2025-11-03 12:49:48 -05:00
parent 5174fe0d54
commit 817e95337f
13 changed files with 1281 additions and 91 deletions
+30 -6
View File
@@ -52,15 +52,37 @@ cd ..
### Database Setup
**Automatic Initialization:**
The database and all tables are automatically created on first startup. No manual migration is needed!
The web application will:
- Create the database file at `data/punimtag.db` (SQLite default) if it doesn't exist
- Create all required tables with the correct schema on startup
- Match the desktop version schema exactly for compatibility
**Manual Setup (Optional):**
If you need to reset the database or create it manually:
```bash
# Generate and run initial migration
source venv/bin/activate
export PYTHONPATH=/home/ladmin/Code/punimtag
alembic revision --autogenerate -m "Initial schema"
alembic upgrade head
# Recreate all tables from models
python scripts/recreate_tables_web.py
```
This creates the SQLite database at `data/punimtag.db` (default). For PostgreSQL, set the `DATABASE_URL` environment variable.
**PostgreSQL (Production):**
Set the `DATABASE_URL` environment variable:
```bash
export DATABASE_URL=postgresql+psycopg2://user:password@host:port/database
```
**Database Schema:**
The web version uses the **exact same schema** as the desktop version for full compatibility:
- `photos` - Photo metadata (path, filename, date_taken, processed)
- `people` - Person records (first_name, last_name, middle_name, maiden_name, date_of_birth)
- `faces` - Face detections (encoding, location, quality_score, face_confidence, exif_orientation)
- `person_encodings` - Person face encodings for matching
- `tags` - Tag definitions
- `phototaglinkage` - Photo-tag relationships (with linkage_type)
### Running the Application
@@ -121,6 +143,7 @@ Then open your browser to **http://localhost:3000**
- Password: `admin`
**Note:**
- The database and tables are **automatically created on first startup** - no manual setup needed!
- The RQ worker starts automatically in a background subprocess when the API server starts
- Make sure Redis is running first, or the worker won't start
- Worker names are unique to avoid conflicts when restarting
@@ -202,9 +225,10 @@ punimtag/
- ✅ All page routes (Dashboard, Scan, Process, Search, Identify, Auto-Match, Tags, Settings)
**Database:**
- ✅ All tables created: `photos`, `faces`, `people`, `person_embeddings`, `tags`, `photo_tags`
- ✅ All tables created automatically on startup: `photos`, `faces`, `people`, `person_encodings`, `tags`, `phototaglinkage`
- ✅ Schema matches desktop version exactly for full compatibility
- ✅ Indices configured for performance
- ✅ SQLite database at `data/punimtag.db`
- ✅ SQLite database at `data/punimtag.db` (auto-created if missing)
### Phase 2: Image Ingestion & Processing ✅ **COMPLETE**