```html

Building a Multi-Domain Executive Intelligence System: Lambda, SES, and Real-Time Reporting Infrastructure

Over the past development session, we built and deployed a comprehensive executive reporting infrastructure spanning four business entities (JADA, Queen of San Diego, QuickDumpNow, DangerousCentaur) plus three supporting asset management domains. This post details the technical architecture, deployment strategy, and architectural decisions behind a system that generates role-specific intelligence reports and delivers them via AWS SES.

What Was Built

The core deliverable was a multi-perspective reporting system that generates eight specialized reports:

  • CEO Report — Asset inventory, profitability shortfalls, KPI gaps, 30-day prioritized action plan
  • CTO/Engineering Report — Stack audit, security hardening checklist, infrastructure cost analysis, UX debt inventory, dev cycle maturity assessment
  • CFO Report — Burn rate modeling, capital deployment framework, break-even analysis, monthly revenue targets
  • CMO Report — Channel visibility matrix, OTA sequencing strategy, local SEO roadmap, 30/60/90-day marketing milestones
  • Accounting/Controller Report — Revenue recognition audit, chart of accounts rebuild, expense categorization, accounting system roadmap
  • Real Estate Manager Report — 3028 51st St rental asset analysis, occupancy modeling, maintenance cost tracking
  • Logistics Director Report — Expert Yacht Delivery operational metrics, delivery SLA tracking, client billing audit
  • Portfolio Billing Audit — DangerousCentaur client receivables, invoice aging, payment collection risk assessment

Technical Architecture

Report Generation Pipeline

The reporting system is split into two Python modules:

  • /Users/cb/Documents/repos/tools/send_exec_reports.py — Primary report orchestrator
  • /Users/cb/Documents/repos/tools/send_exec_reports_2.py — Secondary reports and dashboard task creation

Each script uses structured data aggregation to pull context from:

  • Project handoff markdown files in /agent_handoffs/projects/
  • Lambda environment variables for entity-specific configurations
  • Manual asset inventories across all four entities
  • SES verified sender addresses from repos.env

The scripts generate formatted HTML email bodies with role-specific insights, then invoke AWS SES to deliver them. Each report is tailored to the recipient's domain of responsibility, using consistent structure but radically different content depth and focus areas.

Email Delivery via SES

We leverage AWS SES for reliable, cost-effective email delivery across all reports. The sender address is configured as admin@queenofsandiego.com (a verified SES identity), with recipients specified in environment variables:


# From repos.env (sensitive values redacted)
SES_SENDER=admin@queenofsandiego.com
REPORT_RECIPIENT_PRIMARY=c.b.ladd@gmail.com
# BCC configured for audit trail

The Python scripts construct boto3 SES clients, validate sender/recipient addresses against verified identities, and send via the SendEmail API. This approach avoids SMTP configuration overhead and provides automatic bounce/complaint handling through SES's native event streams.

Lambda Function Enhancements for ShipCaptainCrew

In parallel with the reporting system, we made extensive updates to the ShipCaptainCrew tool's Lambda function and frontend, improving event lifecycle management, user authentication, and role-based access control.

Key Lambda Changes

File: /Users/cb/Documents/repos/sites/queenofsandiego.com/tools/shipcaptaincrew/lambda_function.py

The Lambda function went through 10+ iterative refinements:

  • JWT Authentication — Implemented magic link token generation and validation using JWT_SECRET from Lambda environment variables. Tokens include user identity, role, and expiration.
  • Event Lifecycle Handlers — Added /create_event, /event/{event_id}/claim, and /event/{event_id}/designate endpoints to handle captain/crew role assignment and release.
  • Checklist Management — Integrated pre-event/departure/return/post-event checklist state machine with timing hooks that fire at sunset-relative intervals.
  • Sunset Time Calculation — Added geolocation-based sunset calculation (San Diego specific initially, but architectured for extensibility) to trigger time-sensitive notifications.
  • DynamoDB Event Storage — Events stored with event_id as partition key, role assignments stored as nested JSON, enabling atomic role transitions.

The deployment pattern for Lambda was:


# Syntax validation
python3 -m py_compile lambda_function.py

# Package for deployment
zip -r lambda_package.zip lambda_function.py

# Deploy to AWS Lambda
aws lambda update-function-code \
  --function-name shipcaptaincrew-main \
  --zip-file fileb://lambda_package.zip

Frontend Updates

File: /Users/cb/Documents/repos/sites/queenofsandiego.com/tools/shipcaptaincrew/frontend/index.html

The frontend underwent four major iterations:

  • Magic Link Handler — JavaScript code to parse JWT from URL query string, validate expiration, and store auth token in sessionStorage.
  • Role Claim Modal — Interactive UI to allow users to claim captain or crew roles with email confirmation.
  • Timing Panel — Real-time display of sunset time, relative checklist deadlines (e.g., "Departure checklist due in 45 minutes"), and countdown timers.
  • Checklist State Machine UI — Visual progression through pre-event → departure → return → post-event states with timestamp tracking.

Frontend deployment uses S3 + CloudFront:


# Upload to S3
aws s3 sync ./frontend s3://queenofsandiego-shipcaptaincrew/ --delete

# Invalidate CloudFront cache (distribution ID stored in config)
aws cloudfront create-invalidation \
  --distribution-id [DIST_ID] \
  --paths "/*"

Infrastructure and Deployment Strategy

Project Handoff Documentation

All architectural decisions and in-progress work are tracked in /Users/cb/Documents/repos/agent_handoffs/projects/shipcaptaincrew.md. This file serves as the single source of truth for:

  • Feature status and blockers
  • Known bugs and technical debt
  • Security audit findings
  • Deployment prerequisites and rollback procedures

This handoff document is updated after each deployment cycle, enabling seamless context transfer between developers and automated agents.

Environment Configuration

Lambda environment variables (non-sensitive keys only) include:

  • DYNAMODB