| Server IP : 216.92.14.13 / Your IP : 216.73.217.126 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/home/rmlac2fmr/ |
Upload File : |
#!/usr/bin/env python3
"""
JBT Travel Ops — Bulk Import Investigation
Checks current DB state and recent activity log for evidence of what happened
to the bulk-imported people.
"""
import json
import os
import sys
from datetime import datetime, timedelta
candidates = [
'db.json',
'./data/db.json',
os.path.expanduser('~/public_html/jn.com/ops/data/db.json')
]
db_path = next((c for c in candidates if os.path.exists(c)), None)
if not db_path:
print("ERROR: db.json not found")
sys.exit(1)
with open(db_path, 'r') as f:
db = json.load(f)
print(f"Reading: {db_path}")
print(f"DB _lastSaved: {db.get('_lastSaved','(unknown)')}")
print(f"DB _savedBy: {db.get('_savedBy','(unknown)')}")
print()
print("=" * 70)
print("CURRENT STATE")
print("=" * 70)
print(f" Total persons: {len(db.get('persons',[]))}")
print(f" Total assignments: {len(db.get('assignments',[]))}")
print(f" NMDC (S2) assigns: {len([a for a in db.get('assignments',[]) if a.get('showId')=='S2'])}")
print(f" ACF (S3) assigns: {len([a for a in db.get('assignments',[]) if a.get('showId')=='S3'])}")
print()
# Find persons created most recently (today/yesterday)
print("=" * 70)
print("PERSONS CREATED MOST RECENTLY (top 15 by created date or ID timestamp)")
print("=" * 70)
import re
def person_ts(p):
# Try created field first, then extract from ID
c = p.get('created', '')
if c:
try: return datetime.strptime(c, '%Y-%m-%d').timestamp() * 1000
except: pass
m = re.match(r'^P(\d+)', p.get('id',''))
if m: return int(m.group(1))
return 0
sorted_persons = sorted(db.get('persons', []), key=person_ts, reverse=True)
for p in sorted_persons[:15]:
print(f" {p.get('id'):<20} {p.get('firstName','')+' '+p.get('lastName',''):<30} created={p.get('created','(?)')} email={p.get('email','')}")
print()
print("=" * 70)
print("RECENT ACTIVITY LOG (last 30 entries, newest first)")
print("=" * 70)
log = db.get('activityLog', [])
for entry in log[:30]:
time_str = entry.get('time','')[:19] # trim to YYYY-MM-DDTHH:MM:SS
msg = entry.get('msg','')[:150]
# strip HTML tags for readability
msg_clean = re.sub(r'<[^>]+>', '', msg)
print(f" [{time_str}] {entry.get('user','(?)'):<15} | {entry.get('type','(?)'):<8} | {msg_clean}")
# Look for bulk import entries specifically
print()
print("=" * 70)
print("BULK IMPORT ENTRIES IN LOG")
print("=" * 70)
bulk_entries = [e for e in log if 'bulk' in (e.get('msg','') or '').lower()]
for entry in bulk_entries[:10]:
time_str = entry.get('time','')[:19]
msg = re.sub(r'<[^>]+>', '', entry.get('msg',''))
print(f" [{time_str}] {entry.get('user','(?)'):<15} | {msg}")
if not bulk_entries:
print(" (no bulk import entries found)")
# Backup files present
print()
print("=" * 70)
print("AVAILABLE BACKUPS")
print("=" * 70)
backup_dir = os.path.dirname(db_path) or '.'
backups = sorted([f for f in os.listdir(backup_dir) if f.startswith('db.json.backup')])
for b in backups:
full = os.path.join(backup_dir, b)
size = os.path.getsize(full)
mtime = datetime.fromtimestamp(os.path.getmtime(full)).isoformat()[:19]
print(f" {b} ({size:,} bytes, {mtime})")