#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = ["pymongo"]
# ///

from datetime import datetime, timedelta, timezone
from pymongo import MongoClient

client = MongoClient(
    "mongodb://root:3wwfoUjyk2E2zWELXFlLuHqfw1ALlOp4pb2H5Vq3TImbMIHL2h1u8Jej2mjzCPl@docdb.connorrhodes.com:35563"
)

seven_days_ago = datetime.now(timezone.utc) - timedelta(days=7)

results = client.notes.journal.find(
    {
        "tags": "examination_of_conscience",
        "created_at": {"$gte": seven_days_ago},
    }
)

for doc in results:
    print(f"[{doc['created_at'].strftime('%Y-%m-%d %H:%M')}] {doc['note']}")

client.close()
