41e8608315e75a9d97cadb737a10c2d461964169
- Add targeted unit tests in tests/unit/services/test_booking_service.py asserting strict boundaries (< vs <=), encroaching buffer intervals, and 48.0h cutoff comparisons - Add naive/aware UTC normalization tests in tests/unit/services/test_timestamps.py - Add calendar prefix state tests and mock/failure sync tests in tests/unit/services/test_calendar.py - Achieve 100% mutmut kill score (253/253 mutants killed, 0 surviving) - Document test taxonomy and mutmut workflow in tests/README.md - Add ADR 0006 documenting mutation testing quality audit gate Refs: #6
feat(models): implement SQLModel table models, portable database engine, and align INDIVIDUAL schema
feat(models): implement SQLModel table models, portable database engine, and align INDIVIDUAL schema
Armonía del Ser: Core API (armonia-api)
Backend API service for Armonía del Ser—a holistic therapy, meditation, and personal growth center founded by Jasmin in Mexico.
Built with FastAPI and Turso (libSQL) to serve as the operational source of truth between Google Calendar, Turso, and the Admin Dashboard (armonia-dashboard) protected with a server-side allowlist for Google OAuth.
Architecture & Design
[Clients / Landing UI] [Admin Dashboard (Jasmin & Assistant)]
│ │ (Google OAuth + Turso Allowlist)
▼ ▼
┌──────────────────────────────────────────────────────────┐
│ FastAPI Core Service │
│ - Separated Booking & Payment State Engine │
│ - 48-Hour Payment Follow-Up Queue & Delayed Exceptions │
│ - Deliberate Slot Release & Audit Trail │
│ - Google OAuth2 + Turso Allowlist Guard │
└──────────────┬─────────────────────────────┬─────────────┘
│ │
▼ ▼
[Turso Database] [Google Calendar API]
(SQLite / libSQL at edge) (Schedule coordination &
recoverable sync health)
Key Principles
- Separated Booking & Payment States:
booking_status(RESERVED,RELEASED,CANCELLED,COMPLETED,NO_SHOW) is modeled orthogonally frompayment_arrangement(PREPAID_DEFAULT,DELAYED_ALLOWED,PACKAGE_REDEEMED) andpayment_status(AWAITING_ACKNOWLEDGMENT,ACKNOWLEDGED,NOT_APPLICABLE).
- Prepayment by Default, Explicit Delayed-Payment Exceptions:
- Most bookings require prepayment (
PREPAID_DEFAULT). Authorized administrators can explicitly authorize a delayed-payment exception (DELAYED_ALLOWED), keepingpayment_status = 'AWAITING_ACKNOWLEDGMENT'until payment is actually settled.
- Most bookings require prepayment (
- Deliberate Slot Release & 48-Hour Follow-Up Visibility:
- Bookings never expire automatically on a timer. At 48 hours prior to a session, unacknowledged bookings appear in
GET /bookings/follow-up-queueso the assistant can manually follow up via WhatsApp and either acknowledge payment, authorize delayed payment, or deliberately release the slot (RELEASED).
- Bookings never expire automatically on a timer. At 48 hours prior to a session, unacknowledged bookings appear in
- Google OAuth + Turso Allowlist:
- Administrative endpoints verify the caller's Google OAuth session against Turso's
admin_allowlisttable on every request and record all mutations inadmin_audit_log.
- Administrative endpoints verify the caller's Google OAuth session against Turso's
- Zero-Cost Infrastructure:
- Runs containerized on Google Cloud Run free tier (scale-to-zero, $0/month).
- Data stored in Turso free tier, with local fallback to file-based SQLite (
file:local.db).
Data Model Overview
| Entity | Purpose |
|---|---|
admin_allowlist |
Authorized administrator emails (OWNER, ASSISTANT, ADMIN), active status, and last login timestamp. |
services |
Catalog of offerings (Círculos de Cacao, Meditaciones, Constelaciones, Psicoterapia), format (ONLINE / PRESENCIAL), type (GROUP / INDIVIDUAL), capacity, mandatory buffer, and price in MXN. |
clients |
Client directory (name, phone / WhatsApp, email, notes). |
bookings |
Appointments tracking booking_status, payment_arrangement, payment_status, folio (ADS-XXXX), exception/release/acknowledgment audit metadata, and Google Calendar sync health. |
payments |
Audit record of SPEI/OXXO/cash payment acknowledgment (acknowledged_by, acknowledged_at, notes). |
admin_audit_log |
Immutable log of administrative actions (ACKNOWLEDGE_PAYMENT, AUTHORIZE_DELAYED_PAYMENT, RELEASE_BOOKING, etc.). |
Local Development Quickstart
Prerequisites
- Python 3.13+
uv
1. Setup Environment
cp .env.example .env
By default, .env uses DATABASE_URL=file:local.db for zero-configuration local SQLite testing.
2. Install Dependencies
uv sync
3. Initialize Database & Seed Services
uv run python -m app.db.init_db
4. Run Development Server
uv run uvicorn app.main:app --reload --port 8000
Interactive API docs are available at http://localhost:8000/docs.
Verification Gates
All changes must pass local verification before proposing commits:
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest
Languages
Python
99.2%
Dockerfile
0.5%
Nix
0.3%