27 Commits

Author SHA1 Message Date
a6ba78cd54 feat: add debug mode, distance-based thresholds, and improve pose detection
- Add debug mode support for encoding statistics in API responses
  - Debug info includes encoding length, min/max/mean/std, and first 10 values
  - Frontend logs encoding stats to browser console when debug enabled
  - Identify page enables debug mode by default

- Implement distance-based confidence thresholds for stricter matching
  - Borderline distances require higher confidence (70-95% vs 50%)
  - Applied when use_distance_based_thresholds=True (auto-match)
  - Reduces false positives for borderline matches

- Dual tolerance system for auto-match
  - Default tolerance 0.6 for regular browsing (more lenient)
  - Run auto-match button uses 0.5 tolerance with distance-based thresholds (stricter)
  - Auto-accept threshold updated to 85% (from 70%)

- Enhance pose detection with single-eye detection
  - Profile threshold reduced from 30° to 15° (stricter)
  - Detect single-eye visibility for extreme profile views
  - Infer profile direction from landmark visibility
  - Improved face width threshold (20px vs 10px)

- Clean up debug code
  - Remove test photo UUID checks from production code
  - Remove debug print statements
  - Replace print statements with proper logging
2026-02-10 13:20:07 -05:00
6b6b1449b2 Modified files:
backend/config.py - Added MIN_AUTO_MATCH_FACE_SIZE_RATIO = 0.005
backend/services/face_service.py - Multiple changes:
Added load_face_encoding() function (supports float32 and float64)
Added _calculate_face_size_ratio() function
Updated find_similar_faces() to filter small faces
Updated find_auto_match_matches() to exclude small reference faces
Fixed reference face quality calculation (use actual quality, not hardcoded 0.5)
Fixed duplicate detection (exclude faces from same photo)
Updated confidence threshold from 40% to 50%
Updated confidence calibration (moderate version)
backend/api/faces.py - Updated default tolerance to 0.5 for auto-match endpoints
backend/schemas/faces.py - Updated default tolerance to 0.5
admin-frontend/src/pages/AutoMatch.tsx - Updated default tolerance to 0.5
admin-frontend/src/api/faces.ts - Added tolerance parameter support
2026-02-06 14:16:11 -05:00
tanyar09
d0dd5c82ea feat: add click logging for admin frontend
Some checks failed
CI / skip-ci-check (pull_request) Successful in 8s
CI / lint-and-type-check (pull_request) Successful in 54s
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / python-lint (pull_request) Has been cancelled
- Add backend click logging utility with file rotation and retention
- Add POST /api/v1/log/click endpoint for logging click events
- Add frontend click logger service with batching and context extraction
- Add global click handler in App.tsx for authenticated users
- Add log cleanup script for old log files
- Update QUICK_LOG_REFERENCE.md with click log documentation

