def score_notes(
    self, noteStats: pd.DataFrame, currentLabels: pd.DataFrame, statusColumn: str
  ) -> Tuple[pd.DataFrame, pd.DataFrame]:
    """Sets Top Tags inplace on noteStats,
    returns notes on track for CRH / CRNH with insufficient to receive NMR status."""
    noteStats[c.firstTagKey] = noteStats[c.firstTagKey].astype(object)
    noteStats[c.secondTagKey] = noteStats[c.secondTagKey].astype(object)

    if self._tagsConsidered is None:
      # Set Top CRH Tags
      crh_idx = noteStats[c.noteIdKey].isin(
        currentLabels.loc[currentLabels[statusColumn] == c.currentlyRatedHelpful, c.noteIdKey]
      )
      topCrhTags = get_top_two_tags_for_note(
        noteStats.loc[crh_idx, :],
        self._minTagsNeededForStatus,
        self._minRatingsToGetTag,
        c.helpfulTagsTiebreakOrder,
      )
      noteStats.set_index(c.noteIdKey, inplace=True)
      noteStats.loc[topCrhTags[c.noteIdKey], c.firstTagKey] = topCrhTags[c.firstTagKey]
      noteStats.loc[topCrhTags[c.noteIdKey], c.secondTagKey] = topCrhTags[c.secondTagKey]
      noteStats.reset_index(inplace=True)

      # Set Top CRNH Tags
      crnh_idx = noteStats[c.noteIdKey].isin(
        currentLabels.loc[currentLabels[statusColumn] == c.currentlyRatedNotHelpful, c.noteIdKey]
      )
      topCrnhTags = get_top_two_tags_for_note(
        noteStats.loc[crnh_idx, :],
        self._minRatingsToGetTag,
        self._minTagsNeededForStatus,
        c.notHelpfulTagsTiebreakOrder,
      )
      noteStats.set_index(c.noteIdKey, inplace=True)
      noteStats.loc[topCrnhTags[c.noteIdKey], c.firstTagKey] = topCrnhTags[c.firstTagKey]
      noteStats.loc[topCrnhTags[c.noteIdKey], c.secondTagKey] = topCrnhTags[c.secondTagKey]
      noteStats.reset_index(inplace=True)
    else:
      topTags = get_top_two_tags_for_note(
        noteStats,
        self._minRatingsToGetTag,
        self._minTagsNeededForStatus,
        self._tagsConsidered,
      )
      noteStats.loc[:, c.firstTagKey] = topTags[c.firstTagKey]
      noteStats.loc[:, c.secondTagKey] = topTags[c.secondTagKey]

    noteStats[c.firstTagKey] = noteStats[c.firstTagKey].astype(object)
    noteStats[c.secondTagKey] = noteStats[c.secondTagKey].astype(object)

    with c.time_block("Insufficient explanation: post-processing"):
      # Prune noteStats to only include CRH / CRNH notes.
      crNotes = currentLabels[
        (currentLabels[statusColumn] == c.currentlyRatedHelpful)
        | (currentLabels[statusColumn] == c.currentlyRatedNotHelpful)
      ][[c.noteIdKey]]
      crStats = noteStats.merge(crNotes, on=c.noteIdKey, how="inner")
      logger.info(
        f"CRH / CRNH notes prior to filtering for insufficient explanation: {len(crStats)}"
      )

      # Identify impacted notes.
      noteStatusUpdates = crStats.loc[
        (~crStats[[c.firstTagKey, c.secondTagKey]].isna()).sum(axis=1)
        < self._minTagsNeededForStatus
      ][[c.noteIdKey]]

      pd.testing.assert_frame_equal(noteStatusUpdates, noteStatusUpdates.drop_duplicates())

      logger.info(f"Total notes impacted by explanation filtering: {len(noteStatusUpdates)}")
      noteStatusUpdates[statusColumn] = self._status

    return (noteStatusUpdates, None)
Sets Top Tags inplace on noteStats,
    returns notes on track for CRH / CRNH with insufficient to receive NMR status.
sourcecode/scoring/scoring_rules.py