---
name: "BAIC Dashboard"
client: BAIC
status: active
tech: [Python, Flask, Hypercorn, React, Vite, Recharts, PapaParse, Azure AD, Make.com]
local_path: /Users/ai_leed/Documents/Projects/Oliver/baic_dashboard
deploy: python + npm run dev
url: 
server: baic (web-03)
tags: [baic, analytics, dashboard, flask, react, recharts, make, azure-ad]
created: 2026-04-14
last_commit: 2026-05-10
commits: 13
---

## Overview
Oliver Agency Reporting Module — analytics dashboard for conversation and message volumes. Backend fetches from Make.com webhook, enriches data, serves via REST API. Frontend filters client-side.

**Data flow:**
Make.com webhook → Flask API → enrich messages with conversation metadata → React SPA → Recharts visualization

## Tech Stack
- **Frontend:** React + Vite SPA (`/frontend/`) + Recharts + PapaParse (CSV export)
- **Backend:** Python Flask (`/backend/app.py`) + Hypercorn ASGI
- **Auth:** Azure AD (MSAL) — requires Azure App Registration
- **Data source:** Make.com webhook URL
- **Infrastructure:** No Docker

## Env Config (`.env`)
```
DOMAIN=
BASE_PATH=/dashboard/
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
MAKE_WEBHOOK_URL=
# Duplicate all with VITE_ prefix for frontend
```

## Architecture
```
Make.com webhook (data source)
    ↓
Flask backend (/backend/app.py)
    ↓ message enrichment (+ conversation metadata, assistant name mapping)
React SPA (client-side filtering + CSV export)
    └── Recharts (visualization)
    └── PapaParse (CSV export)
```

**Assistant ID mapping:** `assistantMapping.js` maps IDs → friendly display names.

## Dev Commands
```bash
cp .env.example .env    # Configure Azure AD + Make.com URL
# Start both:
cd backend && python app.py
cd frontend && npm run dev
```

## Deployment
- **Local path:** `/Users/ai_leed/Documents/Projects/Oliver/baic_dashboard`
- **Server base path:** `/dashboard/`
- **Last deploy:** 2025-11-19 (restart backend service fix)

## Timeline / Git History
| Date | Change |
|------|--------|
| 2026-05-10 | Fix date range filter ignoring messages without Timestamp |
| 2026-05-06 | Add Per-User Report tab with bar chart, table, and CSV export |
| 2025-11-19 | Update deploy script to restart backend service instead of start |

## Sessions
### 2026-05-10 – Fix date range filtering to show
**Asked:** Fix date range filtering to show only messages within selected timeframe instead of all-time counts.
**Done:** Recreated venv, deployed updated backend and frontend with corrected date filtering logic and restarted service.

### 2026-05-10 – Fix date range filtering not working
**Asked:** Fix date range filtering not working in message export analytics.
**Done:** Identified that message counts show all-time totals instead of filtering by selected date range in exports and tables.

### 2026-05-10 – Richard reported that date range filtering
**Asked:** Richard reported that date range filtering isn't working and shows total message counts instead of filtered counts.
**Done:** Investigated the issue and confirmed existing lint/build errors are pre-existing problems unrelated to recent changes.

### 2026-05-06 – Set up a per-user report generation
**Asked:** Set up a per-user report generation system for BAIC UK client with monthly data tracking using JSON files and CSV output.
**Done:** Deployed new index.html and assets to server with Per-User Report dashboard feature now live at baic.oliver.solutions.

### 2026-05-06 – Implement per-user report generation for BAIC
**Asked:** Implement per-user report generation for BAIC UK and deploy frontend changes to the server.
**Done:** Updated frontend components to generate per-user CSV reports from existing API data and deployed dist files to production via rsync.

### 2026-05-06 – Check current functionality and implement a
**Asked:** Check current functionality and implement a per-user monthly report system for BAIC UK using provided JSON data files.
**Done:** Analyzed server deployment structure and confirmed dist/ files should be deployed via rsync to /var/vhosts/baic.oliver.solutions/htdocs/dashboard/ while leaving backend untouched.

### 2026-05-06 – Set up per-user monthly reporting for
**Asked:** Set up per-user monthly reporting for BAIC UK by processing message and conversation JSON files into CSV format.
**Done:** Analyzed server deployment structure and confirmed local build paths are correct for the `/dashboard/` route with proper asset hashing.

### 2026-05-06 – How to implement a per-user message
**Asked:** How to implement a per-user message report for BAIC UK client and structure monthly data collection?
**Done:** Created user aggregation utilities and UserReport component with CSV export functionality that compiles without errors.

### 2026-04-29 – Asked | Check if the project
**Asked:** Asked | Check if the project is configured for the URL https://baic.oliver.solutions/
**Done:** Done | Reviewed project configuration for the specified URL

### 2026-04-24 – Asked for integration and hooks verification
**Asked:** Asked for integration and hooks verification across Claude, Obsidian, and cc-dashboard on this machine.
**Done:** Verified and fixed missing PROJECTS_ROOT configuration in settings.json hooks for scripts and cc-collector path resolution.

### 2026-04-14 – Project catalogued
**Done:** Added to Obsidian second brain with full details.

---
## Change Log
| Date | Requested | Changed | Files |
|------|-----------|---------|-------|
| 2026-05-10 | Date range filtering | Fixed timeframe logic in message counting, updated venv configuration, redeployed service | Dashboard.jsx, backend/app.py, venv configuration |
| 2026-05-10 | Date range filtering bug | Message count calculation, table filtering logic | analytics.tsx, messageExport.ts |
| 2026-05-10 | Date filtering bug | Message counts not filtered by date range, tables show all-time data instead of timeframe-filtered data | Backend, Frontend |
| 2026-05-06 | Report automation | Per-user CSV generation from JSON files, git-based deployment with deploy keys and update.sh script | baic_messages.json, baic_conversations.json, update.sh, .env |
| 2026-05-06 | Per-User Report feature | New Per-User Report tab, bar chart, user message table, export button | index.html, assets/ |
| 2026-05-06 | Per-User Report | index.html, assets/, git push (46ccccc) | index.html, assets/ |
| 2026-05-06 | Per-user report feature | Frontend components updated, dist files deployed | frontend/src/*, dist/index.html |
| 2026-05-06 | BAIC UK monthly reports | Python CSV generation script, deployment strategy via rsync | vite.config.js, index.html, backend deployment process |
| 2026-05-06 | Report setup | Process JSON to CSV monthly, verify Vite asset paths | vite.config.js, index.html, dist/index.html |
| 2026-05-06 | User report implementation | userAggregation.js, UserReport.jsx, UserExportButton.jsx | frontend/src/utils/userAggregation.js, frontend/src/components/UserReport.jsx, frontend/src/components/UserExportButton.jsx |
| 2026-04-29 | Project config review | Verified URL configuration, checked domain settings | Configuration files |
| 2026-04-24 | Integration audit | Added PROJECTS_ROOT to hooks, Fixed cc-collector path resolution | settings.json, cc-collector config |
| 2025-11-19 | Deploy fix | Restart backend instead of start | deploy script |

## Related
- [[cc-dashboard/CC Dashboard]]
