Improve reports 2#77
Merged
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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_sheetandformat_export_filtershelpers insimple_org_chart/exports.py, plus a_resolve_logo_pathutility for embedding the configured logo. - All XLSX export paths in
app_main.py,data_update.py, anduser_scanner_service.pyupdated to compute the filename earlier and calladd_metadata_sheet. - PDF export in
static/app.jsappends a metadata page;static/reports.jsadds tagpicker filter rendering for the PDF filter summary; new unit tests intests/test_exports.pycoverformat_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. |
| from datetime import datetime | ||
| import os | ||
| from datetime import datetime, timezone | ||
| from pathlib import Path |
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 on lines
+100
to
+101
| ('Exported by', exported_by), | ||
| ] |
Owner
Author
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/dvir001/Simple-Org-Chart/sessions/b7cde0bc-e4e0-4963-bb03-3bc6f6f63aa2 Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
Contributor
Implemented in commit I addressed the review thread by:
No visible in-app UI was changed (export metadata content only). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_sheetfunction toexports.pythat 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_filtershelper 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
Refactoring and code cleanup
UI improvements
These changes ensure that all data exports are more transparent, auditable, and user-friendly, with consistent metadata for downstream consumers.