CSC/ECE 517 Fall 2024 - G2401 Refactor Graphql API endpoint for contribution metrics
Expertiza
Expertiza is an open-source project built using Ruby on Rails. It provides a platform for instructors and students to manage, submit, and evaluate assignments and projects. Instructors can create, edit, and grade assignments, while students can collaborate in teams, submit their work, and review peers' submissions. Expertiza supports submission across various document types, including URLs and wiki pages.
Project Description
Refactor the GraphQL API endpoint for contribution metrics by
- replacing hard-coded variables with reusable constants
- implementing and publishing GraphQL queries as Flask endpoints so that the queries can be sent to the GitHub GraphQL API using a URL.
Key Objectives
API Endpoint Development:
- Integrate existing code with Flask to expose GraphQL queries as API endpoints.
Testing and Validation:
- Conduct thorough testing (unit tests and integration tests) to verify the correctness and reliability of the implemented endpoints.
- Validate API functionality across different scenarios to ensure robustness and reliability.
Implementation
Each query was refactored by replacing hard-coded variables with new constants defined in Constants
/comments
- user_commit_comments Git commit
- user_gist_comments Git commit
- user_issue_comments Git commit
- user_repository_discussion_comments Git commit
/contributions
- user_gists Git commit
- user_issues Git commit
- user_pull_requests Git commit
/time_range_contributions
- user_contributions_collection Git commit
Constants
Field constants, node constants, and argument constants were all added to the codebase for reusability. Many of the GraphQL queries reference these variables multiple times. Github commit
Field Constants
Node Constants
Argument Constants
Design Pattern and Strategy
Our main goal is to help present the user's activities on GitHub which includes comments, contributions, time range contributions and profiles.
Frontend GUI (React):
- Implement an interactive UI for the users to display the information related to GitHub activities.
- To build a clean and robust frontend design to make it visually appealing.
Backend (Flask):
- Integrate Flask API endpoints to fetch the data which includes user's comments, contributions, time range contributions and profiles on Github.
- Integrate and implement a GitHub token-based login feature to access the information.
Workflow:
- The backend system will fetch the data of the user's GitHub activities.
- It will pass this information to frontend which is fetched by React.
- After fetching the details from the backend system, it will display it in the form of UI.
Workflow Diagrams
Phase 1:
Phase 2:
Frontend screenshots
Home page
Upload csv feature
User Profile
User Gists
User Issue Comments
User Gist Comments
User Contributions
Phase 1 vs Phase 2: Key Differences
Objective
- Phase 1
- Develop a backend service using Flask to interact with the GitHub GraphQL API.
- Phase 2
- Refactor the backend code to improve maintainability by using constants and develop a frontend using React.
Backend Queries
- Phase 1
- Use hard-coded strings for field names, node names, and arguments.
- Phase 2
- Replace hard-coded strings with reusable constants for fields, nodes, and arguments.
API Endpoints
- Phase 1
- Implement API endpoints for `/comments`, `/contributions`, `/profiles`, and `/time_range_contributions`.
- Phase 2
- Enhance endpoints with better code readability by using pre-defined constants.
Frontend
- Phase 1
- No frontend implementation.
- Phase 2
- Develop a React-based frontend that allows users to interact with the GitHub GraphQL API.
Bulk Querying
- Phase 1
- No support for bulk querying of usernames.
- Phase 2
- Implement a feature that allows users to upload a CSV containing GitHub usernames and retrieves their contribution metrics.
Testing
- Phase 1
- Perform unit and integration tests for Flask endpoints.
- Phase 2
- Expand tests to include the refactored backend and React frontend functionality.
Deliverables
- Phase 1
- Deliver a functional backend that can query the GitHub GraphQL API.
- Phase 2
- Deliver a refactored backend, React frontend, and CSV bulk query feature for GitHub metrics.
Flask API Endpoints
/comments
/contributions
/profiles
/time_range_contributions
Testing
/time range contributions
/comments
Team
Mentor:
Jialin Cui
Team Members:
Anjan Jagadishbhai Diyora
Vighnesh Hegde
Kaylie Naylor
Github Repository
Original: https://github.ncsu.edu/jcui9/GitHub_Miner
Forked: https://github.ncsu.edu/vshegde2/GitHub_Miner
Pull Request 1: https://github.ncsu.edu/vshegde2/GitHub_Miner/pull/8
Pull Request 2: https://github.ncsu.edu/vshegde2/GitHub_Miner/pull/11