def _save_dfs_to_shared_memory(
  scoringArgs: ScoringArgs,
) -> Tuple[List[shared_memory.SharedMemory], c.ScoringArgsSharedMemory]:
  """
  Save large dfs to shared memory. Called before beginning multiprocessing.
  """
  shms: List[shared_memory.SharedMemory] = []
  noteTopics = save_df_to_shared_memory(scoringArgs.noteTopics, shms)
  # Order ratings by highVolumeRaterKey so that later we can split ratings
  # to remove ratings from high volume users without having to make a copy.
  sortedRatings = scoringArgs.ratings.sort_values(c.highVolumeRaterKey, ascending=True)
  ratings = save_df_to_shared_memory(
    keep_columns(
      sortedRatings,
      [
        c.noteIdKey,
        c.raterParticipantIdKey,
        c.helpfulNumKey,
        c.helpfulnessLevelKey,
        c.createdAtMillisKey,
        c.highVolumeRaterKey,
      ]
      + c.notHelpfulTagsTSVOrder
      + c.helpfulTagsTSVOrder,
    ),
    shms,
  )
  noteStatusHistory = save_df_to_shared_memory(scoringArgs.noteStatusHistory, shms)
  userEnrollment = save_df_to_shared_memory(scoringArgs.userEnrollment, shms)

  if type(scoringArgs) == FinalScoringArgs:
    prescoringNoteModelOutput = save_df_to_shared_memory(
      scoringArgs.prescoringNoteModelOutput, shms
    )
    prescoringRaterModelOutput = save_df_to_shared_memory(
      scoringArgs.prescoringRaterModelOutput, shms
    )
    return shms, c.FinalScoringArgsSharedMemory(
      noteTopics,
      ratings,
      noteStatusHistory,
      userEnrollment,
      prescoringNoteModelOutput,
      prescoringRaterModelOutput,
    )
  else:
    return shms, c.PrescoringArgsSharedMemory(
      noteTopics, ratings, noteStatusHistory, userEnrollment
    )

  Save large dfs to shared memory. Called before beginning multiprocessing.
  
sourcecode/scoring/run_scoring.py