Skip to content

FAC-113 feat: scoped program filters for analytics attention endpoint #268

@ayacoders

Description

@ayacoders

Summary

The frontend dean dashboard now includes a Faculty Requiring Attention section powered by:

  • GET /api/v1/analytics/attention

We also want the dashboard to support filtering by:

  • semester
  • program

At the moment, overview already supports programCode, but attention does not, so the dashboard cannot be filtered consistently by program.

Role scope rules

Expected access model:

Dean

  • scoped to their department(s) for the selected semester
  • can view all programs inside those departments

Example:

  • specific campus
  • specific department
  • all programs under that department (BSCS, BSIT, etc.)

Chairperson

  • still within the parent department context
  • but limited to one or more assigned programs only

Example:

  • same department as dean scope
  • only assigned programs such as BSCS
  • or multiple programs if assigned

Requested backend changes

1. Add scoped analytics programs endpoint

Proposed route:

  • GET /api/v1/analytics/programs

Query params:

  • semesterId required

Auth:

  • DEAN
  • CHAIRPERSON
  • SUPER_ADMIN

Response:

Array<{
  id: string;
  code: string;
  name: string | null;
}>

Expected behavior:

  • DEAN: return all programs inside the dean's scoped department(s) for the selected semester
  • CHAIRPERSON: return only assigned/in-scope programs for the selected semester
  • SUPER_ADMIN: unrestricted list is acceptable

2. Extend attention endpoint to support program filter

Existing route:

  • GET /api/v1/analytics/attention

Add optional query param:

  • programCode?: string

Expected behavior:

  • when programCode is provided, return only attention items for that program
  • still enforce caller scope
  • if the requested program is outside caller scope, either return empty results or reject with 403

Either is acceptable as long as behavior is intentional and documented.

Why this is needed

Frontend wants a consistent dean/chairperson dashboard filter model:

  • Semester
  • Program

Current state:

  • GET /analytics/overview supports semesterId + programCode
  • GET /analytics/attention supports only semesterId

Because of that mismatch, the dashboard cannot safely expose a real program filter yet without creating inconsistent sections.

Frontend dependency

Frontend is waiting on:

  1. scoped program options endpoint
  2. programCode support on GET /analytics/attention

Once available, frontend will wire the dashboard filter so both:

  • overview metrics/chart
  • faculty requiring attention

follow the same selected semester and program.

Notes

This should be reusable for both:

  • dean dashboard
  • future chairperson dashboard

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions