def score_notes(
    self, noteStats: pd.DataFrame, currentLabels: pd.DataFrame, statusColumn: str
  ) -> Tuple[pd.DataFrame, Optional[pd.DataFrame]]:
    """Flip notes from CRH to NMR based on the topic model results."""
    # Identify notes which are currently CRH or NYH.
    currentCRHNotes = currentLabels[
      currentLabels[statusColumn].isin({c.currentlyRatedHelpful, c.needsYourHelp})
    ][[c.noteIdKey]]
    # Identify notes which are below threshld from the applicable topic model.
    topicLowNotes = noteStats[
      (
        (noteStats[c.topicNoteInterceptKey] < self._topicNMRInterceptThreshold)
        | (noteStats[c.topicNoteFactor1Key].abs() > self._topicNMRFactorThreshold)
      )
      & (noteStats[c.topicNoteConfidentKey])
      & (noteStats[c.noteTopicKey] == self._topic.name)
    ][[c.noteIdKey]]
    # Set note status for candidates and return
    noteStatusUpdates = currentCRHNotes.merge(topicLowNotes, on=c.noteIdKey, how="inner")
    noteStatusUpdates[statusColumn] = c.needsMoreRatings

    return (noteStatusUpdates, None)
Flip notes from CRH to NMR based on the topic model results.
sourcecode/scoring/scoring_rules.py