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: Filter the bot responses given the specific problem buckets being used.
docstr_tok: ["Filter","the","bot","responses","given","the","specific","problem","buckets","being","used","."]
code: def _problem_bucket_specific_filtering(
      self, bot_only_df: pd.DataFrame
  ) -> pd.DataFrame:
      """
      Filter the bot responses given the specific problem buckets being used.
      """
  
      non_none_problem_buckets = [
          bucket
          for bucket in self.problem_buckets
          if bucket != "none_all_good"
      ]
      assert len(set(non_none_problem_buckets)) + 1 == len(
          self.problem_buckets
      )
      # Make sure problem buckets are all unique
  
      utterance_count_total = len(bot_only_df)
  
      # Select which columns are consistent
      is_consistent = (
          bot_only_df[non_none_problem_buckets[0]]
          + bot_only_df["none_all_good"]
      ) < 2
      for bucket in non_none_problem_buckets[1:]:
          is_consistent = is_consistent & (
              (bot_only_df[bucket] + bot_only_df["none_all_good"]) < 2
          )
      bot_only_df["is_consistent"] = is_consistent
      bot_only_df = bot_only_df[bot_only_df["is_consistent"]]
  
      # If any of the problem buckets have marked True
      any_problem = bot_only_df[non_none_problem_buckets[0]]
      for bucket in non_none_problem_buckets[1:]:
          any_problem = any_problem | bot_only_df[bucket]
      bot_only_df["any_problem"] = any_problem
  
      print(
          f"Dropped {utterance_count_total - len(bot_only_df)} inconsistently annotated utterances (none_all_good and a problem bucket). Now have {len(bot_only_df)} utterances."
      )
  
      return bot_only_df
  
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 13 for calling the TurnAnnotationsStaticResultsCompiler obj's underlying member method code with example usage: obj._problem_bucket_specific_filtering(bot_only_df) and returns: bot_only_df