Skip to content

Development: Implement CQI calculation components for team collaboration analysis#37

Closed
SindiBuklaji wants to merge 28 commits intomainfrom
feature/cqi-calculation
Closed

Development: Implement CQI calculation components for team collaboration analysis#37
SindiBuklaji wants to merge 28 commits intomainfrom
feature/cqi-calculation

Conversation

@SindiBuklaji
Copy link
Copy Markdown
Collaborator

@SindiBuklaji SindiBuklaji commented Nov 28, 2025

Checklist

General

  • I tested all changes and their related features with all corresponding user types.

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • I documented the React code.

Motivation and Context

This PR implements the core calculation components for the Collaboration Quality Index (CQI) system. The CQI is a key feature of Harmonia that provides instructors with quantifiable metrics to assess team collaboration quality based on Git repository analysis.

Description

This PR introduces two essential CQI calculation services that analyze different aspects of team collaboration:

ContributionBalanceCalculator:

  • Calculates contribution balance score (0-100) based on commit distribution among team members
  • Uses standard deviation formula: 100 * (1 - stdev(commit_frequency) / max_stdev)
  • Applies 10% penalty when any member contributes >70% of commits
  • Handles edge cases: single contributors, empty data, perfect balance scenarios

PairingSignalsCalculator:

  • Calculates pairing signals score (0-100) based on collaboration patterns
  • Analyzes alternation rate (team members alternating work on same files)
  • Analyzes co-editing rate (multiple authors editing same files within 10-minute window)
  • Applies 50% penalty when thresholds not met (alternation <30% or co-editing <15%)

Key Features:

  • Comprehensive unit tests with mock data covering all scenarios
  • Proper error handling and logging
  • Performance-optimized algorithms
  • Complete JavaDoc documentation
  • Follows Spring service architecture patterns

Files Added:

  • ContributionBalanceCalculator.java - Core balance calculation logic
  • PairingSignalsCalculator.java - Collaboration pattern analysis
  • ContributionBalanceCalculatorTest.java - Comprehensive test coverage
  • PairingSignalsCalculatorTest.java - Comprehensive test coverage

Steps for Testing

Prerequisites:

  • Java 25 installed
  • Docker running for database
  • Gradle build environment

Review Progress

  1. Build project: ./gradlew clean build
  2. Run tests: ./gradlew test
  3. Verify code quality: ./gradlew checkstyleMain

Code Review

  • Code Review 1: Verify calculation algorithms match CQI specification
  • Code Review 2: Confirm proper handling of edge cases and error scenarios
  • Code Review 3: Check JavaDoc completeness and code style compliance

Manual Tests

  • Test 1: Perfect balance scenario - should return score of 100
  • Test 2: Over-contributor scenario - should apply 10% penalty
  • Test 3: No collaboration scenario - should return score of 0
  • Test 4: Threshold penalties - should apply 50% penalty for poor pairing

Test Coverage

Comprehensive unit test coverage includes:

  • ContributionBalanceCalculator: 7 test cases covering perfect balance, imbalance scenarios, penalties, edge cases
  • PairingSignalsCalculator: 8 test cases covering collaboration patterns, thresholds, time windows, edge cases
  • All tests use mock data to simulate realistic team collaboration scenarios
  • Edge cases: empty data, single contributors, extreme imbalances, time boundary conditions

Screenshots

N/A - Backend service implementation with no UI components.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@SindiBuklaji SindiBuklaji changed the title Feature/cqi calculation ´Development´: Implement CQI calculation components for team collaboration analysis Dec 4, 2025
@SindiBuklaji SindiBuklaji changed the title ´Development´: Implement CQI calculation components for team collaboration analysis Development: Implement CQI calculation components for team collaboration analysis Dec 4, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 OpenAPI spec and client code auto-updated and committed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

Predixx and others added 11 commits December 18, 2025 19:03
- Add analyzeRepository method to GitContributionAnalysisService for streamlined contribution analysis.
- Implement loadBasicTeamDataStream for real-time team data fetching in Teams component.
- Update RequestService to clear database before saving results and improve repository processing.
- Introduce StreamResource for SSE streaming of repository analysis results.
- Adjust tests to accommodate new method signatures and functionality.
…: add test logging and modify repository IDs in tests
…r obsolete directories to streamline the project structure.
- Add cqi: Double field to represent collaboration quality index
- Add isSuspicious: Boolean field to flag unusual team activity
- Update DTO to include server-calculated team quality metrics
- Inject ContributionBalanceCalculator dependency
- Calculate CQI for each team using contribution balance scores
- Update ClientResponseDTO to include cqi and isSuspicious values
- Pass calculated metrics to client via streaming and database APIs
- Expose new GET /api/requestResource/getData endpoint
- Retrieve pre-analyzed team data from database without re-analysis
- Provides fallback for loading cached team metrics
- Accept exerciseId parameter to lookup exercise-specific git repo path
- Support multiple exercises with different repository configurations
- Read gitRepoPath from HarmoniaProperties based on exerciseId
- Pass gitRepoPath as parameter instead of reading from config
- Support exercise-specific repository storage paths
- Improve flexibility for multi-exercise scenarios
sindiibb and others added 8 commits December 18, 2025 22:01
- Add detailed VCS access log debugging information
- Log action types and sample entries for troubleshooting
- Improve error messages with participation context
- Remove exerciseId and gitRepoPath from global Artemis config
- These are now exercise-specific in harmonia.projects config
- Simplifies configuration management for multiple exercises
- Add cqi property for collaboration quality index
- Add isSuspicious property for team anomaly detection
- Regenerated from OpenAPI schema
- Add getData() method to RequestResourceApi client
- Support retrieving cached team data from server
- Regenerated from updated OpenAPI schema
- Add team caching to ensure consistent metrics across views
- Transform ComplexTeamData using server-provided CQI values
- Remove client-side CQI recalculation, use server as source-of-truth
- Update stream handler to emit ComplexTeamData with full metrics
- Add teamCache to prevent duplicate transformations
- Update terminology: backend  server in comments
- Add useQuery hook to cache teams per exercise with infinite staleTime
- Prevent unnecessary re-fetching when navigating back
- Check cache before initiating SSE stream
- Update React Query cache in real-time as teams stream in
- Invalidate cache only on explicit reanalysis request
- Pass team object via route state from Teams page
- Eliminate redundant API call that fetches fresh data
- Ensures CQI metrics are consistent between list and detail views
- Simplify component by removing useQuery and loading states
@github-actions
Copy link
Copy Markdown
Contributor

🤖 OpenAPI spec and client code auto-updated and committed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@Predixx Predixx deleted the feature/cqi-calculation branch January 19, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants