def _prepare_ratings(
    self,
    ratings: pd.DataFrame,
    raterFactors: pd.DataFrame,
    ratingCutoff: pd.DataFrame,
  ) -> pd.DataFrame:
    """Prune add rater factor and prune any ratings occurring after status cutoff.
    Note that the p(flip) model is applied at the time that note would enter the
    NmrDueToMinStableCrhTime waiting period.  Consequently, for all notes scored in
    production there are by definition no ratings available after a status would
    have been shown.  While filtering ratings is only necessary during training,
    there is no risk / effect of filtering ratings in production.

    Args:
      ratings: pd.DataFrame containing all ratings used in scoring
      raterFactors: pd.DataFrame mapping raters to a single factor.
      ratingCutoff: pd.DataFrame specifying rating cutoffs for each note when applicable

    Returns:
      pd.DataFrame filtered to include only ratings before a note is assigned status
        or enters the NmrDueToMinStableCrhTime waiting period and augmented with
        rater factors.
    """
    # Add factors and rating cutoff
    ratings = ratings.merge(raterFactors, how="left")
    ratings = ratings.merge(ratingCutoff, how="left")
    # Add rating cutoff and prune late ratings
    ratings = ratings[
      (ratings[_STATUS_MTS].isna()) | (ratings[c.createdAtMillisKey] < ratings[_STATUS_MTS])
    ]
    # Remove _STATUS_MTS column
    return ratings.drop(columns=_STATUS_MTS)
Prune add rater factor and prune any ratings occurring after status cutoff.
    Note that the p(flip) model is applied at the time that note would enter the
    NmrDueToMinStableCrhTime waiting period.  Consequently, for all notes scored in
    production there are by definition no ratings available after a status would
    have been shown.  While filtering ratings is only necessary during training,
    there is no risk / effect of filtering ratings in production.

    Args:
      ratings: pd.DataFrame containing all ratings used in scoring
      raterFactors: pd.DataFrame mapping raters to a single factor.
      ratingCutoff: pd.DataFrame specifying rating cutoffs for each note when applicable

    Returns:
      pd.DataFrame filtered to include only ratings before a note is assigned status
        or enters the NmrDueToMinStableCrhTime waiting period and augmented with
        rater factors.
    
sourcecode/scoring/pflip_model.py