The report_history project provides a practical solution. It extracts the complete JSON definition of Visual Analytics reports and captures PNG images of every report section, creating artifacts that can be stored and tracked in Git.
By combining report extraction with Git version control, organizations can create a complete history of report evolution and establish a lightweight governance framework for their SAS Visual Analytics environment.
The report_history project is a Python utility that connects to SAS Viya, extracts report definitions, and generates images of report sections. For each configured report, the tool:
The resulting output contains both:
This combination makes the repository particularly useful for governance, auditing, documentation, and change tracking.
The JSON representation of a Visual Analytics report contains the report's metadata, layout definitions, visual objects, data mappings, calculations, filters, and other configuration elements.
Unlike screenshots, JSON files can be compared automatically using version control systems.
For example, a Git comparison can show:
This level of detail is essential for governance teams and report administrators.
Although JSON is essential for technical comparisons, it is not always easy for business stakeholders to review.
The generated PNG images complement the JSON definition by providing a visual representation of each report section.
These images make it easy to:
When combined with Git, image differences become an additional layer of change visibility.
The project is configured using a .env file containing:
Here is a sample .env file.
VIYA_BASE_URL=https://viya.company.com
VIYA_USERNAME=myuser
VIYA_PASSWORD=mypassword
VIYA_CLIENT_ID=myclient
VIYA_CLIENT_SECRET=mysecret
VIYA_SERVER_CERTIFICATE=/path/to/certificate.pem
REPORT_HISTORY_OUTPUT_LOCATION=/reports/output
REPORT_HISTORY_REPORTS_LIST=/reports/reports.json
The reports to process are defined in a JSON file referenced by the REPORT_HISTORY_REPORTS_LIST parameter.
Each entry contains:
[
{
"report_url": "https://viya.company.com/links/resources/report?uri=/reports/reports/12345",
"label": "Executive Dashboard"
}
]
The report URL can be obtained directly from Visual Analytics using the Copy Link action. Using the SAS Visual Analytics REST APIs, you can also create a list of reports based on your needs.
The utility extracts the report identifier from the URL and uses it to retrieve the report definition and generate images.
Once configured, the extraction process can be executed with:
uv run --env-file .env report-history
The utility authenticates with SAS Viya, removes any existing output directory for the report, downloads the report definition, and generates PNG images for all report sections. The resulting structure resembles:
output/
└── report-id/
├── report-id.json
└── images/
├── Retail Insights.png
├── Sales.png
└── Forecast.png
The resulting json will look like this with browser formatting applied:
The resulting PNG image of a report section will look like this:
The real value emerges when these extracted assets are committed to a Git repository.
Instead of treating reports as objects hidden inside the SAS Viya platform, organizations can manage report definitions similarly to source code.
A typical workflow looks like this:
Each extraction becomes a snapshot of the reporting environment. A scheduled execution can:
The Git repository then becomes the historical archive for reporting assets.
Every commit records:
This provides a valuable audit trail without requiring specialized governance software.
Suppose a report is modified incorrectly. With Git, previous versions remain available. Administrators can review historical report definitions and identify when an issue was introduced. Because the report definition is stored as JSON, recovering earlier configurations becomes straightforward.
Teams can review report modifications through pull requests.
Before accepting a report update, reviewers can inspect:
This introduces software engineering practices into analytics governance.
Many organizations operate in regulated environments where reporting changes must be documented.
Examples include:
A Git repository containing JSON definitions and report images provides a historical record demonstrating how reports evolved over time.
If a report is accidentally deleted or corrupted, the extracted JSON serves as a backup representation of the report at multiple points in time.
While the repository is not intended to replace SAS backup strategies, it provides an additional layer of protection.
Governance teams can certify specific report versions by tagging Git commits.
Example:
git tag certified-q3-finance
This creates a permanent reference for a certified report state.
Teams can associate report versions with business releases:
Release 2026.1
├── Sales Dashboard
├── Executive Summary
└── Forecast Analysis
Each release corresponds to a set of Git commits.
By reviewing Git history, administrators can answer questions such as:
To maximize governance value:
Best practice |
Recommendations & Examples |
| Store One Repository per Environment |
Maintain separate repositories for:
|
| Schedule Regular Extractions | Automate execution daily or weekly to capture report evolution continuously. |
| Use Meaningful Commit Messages |
Examples:
|
| Protect Main Branches | Require pull requests and reviews for governance-controlled reports. |
| Tag Major Releases | Create Git tags for official report publications or certification milestones. |
The report_history project transforms SAS Visual Analytics reports from platform-managed assets into version-controlled artefacts. By extracting report definitions as JSON and generating visual snapshots of report sections, it creates a foundation for governance, auditing, change tracking, and documentation.
When integrated with Git, the solution provides capabilities typically associated with modern software development:
For organisations seeking a lightweight yet powerful approach to Visual Analytics governance, combining report_history with Git offers a practical way to maintain visibility into how reports evolve over time while creating a durable historical record of analytic content.
The code related to this article is available here.
Find more articles from SAS Global Enablement and Learning here.
Visit the Tips & Tricks page for setup guidance, demos, and practical examples that show how Copilot supports your workflows.
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.