Skip to content

Commit ad8b0ec

Browse files
authored
Merge pull request #13 from ga4gh/cc-activity-score
Fix for github activity score
2 parents 0c36551 + deb03e8 commit ad8b0ec

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

app/callbacks/github_callbacks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def fig_github_activity_bar(gh_activity_df, color_map=None):
9090
hovertemplate=(
9191
f"Repo: {row['name']}<br>"
9292
f"Activity Score: {row['activity_score']:.4f}<br>"
93-
f"Pushed At: {row['pushed_at_str']}<br>"
94-
f"Last Updated: {row['last_updated_str']}<br>"
93+
#f"Pushed At: {row['pushed_at_str']}<br>"
94+
#f"Last Updated: {row['last_updated_str']}<br>"
9595
"<extra></extra>"
9696
),
9797
)

app/services/github_client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,26 @@ def get_json(endpoint: str, token: Optional[str] = None):
2020
resp.raise_for_status()
2121
return resp.json()
2222

23-
24-
def prepare_github_data(fetch_date="2025-10-01"):
23+
24+
def prepare_github_data():
25+
2526
GA4GH_json = get_json(api_constants.GITHUB_REPOS_API)
2627

2728
gh_df = pd.DataFrame.from_records(GA4GH_json)
28-
29+
fetch_date=gh_df["created_at"].max()
2930

3031
gh_df["last_updated"] = pd.to_datetime(gh_df["last_updated"], utc=True, errors="raise")
3132
gh_df["pushed_at"] = pd.to_datetime(gh_df["pushed_at"], utc=True, errors="raise")
3233
gh_df["created_on"] = pd.to_datetime(gh_df["created_on"], utc=True, errors="raise")
3334

34-
target_date = pd.to_datetime(fetch_date, utc=True)
35+
target_date = pd.to_datetime("today", utc=True)
3536

36-
# Use absolute timedeltas so days-since values are never negative
37-
gh_df["days_since_pushed_at"] = (target_date - gh_df["pushed_at"]).abs().dt.days
38-
gh_df["days_since_last_updated"] = (target_date - gh_df["last_updated"]).abs().dt.days
37+
gh_df["days_since_pushed_at"] = (target_date - gh_df["pushed_at"]).dt.days
38+
gh_df["days_since_last_updated"] = (target_date - gh_df["last_updated"]).dt.days
3939

4040
gh_df["activity_score"] = (
41-
1 / (1 + gh_df["days_since_pushed_at"])
42-
+ 1 / (1 + gh_df["days_since_last_updated"])
41+
(1 / (1 + gh_df["days_since_pushed_at"]))
42+
+ (1 / (1 + gh_df["days_since_last_updated"]))
4343
)
4444

4545
# Top 15 active repos

0 commit comments

Comments
 (0)