Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track Paper Matching: configure edge browser urls based on committee role #1795

Merged
merged 7 commits into from
Sep 11, 2023
40 changes: 26 additions & 14 deletions openreview/venue/invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2087,18 +2087,30 @@ def set_assignment_invitation(self, committee_id, submission_content=None):
venue = self.venue
venue_id = venue.get_id()
assignment_invitation_id = venue.get_assignment_id(committee_id, deployed=True)
is_reviewer = committee_id == venue.get_reviewers_id()
is_area_chair = committee_id == venue.get_area_chairs_id()
is_senior_area_chair = committee_id == venue.get_senior_area_chairs_id()
committee_name = self.venue.get_committee_name(committee_id)
is_reviewer = committee_name in venue.reviewer_roles
is_area_chair = committee_name in venue.area_chair_roles
is_senior_area_chair = committee_name in venue.senior_area_chair_roles
review_stage = venue.review_stage if is_reviewer else venue.meta_review_stage
is_ethics_reviewer = committee_id == venue.get_ethics_reviewers_id()

area_chairs_id = self.venue.get_area_chairs_id()
senior_area_chairs_id = self.venue.get_senior_area_chairs_id()
if is_reviewer:
area_chairs_id = committee_id.replace(self.venue.reviewers_name, self.venue.area_chairs_name)
senior_area_chairs_id = committee_id.replace(self.venue.reviewers_name, self.venue.senior_area_chairs_name)

if is_area_chair:
area_chairs_id = committee_id
senior_area_chairs_id = committee_id.replace(self.venue.area_chairs_name, self.venue.senior_area_chairs_name)


content = {
'review_name': {
'value': review_stage.name if review_stage else 'Official_Review'
},
'reviewers_id': {
'value': venue.get_reviewers_id() if is_reviewer else venue.get_area_chairs_id()
'value': committee_id
},
'reviewers_name': {
'value': venue.reviewers_name if is_reviewer else venue.area_chairs_name
Expand All @@ -2107,10 +2119,10 @@ def set_assignment_invitation(self, committee_id, submission_content=None):
'value': venue.get_anon_reviewers_name() if is_reviewer else venue.get_anon_area_chairs_name()
},
'sync_sac_id': {
'value': venue.get_senior_area_chairs_id(number='{number}') if is_area_chair and venue.use_senior_area_chairs else ''
'value': venue.get_senior_area_chairs_id(number='{number}') if committee_name == venue.area_chairs_name and venue.use_senior_area_chairs else ''
},
'sac_assignment_id': {
'value': venue.get_assignment_id(venue.get_senior_area_chairs_id(), deployed=True) if is_area_chair and venue.use_senior_area_chairs else ''
'value': venue.get_assignment_id(senior_area_chairs_id, deployed=True) if is_area_chair and venue.use_senior_area_chairs else ''
}
}

Expand Down Expand Up @@ -2157,14 +2169,14 @@ def set_assignment_invitation(self, committee_id, submission_content=None):
if is_reviewer:
edge_nonreaders = [venue.get_authors_id(number='${{2/head}/number}')]
if venue.use_senior_area_chairs:
invitation_readers.append(venue.get_senior_area_chairs_id())
edge_invitees.append(venue.get_senior_area_chairs_id())
invitation_readers.append(senior_area_chairs_id)
edge_invitees.append(senior_area_chairs_id)
edge_readers.append(venue.get_senior_area_chairs_id(number='${{2/head}/number}'))
edge_writers.append(venue.get_senior_area_chairs_id(number='${{2/head}/number}'))
edge_signatures.append(venue.get_senior_area_chairs_id(number='.*'))
if venue.use_area_chairs:
invitation_readers.append(venue.get_area_chairs_id())
edge_invitees.append(venue.get_area_chairs_id())
invitation_readers.append(area_chairs_id)
edge_invitees.append(area_chairs_id)
edge_readers.append(venue.get_area_chairs_id(number='${{2/head}/number}'))
edge_writers.append(venue.get_area_chairs_id(number='${{2/head}/number}'))
edge_signatures.append(venue.get_area_chairs_id(number='.*', anon=True))
Expand All @@ -2178,11 +2190,11 @@ def set_assignment_invitation(self, committee_id, submission_content=None):
edge_signatures.append(venue.get_ethics_chairs_id())

