def update_note_status_history(
  mergedStatuses: pd.DataFrame,
  newScoredNotesSuffix: str = "_sn",
) -> pd.DataFrame:
  """Generate new noteStatusHistory by merging in new note labels."""
  if c.useCurrentTimeInsteadOfEpochMillisForNoteStatusHistory:
    # When running in prod, we use the latest time possible, so as to include as many valid ratings
    # as possible, and be closest to the time the new note statuses are user-visible.
    currentTimeMillis = 1000 * time.time()
  else:
    # When running in test, we use the overridable epochMillis constant.
    currentTimeMillis = c.epochMillis

  def apply_update(mergedNote):
    return _update_single_note_status_history(
      mergedNote, currentTimeMillis=currentTimeMillis, newScoredNotesSuffix=newScoredNotesSuffix
    )

  newNoteStatusHistory = mergedStatuses.apply(apply_update, axis=1)

  assert pd.isna(newNoteStatusHistory[c.noteAuthorParticipantIdKey]).sum() == 0
  assert pd.isna(newNoteStatusHistory[c.createdAtMillisKey]).sum() == 0
  return newNoteStatusHistory[c.noteStatusHistoryTSVColumns]
Generate new noteStatusHistory by merging in new note labels.
sourcecode/scoring/note_status_history.py