Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Save worker name in Acute-Eval analysis script #4126

Merged
merged 3 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions parlai/crowdsourcing/tasks/acute_eval/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from mephisto.tools.data_browser import DataBrowser as MephistoDataBrowser
from mephisto.abstractions.databases.local_database import LocalMephistoDB
from mephisto.data_model.unit import Unit as MephistoUnit
from mephisto.data_model.worker import Worker
from scipy.stats import binom_test

from parlai.core.params import ParlaiParser
Expand Down Expand Up @@ -137,8 +138,8 @@ def __init__(self, opt: Dict, remove_failed: bool = True):
mephisto_root_path = opt['mephisto_root']
if not mephisto_root_path:
mephisto_root_path = None
mephisto_db = LocalMephistoDB(database_path=mephisto_root_path)
self.mephisto_data_browser = MephistoDataBrowser(db=mephisto_db)
self.mephisto_db = LocalMephistoDB(database_path=mephisto_root_path)
self.mephisto_data_browser = MephistoDataBrowser(db=self.mephisto_db)
self.checkbox_prefix = self.CHECKBOX_PREFIX
# Prepended to checkbox columns in self.dataframe
self.dataframe = self._extract_to_dataframe()
Expand Down Expand Up @@ -168,6 +169,9 @@ def _extract_response_by_index(
response: Dict[str, Any] = {
'run_id': self.run_id,
'worker': unit_details['worker_id'],
'worker_name': Worker.get(
self.mephisto_db, unit_details['worker_id']
).worker_name,
'time_taken': unit_details['task_end'] - unit_details['task_start'],
'question': task_data['task_specs']['question'],
'unit_id': unit_details['unit_id'],
Expand Down
Loading