Files
momentry_core/scripts/fix_processors_asrx.py
Accusys 14e886cc08 feat: progressive multi-round face matching + pending person API
- Identity agent: per-face max matching, multi-round with derived
  seeds from high-confidence faces, angle diversity filter (cosine sim < 0.90)
- Pending person API: POST /file/:file_uuid/pending-person
  + GET /file/:file_uuid/pending-persons with status=pending, source=manual
- Update API docs (07_identity.md)
2026-06-24 03:42:04 +08:00

58 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
Fix existing monitor_jobs records to include ASRX in processors list.
This script adds 'asrx' to processors array for all monitor_jobs records
that don't have it yet.
"""
import os
import psycopg2
def fix_processors():
schema = os.environ.get('DATABASE_SCHEMA', 'public')
conn = psycopg2.connect(os.environ.get('DATABASE_URL', 'postgres://accusys@localhost:5432/momentry'))
cur = conn.cursor()
# Check current state
cur.execute(f"""
SELECT COUNT(*) FROM {schema}.monitor_jobs
WHERE processors IS NOT NULL
AND NOT ('asrx' = ANY(processors))
""")
missing_asrx = cur.fetchone()[0]
print(f"Found {missing_asrx} jobs missing ASRX in processors")
if missing_asrx > 0:
# Add ASRX to processors array
cur.execute(f"""
UPDATE {schema}.monitor_jobs
SET processors = array_append(processors, 'asrx')
WHERE processors IS NOT NULL
AND NOT ('asrx' = ANY(processors))
""")
updated = cur.rowcount
conn.commit()
print(f"Updated {updated} jobs to include ASRX")
# Verify
cur.execute(f"""
SELECT uuid, processors FROM {schema}.monitor_jobs
WHERE processors IS NOT NULL
AND 'asrx' = ANY(processors)
ORDER BY created_at DESC LIMIT 5
""")
for row in cur.fetchall():
print(f"UUID: {row[0]}, Processors: {row[1]}")
else:
print("All jobs already have ASRX in processors")
conn.close()
if __name__ == '__main__':
fix_processors()