Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement GitHub User Activity Predictions #19

Open
TheCarBun opened this issue Feb 7, 2025 · 1 comment
Open

Implement GitHub User Activity Predictions #19

TheCarBun opened this issue Feb 7, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@TheCarBun
Copy link
Owner

Implement GitHub User Activity Predictions

We need to implement a set of Python functions to analyze and predict GitHub user activity based on their historical data. These functions will use metrics such as total contributions, active days, account creation date, and current year activity to make predictions about the user’s future behavior, consistency, and milestones.

This feature will help us:

  • Predict future contributions and active days.
  • Identify trends in user activity (e.g., increasing or decreasing).
  • Estimate milestone achievement (e.g., 10,000 contributions).
  • Measure user consistency and productivity.

Acceptance Criteria

The following functions must be implemented and tested:

  1. predict_long_term_activity

    • Input: total_contributions, github_days, current_year_contributions, active_days
    • Output: Lifetime and current daily contribution rates, and trend (increasing/decreasing).
  2. predict_future_active_days

    • Input: active_days, github_days, remaining_days
    • Output: Predicted number of active days for the rest of the year.
  3. predict_burnout

    • Input: active_days_by_year (list of active days per year)
    • Output: Trend analysis (e.g., "Activity is decreasing").
  4. predict_consistency

    • Input: active_days, github_days
    • Output: Consistency score and classification (e.g., "Sporadic contributor").
  5. predict_account_longevity

    • Input: active_days_by_year
    • Output: Estimated time until activity ceases (e.g., "Account activity may cease in ~2 years").
  6. predict_effective_rate

    • Input: total_contributions, active_days, github_days
    • Output: Effective contribution rate (weighted by activity frequency).
  7. predict_milestone

    • Input: current_contributions, milestone, lifetime_rate
    • Output: Days required to reach the milestone.
  8. run_all_predictions

    • Input: user_data (dictionary with all required fields)
    • Output: Dictionary containing all predictions.

Steps to Implement

  1. Create a new Python file (e.g., github_predictions.py).
  2. Implement the functions as described above.
  3. Write unit tests for each function to ensure accuracy.
  4. Add documentation (docstrings) for each function.
  5. Provide an example usage script to demonstrate how the functions work.

Example Input

user_data = {
    "created_at": "2015-01-01",  # Account creation date
    "active_days": 200,          # Total active days since account creation
    "total_contributions": 5000, # Total contributions (commits, PRs, issues, etc.)
    "current_year_contributions": 115,  # Contributions this year
    "current_year_active_days": 37,     # Active days this year
    "active_days_by_year": [150, 100, 50],  # Active days per year (e.g., last 3 years)
    "milestone": 10000  # Optional: Milestone to predict (e.g., 10,000 contributions)
}

Example Output

{
    "long_term_activity": {
        "lifetime_rate": 1.37,
        "current_rate": 3.11,
        "trend": "increasing"
    },
    "future_active_days": 65.6,
    "burnout": "Activity is decreasing.",
    "consistency": "Sporadic contributor.",
    "account_longevity": "Account activity may cease in ~2.0 years.",
    "effective_rate": 1.37,
    "milestone": 3650.0
}

Additional Context

  • The functions should be modular and reusable.
  • Use Python’s datetime module for date calculations.
  • Include error handling for edge cases (e.g., missing data).
  • Add comments and docstrings to explain the logic and inputs/outputs.

Testing

  • Write unit tests for each function using pytest or unittest.
  • Test edge cases (e.g., zero active days, missing data).
  • Ensure the functions handle invalid inputs gracefully.
@TheCarBun TheCarBun added the enhancement New feature or request label Feb 7, 2025
@pakagronglb
Copy link
Contributor

Would you mind if i try and tackle this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants