| 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 — Bryan Dozier Cleanup Diagnostic
Finds every remaining trace of Bryan Dozier (or Dozer) in the database
across all collections. Read-only — does not modify anything.
"""
import json
import os
import sys
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}\n")
NAME_PATTERN = ['dozier', 'dozer']
EMAIL_PATTERN = ['dozier', 'dozer']
def matches(text):
if not text: return False
t = str(text).lower()
return any(p in t for p in NAME_PATTERN)
def matches_email(text):
if not text: return False
t = str(text).lower()
return any(p in t for p in EMAIL_PATTERN)
# Find Bryan in persons
print("=" * 70)
print("PERSONS")
print("=" * 70)
matched_persons = []
for p in db.get('persons', []):
name = (p.get('firstName','') + ' ' + p.get('lastName','') + ' ' + p.get('middleName','')).strip()
email = p.get('email','')
if matches(name) or matches_email(email):
matched_persons.append(p)
print(f"\n PERSON ID: {p.get('id')}")
for k, v in p.items():
if v not in (None, '', [], {}, False):
print(f" {k}: {v}")
person_ids = {p.get('id') for p in matched_persons}
# Travel requests
print("\n" + "=" * 70)
print("TRAVEL REQUESTS")
print("=" * 70)
matched_reqs = []
for r in db.get('travelRequests', []):
if r.get('personId') in person_ids \
or matches(r.get('submittedName','')) \
or matches(r.get('lastName','')) \
or matches_email(r.get('submittedEmail','')):
matched_reqs.append(r)
print(f"\n REQ ID: {r.get('id')}")
print(f" showId: {r.get('showId')}")
print(f" personId: {r.get('personId')}")
print(f" submittedName: {r.get('submittedName','')}")
print(f" submittedEmail: {r.get('submittedEmail','')}")
print(f" status: {r.get('status','')}")
print(f" travelMethod: {r.get('travelMethod','')}")
req_ids = {r.get('id') for r in matched_reqs}
# Hotel bookings
print("\n" + "=" * 70)
print("HOTEL BOOKINGS")
print("=" * 70)
matched_hotels = []
for h in db.get('hotelBookings', []):
if h.get('personId') in person_ids \
or matches(h.get('lastName','')) \
or matches(h.get('firstName','')):
matched_hotels.append(h)
print(f"\n HOTEL ID: {h.get('id')}")
for k, v in h.items():
if v not in (None, '', [], {}, False):
print(f" {k}: {v}")
# Per Diems
print("\n" + "=" * 70)
print("PER DIEMS")
print("=" * 70)
matched_pds = []
for pd in db.get('perDiems', []):
if pd.get('personId') in person_ids or pd.get('reqId') in req_ids:
matched_pds.append(pd)
print(f"\n PD ID: {pd.get('id')}")
for k, v in pd.items():
if v not in (None, '', [], {}, False):
print(f" {k}: {v}")
# Assignments
print("\n" + "=" * 70)
print("ASSIGNMENTS")
print("=" * 70)
matched_assigns = []
for a in db.get('assignments', []):
if a.get('personId') in person_ids:
matched_assigns.append(a)
print(f" {a.get('id')}: personId={a.get('personId')} -> showId={a.get('showId')}")
# Approvals
print("\n" + "=" * 70)
print("APPROVALS")
print("=" * 70)
matched_apps = []
for ap in db.get('approvals', []):
if ap.get('personId') in person_ids:
matched_apps.append(ap)
print(f" {ap.get('id')}: personId={ap.get('personId')} status={ap.get('status','')}")
# Bookings (legacy collection if present)
print("\n" + "=" * 70)
print("BOOKINGS (legacy)")
print("=" * 70)
matched_bookings = []
for b in db.get('bookings', []):
if b.get('personId') in person_ids:
matched_bookings.append(b)
print(f" {b.get('id')}: personId={b.get('personId')}")
# Notes
print("\n" + "=" * 70)
print("NOTES")
print("=" * 70)
matched_notes = []
for n in db.get('notes', []):
if n.get('personId') in person_ids or matches(n.get('text','')):
matched_notes.append(n)
print(f" {n.get('id')}: personId={n.get('personId')} text={(n.get('text','') or '')[:80]}")
# Discrepancy status (keyed by personId-something often)
print("\n" + "=" * 70)
print("DISCREPANCY STATUS")
print("=" * 70)
disc_keys_to_clean = []
for key, val in (db.get('discrepancyStatus') or {}).items():
for pid in person_ids:
if pid and pid in key:
disc_keys_to_clean.append(key)
print(f" {key}: {val}")
break
for rid in req_ids:
if rid and rid in key and key not in disc_keys_to_clean:
disc_keys_to_clean.append(key)
print(f" {key}: {val}")
break
# Summary
print("\n" + "=" * 70)
print("SUMMARY — RECORDS THAT WOULD BE DELETED")
print("=" * 70)
print(f" Persons: {len(matched_persons)}")
print(f" Travel Requests: {len(matched_reqs)}")
print(f" Hotel Bookings: {len(matched_hotels)}")
print(f" Per Diems: {len(matched_pds)}")
print(f" Assignments: {len(matched_assigns)}")
print(f" Approvals: {len(matched_apps)}")
print(f" Bookings (legacy): {len(matched_bookings)}")
print(f" Notes: {len(matched_notes)}")
print(f" Discrepancy keys: {len(disc_keys_to_clean)}")
print()
print("If this looks correct, run: python3 cleanup_dozier.py")