Skip to content

Report Schema ​

RichView reports are declarative JSON or YAML documents validated at runtime by Zod schemas and at edit-time by TypeScript types.

Report structure ​

typescript
interface Report {
  title: string;
  subtitle?: string;
  theme?: "default-dark" | "default-light" | "auto";
  generatedBy?: {
    model?: string;
    timestamp?: string;      // ISO 8601
    confidenceScore?: number; // 0--1
  };
  settings?: ReportSettings;
  sections: Section[];
}

Section types ​

Every section has an id (auto-generated if omitted), a type, and optional assertions for verification.

markdown ​

Rich text content rendered from Markdown.

yaml
- id: intro
  type: markdown
  content: |
    Revenue grew **12%** quarter-over-quarter, driven by
    expansion in the enterprise segment.

chart ​

Interactive ECharts visualization. The chart field uses RichView's internal chart spec (not raw ECharts JSON).

yaml
- id: revenue
  type: chart
  title: Revenue by Quarter
  chart:
    type: bar          # bar, line, area, pie, scatter, heatmap, radar, funnel, gauge
    xAxis: { field: quarter }
    yAxis: { field: revenue, format: currency }
    series:
      - dataKey: revenue
        name: Revenue
  data:
    type: inline
    columns: [quarter, revenue]
    values:
      - [Q1, 1200000]
      - [Q2, 1350000]

Chart types: bar, line, area, pie, scatter, heatmap, radar, funnel, gauge, treemap, sankey, candlestick, boxplot, waterfall, stacked-bar, stacked-area, grouped-bar, horizontal-bar, donut, bubble, multi-axis.

table ​

Structured data display with optional column configuration.

yaml
- id: metrics
  type: table
  title: Key Metrics
  columns:
    - key: metric
      label: Metric
    - key: value
      label: Value
      align: right
  data:
    type: inline
    columns: [metric, value]
    values:
      - [Monthly Active Users, "2.4M"]
      - [Revenue, "$4.2M"]

big-number ​

KPI card with value, label, and optional change indicator.

yaml
- id: revenue-kpi
  type: big-number
  label: Total Revenue
  value: "$4.2M"
  change:
    value: 12
    direction: up
    period: vs last quarter

image ​

Captioned image with alt text.

yaml
- id: architecture
  type: image
  src: https://example.com/diagram.png
  alt: System architecture diagram
  caption: Figure 1. High-level architecture

code ​

Syntax-highlighted code block.

yaml
- id: query
  type: code
  language: sql
  code: |
    SELECT date, SUM(revenue) as total
    FROM sales
    GROUP BY date
    ORDER BY date

video ​

Embedded video (YouTube, Vimeo, or direct URL).

yaml
- id: demo
  type: video
  url: https://www.youtube.com/watch?v=example
  caption: Product walkthrough

callout ​

Highlighted information box with severity level.

yaml
- id: warning
  type: callout
  variant: warning   # info, warning, danger, success
  content: Data for December is preliminary and subject to revision.

divider ​

Visual separator between sections.

yaml
- id: sep
  type: divider

embed ​

External content embed via URL.

yaml
- id: dashboard
  type: embed
  url: https://example.com/dashboard

quote ​

Pull quote or blockquote.

yaml
- id: ceo-quote
  type: quote
  content: "We've never seen growth like this."
  attribution: CEO, Annual Report

Data sources ​

Sections that display data (chart, table) accept a data field:

TypeDescription
inlineData embedded directly in the schema
fileReference to a CSV/JSON file path
sqlSQL query against a configured connection
slash-commandSlash command data source
databaseDirect database connection

Assertions ​

Sections can include assertions for the verification pipeline:

yaml
assertions:
  - type: range-check
    field: revenue
    min: 0
    max: 100000000
    status: pass
  - type: freshness-check
    field: timestamp
    maxAge: "30d"
    status: pass

Types: range-check, consistency-check, freshness-check, citation-check.

Layout options ​

Sections accept layout hints:

FieldValuesDescription
layoutfull, halfColumn width (consecutive half sections form 2-column rows)
layoutAlignstart, endAlignment within a column row

Generating the JSON Schema ​

For IDE autocomplete, generate the full JSON Schema:

bash
richview schema > richview-report.schema.json

Released under the Elastic License 2.0 (ELv2).