Archived. The concepts explored here were discovered to already exist in
@sqlrooms/noodles— under active maintenance and prioritized over an internal approach. No further development planned.
Shared spatiotemporal data infrastructure for NEW HEAT and Agroview.
Strata gives your app three things: a DuckDB schema for client-side spatial data, Zustand slices for state management, and shared types with validation.
{
"dependencies": {
"@new-heat/strata": "file:../strata"
}
}@new-heat/strata/sql DuckDB tables, views, query builders
@new-heat/strata/slices Zustand slices (sources, timeline, colors, compute)
@new-heat/strata/core Source/Group types, Zod schemas, STP protocol
@new-heat/strata/colors Color themes and palettes
@new-heat/strata/ai Date tools, geocoding, activity utils, graph mods
@new-heat/strata/operators Arrow operator logic (pure functions + noodles wrappers)
import { initAll, sourcesQuery } from '@new-heat/strata/sql';
// Create all tables and views
await db.exec(initAll());
// Query with type-safe filters
const sql = sourcesQuery({
types: ['motion'],
uploaderId: 'user-1',
timeRange: { start: 1704067200000, end: 1704153600000 },
});
const result = await db.query(sql);import {
createSourcesSlice,
createTimelineSlice,
createColorsSlice,
createComputeSlice,
} from '@new-heat/strata/slices';
// Each slice is a function: (set, get) => sliceState
// Compose into your Zustand store however you like
const useStore = create((set, get) => ({
...createSourcesSlice()(set, get),
...createTimelineSlice()(set, get),
...createColorsSlice()(set, get),
...createComputeSlice()(set, get),
}));
// Slices give you actions + SQL generators
const sql = useStore.getState().filteredSourcesSql();
const temporalFilter = useStore.getState().temporalFilterSql();
const colorExpr = useStore.getState().colorExpressionSql();import { sourceSchema, parseSTP, buildSTP } from '@new-heat/strata/core';
// Validate untrusted source data
const source = sourceSchema.parse(untrustedJson);
// Parse/build STP protocol URIs
const parsed = parseSTP('stp://group/g1/motions');
const uri = buildSTP({ kind: 'group', groupId: 'g1', filter: 'motions' });src/
core/ Types, Zod schemas, STP protocol, geo validation
sql/ DuckDB table DDL, views, query builders
slices/ Zustand slice creators (no zustand dependency)
colors/ Color theme data and types
ai/ Date tools, geocode, activity utils, graph modifications
operators/ Arrow operator logic + noodles.gl wrappers
pnpm test # 211 tests (vitest)
pnpm build # Build (tsc)
pnpm typecheck # Type check
pnpm clean # Remove dist/core/has zero external dependencies (just zod)sql/depends only on core typesslices/are pure functions — no zustand dependency, consumers passset/getai/is mostly pure utilities;apply-modificationsrequires noodles-gl runtimeoperators/logic functions are pure; operator classes require noodles-gl runtime- Bare
noodles-gl/*imports resolve through the consumer's bundler via Vite alias
MIT — NEW HEAT, Inc.