class_docstr: Abstract data loader for Multiwoz V2.2 into TOD structured data format.
  
  Multiwoz 2.2 has 'find' and 'book' as the only intents.
  
  For API calls, we look for turns that are not 'NONE' `active_intents` in the USER's turn state. We then filter these for whether or not the SYSTSEM has actually made an api call by looking in the dialogue act of the SYSTEM turn.
  * For 'find' intents, we make an API call if it does an "Inform" or gives a "NoOffer". We look in the corresponding `.db` file to return the relevant information.
  * For 'book' intents, we make an API call if the SYSTEM's dialogue act includes  booking and then offer the slots/values of that key as the API response.
class_docstr_tok: ["Abstract","data","loader","for","Multiwoz","V2.2","into","TOD","structured","data","format",".","Multiwoz","2.2","has","'find","'","and","'book","'","as","the","only","intents",".","For","API","calls",",","we","look","for","turns","that","are","not","'NONE","'","`","active_intents","`","in","the","USER","'s","turn","state",".","We","then","filter","these","for","whether","or","not","the","SYSTSEM","has","actually","made","an","api","call","by","looking","in","the","dialogue","act","of","the","SYSTEM","turn",".","*","For","'find","'","intents",",","we","make","an","API","call","if","it","does","an","``","Inform","''","or","gives","a","``","NoOffer","''",".","We","look","in","the","corresponding","`",".db","`","file","to","return","the","relevant","information",".","*","For","'book","'","intents",",","we","make","an","API","call","if","the","SYSTEM","'s","dialogue","act","includes","booking","and","then","offer","the","slots\/values","of","that","key","as","the","API","response","."]
docstr: Get an API response out of the lookup databases.
docstr_tok: ["Get","an","API","response","out","of","the","lookup","databases","."]
code: def _get_find_api_response(self, intent, raw_slots, sys_dialog_act):
      """
      Get an API response out of the lookup databases.
      """
      domain = ""
      for cand in DOMAINS:
          if cand in intent:
              domain = cand
      if domain == "taxi":  # handle separately cause funky
          for action in sys_dialog_act:
              if action == "Taxi-Inform":
                  return {x[0]: x[1] for x in sys_dialog_act[action]}
          return {domain: domain}  # too much work to do this right...
      if domain == "hospital":  # handle separately cause funky
          res = self.hospital_address
          if "hospital-department" in raw_slots:
              for blob in self.hospital_department_details:
                  if (
                      blob["department"]
                      in raw_slots["hospital-department"]
                  ):
                      res[blob["department"]] = blob
          return res
      slots = {}
      for raw_key in raw_slots:
          key = raw_key[len(domain + "-") :]
          slots[key] = raw_slots[raw_key]
      for action in sys_dialog_act:
          if "Recommend" in action:
              add_slots = {}
              for x in sys_dialog_act[action]:
                  name = x[0]
                  val = x[1]
                  if self._slot_in_schema(name, intent):
                      if name not in add_slots:
                          add_slots[name] = []
                      add_slots[name].append(val)
              for key in add_slots:
                  slots[key] = add_slots[key]
  
      find = self.dbs[domain]
      for slot, values in slots.items():
          if slot == "arriveby":
              condition = find[slot] < values[0]
          elif slot == "leaveat":
              condition = find[slot] > values[0]
          else:
              condition = find[slot].isin(values)
  
          find = find[condition]
  
      filtered = self.dbs[domain].iloc[find.index]
      count = len(filtered.index)
      if count == 0:
          return {}
      blob = filtered.head(1).to_dict("records")
  
      results = blob[0]
      results["COUNT"] = count
      return results
  
imports: import copy
  import json
  import os
  from typing import Optional
  import numpy
  import pandas
  import parlai.core.tod.tod_agents
  import parlai.core.tod.tod_core
  import parlai.tasks.multiwoz_v22.build
  from parlai.core.message import Message
  from parlai.core.metrics import AverageMetric
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.utils.data import DatatypeHelper
  from parlai.utils.io import PathManager
  from parlai.utils.testing import is_this_circleci
label_desc: Use image node_id 6 for calling the MultiwozV22Parser obj's underlying member method code with example usage: obj._get_find_api_response(intent, raw_slots, sys_dialog_act) and returns: results, dict, res, dict, unknown