Appearance
Analytics
analyzeRun(result) is a pure, synchronous entry point usable in Node or the browser. It calculates metrics, score components, diagnostics, accessibility, and built-form summaries. compareAnalyses compares analyses; use consistent profiles, populations, settings, package versions, and seed sets when comparing schemes.
Mount a report card
The optional DOM report card is framework-neutral. Import its stylesheet once:
ts
import { analyzeRun, mountReportCard } from '@grabm/abm/analytics'
import type { RunResult } from '@grabm/abm'
import '@grabm/abm/analytics/styles.css'
export function mountAnalysis(host: HTMLElement, result: RunResult) {
const analysis = analyzeRun(result)
const card = mountReportCard(host, analysis, { title: 'Example analysis' })
return { analysis, dispose: () => card.dispose() }
}Call card.update(nextAnalysis) to replace content and card.dispose() when unmounting. analyzeBuiltForm(elements) also works independently of simulation and does not add parking or programme-size measures to the urban score.
Optional Plotly charts
Install plotly.js-basic-dist-min only if you need charts. Dynamically import @grabm/abm/analytics/plotly in browser code after mounting the report card, then call mountPlotlyCharts(reportHost, analysis, palette). The palette requires foreground, grid, and series colors resolved from your theme.
Keep the returned chart handle. On theme changes call charts.update(analysis, palette); on container resize call charts.resize(). Dispose charts before disposing or replacing report-card content. If replacing report markup, remount charts on the new elements. The root analytics import does not load Plotly.
Interpret the output
Start with reading results for the meanings of trip completion, occupancy, reservations, observation buckets, and unmet demand.
The default urban profile uses the 30/25/20/15/10 weighting. Its accessibility measure is population-weighted walking coverage of demanded activities within 15 minutes; external fallback gateways are excluded. A score is only meaningful with its assumptions.
Read warnings, constraint outcomes, and departure causes before interpreting low movement or peaks. Authored need fulfillment and recorded trips answer different questions. See behavior and limitations and analytics API.
Regional edge-detail storage
analyzeRun(run, { edgeDetails: 'observed' }) retains detail rows only for edges with at least one recorded observation bucket. Explicitly recorded zero buckets remain included. The default, edgeDetails: 'all', retains the existing complete edge table.
The opt-in result includes edgeDetailCoverage with kind: 'observed', totalEdges, and omittedZeroEdges. Omitted rows have the same zero observation values the complete analysis would assign; their geometry, length and allowed modes remain in the original run archive. Consumers must not treat the shorter edge table as the network's edge count or use it to redefine denominators.
Only the detail table changes. Aggregate metrics, scores, accessibility, observations, trip distributions and the run hash are computed from the full run. This option does not reduce the simulation network or change route choice. It is particularly useful with edgeObservationStorage: 'sparse-zero-v1'; dense inputs that explicitly record every edge retain every recorded row.