def coalesce_topic_models(scoredNotes: pd.DataFrame) -> pd.DataFrame:
  """Coalesce all topic modeling columns across note and user scoring.

  Since each Scorer must have distinct output columns, we use coalescing to run
  multiple instances of MFTopicScorer objects and then condense the results into
  a single set of columns.  This approach works because each note will be scored
  by at most one MFTopicScorer instance.

  Args:
    scoredNotes: scoring output for notes.

  Returns:
    tuple containing coalesced scoring results for notes and users.
  """
  for col in [
    c.topicNoteInterceptKey,
    c.topicNoteFactor1Key,
    c.topicRatingStatusKey,
    c.topicNoteConfidentKey,
    c.noteTopicKey,
    c.topicInternalActiveRulesKey,
    c.topicNumFinalRoundRatingsKey,
    c.topicNoteInterceptNoHighVolKey,
  ]:
    scoredNotes = coalesce_columns(scoredNotes, col)

  return scoredNotes
Coalesce all topic modeling columns across note and user scoring.

  Since each Scorer must have distinct output columns, we use coalescing to run
  multiple instances of MFTopicScorer objects and then condense the results into
  a single set of columns.  This approach works because each note will be scored
  by at most one MFTopicScorer instance.

  Args:
    scoredNotes: scoring output for notes.

  Returns:
    tuple containing coalesced scoring results for notes and users.
  
sourcecode/scoring/mf_topic_scorer.py