---
id: T01
parent: S03
milestone: M008
provides: []
requires: []
affects: []
key_files: ["backend/schemas.py", "backend/routers/techniques.py", "frontend/src/api/public-client.ts", "frontend/src/pages/Home.tsx", "frontend/src/App.css"]
key_decisions: ["Used correlated COUNT subquery for key_moment_count matching creators.py pattern", "Built separate base_stmt for count query to handle join filters"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "API verification: curl confirmed all technique items include key_moment_count with real values (4, 4, 2). Frontend: tsc --noEmit passes, npm run build succeeds. Browser screenshot confirmed tag pills and moment counts render on homepage cards."
completed_at: 2026-03-31T05:23:21.747Z
blocker_discovered: false
---

# T01: Added key_moment_count correlated subquery to technique list API and rendered topic tag pills + moment count on homepage cards

> Added key_moment_count correlated subquery to technique list API and rendered topic tag pills + moment count on homepage cards

## What Happened
---
id: T01
parent: S03
milestone: M008
key_files:
  - backend/schemas.py
  - backend/routers/techniques.py
  - frontend/src/api/public-client.ts
  - frontend/src/pages/Home.tsx
  - frontend/src/App.css
key_decisions:
  - Used correlated COUNT subquery for key_moment_count matching creators.py pattern
  - Built separate base_stmt for count query to handle join filters
duration: ""
verification_result: passed
completed_at: 2026-03-31T05:23:21.748Z
blocker_discovered: false
---

# T01: Added key_moment_count correlated subquery to technique list API and rendered topic tag pills + moment count on homepage cards

**Added key_moment_count correlated subquery to technique list API and rendered topic tag pills + moment count on homepage cards**

## What Happened

Backend: Added key_moment_count field to TechniquePageRead schema and correlated COUNT subquery in list_techniques endpoint following the creators.py pattern. Frontend: Added key_moment_count to TechniqueListItem interface, rendered topic_tags as pill badges and moment count on homepage recent cards. Deployed to ub01 and verified API returns real counts and homepage renders correctly.

## Verification

API verification: curl confirmed all technique items include key_moment_count with real values (4, 4, 2). Frontend: tsc --noEmit passes, npm run build succeeds. Browser screenshot confirmed tag pills and moment counts render on homepage cards.

## Verification Evidence

| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `curl -s http://ub01:8096/api/v1/techniques?limit=3 | python3 -c "...assert all('key_moment_count' in i for i in items)..."` | 0 | ✅ pass | 1000ms |
| 2 | `npx tsc --noEmit` | 0 | ✅ pass | 8000ms |
| 3 | `npm run build` | 0 | ✅ pass | 1000ms |


## Deviations

Used separate base_stmt for total count query instead of stmt.subquery() to handle join filters cleanly. Docker service name is chrysopedia-web not chrysopedia-web-8096.

## Known Issues

None.

## Files Created/Modified

- `backend/schemas.py`
- `backend/routers/techniques.py`
- `frontend/src/api/public-client.ts`
- `frontend/src/pages/Home.tsx`
- `frontend/src/App.css`


## Deviations
Used separate base_stmt for total count query instead of stmt.subquery() to handle join filters cleanly. Docker service name is chrysopedia-web not chrysopedia-web-8096.

## Known Issues
None.
