SCRAPE-9: Implement updateDailySummary() aggregation #14

Merged
stephen merged 1 commits from scraper/daily-summary into dev 2026-02-06 00:15:30 -07:00

1 Commits

Author SHA1 Message Date
c25f2b4950 Implement updateDailySummary() aggregation function
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 12s
CI/CD Pipeline - Apartment API / Run Linting (pull_request) Successful in 9m36s
CI/CD Pipeline - Apartment API / Run Tests (pull_request) Successful in 9m51s
CI/CD Pipeline - Apartment API / Send Webhook Notification (pull_request) Successful in 2s
CI/CD Pipeline - Apartment API / Build & Push Image (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Deploy to Production (pull_request) Has been skipped
Add daily summary aggregation that tracks apartment inventory changes:
- Upsert summaries by date key for idempotent operation
- Track new_units, rented_units, and stale_units arrays with counts
- Calculate net_change (new - rented) and total_available_today
- Fetch previous day summary for total_available_yesterday
- Compute turnover_rate as percentage of rented vs yesterday available
- Handle edge cases: zero division, missing previous day, month boundaries
- Full test coverage with 22 tests across all functional areas
2026-02-06 00:04:11 -07:00