@altertable/data-app-examples 0.75.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,14 +17,14 @@ on this package.
17
17
 
18
18
  ## Starters
19
19
 
20
- | ID | Use |
21
- | -------------------------------- | ------------------------------------------------------------------------- |
22
- | `starter-data-app` | [Hosted single-file app](templates/starter-data-app/index.tsx) |
23
- | `starter-local-data-app` | [Local Bun and React project](templates/starter-local-data-app/README.md) |
24
- | `starter-metric-data-app` | [Hosted metric app](templates/starter-metric-data-app/index.tsx) |
25
- | `starter-finding-data-app` | [Hosted finding app](templates/starter-finding-data-app/index.tsx) |
26
- | `starter-local-metric-data-app` | [Local metric app](templates/starter-local-metric-data-app/README.md) |
27
- | `starter-local-finding-data-app` | [Local finding app](templates/starter-local-finding-data-app/README.md) |
20
+ | ID | Use |
21
+ | -------------------------------- | ------------------------------------------------------------------------------- |
22
+ | `starter-data-app` | [Hosted single-file app](templates/starter-data-app/index.tsx) |
23
+ | `starter-local-data-app` | [Local Bun and React project](templates/starter-local-data-app/README.md) |
24
+ | `starter-metric-data-app` | [Hosted metric app](templates/starter-metric-data-app/index.tsx) |
25
+ | `starter-finding-data-app` | [Hosted Finding exploration](templates/starter-finding-data-app/index.tsx) |
26
+ | `starter-local-metric-data-app` | [Local metric app](templates/starter-local-metric-data-app/README.md) |
27
+ | `starter-local-finding-data-app` | [Local Finding exploration](templates/starter-local-finding-data-app/README.md) |
28
28
 
29
29
  Pin to the same exact version as `@altertable/data-app`. Authoring guides and
30
30
  API reference ship in that base package.
package/dist/index.js CHANGED
@@ -25,8 +25,8 @@ const dataAppExamples = [
25
25
  },
26
26
  {
27
27
  id: "starter-finding-data-app",
28
- title: "Hosted Finding document",
29
- description: "A focused finding app for hosted execution.",
28
+ title: "Hosted Finding exploration",
29
+ description: "An interactive companion to a Finding’s text for hosted execution.",
30
30
  mode: "hosted"
31
31
  },
32
32
  {
@@ -37,8 +37,8 @@ const dataAppExamples = [
37
37
  },
38
38
  {
39
39
  id: "starter-local-finding-data-app",
40
- title: "Local Finding document",
41
- description: "A focused finding app for local execution.",
40
+ title: "Local Finding exploration",
41
+ description: "An interactive companion to a Finding’s text for local execution.",
42
42
  mode: "local"
43
43
  }
44
44
  ];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description: 'A single-file React app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description: 'A Bun and React project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding document',\n description: 'A focused finding app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding document',\n description: 'A focused finding app for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description: 'A single-file React app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description: 'A Bun and React project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
