Skip to content

Improve reports#73

Merged
dvir001 merged 6 commits into
mainfrom
2026-05-16-Reports
May 16, 2026
Merged

Improve reports#73
dvir001 merged 6 commits into
mainfrom
2026-05-16-Reports

Conversation

@dvir001
Copy link
Copy Markdown
Owner

@dvir001 dvir001 commented May 16, 2026

This pull request enhances the reporting and filtering capabilities of the simple_org_chart application by introducing new API endpoints for missing photo reports, adding flexible tag-based filtering, and standardizing filter argument parsing across multiple report endpoints. It also improves the metadata API and introduces a scope filter to limit results to org chart employees when needed.

New features:

  • Added API endpoints to generate and export "missing photo" reports, including filtering and XLSX export functionality. (get_missing_photo_report, export_missing_photo_report, MISSING_PHOTO_FILE, load_missing_photo_data, apply_missing_photo_filters) [1] [2]
  • Introduced tagpicker filtering (by title, department, country) for all major report endpoints, allowing users to include or exclude records based on these fields. (apply_tagpicker_filters, _parse_tagpicker_args, usage in all report endpoints) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Improvements to filtering and API consistency:

  • Standardized parsing of filter toggles across endpoints using _parse_standard_toggle_args, simplifying filter handling and making filter application more consistent. [1] [2] [3] [4]
  • Added a scope parameter to multiple endpoints, allowing users to restrict results to org chart employees or include all records. (_apply_scope_filter, usage in all report endpoints) [1] [2] [3] [4] [5] [6] [7]

Metadata and auxiliary improvements:

  • The metadata API now includes a list of countries, supporting improved filtering and UI options. (get_metadata_options)

These changes provide users with more powerful and flexible ways to generate, filter, and export organizational reports, while also making the codebase easier to maintain and extend.

Introduce a missing-photo report (API + XLSX export) and support for tagpicker (title/department/country) and scope (orgChart/all) filters across reports and the user scanner. Key changes: add MISSING_PHOTO_FILE config, msgraph.batch_check_photos to detect users with profile photos, data_update now builds missing_photo_records.json and collects recently-hired from all users, reports module gains load/apply helpers (apply_missing_photo_filters, apply_tagpicker_filters) and new load_missing_photo_data. app_main: new endpoints for missing-photo, unified parsing helpers (_parse_tagpicker_args, _parse_standard_toggle_args, _apply_scope_filter), and propagate scope/tagpicker handling to many report endpoints and the full user scanner. UI: update i18n strings, add tagpicker/scope UI and CSS rules, refactor reports.js filter construction and change default report. Also include country in record payloads and table columns where applicable.
Copilot AI review requested due to automatic review settings May 16, 2026 15:08
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

This PR expands the admin reports area with missing-photo reporting, broader scope/tag filtering, and related backend/frontend support for country metadata and scanner filtering.

Changes:

  • Adds missing-photo cache generation, API/report/export support, and UI/report configuration.
  • Introduces reusable scope, toggle, and tagpicker filters across reports and scanner full scans.
  • Updates metadata, localization, styling, and Graph data collection to support country/photo filtering.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
templates/reports.html Updates report selector options, filter toolbar placement, and scanner tab defaults.
static/reports.js Adds missing-photo config, shared filter definitions, tagpicker UI, retry handling, and scanner filter integration.
static/reports.css Styles new tagpicker filter rows and adjusts scanner/report spacing.
static/locales/en-US.json Adds/updates report labels, missing-photo strings, scope/tagpicker labels, and country column text.
simple_org_chart/reports.py Adds missing-photo cache loading and tagpicker/missing-photo filter helpers.
simple_org_chart/msgraph.py Adds country to login records and introduces Graph batch photo checking.
simple_org_chart/hierarchy.py Carries country into flattened hierarchy records.
simple_org_chart/data_update.py Generates missing-photo and all-user recently-hired caches during data sync.
simple_org_chart/config.py Adds the missing-photo cache file path.
simple_org_chart/app_main.py Adds missing-photo endpoints, metadata countries, scope/tagpicker parsing, and applies filters across reports/scanner APIs.
Comments suppressed due to low confidence (2)

simple_org_chart/app_main.py:2477

  • The export path has the same default-scope mismatch as the JSON endpoint: without an explicit scope=all, _apply_scope_filter removes filtered users that are not in the org-chart employee cache, so direct export links/API calls can produce an incomplete workbook. Use all as the default here to keep the filtered-users report/export consistent.
        scope = request.args.get('scope', 'orgChart')

static/reports.js:1958

  • The full-scan request body uses the same comma-delimited serialization for tagpicker values, so a selected title/department/country containing a comma is split into multiple filters by the backend and the scan population is filtered incorrectly. Send the selected values as arrays (or otherwise encode them losslessly) and parse that shape on the server.
                    base[paramName] = tagVal.values.join(',');
                    base[filter.modeQueryParam] = tagVal.mode || 'exclude';

Comment thread simple_org_chart/app_main.py Outdated
Comment thread simple_org_chart/msgraph.py Outdated
Comment thread static/reports.js Outdated
Comment thread static/reports.js Outdated
@dvir001
Copy link
Copy Markdown
Owner Author

dvir001 commented May 16, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented May 16, 2026

@copilot apply changes based on the comments in this thread

Implemented all requested fixes in commit a040749.

Screenshot: /tmp/reports-ui-change.png

This includes: filtered-users default scope corrected to all, missing-photo batch handling now only treats explicit 404 as missing (and aborts on other statuses), tagpicker filters now round-trip comma-containing values safely, and the remove-tag aria-label is now localized via i18n.

…and missing-photo classification

Agent-Logs-Url: https://github.com/dvir001/Simple-Org-Chart/sessions/6b4eb369-5649-4d3a-a178-97cc2abea538

Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
dvir001 added 2 commits May 16, 2026 19:46
Delete data/.scheduler.lock and data/data_update_status.json to clear a stale scheduler lock and the last update status (which contained an "Access token retrieval failed" error). This cleans up state so the scheduler/update process won't remain stuck on the previous failure.
@dvir001 dvir001 merged commit ae53e82 into main May 16, 2026
6 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