Snapshot: full project state

This commit is contained in:
2026-10-06 23:43:21 -07:00
commit 1551408fc5
37 changed files with 2827 additions and 0 deletions

32
improve.py Normal file
View File

@@ -0,0 +1,32 @@
# Procyon — self-improvement loop. Logs outcomes, surfaces what works.
import db
def log_outcome(app_id, stage, notes=''):
db.add_outcome(app_id, stage, notes)
db.update_application(app_id, status=stage)
def insights():
"""Aggregate outcomes -> simple actionable insights."""
conn = db.get_conn()
try:
rows = conn.execute(
'SELECT stage, COUNT(*) c FROM outcomes GROUP BY stage').fetchall()
sent = conn.execute(
"SELECT COUNT(*) c FROM applications WHERE outcome IN ('response','interview','offer')"
).fetchone()['c']
total = conn.execute('SELECT COUNT(*) c FROM applications').fetchone()['c']
by_stage = {r['stage']: r['c'] for r in rows}
resp_rate = round(sent / total, 3) if total else 0.0
return {
'total_applications': total,
'by_stage': by_stage,
'positive_outcomes': sent,
'response_rate': resp_rate,
'note': ('Response rate is positive-outcome / total applications. '
'Higher = your tailoring and targeting are landing.'),
}
finally:
conn.close()