Repository navigation
feat(tags): group tags into categories - #685
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @alukach's task in 16s —— View job ✅ No blocking issues — safe to merge. I read the operations, DB client, action, Simplify (ponytail)
DocsThe PR description covers all three: it names the 💰 Estimated review cost: $0.17 · 0m15s · 5 turns |
Every approved tag belongs to one of eight categories, defined in src/lib/tags/categories.ts. The tag picker lists tags under their category headings, each described under its heading, with uncategorized ones under "Other". Approving a suggestion requires a category, through PATCH /api/v1/tags/{tag_id} with `category` and a category select on the review card; undoing an approval clears it. GET /api/v1/tags lists each tag's category. The cleanup script writes each corpus tag's category from BY_CATEGORY, seeds the frequency tags, refuses to apply while a corpus tag has none, deletes imported tags the corpus no longer has, leaves pending and approved suggestions alone, and rewrites products whose only tag is empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e9d2ea3 to
ab3f80a
Compare
A tag checked with the picker open now joins "On this product" at once instead of on the next open, and stays checked in its category too, so the row just clicked doesn't move from under the cursor. "Edit tags" moves to its own line below the chips, so adding a chip no longer pushes the button, and the open popover anchored to it, sideways. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every approved tag now belongs to one of eight categories, and the tag picker groups its list by them. Rebuilt on
mainafter #647 and #648 merged, on top of #648's REST tags API,TagMenuand staged-merge review card.(The screenshots predate the rebase onto #648's UI. The grouping and the required category are the same, but the controls around them now look like #648's.)
Categories
The five categories proposed (feature type, methodology, format, domain, temporal frequency) plus three more, because about half of today's tags fit none of the five: place, sensor or platform, and source or project. They're defined in
src/lib/tags/categories.ts, in the order the picker shows them.agriculture,weather,climate,energyfield,boundaries,building-footprints,land-coverspain,germany,united-states,globalsegmentation,forecasting,machine-learningsentinel-2,landsat,goes,gpmfiboa,fields-of-the-world,nasa,usgsgeoparquet,pmtiles,zarr,csvtime-series,daily,hourly,monthlyBY_CATEGORYinscripts/clean-tags.tsassigns every corpus tag. It follows the cleanup onmain:fieldandboundariesandadminreplacefield-boundariesandadmin-boundaries, which #648's cleanup splits. It also covers the tagsmain's cleanup added toKEEPand its aliases:goes,metopandgpmas sensors;copernicus,epa,esa,jpss,nasa,neon,nsta,usgs,imerg,mrmsandtamsatas sources;csv,icebergandpngas formats; andground-truthas a feature type. The script's preview lists any corpus tag still without a category under "No category yet", and applying refuses until there are none.What changes
sc-{stage}-tags): an approved tag's row gets acategory. Products still store plain tag strings, so moving a tag to another category rewrites one row.PATCH /api/v1/tags/{tag_id}withpending: falsetakes acategory, and refuses without one (invalid, oncategory). Undoing an approval clears it. On/admin/tags, a category select sits beside Approve as a new tag, which stays disabled until one is chosen.GET /api/v1/tagslists each approved tag'scategoryto anyone, besidetag_id.TagMenusections take an optionaldescriptionfor this.hourly,daily,weekly,monthly,yearly), and deletes imported tags the corpus no longer has. It leaves suggested tags alone, pending or approved: products keep them, and their rows, which hold the review record, aren't rewritten or deleted. It also rewrites a product whose only tag is"", which the old comparison missed because[""]and[]join to the same string.Decisions worth a second look
vectorandrasterare under Format. They're geometry types rather than file formats, but a separate "data type" category for two tags seemed like too much.aiis a methodology next tomachine-learning;cloudis a domain, though on some products it may mean cloud storage;census,cerandnebare sources;satellite-imagery,imagery,ground-truthandembeddingsare feature types;gpmis a sensor (the mission) whileimergis a source (the dataset);time-seriesis a temporal frequency.PATCHonly sets a category while approving. Add it when someone needs it./productsyet. That's left for its own PR.Stories
On this branch's Storybook deploy:
Docs
public/llms.txt: the/api/v1/tagsline now says each tag comes with its category.docs/using-source/create-a-data-product.mdstill describes picking and suggesting tags accurately; the grouping needs no new instructions.Testing
npm run type-checkreports only@vercel/analytics/nextmissing, because the local worktree'snode_modulespredates feat(analytics): add Vercel Web Analytics #689; it's unrelated to this change.src/lib/operations/tags.test.ts: approving stores the category and refuses a missing or unknown one;listTagsshows categories to anyone.src/lib/clients/database/tags.test.ts:tagPropspasses each approved tag's category.TagPicker.test.tsx: grouping in category order with "Other", group descriptions, an empty tag left out, and a tag checked while open listed with the product's tags as well as in its category.AdminTagSuggestions.test.tsx: approving waits for a category.scripts/clean-tags.ts --countsran on a sample counts file and grouped the corpus by category and flagged an uncategorized tag. Its<stage>mode wasn't run against a table.🤖 Generated with Claude Code