Logs are written to /opt/punimtag/logs/admin-clicks.log with:
- Auto-rotation at 10MB (keeps 5 backups)
- 30-day retention
- Format: timestamp | username | page | element_type | element_id | element_text | context
2026-02-05 17:50:15 +00:00
tanyar09
09ee8712aa feat: extend people search to first/middle/last/maiden names and fix port binding issue
- Backend: Updated list_people_with_faces to search by first_name, middle_name, last_name, and maiden_name
- Frontend: Updated Modify page search UI and API client to support extended search
- Frontend: Updated Help page documentation for new search capabilities
- Infrastructure: Added start-api.sh wrapper script to prevent port 8000 binding conflicts
- Infrastructure: Updated PM2 config with improved kill_timeout and restart_delay settings
2026-02-05 16:57:47 +00:00
tanyar09
7a981b069a feat: Enhance logging and error handling for job streaming and photo uploads
All checks were successful
CI / skip-ci-check (pull_request) Successful in 8s
CI / lint-and-type-check (pull_request) Successful in 1m12s
CI / python-lint (pull_request) Successful in 36s
CI / test-backend (pull_request) Successful in 3m47s
CI / build (pull_request) Successful in 3m28s
CI / secret-scanning (pull_request) Successful in 14s
CI / dependency-scan (pull_request) Successful in 13s
CI / sast-scan (pull_request) Successful in 1m33s
CI / workflow-summary (pull_request) Successful in 5s
- Added new logging scripts for quick access to service logs and troubleshooting.
- Updated job streaming API to support authentication via query parameters for EventSource.
- Improved photo upload process to capture and validate EXIF dates and original modification times.
- Enhanced error handling for file uploads and EXIF extraction failures.
- Introduced new configuration options in ecosystem.config.js to prevent infinite crash loops.
2026-02-04 19:30:05 +00:00
tanyar09
42101ea7e7 feat: Add exifread library for enhanced EXIF date extraction
Some checks failed
CI / skip-ci-check (pull_request) Successful in 10s
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / lint-and-type-check (pull_request) Has been cancelled
- Introduced the exifread library to improve reliability in extracting EXIF date from images.
- Updated the extract_exif_date function to prioritize exifread for date extraction.
- Enhanced logging for successful and failed date extractions.
- Added validation for extracted dates to ensure they fall within a valid range.
2026-01-30 17:19:52 +00:00
tanyar09
d89238facf refactor: Enhance EXIF date extraction in photo_service
Some checks failed
CI / skip-ci-check (pull_request) Successful in 10s
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / lint-and-type-check (pull_request) Has been cancelled
- Improved logging for EXIF date extraction process, including success and failure messages.
- Updated methods to access EXIF data using modern and deprecated APIs.
- Added validation for extracted dates to ensure they fall within a valid range.
- Enhanced error handling for various exceptions during EXIF data access and date parsing.
2026-01-30 16:31:48 +00:00
tanyar09
f4bdb5d9b3 feat: Implement directory browsing functionality
Some checks failed
CI / skip-ci-check (pull_request) Successful in 10s
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / lint-and-type-check (pull_request) Has been cancelled
- Add `browseDirectory` API endpoint to list directory contents.
- Create `FolderBrowser` component for user interface to navigate directories.
- Update `Scan` page to integrate folder browsing feature.
- Define `DirectoryItem` and `BrowseDirectoryResponse` schemas for API responses.
2026-01-30 16:09:24 +00:00
tanyar09
6688a654d3 chore: Clean up documentation and update various files
Some checks failed
CI / skip-ci-check (pull_request) Successful in 8s
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / lint-and-type-check (pull_request) Has been cancelled
- Remove obsolete documentation files
- Update .env_example
- Update ManageUsers components
- Update pending_photos API
- Add verify-all-users script
2026-01-29 19:52:48 +00:00
tanyar09
70923e0ecf feat: Enhance photo and video handling in admin frontend
Some checks failed
CI / skip-ci-check (pull_request) Successful in 7s
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / lint-and-type-check (pull_request) Has been cancelled
- Added media_type to PhotoSearchResult interface to distinguish between images and videos.
- Updated PhotoViewer component to support video playback, including URL handling and preloading logic.
- Modified openPhoto function in Search page to open videos correctly.
- Enhanced backend API to serve video files with range request support for better streaming experience.

These changes improve the user experience by allowing seamless viewing of both images and videos in the application.
2026-01-28 17:45:45 +00:00
f9fafcbb1a fix: prevent server crashes during photo processing
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m49s
CI / lint-and-type-check (pull_request) Successful in 2m28s
CI / python-lint (pull_request) Successful in 2m12s
CI / test-backend (pull_request) Successful in 4m5s
CI / build (pull_request) Successful in 4m53s
CI / secret-scanning (pull_request) Successful in 1m56s
CI / dependency-scan (pull_request) Successful in 1m54s
CI / sast-scan (pull_request) Successful in 3m2s
CI / workflow-summary (pull_request) Successful in 1m48s
- Add database connection health checks every 10 photos
- Add session refresh logic to recover from connection errors
- Improve error handling for database disconnections/timeouts
- Add explicit image cleanup to prevent memory leaks
- Add connection error detection throughout processing pipeline
- Gracefully handle database connection failures instead of crashing

