def _get_visible_rating_counts(
  scoredNotes: pd.DataFrame, ratings: pd.DataFrame, noteStatusHistory: pd.DataFrame
) -> pd.DataFrame:
  """
  Given scored notes from the algorithm, all ratings, and note status history, this function
  analyzes how succesfully a user rates notes. It aggregates how successfully/unsucessfully
  a notes ratings aligns with a contributors ratings.

  Args:
      scoredNotes (pd.DataFrame): Notes scored from MF + contributor stats
      ratings (pd.DataFrame): all ratings
      statusHistory (pd.DataFrame): history of note statuses
  Returns:
      pd.DataFrame: noteCounts The visible rating counts
  """
  ratingCountRows = [
    c.successfulRatingHelpfulCount,
    c.successfulRatingNotHelpfulCount,
    c.successfulRatingTotal,
    c.unsuccessfulRatingHelpfulCount,
    c.unsuccessfulRatingNotHelpfulCount,
    c.unsuccessfulRatingTotal,
  ]
  validRatings = get_valid_ratings(ratings, noteStatusHistory, scoredNotes)
  ratingCounts = validRatings.groupby(c.raterParticipantIdKey).sum()[ratingCountRows]

  ratingsWithScores = get_ratings_with_scores(ratings, noteStatusHistory, scoredNotes)

  historyCounts = ratingsWithScores.groupby(c.raterParticipantIdKey).sum()[
    [c.awaitingMoreRatingsBoolKey]
  ]
  historyCounts[c.ratingsAwaitingMoreRatings] = historyCounts[c.awaitingMoreRatingsBoolKey]
  ratedAfterDecision = _get_rated_after_decision(ratings, noteStatusHistory)
  historyCounts = historyCounts.merge(
    ratedAfterDecision,
    on=c.raterParticipantIdKey,
    how="left",
    unsafeAllowed=c.ratedAfterDecision,
  )
  # Fill in zero for any rater who didn't rate any notes after status was assigned and consequently
  # doesn't appear in the dataframe.
  historyCounts = historyCounts.fillna({c.ratedAfterDecision: 0})

  ratingCounts = ratingCounts.merge(
    historyCounts, on=c.raterParticipantIdKey, how="outer", unsafeAllowed=set(ratingCountRows)
  )
  for rowName in ratingCountRows:
    ratingCounts[rowName] = ratingCounts[rowName].fillna(0)
  return ratingCounts

  Given scored notes from the algorithm, all ratings, and note status history, this function
  analyzes how succesfully a user rates notes. It aggregates how successfully/unsucessfully
  a notes ratings aligns with a contributors ratings.

  Args:
      scoredNotes (pd.DataFrame): Notes scored from MF + contributor stats
      ratings (pd.DataFrame): all ratings
      statusHistory (pd.DataFrame): history of note statuses
  Returns:
      pd.DataFrame: noteCounts The visible rating counts
  
sourcecode/scoring/contributor_state.py