CSC/ECE 517 Fall 2021 - E2149. Finish Github metrics integration - Reputations

From Expertiza_Wiki
Revision as of 22:35, 8 November 2021 by Mguo6 (talk | contribs)
Jump to navigation Jump to search

Abstract

Expertiza provides teammate reviews to measure how much each team member contributed. It also augments this data with Github data of each group’s submitted repo link to help differentiate the performance of team members for grading purposes and predict which projects are likely to be merged. Instructors would like to compile this Github repository statistics on a per-project, per-team basis, and integrate the display of these data within Expertiza. The project team will troubleshoot existing code and add new features.

Problem Statement

The functionality of the showing GitHub metrics cannot in the assignment be turned off, meaning that an instructor who uses Expertiza for writing assignments in an English course would get a Github metrics report. There needs to be a way to turn the report off for a particular assignment. The project doesn't report lines added and deleted because of a lack of support from the API. It adds quite a lot of lines of code for a single project. The tests of the current project are not described very thoroughly. We will run the existing RSpec test code and add some new tests.

Methodology

The team has synced the revised 2021 Spring project E2111 code with the current status of the Expertiza/beta branch and has begun analyzing the existing code. Prior customer feedback has advised the team to address inextensibility/coupling issues, documentation issues, and synchronization issues. We are performing our own end-to-end analysis of the code in addition to this feedback, and have so far found numerous action items. We have separated these action items into Primary and Secondary objectives: Primary objectives are "must-haves" that need to be addressed before the existing code is mergeable. Secondary objectives are "nice-to-haves," or features that were either left out of the original project or would make the integration display more complete.

Design Patterns

To achieve the Primary Objectives while making the application more extensible, the team proposes using a more strict implementation of the Adapter design pattern to decouple the details of the Github API from the proposed Metrics model. Elements of the Observer design pattern will also come into play to ensure that once we queried Github data and an assignment has come to a close, the Metric for that Assignment would be unsubscribed from the Github API. This would further decouple the dependency on API data while retaining the data for future statistical analysis and/or research studies.

Team Action Items

Adding turn on and turn down option

The functionality of the current project cannot be turned off. We will provide an option for instructors not to query Github metrics data before they post the assignment, which is the way we turn the GitHub report off for a particular assignment.

Database Modification

In order to determine whether the GitHub report of the assignment is turned on or turned off, we need to create a new table named "use_github_metric" to save the id of the assignment which turns on GitHub metric.

Table: use_github_metric

id(PK) Assignment_id(FK)
1 1
2 15

Frontend Modification

If a user chose not to include the GitHub metric in the assignment (the functionality is turned off), the frontend page should not occur the icon named "Login to Query of Github data" should not be displayed.

Testing

See the details in Test Plan.

Functionality Walk Through

Assignment edit page view

This view is where an instructor can customize an assignment. We will provide an option for instructors to decide whether they need Github metrics in the assignment or not.

Before we modified this part, this page is as following:

After modifying it, this page is:

List Submissions View: with Github metrics option

This is how a user will view List Submissions when they chose Github metrics in the previous assignment edit page and are not yet authenticated to Github. The Login link redirects to an omniauth login screen, which redirects back to this page.



List Submissions View: without Github metrics option

This is how a user will view List Submissions when they did not choose Github metrics in the previous assignment edit page. The Login link for querying Github data would not be provided to the instructors if they don't choose "use github metric" option.

Final Design UML

We show the UML for the new classes and model we created and implemented in our final project for a overview. Other than these, we also modified some of the existing classes and method, we will give detailed introduction later.

OminiAuth Github API update

GitHub no longer supports authentication through query parameters. Thus, we move the authentication in the header. Starting on September 8 2021, using access_token as a query parameter to access the API (as a user or as a GitHub App) or using client_id/client_secret to make OAuth app unauthenticated calls are disabled.

Using access_token as a query param

Originally, the code makes an API

curl "https://api.github.com/user/repos?access_token=my_access_token"

Instead, we send the token in the header:

curl -H 'Authorization: token my_access_token' https://api.github.com/user/repos

Using client_id/client_secret as a query param

Originally, the code uses an OAuth app's client_id and client_secret to make unauthenticated calls with a higher rate limit similar to

curl "https://api.github.com/user/repos?client_id=my_client_id&client_secret=my_secret_id"

Instead, we use the following format:

curl -u my_client_id:my_client_secret https://api.github.com/user/repos

Test Plan

UI Testing

Our UI tests aim to capture the following core pieces of functionality:

Turn on and turn down functionality button:

In order to test the functionality manually, we follow the following steps:

1. Log in to Expertiza as an instructor
2. Navigate to assignments through Manage
3. Show a turn on/turn down button on the page
4. Click the button to turn the Github metrics report off for a particular assignment
5. The page should not display "Login to Query of Github data", "Refresh Github data" and "Assign grade Github metrics" options.

Reduce report lines added and deleted:

Rspec

Resources

Key Links

Github API Documentation

Deprecating API authentication through query parameters

Previous Project References

Original E1858 Documentation

E1983 Revision Documentation

E2111 Project Refactoring