Smart Site
Home Docs Smart Data Report System

Report System

The Report module generates periodic and on-demand reports from historical telemetry, alarm events, and operational metadata. Reports can be previewed in the browser, exported to multiple formats, and delivered on a schedule.

Interface Screenshot

Report System (English UI)

Captured from the live Smart Site system with the English UI. See the zh-CN counterpart for the Chinese-UI screenshot.

1. Core Concepts

  • Report Definition — A template describing layout, data sources, parameters, and output format
  • Report Template — The reusable layout (headers, tables, charts) applied to a data query
  • Data Source — Where the report data comes from (InfluxDB query, alarm history, device metadata)
  • Scheduled Export — A cron-triggered job that renders and delivers a report

The engine is implemented in @ss-node/ss-report and exposed through the System → Reports page (route /system/reports).

2. Report Design

The report designer lets you build a report visually:

  1. Layout — define sections (header, body, footer) and place widgets (table, chart, KPI)
  2. Parameters — declare input parameters (date range, device filter, tag selection) that the user supplies at run time
  3. Bindings — bind each widget to a data source query
  4. Styling — apply theme colors via CSS variables (no hardcoded colors)

Reports are stored as JSON definitions in the project database, so they travel with the project when it is backed up or moved.

3. Data Source Configuration

Each widget in a report binds to a data source:

Source Type Description
InfluxDB Query Time-series data for charts and trend tables
Alarm History List of alarms within the parameter window
Device Metadata Device and tag inventory
SQL (SQLite) Project metadata tables for ad-hoc queries
Script Output Run a script and use its return value as the dataset

Parameters declared in the report are substituted into the query at run time, enabling dynamic filtering.

4. Scheduled Export

Reports can be exported automatically on a schedule:

  1. Open the report definition
  2. Navigate to the Schedule tab
  3. Set a cron expression (e.g. 0 8 * * * for daily at 08:00)
  4. Choose an output format (PDF, Excel, CSV)
  5. Configure delivery — download to a folder, email attachment, or webhook upload

The scheduler uses @nestjs/schedule and records each run in the report execution log. Failed exports are retried with exponential backoff.

5. Report Templates

The system ships with starter templates:

  • Daily Device Summary — per-device min/max/avg for key tags over 24h
  • Alarm Log — all alarms raised in a period with acknowledge times
  • Compliance Report — regulatory-style data rollup with header/footer
  • Energy Consumption — hourly energy totals with bar chart

Templates can be customized and saved as new report definitions without overwriting the originals.

6. Report Preview

Before publishing or scheduling, preview the report:

  1. Open the report definition
  2. Click Preview
  3. Enter parameter values (or accept defaults)
  4. The backend renders the report and streams it back as HTML/PDF
  5. Adjust layout and re-preview until satisfied

Preview uses the same rendering pipeline as the final export, so what you see is what you get.

7. Operational Guidance

7.1 Improving Report Performance

  • Bound the time range — unbounded InfluxDB queries are slow
  • Use aggregation (mean/max) instead of raw points for long ranges
  • Avoid thousands of rows in a single table widget — paginate or summarize
  • Schedule heavy reports off-peak

7.2 Delivering via Email

  1. Configure SMTP in System → Settings → Notification
  2. In the report schedule, select Email delivery
  3. Enter recipient addresses (comma-separated)
  4. The export is attached as a PDF/XLSX and sent on each run

8. FAQ

Q: A scheduled report did not run. A: Check the report execution log for errors. Verify the cron expression and that the scheduler module is loaded. Confirm that any parameters with defaults are set, since the scheduled run cannot prompt for input.

Q: The PDF export looks different from the preview. A: PDF rendering depends on the headless browser / print engine. Ensure charts have explicit dimensions and that fonts are available on the server. Avoid CSS features unsupported by the print engine.

Q: How do I add a chart to a report? A: In the designer, drag a Chart widget into a section, bind it to an InfluxDB data source, and map the returned columns to X and Y axes. Preview to verify.

Q: Can reports access data across projects? A: No. Reports run in the context of the active project and its InfluxDB bucket. For cross-project rollups, create a dedicated project that aggregates data via scripts or external ETL.

  • ../../07-storage/README.md
  • ../../10-script/README.md
  • ../../06-alarm/README.md
  • Report Package