if is_area_chair:
invitation_readers.append(venue.get_area_chairs_id())
invitation_readers.append(area_chairs_id)
edge_nonreaders = [venue.get_authors_id(number='${{2/head}/number}')]
if venue.use_senior_area_chairs:
invitation_readers.append(venue.get_senior_area_chairs_id())
edge_invitees.append(venue.get_senior_area_chairs_id())
invitation_readers.append(senior_area_chairs_id)
edge_invitees.append(senior_area_chairs_id)
edge_readers.append(venue.get_senior_area_chairs_id(number='${{2/head}/number}'))
edge_writers.append(venue.get_senior_area_chairs_id(number='${{2/head}/number}'))
edge_signatures.append(venue.get_senior_area_chairs_id(number='.*'))
Expand All @@ -2192,7 +2204,7 @@ def set_assignment_invitation(self, committee_id, submission_content=None):
edge_head = {
'param': {
'type': 'profile',
'inGroup': venue.get_area_chairs_id()
'inGroup': area_chairs_id
}
}
process = self.get_process_content('process/sac_assignment_post_process.py')
Expand Down
104 changes: 63 additions & 41 deletions openreview/venue/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,25 @@ def __init__(self, venue, match_group, alternate_matching_group=None, submission
self.client = venue.client
self.match_group = match_group
self.alternate_matching_group = alternate_matching_group
self.is_reviewer = venue.get_reviewers_id() == match_group.id
self.is_area_chair = venue.get_area_chairs_id() == match_group.id
self.is_senior_area_chair = venue.get_senior_area_chairs_id() == match_group.id

self.match_group_name = self.venue.get_committee_name(self.match_group.id)

self.is_reviewer = self.match_group_name in self.venue.reviewer_roles
self.is_area_chair = self.match_group_name in self.venue.area_chair_roles
self.is_senior_area_chair = self.match_group_name in self.venue.senior_area_chair_roles
self.is_ethics_reviewer = venue.get_ethics_reviewers_id() == match_group.id
self.should_read_by_area_chair = venue.get_reviewers_id() == match_group.id and venue.use_area_chairs

self.area_chairs_id = venue.get_area_chairs_id()
self.senior_area_chairs_id = venue.get_senior_area_chairs_id()
if self.is_reviewer:
self.area_chairs_id = self.match_group.id.replace(self.venue.reviewers_name, self.venue.area_chairs_name)
self.senior_area_chairs_id = self.match_group.id.replace(self.venue.reviewers_name, self.venue.senior_area_chairs_name)

if self.is_area_chair:
self.area_chairs_id = self.match_group.id
self.senior_area_chairs_id = self.match_group.id.replace(self.venue.area_chairs_name, self.venue.senior_area_chairs_name)

self.should_read_by_area_chair = self.is_reviewer and venue.use_area_chairs and (openreview.stages.IdentityReaders.AREA_CHAIRS_ASSIGNED in self.venue.reviewer_identity_readers or openreview.stages.IdentityReaders.AREA_CHAIRS in self.venue.reviewer_identity_readers)
self.sac_profile_info = None #expects a policy, for example: openreview.tools.get_sac_profile_info
self.sac_n_years = None
self.submission_content = submission_content
Expand All @@ -36,36 +50,44 @@ def _get_submission_content_query(self):
query += f'&content.{key}={value}'
return query

def _match_submission_content(self, content):
if not self.submission_content:
return True
for name, value in self.submission_content.items():

paper_value = content.get(name)
if isinstance(paper_value, dict):
paper_value = paper_value.get('value')

if paper_value != value:
return False
return True

def _get_submissions(self):

submissions = self.venue.get_submissions(sort='number:asc')
filtered_submissions = [s for s in submissions if self._match_submission_content(s.content)]
return filtered_submissions

def _get_edge_invitation_id(self, edge_name):
return self.venue.get_invitation_id(edge_name, prefix=self.match_group.id)

def _get_edge_readers(self, tail):
readers = [self.venue.venue_id]
if self.should_read_by_area_chair:
if self.venue.use_senior_area_chairs:
readers.append(self.venue.get_senior_area_chairs_id())
readers.append(self.venue.get_area_chairs_id())
readers.append(self.senior_area_chairs_id)
readers.append(self.area_chairs_id)
readers.append(tail)
return readers

def get_committee_name(self):
if self.is_reviewer:
return 'Reviewers'
if self.is_area_chair:
return 'Area_Chairs'
if self.is_senior_area_chair:
return 'Senior_Area_Chairs'
if self.is_ethics_reviewer:
return 'Ethics_Reviewers'
return self.match_group.id.split('/')[-1]

def _create_edge_invitation(self, edge_id, any_tail=False, default_label=None):

venue = self.venue
venue_id = venue.venue_id

is_assignment_invitation=edge_id.endswith('Assignment') or edge_id.endswith('Aggregate_Score')
paper_number = '${{2/head}/number}' if is_assignment_invitation else None
paper_number = '${{2/head}/number}'

assignment_or_proposed = edge_id.endswith('Assignment')

Expand All @@ -77,37 +99,37 @@ def _create_edge_invitation(self, edge_id, any_tail=False, default_label=None):
edge_nonreaders = []

if edge_id.endswith('Affinity_Score'):
edge_nonreaders = [venue.get_authors_id(number='${{2/head}/number}')]
edge_nonreaders = [venue.get_authors_id(number=paper_number)]

if self.is_reviewer:
if venue.use_senior_area_chairs:
edge_readers.append(venue.get_senior_area_chairs_id(number=paper_number))
invitation_readers.append(venue.get_senior_area_chairs_id())
edge_readers.append(venue.get_senior_area_chairs_id(number=paper_number) if is_assignment_invitation else self.senior_area_chairs_id)
invitation_readers.append(self.senior_area_chairs_id)
if venue.use_area_chairs:
edge_readers.append(venue.get_area_chairs_id(number=paper_number))
invitation_readers.append(venue.get_area_chairs_id())
edge_readers.append(venue.get_area_chairs_id(number=paper_number) if is_assignment_invitation else self.area_chairs_id)
invitation_readers.append(self.area_chairs_id)

if is_assignment_invitation:
if venue.use_senior_area_chairs:
edge_invitees.append(venue.get_senior_area_chairs_id())
edge_invitees.append(self.senior_area_chairs_id)
edge_writers.append(venue.get_senior_area_chairs_id(number=paper_number))
edge_signatures.append(venue.get_senior_area_chairs_id(number='.*'))
if venue.use_area_chairs:
edge_invitees.append(venue.get_area_chairs_id())
edge_invitees.append(self.area_chairs_id)
edge_writers.append(venue.get_area_chairs_id(number=paper_number))
edge_signatures.append(venue.get_area_chairs_id(number='.*', anon=True))

edge_nonreaders = [venue.get_authors_id(number=paper_number)]

if self.is_area_chair:
if venue.use_senior_area_chairs:
edge_readers.append(venue.get_senior_area_chairs_id(number=paper_number))
invitation_readers.append(venue.get_senior_area_chairs_id())
edge_readers.append(venue.get_senior_area_chairs_id(number=paper_number) if is_assignment_invitation else self.senior_area_chairs_id)
invitation_readers.append(self.senior_area_chairs_id)

if is_assignment_invitation:
invitation_readers.append(venue.get_area_chairs_id())
invitation_readers.append(self.area_chairs_id)
if self.venue.use_senior_area_chairs:
edge_invitees.append(venue.get_senior_area_chairs_id())
edge_invitees.append(self.senior_area_chairs_id)
edge_writers.append(venue.get_senior_area_chairs_id(number=paper_number))
edge_signatures.append(venue.get_senior_area_chairs_id(number='.*'))

Expand Down Expand Up @@ -142,8 +164,8 @@ def _create_edge_invitation(self, edge_id, any_tail=False, default_label=None):
'withVenueid': venue.get_submission_venue_id()
}
}
if self.submission_content:
edge_head['param']['withContent'] = self.submission_content
if self.submission_content:
edge_head['param']['withContent'] = self.submission_content

