Files
personal-ai-assistant/backend/app/services/scheduler_service.py
dolgolyov.alexei b0790d719c Generalize from health-specific to universal personal assistant
The app manages multiple life areas (health, finance, personal, work),
not just health. Updated all health-specific language throughout:

Backend:
- Default system prompt: general personal assistant (not health-only)
- AI tool descriptions: generic (not health records/medications)
- Memory categories: health, finance, personal, work, document_summary, other
  (replaces condition, medication, allergy, vital)
- PDF template: "Prepared for" (not "Patient"), "Key Information" (not "Health Profile")
- Renamed generate_health_pdf -> generate_pdf_report, health_report.html -> report.html
- Renamed run_daily_health_review -> run_daily_review
- Context assembly: "User Profile" (not "Health Profile")
- OpenAPI: generic descriptions

Frontend:
- Dashboard subtitle: "Your personal AI assistant"
- Memory categories: Health, Finance, Personal, Work
- Document types: Report, Contract, Receipt, Certificate (not lab_result, etc.)
- Updated en + ru translations throughout

Documentation:
- README: general personal assistant description
- Removed health-only feature descriptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 15:15:39 +03:00

42 lines
1.3 KiB
Python

from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
from apscheduler.triggers.date import DateTrigger
scheduler = AsyncIOScheduler()
def start_scheduler():
if not scheduler.running:
# Register periodic jobs
from app.workers.notification_sender import send_pending_notifications
scheduler.add_job(
send_pending_notifications,
trigger=CronTrigger(second="0", minute="*"), # every minute
id="send_pending_notifications",
replace_existing=True,
)
from app.workers.health_review import run_daily_review
scheduler.add_job(
run_daily_review,
trigger=CronTrigger(hour=8, minute=0),
id="daily_review",
replace_existing=True,
)
scheduler.start()
def shutdown_scheduler():
if scheduler.running:
scheduler.shutdown(wait=False)
def schedule_one_time(job_id: str, run_date, func, **kwargs):
scheduler.add_job(func, trigger=DateTrigger(run_date=run_date), id=job_id, replace_existing=True, kwargs=kwargs)
def schedule_recurring(job_id: str, cron_expr: str, func, **kwargs):
trigger = CronTrigger.from_crontab(cron_expr)
scheduler.add_job(func, trigger=trigger, id=job_id, replace_existing=True, kwargs=kwargs)