Tags
A tag is a label a coach puts on athletes, exercises, workouts, sessions, sets or reps. This page is the model the UI follows. Rationale and alternatives live in the local tagging study (tab 09, "Flow proposals").
Uses: what a tag is for
The backend stores six kind flags per tag (isUserTag, isExerciseTag,
isWorkoutTag, isSessionTag, isSetTag, isRepTag). The flags decide
which pickers offer a tag (getTagsForEntityKind) and how far a workout's tag
travels down to what is recorded from it.
Coaches never see the six flags by default. They see four uses
(packages/core/src/tags/uses.ts), each a bundle of flags:
| Use | Flags | Meaning |
|---|---|---|
| Athletes | Users | A living group of people |
| Exercises | Exercises | A living group of exercises |
| Training | Workouts + Sessions + Sets + Reps | Marks the plan; everything recorded from it carries the tag |
| Sets and reps | Sets + Reps | A note on what happened |
- A use is read when the tag has at least one of its flags (
tagUses), so legacy partial cascades still show a use. - The six switches stay reachable under "Details" in the tag form
(
apps/portal/src/app/dashboard/tags/tag-uses-section.tsx). - A tag always has a use. The form won't create or save a tag with none; the Tags page flags existing ones as "Not used for anything yet".
- A tag on a workout always travels down (
withWorkoutCascade): with Workouts on, Sessions, Sets and Reps are on too. There is no "organise the library only" workout tag; a legacy one is brought in line on its next save.
One tag, one meaning per place
A tag has no single role. Its meaning comes from where it is used: on an athlete it is a group, on a workout it marks training, on a rep it is a note. enode's own tags mix uses (Competition is on all six kinds).
Sources
tagSource(tag, myUserID) returns the Tags page's three words:
own(Mine): the viewer's tag. Only these can be changed (canChangeTag).shared(Shared with me): a colleague's tag, shared inside the organisation. It can be put on things, but not changed.public(Public): access level Public, read-only. Today every Public tag is provided by enode; coaches may publish tags later.
Pickers group a mixed list under Mine · Shared with me · Public, and Public tags carry their one-line purpose. No tag is treated specially because of where it comes from.
Workout tags
A workout can carry any number of tags, and every one marks each session
recorded from it. Tags stop at the session: sets and reps carry only the tags a
coach puts on them by hand, and readers reach a set's session tags through its
session. Older tracking app versions copied session tags onto sets and reps;
those copies stay in the data and read as session tags. The workout's tag card
(apps/portal/src/app/dashboard/planner/workout-tags-field.tsx, used by the
schedule and template drawers):
- Suggests up to three tags from the coach's habits
(
packages/core/src/tags/workout-suggestions.ts): the template's earlier tags, the last workout for the same athletes, then the most used workout tags. - Asks for what it plans, as a call to action on the sessions: "Tag every session from this workout [tags] [+ Tag sessions]", then "Planned 12 sessions · 4 athletes × 3 exercises" ("planned": what is actually recorded can differ). Templates, without athletes, say "Planned 3 sessions per athlete". An empty card shows an example ("For example, Deload to keep light weeks out of charts, or Testing to find your test results."), and a proof line once a tag has recorded sessions ("Testing is on 12 sessions so far · Show").
- The same most-used workout tags lead the chart filter chip, History's quick filters and Export's quick exports.
Exercise tags and testing protocols
Tags are planned in two places: on the workout and on an exercise. Blocks (set groups) carry no tags; sets and reps are tagged by hand.
- In the exercise drawer (
packages/ui/src/workout-builder/WorkoutItemDrawer.tsx, shared with the tracking app's builder) an exercise's tags sit in its card, under the name, as a call to action: "Tag Back squat's sessions [tags] [+ Tag sessions]", then "Planned 4 sessions · only in this workout" — so they don't read as the library's exercise-grouping tags — and the workout's tags as context ("Already tagged from the workout: …"). The athlete count comes from the draft context'splannedAthletes(the planner counts followed tags' members) ordraft.participants. The section below holds the note only ("Notes"). - The picker names its target ("Tag Back squat's sessions", "Only in this workout. Your exercise library isn't changed."), and a tag the workout already carries says "Already tags every session of this workout" (still pickable).
- Several exercises at once: the builder's select mode has "Tag sessions"
(
SelectActionsCard'stagging;selectionTags/setTagsOnItemsinpackages/core/src/workouts/draft.ts). A tag new to the selection is added to all of it; a removed one leaves all of it. - "Add testing" adds the protocol to the exercise. The protocol's blocks go
after the exercise's own, the exercise gets the protocol's session tags, and
an exercise without a note takes the protocol's name as its note
(
appendProtocolToItem, study 21.S11.1.P2). The workout keeps one exercise; the exercise's build-up sets are tagged too, as in the multi-exercise editor. Undoable where the host offers Undo.
Pickers create and reuse inline
Every catalogue picker built on useTagPicker
(packages/ui/src/tags-card.tsx) does three things beyond listing tags:
- Create in place. The search reads "Search or create a tag" and a
"New tag" row is visible before anything is typed; a missing name offers
"Create", and the new tag gets the use the picker implies
(
tagUseForEntityKind). New tags are Private. - Guard against duplicates. A name equal to an existing tag in any spelling
(
tagNameKey: case, spaces and punctuation ignored) is offered back instead of created; close names appear under "Did you mean". - Reuse for another purpose. While searching, the viewer's own tags that
this place doesn't offer appear under "Used for something else". Picking one
asks once ("Also use U19 for training?") and adds the use (
addUseToTag).
Pickers with an explicit availableTags list (filters) stay closed: no create,
no other uses.
A picker can also name what it tags (heading: a title and what a tag there
marks) and add a line under any tag (hints, by tag id), e.g. the exercise
drawer's picker above.
The Tags page
Creating and tagging happen inline. The Tags page is the library and the place for upkeep:
- Tag home (
tag-home.tsx): members per kind, with add and remove for athletes and exercises (named withexerciseRowParts), recorded counts with the most recent sessions (opening the session drawer in place, on the Reps tab filtered to the tag for a sets-and-reps tag), "Show in History" whenever sessions, sets or reps carry the tag (?tag=<name>&tagID=<id>, see History's tag search below), "Export sessions with this tag" (the app's export drawer, seeded with the tag viaopenExportDrawer({ tagID }); like every seeded export it starts with the coach's focus metrics), and the charts that follow the tag as thumbnails that open in the drawer (tag-references.tsx). Opening it loads the chart lists in the background through the shared charts store (loadChartsForFollowers); a chart saved while its list wasn't loaded makes the next read skip the cache. - Workouts (
tag-workouts.tsx): "Scheduled workouts" and "Templates" carrying the tag, the first five of each by name (and date). A row opens the schedule drawer or the template drawer (view only for someone else's template) over the tag drawer. - Planned for this group: for an athlete tag, the "Follows" card lists the
upcoming workouts that follow it as a live group: the repeating ones and the
next four weeks, read from the planner's store (
plannedForTagintag-workouts-model.ts). TODO: a backend read of the workouts following a tag; the store only knows the months it loaded. - Exits: Archive, Merge, and Delete. Delete works for a tag in use too: its confirmation names what the tag is on and what follows it (saved charts, Live sessions, planned workouts), and deleting detaches it from all of them. Bulk delete includes tags in use and counts them in its confirmation.
- Archived tags are hidden from the table until the "Archived" chip is pressed; the tag home of an archived tag offers "Unarchive".
History's tag search
History's search bar holds tag tokens by name, which the server matches
against session tags only. With every tag token resolving to a catalogue tag,
the search also sends the tags' ids (tagIds, tag-search-ids.ts), which the
server uses instead of the names and which also find sessions carrying a tag
only on a set or rep. A link that names the tag's id (?tagID=) searches that
tag alone, not every tag with its name. A token that matches no tag searches by
names only, as before.
Archived tags
An archived tag (isArchived, POST /entity_tags/{id}/archive) stays on
everything it marked, and History, Export and charts are unchanged. The portal
leaves it out of the places a coach picks a tag to put on something:
catalogue pickers (useTagPicker), workout tag suggestions
(mostUsedWorkoutTags, suggestWorkoutTags), the Insights athlete groups and
merge targets. Pickers with an explicit availableTags list (filters over
existing data) keep it. The rule lives in packages/core/src/tags/archive.ts.
Merging tags
mergeTag (packages/core/src/tags/write.ts) calls
POST /entity_tags/{id}/merge: every assignment moves to the target, the
target gets the source's uses, and the source is archived. The merge dialog
offers only the viewer's own tags that the backend accepts (canMergeInto):
not archived, not public, and shared at least as widely as the source (an
organisation tag merges only into another organisation tag).
Workouts that follow athlete tags
A schedule saves assignedUserTagIDs (the followed tags) and participants
(the hand-picked athletes only). The backend adds the tags' active members and
keeps them in step; a recurring workout always follows, a dated one from today
on. The owner's read returns handPickedParticipantIDs. The mapper
(toWorkoutScheduleCreateDto) sends those ids, and sends no participants for a
tag-following workout whose hand-picked athletes it doesn't know, so a tag's
members never become hand-picked by accident.
Chart tag switches
A saved chart lists the tags its data carries in its header, each as a
switch, plus "No tag" for untagged values
(apps/portal/src/components/charts/chart-tag-switches.tsx). All are on by
default; switching one off hides the values that carry it. The state is per
viewer and per chart (localStorage), not part of the saved chart. The board
tile shows the row folded to one line ("Tags in this chart · 4 tags · 1 off");
the focus view shows it open. Both sit in the chart's header (under the standfirst on the tile, under the view controls in the focus view), so they are in view without scrolling.
What a switch shows
- The tags come from the chart's own data (
tagCombos), so only tags on its points are listed, most used first.chartTagSummary(packages/core/src/charts/tag-parts.ts) counts, per tag, the points that hold a value with it and the levels it sits on (sessions, sets, reps, or "sets or reps" below the metric's level). - The "i" button explains a tag: how many of the chart's points carry it
and where, its details and uses,
Only {name}(every other switch off) and "Show in History". - Hidden line: with anything off, "Hidden: Deload, No tag" and "Show all".
Exports print the same line in the standfirst (
useReportFrame).
How a chart is filtered
Saved-chart reads and writes send tagParts=true. The server then labels each
value with its tag combination (tagCombos on the chart, c or parts on each
value), and the portal filters in the browser without a new read
(filterChartByTags). A value that splits across combinations is rebuilt from
the parts that pass: avg = Σsum ÷ Σn, min of mins, max of maxes. The builder's
preview is not labelled and shows no switches.
Matching rule
comboPassesSwitches (apps/portal/src/components/charts/chart-data-filter.ts):
a value is hidden when ANY of its tags is off, at any level (session, set, rep,
or below the metric's level); an untagged value only when "No tag" is off. A
filter stored before the switches ("show only these tags") is read as "only
those on, No tag off" and rewritten on the next change.
When there is nothing to switch
- No labels (a server without tag parts): no switches.
tagPartsLimited(over 64 combinations): a line saying there are too many combinations, with a hint to narrow the chart.- No tags in the data (also user-level metrics such as sleep): "No points in this chart carry a tag yet …".
- Nothing left: the chart shows "Nothing left with these tags off".
Rep tags in training
The tracking app tags reps where they are selected: the complete-set sheet's
reps card and the Insights sheet's Reps tab. Their shared action pill
(packages/ui/src/reps/rep-select-actions.tsx) has "Tag" next to Toggle
valid / Delete / Done. It opens the tag picker for the selection
(useRepTagging, packages/ui/src/reps/use-rep-tagging.tsx), titled
"Tag 3 reps": tags on every selected rep are ticked, tags on some partly
ticked, and a tick puts the tag on all of them (the portal Reps tab's rules,
packages/core/src/tags/rep-tag-selection.ts). A "Recent" row leads with the
rep tags last used on this device (packages/core/src/tags/recent.ts), else
the ones already on the session's reps. The change is written like Toggle
valid, with the set's reps, and goes up with the session. Rep rows show their
tags as pills (RepPairList showTags).
Built ahead of the backend
BACKEND_PENDING (packages/core/src/backend-pending.ts) lists the endpoints
and DTO fields the UI already uses (today only the chart tag switches'
tagParts=true labels, built on the backend but not deployed). Where one is missing, the UI calls
notifyBackendPending(key, t), which shows an info toast, instead of making
the request. When an endpoint ships, delete its key and the compiler lists
every caller to wire.
Athlete scope
The chart builder and the planner's schedule drawer share one athlete
selection (apps/portal/src/components/selection/athlete-scope.tsx): specific
athletes plus tags that are followed now and later. Athletes always show as
profile pictures (AthleteChip) in a bordered box that scrolls sideways,
changed through the picker; exercises keep their chips. The schedule drawer
uses the framed look: the whole scope in one card, "Edit" in the Specific
athletes header, the faces without their own box, and "Tag these athletes…"
under them. With no athletes picked, both hosts show the same empty card
("No athlete selected." and "Add athletes"); only the chart builder adds quick
picks above it.
Each followed tag in the Tags row (athletes, and the chart builder's
exercises) says how many it covers today and offers "Change who has it" /
"Change which exercises have it". The link pushes the tag's home
(TagHomeView in apps/portal/src/app/dashboard/tags/tag-home.tsx, the same
view the Tags page opens) onto the surrounding drawer, so members are changed
there and the back arrow returns to the selection. A tag deleted from that
view also leaves the selection.