Fixes issue where server would crash during long-running photo processing
tasks when database connections were lost or timed out.
2026-01-21 12:47:37 -05:00
51081c1b5d chore: Add deployment checklist and PM2 configuration examples
Some checks failed
CI / test-backend (pull_request) Successful in 5m30s
CI / build (pull_request) Has been skipped
CI / secret-scanning (pull_request) Has been skipped
CI / dependency-scan (pull_request) Has been skipped
CI / sast-scan (pull_request) Has been skipped
CI / lint-and-type-check (pull_request) Has been cancelled
CI / python-lint (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / skip-ci-check (pull_request) Has been cancelled
This commit introduces a new `DEPLOYMENT_CHECKLIST.md` file that outlines the necessary steps for configuring server-specific settings after pulling from Git. It includes instructions for environment files, PM2 configuration, firewall rules, database setup, and building frontends. Additionally, it adds an example `ecosystem.config.js.example` file for PM2 configuration, providing a template for users to customize for their deployment environment. The `.gitignore` file is updated to include the new PM2 ecosystem config file.
2026-01-19 15:20:39 -05:00
4b0a495bb0 chore: Add Semgrep ignore file and CI job status documentation
This commit introduces a Semgrep ignore file to suppress false positives and low-risk findings, particularly for controlled inputs in database scripts and development configurations. Additionally, a new CI Job Status Configuration document is added to clarify which CI jobs should fail on errors and which are informational, enhancing the overall CI/CD process documentation.
2026-01-12 12:25:19 -05:00
922c468e9b chore: Enhance CI workflow summary and improve JWT token generation
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m29s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m47s
CI / test-backend (pull_request) Successful in 3m8s
CI / build (pull_request) Successful in 2m26s
CI / secret-scanning (pull_request) Successful in 1m43s
CI / dependency-scan (pull_request) Successful in 1m35s
CI / sast-scan (pull_request) Successful in 2m46s
CI / workflow-summary (pull_request) Successful in 1m27s
This commit updates the CI workflow summary to provide a clearer overview of job results and their purposes. It also modifies the JWT token generation in the authentication API to include a unique identifier (`jti`) for both access and refresh tokens, improving token management. Additionally, the test for the token refresh endpoint is adjusted to ensure it verifies the new access token correctly.
2026-01-08 14:15:08 -05:00
70cd7aad95 fix: Handle ValueError in accept_matches function for better error reporting
All checks were successful
CI / skip-ci-check (pull_request) Successful in 1m29s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m53s
CI / test-backend (pull_request) Successful in 3m12s
CI / build (pull_request) Successful in 2m47s
CI / secret-scanning (pull_request) Successful in 1m53s
CI / dependency-scan (pull_request) Successful in 1m36s
CI / sast-scan (pull_request) Successful in 2m45s
CI / workflow-summary (pull_request) Successful in 1m27s
This commit updates the `accept_matches` function in the `people.py` API to include error handling for `ValueError`. If the error message indicates that a resource is not found, it raises an HTTP 404 exception with a user-friendly message. This change improves the robustness of the API by providing clearer feedback to users when a match cannot be accepted.
2026-01-08 13:49:38 -05:00
16e5d4acaf chore: Update sensitive information in documentation and code to use environment variables
Some checks failed
CI / skip-ci-check (push) Successful in 1m29s
CI / skip-ci-check (pull_request) Successful in 1m29s
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / lint-and-type-check (push) Has been cancelled
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m47s
CI / test-backend (pull_request) Successful in 3m13s
CI / build (pull_request) Successful in 2m25s
CI / secret-scanning (pull_request) Successful in 1m42s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m42s
CI / workflow-summary (pull_request) Successful in 1m27s
This commit replaces hardcoded sensitive information, such as database passwords and secret keys, in the README and deployment documentation with placeholders and instructions to use environment variables. This change enhances security by preventing exposure of sensitive data in the codebase. Additionally, it updates the database session management to raise an error if the DATABASE_URL environment variable is not set, ensuring proper configuration for development environments.
2026-01-08 13:08:47 -05:00
3e0140c2f3 feat: Implement custom bearer token security dependency for authentication
Some checks failed
CI / skip-ci-check (push) Successful in 1m28s
CI / skip-ci-check (pull_request) Successful in 1m28s
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / lint-and-type-check (push) Has been cancelled
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m53s
CI / test-backend (pull_request) Successful in 3m12s
CI / build (pull_request) Successful in 2m25s
CI / secret-scanning (pull_request) Successful in 1m41s
CI / dependency-scan (pull_request) Successful in 1m35s
CI / sast-scan (pull_request) Successful in 2m49s
CI / workflow-summary (pull_request) Successful in 1m27s
This commit introduces a custom security dependency, `get_bearer_token`, in the authentication API to ensure compliance with HTTP standards by returning a 401 Unauthorized status for missing or invalid tokens. Additionally, it updates test user fixtures to include full names for better clarity in tests.
2026-01-08 12:40:07 -05:00
364974141d chore: Add pytest configuration and update CI to skip DeepFace during tests
Some checks failed
CI / skip-ci-check (push) Successful in 1m27s
CI / lint-and-type-check (push) Has been cancelled
CI / python-lint (push) Has been cancelled
CI / test-backend (push) Has been cancelled
CI / build (push) Has been cancelled
CI / secret-scanning (push) Has been cancelled
CI / dependency-scan (push) Has been cancelled
CI / sast-scan (push) Has been cancelled
CI / workflow-summary (push) Has been cancelled
CI / skip-ci-check (pull_request) Successful in 1m27s
CI / lint-and-type-check (pull_request) Successful in 2m6s
CI / python-lint (pull_request) Successful in 1m54s
CI / test-backend (pull_request) Successful in 3m39s
CI / build (pull_request) Successful in 2m24s
CI / secret-scanning (pull_request) Successful in 1m40s
CI / dependency-scan (pull_request) Successful in 1m33s
CI / sast-scan (pull_request) Successful in 2m47s
CI / workflow-summary (pull_request) Successful in 1m26s
This commit introduces a new `pytest.ini` configuration file for backend tests, specifying test discovery patterns and output options. Additionally, the CI workflow is updated to set an environment variable that prevents DeepFace and TensorFlow from loading during tests, avoiding illegal instruction errors on certain CPUs. The face service and pose detection modules are modified to conditionally import DeepFace and RetinaFace based on this environment variable, enhancing test reliability. These changes improve the testing setup and contribute to a more robust CI process.
2026-01-07 15:02:41 -05:00
906e2cbe19 feat: Enhance installation script and documentation for Python tkinter support
This commit updates the `install.sh` script to include the installation of Python tkinter, which is required for the native folder picker functionality. Additionally, the README.md is modified to reflect this new requirement, providing installation instructions for various operating systems. The documentation is further enhanced with troubleshooting tips for users encountering issues with the folder picker, ensuring a smoother setup experience.
2026-01-06 12:29:40 -05:00
1f3f35d535 docs: Update README.md for PostgreSQL requirement and remove SQLite references
This commit updates the README.md to reflect the requirement of PostgreSQL for both development and production environments. It clarifies the database setup instructions, removes references to SQLite, and ensures consistency in the documentation regarding database configurations. Additionally, it enhances the clarity of environment variable settings and database schema compatibility between the web and desktop versions.
2026-01-06 11:56:08 -05:00
fe01ff51b8 feat: Add PrismaCompatibleDate type and enhance date validation in photo extraction
This commit introduces a new `PrismaCompatibleDate` type to ensure compatibility with Prisma's SQLite driver by storing dates in a DateTime format. Additionally, the `extract_exif_date`, `extract_video_date`, and `extract_photo_date` functions are updated to include validation checks that reject future dates and dates prior to 1900, enhancing data integrity during photo and video metadata extraction.
2026-01-05 15:05:03 -05:00
c69604573d feat: Improve face identification process with validation and error handling
This commit enhances the face identification process by adding validation checks for person ID and names, ensuring that users provide necessary information before proceeding. It also introduces detailed logging for better debugging and user feedback during the identification process. Additionally, error handling is improved to provide user-friendly messages in case of failures, enhancing the overall user experience.
2026-01-05 13:37:45 -05:00
0b95cd2492 feat: Add job cancellation support and update job status handling
This commit introduces a new `CANCELLED` status to the job management system, allowing users to cancel ongoing jobs. The frontend is updated to handle job cancellation requests, providing user feedback during the cancellation process. Additionally, the backend is enhanced to manage job statuses more effectively, ensuring that jobs can be marked as cancelled and that appropriate messages are displayed to users. This improvement enhances the overall user experience by providing better control over job processing.
2026-01-05 13:09:32 -05:00
03d3a28b21 feat: Add date validation for photo import process
This commit introduces a new function, `validate_date_taken`, to ensure that the date taken for photos is valid before being saved. The function checks for valid date objects, prevents future dates, and filters out dates that are too old. The photo import process is updated to utilize this validation, enhancing data integrity and preventing corrupted date data from being stored. Additionally, the `date_added` field is explicitly set to the current UTC time to ensure validity.
2026-01-02 14:46:57 -05:00
e624d203d5 feat: Add DeepFace model weights download functionality to installation script
This commit introduces a new function in the `install.sh` script to download DeepFace model weights, enhancing the setup process for users. The function checks for the presence of DeepFace and attempts to download the ArcFace model weights, providing fallback options and user-friendly messages for manual download if automatic attempts fail. This improvement streamlines the initial configuration for facial recognition capabilities in the application.
2026-01-02 14:16:08 -05:00
32be5c7f23 feat: Enhance auth database setup and environment variable loading
This commit improves the setup of the authentication database by adding a new function to create necessary tables for both frontends. It also ensures that environment variables are loaded from a `.env` file before any database operations, enhancing configuration management. Additionally, minor updates are made to related scripts for better clarity and functionality.
2026-01-02 13:28:07 -05:00
68d280e8f5 feat: Add new analysis documents and update installation scripts for backend integration
This commit introduces several new analysis documents, including Auto-Match Load Performance Analysis, Folder Picker Analysis, Monorepo Migration Summary, and various performance analysis documents. Additionally, the installation scripts are updated to reflect changes in backend service paths, ensuring proper integration with the new backend structure. These enhancements provide better documentation and streamline the setup process for users.
2025-12-30 15:04:32 -05:00