Overview
- Link to an indicator (optional but recommended)
- Define a baseline period for relative targets (year, quarter, month)
- Add one or more target entries with period, type, and value
- Scope entries to a specific site or leave them organization-wide
- Optionally store integration metadata (e.g., dataset mappings)
Data Model
Target (simplified):TIMESTAMPsupports event-based targets in addition to calendar periods.- If
siteIdis omitted on an entry, it applies at organization level. - Relative targets interpret
targetValueas a percentage change from the baseline period.
Target Entries
Each entry represents a goal for a specific period and (optionally) site:- Organization target: omit
siteIdon entries - Site target: set
siteIdper entry; different sites may have different trajectories - Mixed schedule: combine yearly and monthly entries as needed
Baseline & Status
- Absolute targets: compare current indicator value vs
targetValue - Relative targets: evaluate change required from the baseline period (year/quarter/month)
- On-track/Warning/Behind for absolute targets (based on % progress)
- Baseline required for relative targets
API
TRPC procedures (with REST mirrors via OpenAPI):targets.list→ GET/targetstargets.getById→ GET/targets/{id}targets.create→ POST/targetstargets.update→ PUT/targets/{id}targets.delete→ DELETE/targets/{id}
- All operations enforce organization scoping and site-level permissions
- Site IDs in entries must be accessible; otherwise request is rejected
UI & Workflow
- Page:
/targetslists groups with inline title edit, indicator preview, and status badges - Modal: create/edit with preview, per-period entries, and site scoping
- Timeline/List views: visualize progression and trend arrows between entries
- Indicator mappings: optional
metadata.indicatorMappingsto align target context with indicator datasets
Dashboards & Widgets
- Widgets can reference selected target entries (e.g., draw goal lines)
- Selection is stored in widget settings as
selectedTargetEntries: string[]
Query Patterns
- Filter by indicator/site/year on
list - Client usually fetches current indicator values to compare against latest target in the current year
Security
- Organization isolation is enforced in queries
- Site access is validated for any
siteIdpresent in entries
Migration History (high level)
- Introduced
Targetwith per-row fields (period, type, value) - Restructured to
targetEntries(jsonb) to support multiple entries per target - Added
title,organizationId, andbaselineQuarter
See Also
- Concepts:
Dataset,Unit,Dashboard,Widget - Server: targets router in
apps/azalt/src/server/api/routers/target

