Workbooks and analytical assets
A workbook is the main analytical space in Insights. It groups related queries, charts, folders, and dashboards so teams can move from data work to a shared view of results. The workbook also defines the boundary for sharing, copying, export, import, templates, and lineage.
Workbook role
Analytical workspace
The workbook is the container for a connected body of analytical work. Queries provide data, charts turn query results into visual assets, and dashboards arrange charts for people who need to read the result. Folders give queries and charts a local structure without changing their data links.
The workbook list shows the workbooks available to the current user. It separates owned workbooks from workbooks shared by another user and reports basic activity and sharing information. It also identifies workbooks supplied by an installed app. The workbook interface explains how this workspace appears and behaves.
References: insights/…/insights_workbook.py• L169-230 insights/…/insights_workbook.py• L313-372 insights/…/workbooks.py• L29-89 frontend/…/workbook.types.ts• L10-64
Asset relationships
Each query, chart, and dashboard belongs to one workbook. A chart normally uses a query, while a dashboard uses charts and can bind its filters to query fields. These links let a change in the data path reach the dashboard view without copying the analytical work into the dashboard itself.
The following diagram shows the main relationship between workbook assets.
flowchart LR
W[Workbook] --> Q[Queries]
W --> C[Charts]
W --> D[Dashboards]
Q --> C
C --> D
Q --> F[Dashboard filters]
F --> D
References: insights/…/insights_workbook.json• L45-57 frontend/…/workbook.types.ts• L30-64 frontend/…/workbook.types.ts• L83-156
Workbook lifecycle
Creation and editing
An engineer starts with a workbook and adds queries, charts, or dashboards as the analysis takes shape. The workbook exposes these assets with their folder and order data so the interface can present a stable analytical workspace. A workbook with read-only access remains available for analysis but does not save edits.
The workbook has a required title and receives a generated name. If no title is supplied, it gets a default title based on that name. A standard workbook is different: an installed app supplies it through a named module, and the site keeps its shipped identity so app updates can manage the same analytical asset. The workbook interface explains the user-facing editing flow, while the workbook API explains the server contract and lifecycle operations.
Deleting a workbook also removes its folders, queries, charts, and dashboards. Before that removal, the system stores an export of the workbook so a later workbook created through the normal document flow can restore the child assets. The delete is blocked when a desk document still claims one of the workbook's members unless the delete is forced.
References: insights/…/insights_workbook.json• L13-42 insights/…/insights_workbook.py• L72-111 insights/…/insights_workbook.py• L127-167 insights/…/insights_workbook.py• L169-211
Dependencies and lineage
Queries may use other queries as inputs. Lineage makes this path visible by showing the source tables and upstream queries that feed the workbook's queries.
Lineage can cross workbook boundaries when a query refers to a query owned by another workbook. Access to the lineage view is limited to Insights administrators because the graph can reveal data-source and query relationships.
References: insights/…/insights_workbook.py• L591-668 frontend/…/workbook.ts• L43-48 frontend/…/workbook.ts• L454-479
Export, import, and duplication
Export treats a workbook as a portable analytical package. It includes the workbook title and the active folders, queries, charts, dashboards, and links between them. Folders with no active query or chart are not part of the package.
Import rebuilds those assets in a new workbook. It creates referenced queries before the queries that use them, then remaps internal query, chart, and dashboard filter links so the new package remains self-contained. A reference to a query that is not in the package remains a link to the existing site query. The import result provides the new workbook name and the mapping from source asset names to copied names.
Duplication uses the same package boundary. It creates a new workbook rather than a second view of the original, so later edits to either workbook do not change the other. The package form also supports workbooks supplied by apps. Those workbooks keep their declared member names and can remove members no longer present in the shipped file. The workbook API documents the request and response contract for these operations.
The following diagram shows the package lifecycle.
flowchart LR
A[Workbook and linked assets] --> E[Export package]
E --> I[Import package]
I --> N[New workbook with remapped links]
E --> D[Duplicate]
D --> N
References: insights/…/insights_workbook.py• L195-311 insights/…/insights_workbook.py• L393-513 insights/…/insights_workbook.py• L572-576 insights/…/insights_workbook.py• L1140-1154
Access and distribution
Workbook sharing
Workbook sharing controls who can open and edit the analytical workspace. The workbook permissions allow Insights users to create, read, write, delete, export, and share workbooks. The share flow can grant view or edit access to individual Insights users or to the whole organization.
Workbook access is separate from the public presentation of a dashboard. A user may need workbook access to work on source assets, while a dashboard can have its own audience and public state. See workbook interface for the sharing experience and dashboards and visualization for dashboard distribution.
References: insights/…/insights_workbook.json• L64-88 insights/…/workbooks.py• L9-27 insights/…/workbooks.py• L131-240
Dashboard publishing
A dashboard is the workbook's presentation layer for dashboard-oriented work. It places selected charts on a layout and can add text and filters that act on linked chart data. A dashboard may be shared with named users, shared with the organization, or marked public according to its own access settings.
The dashboard keeps a preview image for browsing and sharing. Changes to dashboard content refresh that preview asynchronously, so the stored preview can lag briefly behind the latest layout. Public dashboard filter requests still use only fields that the dashboard has explicitly linked.
References: insights/…/insights_dashboard_v3.py• L41-71 insights/…/insights_dashboard_v3.py• L73-163 insights/…/insights_dashboard_v3.py• L202-260 frontend/…/workbook.types.ts• L105-156
Supplied analytical assets
App-shipped workbooks
An app-shipped workbook is a standard workbook that an installed app provides as a managed analytical asset. It must name the module that ships it. The system rejects a standard workbook when no installed app owns that module because a later site migration could remove the workbook and its members.
Shipped workbooks use stable names for the workbook and its members so links remain consistent across sites. Their dashboard visibility is limited to desk roles, and their charts do not run as the owning user. When a shipped file removes content that a desk document still uses, Insights keeps that content until the desk document no longer claims it.
References: insights/…/insights_workbook.py• L38-50 insights/…/insights_workbook.py• L87-105 insights/…/insights_workbook.py• L515-570 insights/…/insights_workbook.py• L969-1063
Template library
Templates provide ready-made workbooks for an installed app's business data. A template has a title, description, required apps, and source data types. Insights discovers templates from installed apps, shows only templates whose required apps are present, and can warn when the source site has no data for the supplied analysis.
Templates are imported as shared organization workbooks. Only an Insights administrator can create or update one. The site keeps one imported copy for each template, records the shipped version, and checks whether local edits changed the copy before applying a later template version. A pristine copy can update automatically during site migration; an edited copy requires an explicit update.
See workbook templates for the template library and supplied asset flow.
References: insights/…/templates.py• L14-20 insights/…/templates.py• L64-73 insights/…/templates.py• L173-218 insights/…/templates.py• L279-320 insights/…/templates.py• L323-437 insights/…/insights_workbook.json• L13-42
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to workbook fields or child ownership must stay aligned with the workbook payload used by the interface, API, app-shipped file import, and restore flow.
- Changes to standard workbook naming or module ownership must preserve stable member names and reject modules that no installed app ships.
- Changes to exported asset fields or internal references must preserve import ordering and ID remapping. A package that loads but keeps old query or chart names can silently break dashboards and linked filters.
- Changes to workbook deletion must keep the backup, claim check, and child deletion set aligned with the assets that a workbook owns.
- Changes to workbook permissions or sharing must keep workspace access separate from dashboard access and public filter checks.
- Changes to query-reference records must remain compatible with the lineage graph and with the workbook client’s linked-query view.
- Changes to template metadata or version fields must preserve the one-copy-per-site rule and the check that prevents local edits from being overwritten without warning.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A workbook package contains a reference that is not remapped during import | A copied chart or dashboard points to an asset in the source workbook or to a missing asset | Keep export dependencies and import ID mapping in step with query, chart, and dashboard links |
| Imported queries contain a circular reference | Import cannot place the queries in a safe order | Reject the package when no unplaced query has all its package references resolved |
| A standard workbook names a module that no installed app ships | A later migration can delete the workbook and its analytical members | Validate the module before saving the standard workbook |
| A shipped member name collides with another workbook or dashboard route | Import can move another app's member or take over links to an existing dashboard | Refuse borrowed member names and route collisions during restore |
| A shipped file drops a member that a desk document still uses | Migration can leave the desk document without its chart, query, or dashboard | Keep claimed members and their dependent assets until no desk document uses them |
| A workbook is deleted while its child assets are not handled as workbook-owned data | Queries, charts, dashboards, or folders remain as orphaned analytical assets | Keep the workbook deletion set aligned with the child doctypes used by restore and template replacement |
| A user without workbook share permission changes sharing | Access can be widened or narrowed without the owner's approval | Enforce share permission before reading or writing workbook shares and limit recipients to Insights users |
| A template version changes after a site has edited its imported workbook | A refresh can remove local analysis if it treats the copy as pristine | Compare the imported content checksum before automatic or requested replacement |
| A public dashboard filter asks for an unlinked query field | The request can expose data outside the dashboard's declared filter contract | Allow distinct-value requests only for fields linked by a dashboard filter |
Key files
| File | Why to read it |
|---|---|
| insights/…/insights_workbook.py | Defines the workbook boundary, child asset lifecycle, app-shipped workbook rules, package export and import, duplication, and lineage graph. |
| insights/…/insights_workbook.json | Defines the workbook title, standard/module status, backup field, child links, and access permissions. |
| insights/…/workbooks.py | Defines workbook discovery, sharing, folder organization, and ordering through the server API. |
| frontend/…/workbook.ts | Shows how the UI coordinates workbook tabs, asset creation, access state, import, duplication, and deletion. |
| insights/…/templates.py | Defines template discovery, import ownership, version checks, and safe refresh of supplied workbooks. |
| insights/…/insights_dashboard_v3.py | Explains dashboard access, chart links, filter checks, and preview behavior inside a workbook. |
docs/workbook-interface.md | Child page for workbook UI and navigation behavior. |
docs/workbook-api.md | Child page for workbook lifecycle and API contracts. |
| docs/workbook-templates.md | Child page for supplied workbook templates and their update rules. |
docs/dashboards-and-visualization.md | Related page for dashboard presentation and chart behavior. |