edge_weight = {
'param': {
Expand Down Expand Up @@ -273,9 +295,9 @@ def _build_note_conflicts(self, submissions, user_profiles, get_profile_info, co
## for AC conflicts, check SAC conflicts too
sac_user_info_by_id = {}
if self.is_area_chair:
sacs_by_ac = { g['id']['head']: [v['tail'] for v in g['values']] for g in self.client.get_grouped_edges(invitation=self.venue.get_assignment_id(self.venue.get_senior_area_chairs_id()), groupby='head', select=None)}
sacs_by_ac = { g['id']['head']: [v['tail'] for v in g['values']] for g in self.client.get_grouped_edges(invitation=self.venue.get_assignment_id(self.senior_area_chairs_id), groupby='head', select=None)}
if sacs_by_ac:
sac_user_profiles = openreview.tools.get_profiles(self.client, self.client.get_group(self.venue.get_senior_area_chairs_id()).members, with_publications=True)
sac_user_profiles = openreview.tools.get_profiles(self.client, self.client.get_group(self.senior_area_chairs_id).members, with_publications=True)
if self.sac_profile_info:
info_funcion = tools.info_function_builder(self.sac_profile_info)
sac_user_info_by_id = { p.id: info_funcion(p, self.sac_n_years, self.venue.get_submission_venue_id()) for p in sac_user_profiles }
Expand Down Expand Up @@ -891,7 +913,7 @@ def setup(self, compute_affinity_scores=False, compute_conflicts=False, compute_

user_profiles = openreview.tools.get_profiles(client, self.match_group.members, with_publications=compute_conflicts)

submissions = venue.get_submissions(sort='number:asc')
submissions = self._get_submissions()

if not self.match_group.members:
raise openreview.OpenReviewException(f'The match group is empty: {self.match_group.id}')
Expand Down Expand Up @@ -934,7 +956,7 @@ def setup(self, compute_affinity_scores=False, compute_conflicts=False, compute_
if not self.is_senior_area_chair:
with open(os.path.join(os.path.dirname(__file__), 'process/proposed_assignment_pre_process.js')) as f:
content = f.read()
invitation.content = { 'committee_name': { 'value': self.get_committee_name() }}
invitation.content = { 'committee_name': { 'value': self.match_group_name }}
invitation.preprocess = content
venue.invitation_builder.save_invitation(invitation)

Expand Down Expand Up @@ -1044,7 +1066,7 @@ def setup_invite_assignment(self, hash_seed, assignment_title=None, due_date=Non

#To-Do
## Only for reviewers, allow ACs and SACs to review the proposed assignments
if self.match_group.id == venue.get_reviewers_id() and not proposed:
if self.is_reviewer and not proposed:
venue.group_builder.set_external_reviewer_recruitment_groups(name=invited_committee_name, create_paper_groups=True if assignment_title else False)
if assignment_title:
invitation=self.client.get_invitation(venue.get_assignment_id(self.match_group.id))
Expand All @@ -1068,14 +1090,14 @@ def deploy_assignments(self, assignment_title, overwrite):
reviewer_name = venue.area_chairs_name
review_name = 'Meta_Review'

papers = venue.get_submissions()
papers = self._get_submissions()
reviews = client.get_notes(invitation=venue.get_invitation_id(review_name, number='.*'), limit=1)
proposed_assignment_edges = { g['id']['head']: g['values'] for g in client.get_grouped_edges(invitation=venue.get_assignment_id(self.match_group.id),
label=assignment_title, groupby='head', select=None)}
assignment_invitation_id = venue.get_assignment_id(self.match_group.id, deployed=True)
current_assignment_edges = { g['id']['head']: g['values'] for g in client.get_grouped_edges(invitation=assignment_invitation_id, groupby='head', select=None)}

sac_assignment_edges = { g['id']['head']: g['values'] for g in client.get_grouped_edges(invitation=venue.get_assignment_id(venue.get_senior_area_chairs_id(), deployed=True), groupby='head', select=None)}
sac_assignment_edges = { g['id']['head']: g['values'] for g in client.get_grouped_edges(invitation=venue.get_assignment_id(self.senior_area_chairs_id, deployed=True), groupby='head', select=None)}

if overwrite:
if reviews:
Expand Down Expand Up @@ -1173,11 +1195,11 @@ def deploy(self, assignment_title, overwrite=False, enable_reviewer_reassignment
self.venue.invitation_builder.expire_invitation(self.venue.get_assignment_id(self.match_group.id))

## Deploy assignments creating groups and assignment edges
if self.match_group.id == self.venue.get_senior_area_chairs_id():
if self.is_senior_area_chair:
self.deploy_sac_assignments(assignment_title, overwrite)
else:
self.deploy_assignments(assignment_title, overwrite)

if self.match_group.id == self.venue.get_reviewers_id() and enable_reviewer_reassignment:
if self.is_reviewer and enable_reviewer_reassignment:
hash_seed=''.join(random.choices(string.ascii_uppercase + string.digits, k = 8))
self.setup_invite_assignment(hash_seed=hash_seed, invited_committee_name=f'''Emergency_{self.venue.reviewers_name}''')
self.setup_invite_assignment(hash_seed=hash_seed, invited_committee_name=f'''Emergency_{self.match_group_name}''')
Loading