Metric Insight (Value Highlight)
One headline metric with its count qualifier, plus a lens ranking (home), cohort distribution and data-table view, switched by the footer toggle.
Live example
the Pupil Premium metric fromVALUE_METRICS β fully interactive, try the π / Distribution / Data togglePupil Premium Students
The percentage of pupils eligible for Pupil Premium funding β a marker of a more disadvantaged intake.Higher = more challenging context.
EdCo data mapping β shape A (Metrics) β this widget
From the Metric Insight Widget : Home / Cohort Comparison / Distribution Element slides in the Build Requirements deck and the 21-column Metrics shape (Data Shape - Metrics sheet). All three elements consume shape A; which columns each reads is fixed in the widget, and the chosen frame decides the rows (which metric, which cohorts). βRowβ says which returned row supplies the value.
| Visual | Shape A column | ValueMetric field | Row | Notes |
|---|---|---|---|---|
| Topic icon | DefaultIcon | family β icon | national cohort | The prototype derives the icon from the family key; the API supplies it directly. |
| Data family label | DataFamily | family | national cohort | |
| Title | DataCategory | name | national cohort | The metric. A frame returns one DataCategory, which is how the widget knows which metric to show. |
| Headline value | AbsoluteValue (or PercOfPupils / PerPupilValue, per ValueDataType) | value | national cohort | Pre-formatted by the mapping layer. |
| Count qualifier ("99 of 251 students") | ContextMessage | qualifier | national cohort | |
| Change chip | ChangePP | delta + trend | national cohort | Sign gives trend; the lens decides whether that's favourable. |
| Lens (ranking colour) | DataLense | lens | national cohort | |
| Lens description ("Higher = more challenging context") | implied from DataLense | LENSES[lens].interpretation | β | App configuration, not payload. |
| Percentile (ranking panel, histogram marker, table) | Percentile | neighbourhoods[].percentile | one per cohort | |
| Histogram bars | PercentileDistribution | neighbourhoods[].dist | one per cohort | The deck's example is "5,5,7,3,7,3,6,3 β¦" β bucket weights, any scale. |
| Cohort rows in the Data view | CohortID | neighbourhoods[].key / label | one per cohort | The deck shows the school's value repeated per row with the cohort's percentile; the contract keeps value at the top level. |
Which frame feeds each element
The deck and JP's database agree on two of the three. Settings: none defined for this widget (tblWidgetProperties is empty).
| Element | Frame per the deck | Frame per JP's database | Notes |
|---|---|---|---|
| Home | Pupil Premium Student | Pupil Premium Students (77d88d4eβ¦) | Agree. One row: the school against the national cohort. |
| Cohort Comparisons | Pupil Premium Students with cohort comparisons | β¦Cohorts Comparisons (6e5b4216β¦) | Agree. One row per CohortID; header figures from the national row. |
| Distribution | Pupil Premium Student | β¦Cohorts Comparisons (6e5b4216β¦) | Disagree. One frame is enough if the histogram is always national; the cohorts frame is needed if it changes with the section's cohort filter, as this prototype does. Open with EdCo. |
Dependencies
Component: app/components/widgets/ValueHighlight.vue
Explicit imports
Imported at the top of the component.
LENSESβ~/data/widgetsApp-level config: lens colour and the interpretation line ('Higher = more challenging context') shown on every view. Stays in the app β not API data.ValueMetric (type)β~/data/widgetsThe input contract β the shape the API response must be mapped into.SemanticColor, WidgetMode (types)β~/utils/typesColour-token union and the "desktop" | "distribution" | "data" mode union.valenceColor, trendToneβ~/utils/identityLens-aware colouring: variant mode colours by valence (good/bad), and the delta chip colours by whether the trend direction is favourable for this lens.
Auto-imported components (Nuxt)
No import lines β Nuxt resolves these from app/components/widgets/parts/ (flat names, pathPrefix: false). A port to another stack must import them explicitly.
WidgetShellβwidgets/parts/WidgetShell.vueShared chrome: family header, definition tooltip, delta chip, and the home/Distribution/Data mode toggle in the footer.Headlineβwidgets/parts/Headline.vueThe big value plus its qualifier β renders "99 of 251 students" (or a per-pupil figure) beside the headline.RankingPanelβwidgets/parts/RankingPanel.vueHome view: the tinted '64th percentile' lens ranking panel.PercentileLineβwidgets/parts/PercentileLine.vueDistribution view: the percentile read-out line above the histogram.Histogramβwidgets/parts/Histogram.vueDistribution view: the cohort distribution bars with this organisation's position marked.DataGridβwidgets/parts/DataGrid.vueData view: the cohort / value / percentile table (also renders the interpretation line on that view).
Framework APIs
Auto-imported by Nuxt; from 'vue' in a plain Vue build.
ref, computedβvueInternal state only β the active mode and the resolved comparison cohort. None of it needs the API.
Input contract β metric: ValueMetric
Defined in app/data/widgets.ts. The API response for this widget maps to exactly this shape.
| Field | Type | Notes |
|---|---|---|
| id | string | Stable id so a page-config slot can reference this metric. |
| name | string | Widget title, e.g. "Pupil Premium Students". |
| family | FamilyKey | Data family ("demographics", "financial"β¦) β drives the header identity and colours. |
| lens | LensKey | How to read a high value ("complexity", "success"β¦) β drives the ranking colour, interpretation line and trend valence. |
| definition | string | Plain-English definition shown in the header tooltip. |
| value | string | The headline figure, pre-formatted: "39.4%", "Β£7.42m", "+0.31". |
| qualifier | string? | Count-of-cohort sub-text beside the value, per client feedback: "99 of 251 students", "6 of 54 staff". The first token renders emphasised. |
| perPupil | string? | Alternative qualifier for money metrics β renders as "Β£6.84k / pupil". Takes precedence over qualifier. |
| trend | "up" | "down" | "flat" | Direction of travel β the arrow in the header chip. |
| delta | string | Formatted change, e.g. "+1.8pp". Coloured by whether the direction is favourable for the lens. |
| neighbourhoods[].key | string | Cohort key, e.g. "national-all" β matched against the page's section-level cohort filter. |
| neighbourhoods[].label | string | Cohort label, e.g. "National Β· All schools". |
| neighbourhoods[].percentile | number | This organisation's percentile within that cohort (0β100) β drives the ranking panel, distribution marker and data table. |
| neighbourhoods[].dist | number[] | The cohort's distribution as 10 bucket weights (relative heights, any scale) for the histogram. |
Props & events
| Prop | Type | Notes |
|---|---|---|
| metric | ValueMetric | The payload (required) β see the contract. |
| neighbourhood | string? | Key of the cohort to show, usually from a section-level "Compared with" filter shared by every widget in the row. Defaults to the metric's first neighbourhood. |
| advanced | boolean? | Default true. False = the simplified card: headline only, no ranking panel, no mode toggle. |
| variant | boolean? | Default false. True = hide the lens identity and colour by valence instead (used in the Widget Lab's simplified row). |
| drillable | boolean? | Default false. Marks the widget as having a drill-through; it emits "drill" when triggered. (The footer "More" link was removed per client feedback, so currently nothing triggers it.) |
Wiring it to the API
- Replace the mock payload β the widget takes one `metric: ValueMetric` prop. In the prototype it's fed from VALUE_METRICS in ~/data/widgets.ts; the API should return one ValueMetric object per card.
- All figures arrive pre-formatted as strings (value "39.4%", delta "+1.8pp", qualifier "99 of 251 students") β the component renders them verbatim and never parses them. Formatting is the API/mapping layer's job.
- neighbourhoods carries one entry per comparison cohort, each with the organisation's percentile and the cohort's 10-bucket distribution. The three views (ranking, distribution, data) are all derived client-side from this one array β no further API calls after load.
- The neighbourhood prop selects which cohort is displayed; pages share one section-level filter across a row of these widgets, so the API should return the same cohort keys for every metric on a page.
- LENSES is app configuration, not API data β the payload only names its family and lens keys.
- The widget emits a single optional "drill" event (only when drillable is set); there is currently no visible trigger for it.

