feat(analytics): wire Province and Sector filters on Skills Analytics dashboard#191
Open
wilfredeveloper wants to merge 2 commits into
Open
feat(analytics): wire Province and Sector filters on Skills Analytics dashboard#191wilfredeveloper wants to merge 2 commits into
wilfredeveloper wants to merge 2 commits into
Conversation
… dashboard Connects the previously-inert Province and Sector dropdowns in the SkillsAnalytics admin component to actual API params on both the frontend and backend. Frontend: - SkillsAnalytics.tsx: adds province/sector useState; populates dropdowns from MODULE_FILTER_LOCATIONS and new MODULE_FILTER_SECTORS; wires onChange - useSkillGapStats / useSkillsSupplyStats: accept province and sector params; both added to useEffect dependency array so charts refetch on change - AnalyticsService: appends province and sector to URLSearchParams for both skill-gap-stats and skills-supply-stats endpoints - moduleFilterOptions.ts: adds MODULE_FILTER_SECTORS (Agriculture, Energy, Hospitality, Mining, Water) Backend: - analytics/user_filter.py (new): shared helpers for resolving user_id sets by institution, province, and sector; sector resolution uses in-memory TEVETA data (priority_sectors) to map hub names to programme names, then matches against PLAIN_PERSONAL_DATA.data.programme_name - skill_gap/routes.py + skills_supply/routes.py: add province and sector Query params; intersect all active filter sets before scoping aggregation; province filter is admin-only (ignored for institution staff) Tooling: - scripts/seed_analytics_test_data.py: seeds 6 test users across all 5 sectors and 4 provinces for manual filter verification; run with --cleanup to remove CORE-355
Collaborator
|
@wilfredeveloper there are conflicts that need to be resolved before we can merge this, please rebase this branch on main? |
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.
Jira
https://tabiya-tech.atlassian.net/browse/CORE-355
Summary
value="", noonChange, no options). This PR wires them end-to-end.PLAIN_PERSONAL_DATA.data.programme_name.Changes
Frontend (
admin-frontend/)moduleFilterOptions.ts— addsMODULE_FILTER_SECTORS(5 TEVETA sectors)SkillsAnalytics.tsx— addsprovince/sectorstate; populates and wires both dropdownsuseSkillGapStats/useSkillsSupplyStats— acceptprovinceandsector; added touseEffectdep arrayAnalyticsService.ts— appendsprovinceandsectorto URL params for both endpointsBackend (
backend/)analytics/user_filter.py(new) — shared helpers:resolve_user_ids_for_institution,resolve_user_ids_for_province,resolve_user_ids_for_sector,intersect_user_id_setsanalytics/skill_gap/routes.py— addsprovinceandsectorQuery params; intersection logicanalytics/skills_supply/routes.py— sameTooling
scripts/seed_analytics_test_data.py(new) — seeds 6 test users for manual filter verificationTest plan
Automated
Manual (on dev with the seed script)
Seed test data:
cd backend poetry run python scripts/seed_analytics_test_data.pyThis seeds 6 users across all 5 sectors and 4 provinces. Expected results:
Cleanup when done:
Edge cases verified