Skip to content

Improve reports 2#77

Merged
dvir001 merged 3 commits into
mainfrom
2026-05-17-Reports2
May 18, 2026
Merged

Improve reports 2#77
dvir001 merged 3 commits into
mainfrom
2026-05-17-Reports2

Conversation

@dvir001
Copy link
Copy Markdown
Owner

@dvir001 dvir001 commented May 17, 2026

This pull request introduces a consistent metadata sheet/page to all XLSX and PDF exports in the application, improving traceability and aligning with best practices for enterprise data exports. The metadata includes details like export date, filename, export options, and more. The implementation is handled both server-side (for XLSX) and client-side (for PDF), and the code is refactored to centralize and standardize the metadata generation.

Metadata sheet/page addition to exports

  • Added a reusable add_metadata_sheet function to exports.py that appends a standardized "Metadata" sheet to all XLSX exports, including logo, export details, and applied filters. This is now called from all relevant export endpoints and data generation functions (app_main.py, data_update.py, user_scanner_service.py). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

  • Introduced the format_export_filters helper to generate descriptive export option strings for metadata, reflecting all active filters in a human-readable format. [1] [2] [3] [4] [5]

PDF export improvements

  • Appended a metadata page to all exported PDFs, including logo (if configured), export details, and export options, matching the XLSX metadata sheet for consistency.

Refactoring and code cleanup

  • Centralized and standardized filename generation and metadata insertion, removing duplicate code and ensuring all exports follow the same pattern. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

UI improvements

  • Improved PDF export filter labeling and tagpicker filter display for better user clarity in the exported report.

These changes ensure that all data exports are more transparent, auditable, and user-friendly, with consistent metadata for downstream consumers.

Introduce standardized metadata for exported reports and PDFs. Added add_metadata_sheet and format_export_filters to simple_org_chart/exports.py (including logo resolution and UTC timestamps), and update export codepaths to append a Metadata sheet: app_main.py (many export endpoints), data_update.py, and user_scanner_service.py. Frontend PDF export and report filter display were extended to include a metadata page/lines in static/app.js and static/reports.js. Added unit tests for format_export_filters in tests/test_exports.py. These changes improve auditability of exports by recording filename, sheet title, item counts, and active filter details.
Copilot AI review requested due to automatic review settings May 17, 2026 18:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standardized metadata sheet to every XLSX export and a metadata page to PDF exports, so each generated file carries a uniform trailer describing the export (generated time, filename, data sheet, applied filters, item count, etc.). Filename generation is also moved earlier in each export endpoint so it can be passed into the metadata helper.

Changes:

  • New add_metadata_sheet and format_export_filters helpers in simple_org_chart/exports.py, plus a _resolve_logo_path utility for embedding the configured logo.
  • All XLSX export paths in app_main.py, data_update.py, and user_scanner_service.py updated to compute the filename earlier and call add_metadata_sheet.
  • PDF export in static/app.js appends a metadata page; static/reports.js adds tagpicker filter rendering for the PDF filter summary; new unit tests in tests/test_exports.py cover format_export_filters.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
simple_org_chart/exports.py Adds add_metadata_sheet, format_export_filters, and _resolve_logo_path helpers and exports them.
simple_org_chart/app_main.py Wires every XLSX export endpoint to compute the filename earlier and append the metadata sheet with per-report filter strings.
simple_org_chart/data_update.py Adds metadata sheet to the org-chart XLSX generator.
simple_org_chart/user_scanner_service.py Adds metadata sheet to the user-scanner full-scan XLSX.
static/app.js Appends a metadata page (logo + key/value rows) to the org-chart PDF export.
static/reports.js Includes tagpicker filters (with include/exclude mode) in the PDF filter summary.
tests/test_exports.py New tests covering format_export_filters behavior across scope, toggles, and tagpicker inputs.

Comment thread simple_org_chart/exports.py Outdated
from datetime import datetime
import os
from datetime import datetime, timezone
from pathlib import Path
Comment thread static/app.js
Comment on lines +4175 to +4182
const metaFields = [
['Generated on', timestamp],
['Format', 'PDF'],
['File name', fileName],
['Data export option', exportFullChart ? 'fullChart' : 'visibleChart'],
['Exported by', ''],
['Generated by', 'Simple Org Chart'],
];
Comment thread simple_org_chart/exports.py Outdated
Comment on lines +100 to +101
('Exported by', exported_by),
]
@dvir001
Copy link
Copy Markdown
Owner Author

dvir001 commented May 18, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

@copilot apply changes based on the comments in this thread

Implemented in commit 9d63792.

I addressed the review thread by:

  • removing the unused Path import in simple_org_chart/exports.py
  • omitting Exported by from XLSX metadata when no value is provided
  • removing the always-blank Exported by row from PDF metadata
  • adding tests to cover the XLSX metadata behavior (tests/test_exports.py)

No visible in-app UI was changed (export metadata content only).

@dvir001 dvir001 merged commit 551213d into main May 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants