pennlabs / penn-courses

Powering Penn Course Review, Penn Course Plan, Penn Course Alert, and Penn Degree Plan
https://penncourses.org
MIT License
39 stars 4 forks source link

Aggregate Instructor Query for Penn Reviews #669

Open AdvitRanawadePenn opened 6 months ago

AdvitRanawadePenn commented 6 months ago

Developed a new endpoint /api/review/instructors/analysis/ to Penn Course Review to query and retrieve a list of top instructors, either within a specified department or across all departments, based on their performance statistics, primarily focusing on maximum average ratings.

The functionality allows users to specify a range between start and end semesters, or defaults to the complete available data set. it filters the Review objects based on optional parameters such as department and semester range, using the previously-built review_averages function to compute statistics and aggregate them with appropriate annotations. The endpoint was also successfully tested through unit tests.

Possible considerations include the performance implications of the initial data retrieval process, which pulls all Review objects before filtering. This could lead to increased runtime or memory usage, particularly with a large dataset, as each query's complexity scales with the number of reviews.