Review
review
¶
Tools related to assigning proposals to reviewers
In Pretalx assignments can be done in two directions:
- Assign proposals to reviewers
- Assign reviewers to proposals
We will always assume direction 1. in this file when we talk about an assignment. So in Operation Research-speak, resources get assigned tasks, not the other way around. The time needed for the task of reviewing a proposal is quite homogeneous while the number of reviews a single reviewer may highly vary. Also, we will rather use the name submission instead of proposal as this also reflects the naming of the Pretalx API.
We follow the convention over configuration principle here and thus check out the Col
class for the naming of columns.
Col
¶
Additional conventions used for reviews
address_as = 'Address as'
class-attribute
instance-attribute
¶
all_proposals = 'All Proposals'
class-attribute
instance-attribute
¶
committee_contact = 'Committee Contact'
class-attribute
instance-attribute
¶
committee_member = 'Committee Member'
class-attribute
instance-attribute
¶
curr_assignments = 'Current Assignments'
class-attribute
instance-attribute
¶
done_nreviews = 'Done #Reviews'
class-attribute
instance-attribute
¶
nassignments = '#Assignments'
class-attribute
instance-attribute
¶
nvotes = '#Votes'
class-attribute
instance-attribute
¶
pretalx_activated = 'Pretalx activated'
class-attribute
instance-attribute
¶
rem_nreviews = 'Remaining #Reviews'
class-attribute
instance-attribute
¶
target_nreviews = 'Target #Reviews'
class-attribute
instance-attribute
¶
track_prefs = 'Track Preferences'
class-attribute
instance-attribute
¶
vote_score = 'Vote Score'
class-attribute
instance-attribute
¶
read_assignment_as_df(file_path: Path) -> pd.DataFrame
¶
Reads an assignment and returns a dataframe.
Source code in src/pytanis/review.py
def read_assignment_as_df(file_path: Path) -> pd.DataFrame:
"""Reads an assignment and returns a dataframe."""
with open(file_path, encoding='utf8') as fh:
curr_assign = json.load(fh)
df = pd.DataFrame({k: [v] for k, v in curr_assign.items()})
df = df.T.rename_axis(index=Col.email).rename(columns={0: Col.curr_assignments}).reset_index()
return df
save_assignments_as_json(df: pd.DataFrame, file_path: Path | str)
¶
Save the dataframe as proposal assignment JSON file.
We expect df
to have the columns Col.email
and Col.curr_assignments
.
Source code in src/pytanis/review.py
def save_assignments_as_json(df: pd.DataFrame, file_path: Path | str):
"""Save the dataframe as proposal assignment JSON file.
We expect `df` to have the columns `Col.email` and `Col.curr_assignments`.
"""
file_path = Path(file_path)
df = df.loc[:, [Col.email, Col.curr_assignments]]
json_dct = json.loads(df.set_index(Col.email).to_json())[Col.curr_assignments]
# prettify the json string for human-edit-ability if reviewers need to be dropped later
json_str = json.dumps(json_dct).replace('{', '{\n').replace('], ', '],\n').replace(']}', ']\n}')
with open(file_path, 'w', encoding='utf8') as fh:
fh.write(json_str)