Skip to content

Commit 5d39b7f

Browse files
feat: insights pages — stats, plot of the day, similar specs (#5233)
## Summary - **Stats Dashboard** (`/stats`): Library quality/LOC histograms, coverage dot matrix, top rated implementations, tag cloud, timeline, Plausible analytics link - **Plot of the Day**: Daily featured high-quality implementation on homepage (dismissable, sessionStorage persisted) - **Similar Specifications/Implementations**: Tag-based Jaccard similarity — spec pages use spec tags, impl pages use spec + impl tags, with hover-highlighting of shared tags - **Deferred code loading**: Heavy DB fields (`code`, `review_criteria_checklist`, `review_image_description`, `tested`) deferred in model (~25MB saved per `get_all()`), new lightweight `/specs/{id}/{lib}/code` endpoint, frontend prefetch on impl page open - **Collapsible spec tabs** with always-visible tags and metadata footer showing updated dates - **New insights API router** (`/insights/dashboard`, `/insights/plot-of-the-day`, `/insights/related/{spec_id}`) - Updated sitemap, Plausible docs, API docs, footer links Closes #5228 Closes #5229 Closes #5230 ## Test plan - [ ] Verify `/stats` page loads with all sections (counters, library histograms, coverage matrix, top rated, timeline, tags) - [ ] Verify Plot of the Day appears on homepage when no filters active, dismiss persists across navigation - [ ] Verify similar specifications on spec overview page (spec tags only, links to specs) - [ ] Verify similar implementations on impl detail page (spec + impl tags, links to impls, same library preferred) - [ ] Verify tag hover highlighting works between similar cards and tag chips - [ ] Verify code tab loads lazily (check network tab — no code in `/specs/{id}` response) - [ ] Verify all tabs collapse/expand on click including re-click to close - [ ] Run `uv run pytest tests/unit` — 1068 tests pass - [ ] Run `yarn lint && yarn build` — 0 errors 🤖 Generated with [Claude Code](https://claude.ai/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d45c640 commit 5d39b7f

File tree

22 files changed

+1679
-135
lines changed

22 files changed

+1679
-135
lines changed

api/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
debug_router,
2828
download_router,
2929
health_router,
30+
insights_router,
3031
libraries_router,
3132
og_images_router,
3233
plots_router,
@@ -128,6 +129,9 @@ async def add_cache_headers(request: Request, call_next):
128129
# Individual spec details (5 min cache, 1h stale-while-revalidate)
129130
elif path.startswith("/specs/"):
130131
response.headers["Cache-Control"] = "public, max-age=300, stale-while-revalidate=3600"
132+
# Insights endpoints (5 min cache, 1h stale-while-revalidate)
133+
elif path.startswith("/insights/"):
134+
response.headers["Cache-Control"] = "public, max-age=300, stale-while-revalidate=3600"
131135

132136
return response
133137

@@ -141,6 +145,7 @@ async def add_cache_headers(request: Request, call_next):
141145
app.include_router(specs_router)
142146
app.include_router(libraries_router)
143147
app.include_router(plots_router)
148+
app.include_router(insights_router)
144149
app.include_router(download_router)
145150
app.include_router(seo_router)
146151
app.include_router(og_images_router)

api/routers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from api.routers.debug import router as debug_router
44
from api.routers.download import router as download_router
55
from api.routers.health import router as health_router
6+
from api.routers.insights import router as insights_router
67
from api.routers.libraries import router as libraries_router
78
from api.routers.og_images import router as og_images_router
89
from api.routers.plots import router as plots_router
@@ -16,6 +17,7 @@
1617
"debug_router",
1718
"download_router",
1819
"health_router",
20+
"insights_router",
1921
"libraries_router",
2022
"og_images_router",
2123
"plots_router",

0 commit comments

Comments
 (0)