Search by

datawell / reports

ethanbarlo

Saved, shareable charts over Datawell data sources.

Package info

github.com/datawellphp/reports

Homepage

Documentation

Language:TypeScript

pkg:composer/datawell/reports

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-11-05 00:39 UTC

This package is not auto-updated.

Last update: 2026-11-07 08:08:03 UTC


README

Datawell Reports

Packagist PHP from Packagist Total Downloads

Saved, shareable charts over Datawell data sources. A report is a stored QueryRequest (groupBy + aggregates, plus filters and parameters) and a presentation; it is always replayed as the person looking at it.

Installation

composer require datawell/reports
php artisan vendor:publish --tag=reports-migrations
php artisan migrate

The React builder, card and chart publish next to the tables component:

php artisan vendor:publish --tag=tables-frontend   # once, from datawell/tables
php artisan vendor:publish --tag=reports-frontend  # resources/js/datawell/reports/
npm install --save-exact @tanstack/charts@0.16.0

How it works

  • Owned, optionally shared. The creator owns a report and is the only one who edits or deletes it. shared: true makes it visible to everyone; anyone who can see a report can clone it and edit the clone.
  • Replayed as the viewer. Running a report goes through the core executor as the current user: their permissions, their scope, never the author's numbers. Before rendering, each report is dry-run validated against the viewer's schema; one that references a field or source they cannot see comes back valid: false with the reasons, and the published card renders a permission placeholder instead of a chart.
  • Tenancy hook. Narrow which shared reports a viewer sees:
use Datawell\Reports\Reports;

app(Reports::class)->resolveVisibilityUsing(function ($query, $viewer) {
    $query->whereIn('owner_id', $viewer->team->members()->select('id'));
});

Endpoints

Under datawell/reports (configurable in config/reports.php):

Method Path Purpose
GET / Visible reports, each with the viewer's valid verdict
POST / Create (validated as the owner)
GET /{report} One report
PUT /{report} Update (owner only, else 403)
DELETE /{report} Delete (owner only)
POST /{report}/clone A private copy owned by the caller
POST /{report}/run Buckets, replayed as the viewer

Anything the viewer may not see is a 404, indistinguishable from a missing report.

Front-end

import { ReportBuilder } from '@/datawell/reports/report-builder';
import { ReportCard } from '@/datawell/reports/report-card';

<ReportCard report={…} onEdit onCloned onDeleted /> runs the report and renders the chart or the placeholder. <ReportBuilder sources initial onSaved /> derives dimension and measure pickers from the schema and previews live. Chart types: bar, barHorizontal, line, area, pie, number, table.

Testing

composer test

Contributing

This repository is a read-only copy of the reports package, published automatically from Datawell's development repository, so changes aren't merged here directly. Issues and pull requests are still welcome: accepted changes are applied upstream and published back here. See the contributing guide.

License

MIT. See LICENSE.md.