@@ -17,8 +17,8 @@ export declare const dataAppExamples: readonly [{
17
17
  readonly mode: 'hosted';
18
18
  }, {
19
19
  readonly id: 'starter-finding-data-app';
20
- readonly title: 'Hosted Finding document';
21
- readonly description: 'A focused finding app for hosted execution.';
20
+ readonly title: 'Hosted Finding exploration';
21
+ readonly description: 'An interactive companion to a Finding’s text for hosted execution.';
22
22
  readonly mode: 'hosted';
23
23
  }, {
24
24
  readonly id: 'starter-local-metric-data-app';
@@ -27,8 +27,8 @@ export declare const dataAppExamples: readonly [{
27
27
  readonly mode: 'local';
28
28
  }, {
29
29
  readonly id: 'starter-local-finding-data-app';
30
- readonly title: 'Local Finding document';
31
- readonly description: 'A focused finding app for local execution.';
30
+ readonly title: 'Local Finding exploration';
31
+ readonly description: 'An interactive companion to a Finding’s text for local execution.';
32
32
  readonly mode: 'local';
33
33
  }];
34
34
  /** Stable identifier for a canonical starter. */
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@altertable/data-app-examples",
3
- "version": "0.75.0",
3
+ "version": "0.76.0",
4
4
  "description": "Canonical starter templates for Altertable data apps.",
5
+ "keywords": [
6
+ "altertable",
7
+ "data-app",
8
+ "data-apps",
9
+ "templates",
10
+ "starter",
11
+ "boilerplate",
12
+ "dashboard",
13
+ "analytics",
14
+ "react",
15
+ "typescript"
16
+ ],
5
17
  "license": "MIT",
6
18
  "author": "Altertable",
7
19
  "repository": {
@@ -5,18 +5,22 @@ import {
5
5
  mountDataApp,
6
6
  } from '@altertable/data-app-react';
7
7
  import {
8
+ choiceVariable,
8
9
  createDataHooks,
9
10
  DataApp,
10
11
  DataSection,
11
- VisualizationWidget,
12
- DataValue,
13
- TableWidget,
14
- Ranking,
12
+ MetricWidget,
15
13
  Stack,
16
- TextContent,
14
+ TableWidget,
15
+ VisualizationWidget,
17
16
  } from '@altertable/data-app-react';
17
+ import { BarChart, ComposedChart } from '@altertable/data-app-react/ui';
18
18
  import { createDataClient } from '@altertable/data-app/client';
19
- import { parseCount } from '@altertable/data-app/contract';
19
+ import {
20
+ dateTimeRangeVariable,
21
+ defineDateRangeContract,
22
+ parseCount,
23
+ } from '@altertable/data-app/contract';
20
24
  const dataApp = defineDataApp({
21
25
  title: 'Sample finding',
22
26
  description:
@@ -24,151 +28,252 @@ const dataApp = defineDataApp({
24
28
  scope: { organization: 'demo', environment: 'sample' },
25
29
  appearance: { theme: 'system' },
26
30
  queries: {
27
- sampleCountsByGroup: {
31
+ samples: {
28
32
  projections: {
29
- group_name: { type: 'string' },
33
+ period_start: { type: 'string' },
34
+ member: { type: 'string' },
35
+ selected: { type: 'boolean' },
30
36
  sample_count: { type: 'number' },
31
37
  },
32
38
  statement: `
33
- SELECT group_name, SUM(sample_count) AS sample_count
34
- FROM starter_demo.sample_counts
35
- WHERE $groupName = '' OR group_name = $groupName
36
- GROUP BY group_name ORDER BY sample_count DESC LIMIT $limit`,
39
+ SELECT strftime(date_trunc($grain, sample_date), '%Y-%m-%d') AS period_start,
40
+ CASE WHEN $breakdown = 'group' THEN group_name ELSE segment_name END AS member,
41
+ sample_date >= CAST($selected_start AS TIMESTAMP) AS selected,
42
+ SUM(sample_count) AS sample_count
43
+ FROM starter_demo.daily_samples
44
+ WHERE sample_date >= CAST($start AS TIMESTAMP) AND sample_date < CAST($end AS TIMESTAMP)
45
+ GROUP BY ALL ORDER BY period_start, member LIMIT $limit`,
37
46
  params: {
38
- groupName: { type: 'string', defaultValue: '' },
39
- limit: { type: 'number', defaultValue: 10 },
47
+ start: { type: 'string', defaultValue: '2026-03-09T00:00:00Z' },
48
+ end: { type: 'string', defaultValue: '2026-03-16T00:00:00Z' },
49
+ selected_start: {
50
+ type: 'string',
51
+ defaultValue: '2026-03-09T00:00:00Z',
52
+ },
53
+ grain: { type: 'string', defaultValue: 'day' },
54
+ breakdown: { type: 'string', defaultValue: 'segment' },
55
+ limit: { type: 'number', defaultValue: 500 },
40
56
  },
41
57
  },
42
58
  },
43
59
  });
60
+ const calendar = defineDateRangeContract({
61
+ minDate: '2026-01-05',
62
+ maxDate: '2026-03-29',
63
+ maxRangeDays: 28,
64
+ timeZone: 'UTC',
65
+ });
66
+ const findingPeriod = {
67
+ from: new Date('2026-03-09T00:00:00Z'),
68
+ to: new Date('2026-03-16T00:00:00Z'),
69
+ };
70
+ const period = dateTimeRangeVariable({
71
+ key: 'period',
72
+ contract: calendar,
73
+ allowComparison: true,
74
+ defaultValue: findingPeriod,
75
+ presets: [{ label: 'Finding period', range: findingPeriod }],
76
+ });
44
77
  const operations = {
45
- sampleCountsByGroup: dataApp.defineOperation({
46
- input: () => ({}),
47
- checks: [{}],
48
- policy: { maxQueryRows: 10, maxDurationMs: 15000 },
49
- async run({ query }) {
50
- const result = await query('sampleCountsByGroup', {});
78
+ samples: dataApp.defineOperation({
79
+ input: value => {
80
+ const {
81
+ period: selection,
82
+ grain,
83
+ breakdown,
84
+ } = (value ?? {}) as Record<string, unknown>;
85
+ if (grain !== 'day' && grain !== 'week')
86
+ throw new Error('Expected a day or week grain.');
87
+ if (breakdown !== 'segment' && breakdown !== 'group')
88
+ throw new Error('Expected a segment or group breakdown.');
89
+ return { period: period.parseInput(selection), grain, breakdown };
90
+ },
91
+ checks: [
92
+ {
93
+ period: period.input({ range: findingPeriod, comparison: 'previous' }),
94
+ grain: 'day',
95
+ breakdown: 'segment',
96
+ },
97
+ {
98
+ period: period.input(period.defaultValue),
99
+ grain: 'week',
100
+ breakdown: 'group',
101
+ },
102
+ ],
103
+ policy: { maxQueryRows: 500, maxDurationMs: 15000 },
104
+ async run({ query }, { period: { range, comparison }, grain, breakdown }) {
105
+ const result = await query('samples', {
106
+ start: (comparison?.from ?? range.from).toISOString(),
107
+ end: range.to.toISOString(),
108
+ selected_start: range.from.toISOString(),
109
+ grain,
110
+ breakdown,
111
+ });
51
112
  return result.rows.map(row => ({
52
- groupName: row.group_name,
113
+ periodStart: row.period_start,
114
+ member: row.member,
53
115
  sampleCount: parseCount(row.sample_count),
116
+ selected: row.selected,
54
117
  }));
55
118
  },
56
119
  }),
57
120
  };
58
- const queryNames = operations.sampleCountsByGroup.queryNames;
121
+ const queryNames = operations.samples.queryNames;
59
122
  const sampleDataContext = createDataContext(queryNames)({
60
123
  description:
61
- 'Fictional sample volumes grouped from starter_demo.sample_counts. Replace this evidence with the actual Finding queries.',
124
+ 'Fictional daily samples from starter_demo.daily_samples. Replace this evidence with the actual Finding queries.',
62
125
  glossary: {
63
126
  sampleCount: {
64
127
  term: 'Sample count',
65
- definition: 'A fixture value: Alpha is 2,200,000 and Beta is 600,000.',
66
- queryNames: [queryNames.sampleCountsByGroup],
128
+ definition: 'Fixture samples recorded per day, group, and segment.',
129
+ queryNames: [queryNames.samples],
67
130
  },
68
131
  },
69
132
  });
70
- const { defineDataView } = createDataHooks(createDataClient({ operations }));
71
- const sampleCountsView = defineDataView({
133
+ const { defineTimeView } = createDataHooks(createDataClient({ operations }));
134
+ const samplesView = defineTimeView({
72
135
  dataContext: sampleDataContext,
73
- operation: 'sampleCountsByGroup',
74
- describeInput: () => 'fixture groups',
75
- isEmpty: sampleCounts => sampleCounts.length === 0,
76
- emptyFallback: {
77
- title: 'No matching groups',
78
- description: 'No observations are available for this query.',
136
+ operation: 'samples',
137
+ time: period,
138
+ variables: {
139
+ grain: choiceVariable({
140
+ key: 'grain',
141
+ label: 'Grain',
142
+ defaultValue: 'day',
143
+ options: [
144
+ { id: 'day', label: 'Day' },
145
+ { id: 'week', label: 'Week' },
146
+ ],
147
+ presentation: { group: 'display', control: 'widget' },
148
+ }),
149
+ breakdown: choiceVariable({
150
+ key: 'breakdown',
151
+ label: 'Breakdown',
152
+ defaultValue: 'segment',
153
+ options: [
154
+ { id: 'segment', label: 'Segment' },
155
+ { id: 'group', label: 'Group' },
156
+ ],
157
+ presentation: { group: 'display', control: 'widget' },
158
+ }),
79
159
  },
80
- });
81
- const sampleCounts = sampleCountsView.dataset({
82
- name: 'Sample counts',
83
- select: rows => rows,
84
- rowKey: row => row.groupName,
85
- columns: {
86
- groupName: { label: 'Group', value: row => row.groupName },
87
- sampleCount: { value: row => row.sampleCount, format: { kind: 'count' } },
88
- },
89
- evidence: {
90
- id: 'counts-by-group',
91
- glossaryIds: ['sampleCount'],
160
+ isEmpty: rows => rows.length === 0,
161
+ emptyFallback: {
162
+ title: 'No samples in this period',
163
+ description: 'No observations are available for this period.',
92
164
  },
93
165
  });
94
- const totalSamples = sampleCountsView.metric(
166
+ type SampleRow = { sampleCount: number; selected: boolean };
167
+ function total(rows: readonly SampleRow[]) {
168
+ return rows.reduce((sum, row) => sum + row.sampleCount, 0);
169
+ }
170
+ function totalsBy<Row extends SampleRow>(
171
+ rows: readonly Row[],
172
+ key: (row: Row) => string
173
+ ) {
174
+ const totals = new Map<string, number>();
175
+ for (const row of rows)
176
+ totals.set(key(row), (totals.get(key(row)) ?? 0) + row.sampleCount);
177
+ return [...totals].map(([id, sampleCount]) => ({ id, sampleCount }));
178
+ }
179
+ const count = { kind: 'count' } as const;
180
+ const totalSamples = samplesView.metric(
95
181
  {
96
182
  id: 'total-samples',
97
- label: 'Total samples',
183
+ label: 'Samples',
98
184
  glossaryId: 'sampleCount',
99
- format: { kind: 'count' },
185
+ format: count,
100
186
  },
101
- rows => ({ current: rows.reduce((sum, row) => sum + row.sampleCount, 0) })
187
+ (rows, input) => ({
188
+ current: total(rows.filter(row => row.selected)),
189
+ ...(input.period.comparison && {
190
+ previous: total(rows.filter(row => !row.selected)),
191
+ }),
192
+ })
102
193
  );
103
- const alphaSamples = sampleCountsView.metric(
104
- {
105
- id: 'alpha-samples',
106
- label: 'Alpha samples',
107
- glossaryId: 'sampleCount',
108
- format: { kind: 'count' },
194
+ const trend = samplesView.dataset({
195
+ name: 'Samples over time',
196
+ select: rows => totalsBy(rows, row => row.periodStart),
197
+ rowKey: row => row.id,
198
+ columns: {
199
+ id: { label: 'Period start', value: row => row.id },
200
+ sampleCount: { value: row => row.sampleCount, format: count },
109
201
  },
110
- rows => {
111
- const alpha = rows.find(row => row.groupName === 'Alpha');
112
- if (!alpha)
113
- throw new Error('The sample Finding requires evidence for Alpha.');
114
- return { current: alpha.sampleCount };
115
- }
116
- );
117
- // This fictional Finding demonstrates prose, inline evidence, and a Markdown-table equivalent.
118
- // Preserve each real Finding's own headings and argument instead of reusing these sections.
119
- const sampleContent = sampleCountsView.content(result => (
202
+ evidence: { id: 'samples-over-time', glossaryIds: ['sampleCount'] },
203
+ });
204
+ const breakdown = samplesView.dataset({
205
+ name: 'Samples by member',
206
+ select: rows =>
207
+ totalsBy(
208
+ rows.filter(row => row.selected),
209
+ row => row.member
210
+ ),
211
+ rowKey: row => row.id,
212
+ columns: {
213
+ id: { label: 'Member', value: row => row.id },
214
+ sampleCount: { value: row => row.sampleCount, format: count },
215
+ },
216
+ evidence: { id: 'samples-by-member', glossaryIds: ['sampleCount'] },
217
+ });
218
+ const sampleRows = samplesView.dataset({
219
+ name: 'Samples',
220
+ select: rows => rows.filter(row => row.selected),
221
+ rowKey: row => `${row.periodStart}:${row.member}`,
222
+ columns: {
223
+ periodStart: { label: 'Period start', value: row => row.periodStart },
224
+ member: { label: 'Member', value: row => row.member },
225
+ sampleCount: { value: row => row.sampleCount, format: count },
226
+ },
227
+ evidence: { id: 'samples', glossaryIds: ['sampleCount'] },
228
+ });
229
+ // The Finding's text is shown above the app; keep content to charts and captions.
230
+ const sampleContent = samplesView.content(result => (
120
231
  <Stack>
121
- <TextContent>
122
- <h2>Contribution by group</h2>
123
- <p>
124
- <strong>Alpha</strong> contributed{' '}
125
- <DataValue metric={alphaSamples} source={result} /> of the{' '}
126
- <DataValue metric={totalSamples} source={result} /> recorded samples.
127
- The group comparison below supports that concentration; it does not
128
- explain its cause.
129
- </p>
130
- </TextContent>
232
+ <MetricWidget metric={totalSamples} source={result} />
131
233
  <VisualizationWidget
132
- dataset={sampleCounts}
234
+ dataset={trend}
133
235
  source={result}
134
- title="Sample count"
236
+ title="Samples over time"
237
+ description="Includes the previous period when comparison is on."
238
+ breakdown={samplesView.breakdown('grain')}
135
239
  >
136
240
  {rows => (
137
- <Ranking
138
- aria-label="Samples by group"
241
+ <ComposedChart
242
+ ariaLabel="Samples over time"
243
+ data={rows}
244
+ valueFormat={count}
245
+ >
246
+ <ComposedChart.XAxis dataKey="id" />
247
+ <ComposedChart.YAxis />
248
+ <ComposedChart.Line dataKey="sampleCount" name="Samples" />
249
+ <ComposedChart.Tooltip />
250
+ </ComposedChart>
251
+ )}
252
+ </VisualizationWidget>
253
+ <VisualizationWidget
254
+ dataset={breakdown}
255
+ source={result}
256
+ title="Samples by member"
257
+ breakdown={samplesView.breakdown('breakdown')}
258
+ >
259
+ {rows => (
260
+ <BarChart
261
+ ariaLabel="Samples by member"
262
+ unit="samples"
139
263
  items={rows.map(row => ({
140
- id: row.groupName,
141
- label: row.groupName,
264
+ ...row,
265
+ label: row.id,
142
266
  value: row.sampleCount,
143
267
  }))}
144
268
  />
145
269
  )}
146
270
  </VisualizationWidget>
147
- <TextContent>
148
- <h2>Supporting evidence</h2>
149
- <p>
150
- The source rows are grouped by <code>group_name</code> and summed using{' '}
151
- <code>sample_count</code>. The table retains the exact values behind the
152
- comparison.
153
- </p>
154
- <ul>
155
- <li>Compare the groups within the same sample population.</li>
156
- <li>
157
- <em>Volume alone does not establish performance or causality.</em>
158
- </li>
159
- </ul>
160
- </TextContent>
161
- <TableWidget
162
- dataset={sampleCounts}
163
- source={result}
164
- title="Counts by group"
165
- pagination={false}
166
- />
271
+ <TableWidget dataset={sampleRows} source={result} title="Samples" />
167
272
  </Stack>
168
273
  ));
169
274
  function App() {
170
275
  return (
171
- <DataApp view={sampleCountsView} showToolbar={false}>
276
+ <DataApp view={samplesView} showToolbar={false}>
172
277
  <DataSection content={sampleContent} />
173
278
  </DataApp>
174
279
  );
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
4
4
  as the selected scaffold. If dependencies are unavailable, read the
5
- [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
+ [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
6
6
 
7
7
  | Task | App-owned files |
8
8
  | ------------------------------------------ | -------------------------------------------------------- |
@@ -1,7 +1,7 @@
1
1
  # Local data app starter
2
2
 
3
3
  Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
4
- Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
4
+ Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
5
  See [AGENTS.md](AGENTS.md) for app-owned files.
6
6
 
7
7
  ## Run the app
@@ -17,9 +17,9 @@
17
17
  "lint:fix": "oxlint --type-aware --fix src"
18
18
  },
19
19
  "dependencies": {
20
- "@altertable/data-app": "0.75.0",
21
- "@altertable/data-app-bun": "0.75.0",
22
- "@altertable/data-app-react": "0.75.0",
20
+ "@altertable/data-app": "0.76.0",
21
+ "@altertable/data-app-bun": "0.76.0",
22
+ "@altertable/data-app-react": "0.76.0",
23
23
  "react": "19.3.1",
24
24
  "react-dom": "19.3.1"
25
25
  },
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
4
4
  as the selected scaffold. If dependencies are unavailable, read the
5
- [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
+ [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
6
6
 
7
7
  | Task | App-owned files |
8
8
  | ------------------------------------------ | -------------------------------------------------------- |
@@ -1,11 +1,11 @@
1
1
  # Local finding data app starter
2
2
 
3
3
  Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
4
- Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
4
+ Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
5
  See [AGENTS.md](AGENTS.md) for app-owned files.
6
6
 
7
7
  The example queries require the seeded sample data described in the
8
- [local preview guide](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/local-data-apps.md#preview-the-use-case-starters). <!-- x-release-please-version -->
8
+ [local preview guide](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/local-data-apps.md#preview-the-use-case-starters). <!-- x-release-please-version -->
9
9
  Use that mock for development, or replace the example queries with verified data
10
10
  in your lakehouse. The starter does not install a mock or create demo tables.
11
11
 
@@ -1,4 +1,9 @@
1
1
  import { defineDataApp } from '@altertable/data-app';
2
+ import {
3
+ dateTimeRangeVariable,
4
+ defineDateRangeContract,
5
+ } from '@altertable/data-app/contract';
6
+
2
7
  export const dataApp = defineDataApp({
3
8
  title: 'Sample finding',
4
9
  description:
@@ -6,20 +11,49 @@ export const dataApp = defineDataApp({
6
11
  scope: { organization: 'demo', environment: 'sample' },
7
12
  appearance: { theme: 'system' },
8
13
  queries: {
9
- sampleCountsByGroup: {
14
+ samples: {
10
15
  projections: {
11
- group_name: { type: 'string' },
16
+ period_start: { type: 'string' },
17
+ member: { type: 'string' },
18
+ selected: { type: 'boolean' },
12
19
  sample_count: { type: 'number' },
13
20
  },
14
21
  statement: `
15
- SELECT group_name, SUM(sample_count) AS sample_count
16
- FROM starter_demo.sample_counts
17
- WHERE $groupName = '' OR group_name = $groupName
18
- GROUP BY group_name ORDER BY sample_count DESC LIMIT $limit`,
22
+ SELECT strftime(date_trunc($grain, sample_date), '%Y-%m-%d') AS period_start,
23
+ CASE WHEN $breakdown = 'group' THEN group_name ELSE segment_name END AS member,
24
+ sample_date >= CAST($selected_start AS TIMESTAMP) AS selected,
25
+ SUM(sample_count) AS sample_count
26
+ FROM starter_demo.daily_samples
27
+ WHERE sample_date >= CAST($start AS TIMESTAMP) AND sample_date < CAST($end AS TIMESTAMP)
28
+ GROUP BY ALL ORDER BY period_start, member LIMIT $limit`,
19
29
  params: {
20
- groupName: { type: 'string', defaultValue: '' },
21
- limit: { type: 'number', defaultValue: 10 },
30
+ start: { type: 'string', defaultValue: '2026-03-09T00:00:00Z' },
31
+ end: { type: 'string', defaultValue: '2026-03-16T00:00:00Z' },
32
+ selected_start: {
33
+ type: 'string',
34
+ defaultValue: '2026-03-09T00:00:00Z',
35
+ },
36
+ grain: { type: 'string', defaultValue: 'day' },
37
+ breakdown: { type: 'string', defaultValue: 'segment' },
38
+ limit: { type: 'number', defaultValue: 500 },
22
39
  },
23
40
  },
24
41
  },
25
42
  });
43
+ export const calendar = defineDateRangeContract({
44
+ minDate: '2026-01-05',
45
+ maxDate: '2026-03-29',
46
+ maxRangeDays: 28,
47
+ timeZone: 'UTC',
48
+ });
49
+ export const findingPeriod = {
50
+ from: new Date('2026-03-09T00:00:00Z'),
51
+ to: new Date('2026-03-16T00:00:00Z'),
52
+ };
53
+ export const period = dateTimeRangeVariable({
54
+ key: 'period',
55
+ contract: calendar,
56
+ allowComparison: true,
57
+ defaultValue: findingPeriod,
58
+ presets: [{ label: 'Finding period', range: findingPeriod }],
59
+ });
@@ -17,9 +17,9 @@
17
17
  "lint:fix": "oxlint --type-aware --fix src"
18
18
  },
19
19
  "dependencies": {
20
- "@altertable/data-app": "0.75.0",
21
- "@altertable/data-app-bun": "0.75.0",
22
- "@altertable/data-app-react": "0.75.0",
20
+ "@altertable/data-app": "0.76.0",
21
+ "@altertable/data-app-bun": "0.76.0",
22
+ "@altertable/data-app-react": "0.76.0",
23
23
  "react": "19.3.1",
24
24
  "react-dom": "19.3.1"
25
25
  },
@@ -1,121 +1,164 @@
1
1
  import {
2
+ choiceVariable,
2
3
  createDataHooks,
3
4
  DataApp,
4
5
  DataSection,
5
- VisualizationWidget,
6
- DataValue,
7
- TableWidget,
8
- Ranking,
6
+ MetricWidget,
9
7
  Stack,
10
- TextContent,
8
+ TableWidget,
9
+ VisualizationWidget,
11
10
  } from '@altertable/data-app-react';
11
+ import { BarChart, ComposedChart } from '@altertable/data-app-react/ui';
12
12
  import { createDataClient } from '@altertable/data-app/client';
13
13
 
14
14
  import { sampleDataContext } from '#app/data-context.ts';
15
15
  import type { operations } from '#app/operations.ts';
16
- const { defineDataView } =
16
+ import { period } from '#config';
17
+ const { defineTimeView } =
17
18
  createDataHooks(createDataClient<typeof operations>());
18
- const sampleCountsView = defineDataView({
19
+ const samplesView = defineTimeView({
19
20
  dataContext: sampleDataContext,
20
- operation: 'sampleCountsByGroup',
21
- describeInput: () => 'fixture groups',
22
- isEmpty: sampleCounts => sampleCounts.length === 0,
23
- emptyFallback: {
24
- title: 'No matching groups',
25
- description: 'No observations are available for this query.',
26
- },
27
- });
28
- const sampleCounts = sampleCountsView.dataset({
29
- name: 'Sample counts',
30
- select: rows => rows,
31
- rowKey: row => row.groupName,
32
- columns: {
33
- groupName: { label: 'Group', value: row => row.groupName },
34
- sampleCount: { value: row => row.sampleCount, format: { kind: 'count' } },
21
+ operation: 'samples',
22
+ time: period,
23
+ variables: {
24
+ grain: choiceVariable({
25
+ key: 'grain',
26
+ label: 'Grain',
27
+ defaultValue: 'day',
28
+ options: [
29
+ { id: 'day', label: 'Day' },
30
+ { id: 'week', label: 'Week' },
31
+ ],
32
+ presentation: { group: 'display', control: 'widget' },
33
+ }),
34
+ breakdown: choiceVariable({
35
+ key: 'breakdown',
36
+ label: 'Breakdown',
37
+ defaultValue: 'segment',
38
+ options: [
39
+ { id: 'segment', label: 'Segment' },
40
+ { id: 'group', label: 'Group' },
41
+ ],
42
+ presentation: { group: 'display', control: 'widget' },
43
+ }),
35
44
  },
36
- evidence: {
37
- id: 'counts-by-group',
38
- glossaryIds: ['sampleCount'],
45
+ isEmpty: rows => rows.length === 0,
46
+ emptyFallback: {
47
+ title: 'No samples in this period',
48
+ description: 'No observations are available for this period.',
39
49
  },
40
50
  });
41
- const totalSamples = sampleCountsView.metric(
51
+ type SampleRow = { sampleCount: number; selected: boolean };
52
+ function total(rows: readonly SampleRow[]) {
53
+ return rows.reduce((sum, row) => sum + row.sampleCount, 0);
54
+ }
55
+ function totalsBy<Row extends SampleRow>(
56
+ rows: readonly Row[],
57
+ key: (row: Row) => string
58
+ ) {
59
+ const totals = new Map<string, number>();
60
+ for (const row of rows)
61
+ totals.set(key(row), (totals.get(key(row)) ?? 0) + row.sampleCount);
62
+ return [...totals].map(([id, sampleCount]) => ({ id, sampleCount }));
63
+ }
64
+ const count = { kind: 'count' } as const;
65
+ const totalSamples = samplesView.metric(
42
66
  {
43
67
  id: 'total-samples',
44
- label: 'Total samples',
68
+ label: 'Samples',
45
69
  glossaryId: 'sampleCount',
46
- format: { kind: 'count' },
70
+ format: count,
47
71
  },
48
- rows => ({ current: rows.reduce((sum, row) => sum + row.sampleCount, 0) })
72
+ (rows, input) => ({
73
+ current: total(rows.filter(row => row.selected)),
74
+ ...(input.period.comparison && {
75
+ previous: total(rows.filter(row => !row.selected)),
76
+ }),
77
+ })
49
78
  );
50
- const alphaSamples = sampleCountsView.metric(
51
- {
52
- id: 'alpha-samples',
53
- label: 'Alpha samples',
54
- glossaryId: 'sampleCount',
55
- format: { kind: 'count' },
79
+ const trend = samplesView.dataset({
80
+ name: 'Samples over time',
81
+ select: rows => totalsBy(rows, row => row.periodStart),
82
+ rowKey: row => row.id,
83
+ columns: {
84
+ id: { label: 'Period start', value: row => row.id },
85
+ sampleCount: { value: row => row.sampleCount, format: count },
56
86
  },
57
- rows => {
58
- const alpha = rows.find(row => row.groupName === 'Alpha');
59
- if (!alpha)
60
- throw new Error('The sample Finding requires evidence for Alpha.');
61
- return { current: alpha.sampleCount };
62
- }
63
- );
64
- // This fictional Finding demonstrates prose, inline evidence, and a Markdown-table equivalent.
65
- // Preserve each real Finding's own headings and argument instead of reusing these sections.
66
- const sampleContent = sampleCountsView.content(result => (
87
+ evidence: { id: 'samples-over-time', glossaryIds: ['sampleCount'] },
88
+ });
89
+ const breakdown = samplesView.dataset({
90
+ name: 'Samples by member',
91
+ select: rows =>
92
+ totalsBy(
93
+ rows.filter(row => row.selected),
94
+ row => row.member
95
+ ),
96
+ rowKey: row => row.id,
97
+ columns: {
98
+ id: { label: 'Member', value: row => row.id },
99
+ sampleCount: { value: row => row.sampleCount, format: count },
100
+ },
101
+ evidence: { id: 'samples-by-member', glossaryIds: ['sampleCount'] },
102
+ });
103
+ const sampleRows = samplesView.dataset({
104
+ name: 'Samples',
105
+ select: rows => rows.filter(row => row.selected),
106
+ rowKey: row => `${row.periodStart}:${row.member}`,
107
+ columns: {
108
+ periodStart: { label: 'Period start', value: row => row.periodStart },
109
+ member: { label: 'Member', value: row => row.member },
110
+ sampleCount: { value: row => row.sampleCount, format: count },
111
+ },
112
+ evidence: { id: 'samples', glossaryIds: ['sampleCount'] },
113
+ });
114
+ // The Finding's text is shown above the app; keep content to charts and captions.
115
+ const sampleContent = samplesView.content(result => (
67
116
  <Stack>
68
- <TextContent>
69
- <h2>Contribution by group</h2>
70
- <p>
71
- <strong>Alpha</strong> contributed{' '}
72
- <DataValue metric={alphaSamples} source={result} /> of the{' '}
73
- <DataValue metric={totalSamples} source={result} /> recorded samples.
74
- The group comparison below supports that concentration; it does not
75
- explain its cause.
76
- </p>
77
- </TextContent>
117
+ <MetricWidget metric={totalSamples} source={result} />
78
118
  <VisualizationWidget
79
- dataset={sampleCounts}
119
+ dataset={trend}
80
120
  source={result}
81
- title="Sample count"
121
+ title="Samples over time"
122
+ description="Includes the previous period when comparison is on."
123
+ breakdown={samplesView.breakdown('grain')}
82
124
  >
83
125
  {rows => (
84
- <Ranking
85
- aria-label="Samples by group"
126
+ <ComposedChart
127
+ ariaLabel="Samples over time"
128
+ data={rows}
129
+ valueFormat={count}
130
+ >
131
+ <ComposedChart.XAxis dataKey="id" />
132
+ <ComposedChart.YAxis />
133
+ <ComposedChart.Line dataKey="sampleCount" name="Samples" />
134
+ <ComposedChart.Tooltip />
135
+ </ComposedChart>
136
+ )}
137
+ </VisualizationWidget>
138
+ <VisualizationWidget
139
+ dataset={breakdown}
140
+ source={result}
141
+ title="Samples by member"
142
+ breakdown={samplesView.breakdown('breakdown')}
143
+ >
144
+ {rows => (
145
+ <BarChart
146
+ ariaLabel="Samples by member"
147
+ unit="samples"
86
148
  items={rows.map(row => ({
87
- id: row.groupName,
88
- label: row.groupName,
149
+ ...row,
150
+ label: row.id,
89
151
  value: row.sampleCount,
90
152
  }))}
91
153
  />
92
154
  )}
93
155
  </VisualizationWidget>
94
- <TextContent>
95
- <h2>Supporting evidence</h2>
96
- <p>
97
- The source rows are grouped by <code>group_name</code> and summed using{' '}
98
- <code>sample_count</code>. The table retains the exact values behind the
99
- comparison.
100
- </p>
101
- <ul>
102
- <li>Compare the groups within the same sample population.</li>
103
- <li>
104
- <em>Volume alone does not establish performance or causality.</em>
105
- </li>
106
- </ul>
107
- </TextContent>
108
- <TableWidget
109
- dataset={sampleCounts}
110
- source={result}
111
- title="Counts by group"
112
- pagination={false}
113
- />
156
+ <TableWidget dataset={sampleRows} source={result} title="Samples" />
114
157
  </Stack>
115
158
  ));
116
159
  export function App() {
117
160
  return (
118
- <DataApp view={sampleCountsView} showToolbar={false}>
161
+ <DataApp view={samplesView} showToolbar={false}>
119
162
  <DataSection content={sampleContent} />
120
163
  </DataApp>
121
164
  );
@@ -1,13 +1,13 @@
1
1
  import { createDataContext } from '@altertable/data-app-react';
2
- const queryNames = { sampleCountsByGroup: 'sampleCountsByGroup' } as const;
2
+ const queryNames = { samples: 'samples' } as const;
3
3
  export const sampleDataContext = createDataContext(queryNames)({
4
4
  description:
5
- 'Fictional sample volumes grouped from starter_demo.sample_counts. Replace this evidence with the actual Finding queries.',
5
+ 'Fictional daily samples from starter_demo.daily_samples. Replace this evidence with the actual Finding queries.',
6
6
  glossary: {
7
7
  sampleCount: {
8
8
  term: 'Sample count',
9
- definition: 'A fixture value: Alpha is 2,200,000 and Beta is 600,000.',
10
- queryNames: [queryNames.sampleCountsByGroup],
9
+ definition: 'Fixture samples recorded per day, group, and segment.',
10
+ queryNames: [queryNames.samples],
11
11
  },
12
12
  },
13
13
  });
@@ -1,16 +1,49 @@
1
1
  import { parseCount } from '@altertable/data-app/contract';
2
2
 
3
- import { dataApp } from '#config';
3
+ import { dataApp, period } from '#config';
4
4
  export const operations = {
5
- sampleCountsByGroup: dataApp.defineOperation({
6
- input: () => ({}),
7
- checks: [{}],
8
- policy: { maxQueryRows: 10, maxDurationMs: 15000 },
9
- async run({ query }) {
10
- const result = await query('sampleCountsByGroup', {});
5
+ samples: dataApp.defineOperation({
6
+ input: value => {
7
+ const {
8
+ period: selection,
9
+ grain,
10
+ breakdown,
11
+ } = (value ?? {}) as Record<string, unknown>;
12
+ if (grain !== 'day' && grain !== 'week')
13
+ throw new Error('Expected a day or week grain.');
14
+ if (breakdown !== 'segment' && breakdown !== 'group')
15
+ throw new Error('Expected a segment or group breakdown.');
16
+ return { period: period.parseInput(selection), grain, breakdown };
17
+ },
18
+ checks: [
19
+ {
20
+ period: period.input({
21
+ ...period.defaultValue,
22
+ comparison: 'previous',
23
+ }),
24
+ grain: 'day',
25
+ breakdown: 'segment',
26
+ },
27
+ {
28
+ period: period.input(period.defaultValue),
29
+ grain: 'week',
30
+ breakdown: 'group',
31
+ },
32
+ ],
33
+ policy: { maxQueryRows: 500, maxDurationMs: 15000 },
34
+ async run({ query }, { period: { range, comparison }, grain, breakdown }) {
35
+ const result = await query('samples', {
36
+ start: (comparison?.from ?? range.from).toISOString(),
37
+ end: range.to.toISOString(),
38
+ selected_start: range.from.toISOString(),
39
+ grain,
40
+ breakdown,
41
+ });
11
42
  return result.rows.map(row => ({
12
- groupName: row.group_name,
43
+ periodStart: row.period_start,
44
+ member: row.member,
13
45
  sampleCount: parseCount(row.sample_count),
46
+ selected: row.selected,
14
47
  }));
15
48
  },
16
49
  }),
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read `node_modules/@altertable/data-app/docs/app-authoring.md` and use this project
4
4
  as the selected scaffold. If dependencies are unavailable, read the
5
- [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
+ [version-matched recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
6
6
 
7
7
  | Task | App-owned files |
8
8
  | ------------------------------------------ | -------------------------------------------------------- |
@@ -1,11 +1,11 @@
1
1
  # Local metric data app starter
2
2
 
3
3
  Use `node_modules/@altertable/data-app/docs/app-authoring.md` for this SDK version.
4
- Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/app-authoring.md). <!-- x-release-please-version -->
4
+ Otherwise, read the [version-matched authoring recipe](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/app-authoring.md). <!-- x-release-please-version -->
5
5
  See [AGENTS.md](AGENTS.md) for app-owned files.
6
6
 
7
7
  The example queries require the seeded sample data described in the
8
- [local preview guide](https://github.com/altertable-ai/data-app/blob/v0.75.0/docs/local-data-apps.md#preview-the-use-case-starters). <!-- x-release-please-version -->
8
+ [local preview guide](https://github.com/altertable-ai/data-app/blob/v0.76.0/docs/local-data-apps.md#preview-the-use-case-starters). <!-- x-release-please-version -->
9
9
  Use that mock for development, or replace the example queries with verified data
10
10
  in your lakehouse. The starter does not install a mock or create demo tables.
11
11
 
@@ -17,9 +17,9 @@
17
17
  "lint:fix": "oxlint --type-aware --fix src"
18
18
  },
19
19
  "dependencies": {
20
- "@altertable/data-app": "0.75.0",
21
- "@altertable/data-app-bun": "0.75.0",
22
- "@altertable/data-app-react": "0.75.0",
20
+ "@altertable/data-app": "0.76.0",
21
+ "@altertable/data-app-bun": "0.76.0",
22
+ "@altertable/data-app-react": "0.76.0",
23
23
  "react": "19.3.1",
24
24
  "react-dom": "19.3.1"
25
25
  },