class_docstr: Class to compile results from static turn annotations.
  
  Change PROBLEM_BUCKETS in task_config/annotations_config.json to be the buckets that
  you are asking crowdsource workers to annotate with.
  
  NOTE this script directly accesses Mephisto files rather than using the DataBrowser.
  This makes it fragile and not a great example for extension. It is a good candidate
  for refactor.
class_docstr_tok: ["Class","to","compile","results","from","static","turn","annotations",".","Change","PROBLEM_BUCKETS","in","task_config\/annotations_config.json","to","be","the","buckets","that","you","are","asking","crowdsource","workers","to","annotate","with",".","NOTE","this","script","directly","accesses","Mephisto","files","rather","than","using","the","DataBrowser",".","This","makes","it","fragile","and","not","a","great","example","for","extension",".","It","is","a","good","candidate","for","refactor","."]
docstr: Get all the individual folders with data from the <task_run_id> path we are
  given as input.
  
  In Mephisto the structure is:
  /<project_id>/<task_run_id>/<assignment_id>/<agent_id>/
  
  Side note: assignment_id == HIT ID
docstr_tok: ["Get","all","the","individual","folders","with","data","from","the","<","task_run_id",">","path","we","are","given","as","input",".","In","Mephisto","the","structure","is",":","\/","<","project_id",">","\/","<","task_run_id",">","\/","<","assignment_id",">","\/","<","agent_id",">","\/","Side","note",":","assignment_id","==","HIT","ID"]
code: def get_data_paths_mephisto(self, task_run_id_folder):
      """
      Get all the individual folders with data from the <task_run_id> path we are
      given as input.
  
      In Mephisto the structure is:
      /<project_id>/<task_run_id>/<assignment_id>/<agent_id>/
  
      Side note: assignment_id == HIT ID
      """
      # TODO: replace direct folder access with a call to
      #  mephisto.tools.data_browser.DataBrowser
      read_folders = []
      for assignment_id in os.listdir(task_run_id_folder):
          if assignment_id in [
              "onboarding",
              "reservations",
              "build",
              ".",
              "..",
          ]:
              continue
          assignment_folder = os.path.join(
              task_run_id_folder, assignment_id
          )
          if os.path.isdir(assignment_folder):
              if len(os.listdir(assignment_folder)) > 2:
                  print(
                      f"Had more than one HIT in folder: {assignment_folder}, had {len(os.listdir(assignment_folder))} folders."
                  )
              for agent_id in os.listdir(assignment_folder):
                  if os.path.isdir(
                      os.path.join(assignment_folder, agent_id)
                  ):
                      full_path = os.path.join(
                          task_run_id_folder,
                          assignment_id,
                          agent_id,
                          "agent_data.json",
                      )
                      read_folders.append(full_path)
      return read_folders
  
imports: import copy
  import json
  import os
  from datetime import datetime
  from typing import Any, Dict, Optional, Tuple
  import numpy
  import pandas
  from parlai.crowdsourcing.utils.analysis import AbstractTurnAnnotationResultsCompiler
label_desc: Use image node_id 3 for calling the TurnAnnotationsStaticResultsCompiler obj's underlying member method code with example usage: obj.get_data_paths_mephisto(task_run_id_folder) and returns: read_folders