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

Dashboard facelift [REFERENCE] #538

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2a0d510
Added custom qualification types JSON file support.
evankirkiles Mar 28, 2021
03d075c
Added type-checking on advanced qualifications.
evankirkiles Apr 12, 2021
baf7b75
Added example advanced qualification file and config.
evankirkiles Apr 12, 2021
235ff82
Merge branch 'master' of git://github.com/evankirkiles/psiTurk into e…
deargle Apr 12, 2021
ffe13ad
fixes
deargle Apr 12, 2021
4aca04e
Merge branch 'master' of https://github.com/NYUCCL/psiTurk
evankirkiles May 2, 2021
59008ec
Removed participant HIT id query.
evankirkiles May 5, 2021
b2a4f71
Merge branch 'master' of https://github.com/NYUCCL/psiTurk into evan-…
evankirkiles May 10, 2021
19acc23
Working on new dashboard.
evankirkiles May 10, 2021
9dcd05c
Working on integration.
evankirkiles May 13, 2021
ce1e71f
Merge branch 'NYUCCL:master' into master
evankirkiles Jun 12, 2021
4a6e7cc
Fixed blue ribbon image paths.
evankirkiles Jun 12, 2021
13403d6
bootstrapped hit page layout.
evankirkiles Jun 13, 2021
7cce3b0
Flexible layout with filters.
evankirkiles Jun 15, 2021
773fc7f
Added basic filter option to HTML.
evankirkiles Jun 15, 2021
d63a212
Added filter generation.
evankirkiles Jun 15, 2021
9506461
Moved filtering off of DB.
evankirkiles Jun 15, 2021
d67ac96
Got filters working.
evankirkiles Jun 15, 2021
de0a31b
Added row numbers.
evankirkiles Jun 15, 2021
ea01a80
Added assignments database view.
evankirkiles Jun 16, 2021
307c429
Adding HIT create modal.
evankirkiles Jun 16, 2021
d1fd435
Small visual update.
evankirkiles Jun 16, 2021
8d1e58d
Added hit create modal.
evankirkiles Jun 16, 2021
bd2ef4b
Added individual approval and rejection, and endpoints.
evankirkiles Jun 17, 2021
29b92f3
Merged.
evankirkiles Jun 17, 2021
48da31f
Merge branch 'NYUCCL-master' into new-dashboard
evankirkiles Jun 17, 2021
e66455d
Fixup this.
evankirkiles Jun 17, 2021
5746223
Added HIT information to assignment stuff.
evankirkiles Jun 17, 2021
44acd5c
Added data view to dashboard.
evankirkiles Jun 18, 2021
f9a762c
Added multi-approval modal, fully functioning.
evankirkiles Jun 18, 2021
62da083
Intermediary commit, working on bonus modal.
evankirkiles Jun 18, 2021
c53751e
Added version numbering.
evankirkiles Jun 18, 2021
28d0a10
Merge branch 'new-dashboard'
evankirkiles Jun 23, 2021
501ad58
Beginning work on API endpoints.
evankirkiles Jun 29, 2021
5f793f8
Moved dashboard API routes to API file.
evankirkiles Jun 29, 2021
f7adb89
Trimmed files.
evankirkiles Jun 29, 2021
129f946
Initial campaigns integration.
evankirkiles Jun 29, 2021
9c5d201
Added worker view.
evankirkiles Jun 30, 2021
3ad69e0
Added dollar rendering to table.
evankirkiles Jun 30, 2021
143d92f
Fleshed out worker display.
evankirkiles Jun 30, 2021
28b48a5
Added download table button.
evankirkiles Jun 30, 2021
ee9e995
Added inverting filter.
evankirkiles Jun 30, 2021
c6c0309
Prettified login page.
evankirkiles Jun 30, 2021
8d721c1
Added data CSV download endpoint.
evankirkiles Jul 6, 2021
7d59cbb
Fetched upstream.
Nov 30, 2021
1cdd768
Small fixup.
Nov 30, 2021
5f5515f
Another small fixup.
Nov 30, 2021
3b279be
Added bonus capabilities.
Dec 14, 2021
1fb87c8
Added bonus column to dashboard.
evankirkiles Jan 4, 2022
3e26283
Added bonusing from a CSV.
evankirkiles Jan 4, 2022
433b722
Added batch download button and endpoint.
evankirkiles Jan 12, 2022
996157d
fixup.
evankirkiles Jan 12, 2022
5a7712e
Working commit.
evankirkiles Dec 15, 2022
6b617a9
Updated packages with python 3.10 support.
evankirkiles Dec 16, 2022
46855a9
bump to 3.2.1
deargle Oct 1, 2021
7e23a52
pin markupsafe
deargle Feb 28, 2022
6fb7fc5
bump version
deargle Feb 28, 2022
01f47b8
update gitignore
deargle Feb 28, 2022
c333932
Branch v3.3.0 (#544)
deargle Feb 28, 2022
df5177b
bump pyopenssl to 22.0.0 (#551)
deargle Oct 31, 2022
c3291f0
bump to 3.3.1 (#552)
deargle Oct 31, 2022
e302397
Updated packages with python 3.10 support.
evankirkiles Dec 16, 2022
9e6c4fe
Removed GitPython.
evankirkiles Dec 16, 2022
93b4697
Replaces postgres:// with postgresql://
evankirkiles Dec 16, 2022
ed1b547
Replaces postgres:// with postgresql://
evankirkiles Dec 16, 2022
d7b16d2
Merge branch 'master' into beta
evankirkiles Feb 1, 2023
2050636
Fixed data downloading.
evankirkiles Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand Down
45 changes: 42 additions & 3 deletions psiturk/amt_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def wrapper(*args, **kwargs):
response = func(*args, **kwargs)
return AmtServicesSuccessResponse(operation=func.__name__, data=response)
except Exception as e:
# print(e)
return AmtServicesErrorResponse(operation=func.__name__, exception=e)

return wrapper
Expand Down Expand Up @@ -189,7 +188,8 @@ def get_assignments(self, assignment_status=None, hit_ids=None):
for hit_id in hit_ids:
paginator = self.mtc.get_paginator('list_assignments_for_hit')
args = dict(
HITId=hit_id
HITId=hit_id,
PaginationConfig={'PageSize': 100}
)
if assignment_status:
args['AssignmentStatuses'] = [assignment_status]
Expand Down Expand Up @@ -220,6 +220,43 @@ def get_assignment(self, assignment_id):
'status': assignment['AssignmentStatus'],
}
return worker_data

@amt_service_response
def get_bonuses(self, hit_id=None, assignment_ids=None):
"""Get paid bonuses."""
bonuses = []
if hit_id:
paginator = self.mtc.get_paginator('list_bonus_payments')
args = dict(
HITId=hit_id,
PaginationConfig={'PageSize': 100}
)
for page in paginator.paginate(**args):
bonuses.extend(page['BonusPayments'])
elif assignment_ids:
if not isinstance(assignment_ids, list):
assignment_ids = [assignment_ids]
for assignment_id in assignment_ids:
paginator = self.mtc.get_paginator('list_bonus_payments')
args = dict(
AssignmentId=assignment_id,
PaginationConfig={'PageSize': 100}
)
for page in paginator.paginate(**args):
bonuses.extend(page['BonusPayments'])
bonus_data = [{
'workerId': bonus['WorkerId'],
'bonusAmount': bonus['BonusAmount'],
'assignmentId': bonus['AssignmentId'],
'reason': bonus['Reason'],
'grantTime': bonus['GrantTime']
} for bonus in bonuses]
return bonus_data

@amt_service_response
def notify_workers(self, worker_ids, message_subject, message_body):
"""Notify workers"""
return self.mtc.notify_workers(WorkerIds=worker_ids, Subject=message_subject, MessageText=message_body)

@amt_service_response
def bonus_assignment(self, assignment_id, worker_id, amount, reason=""):
Expand Down Expand Up @@ -268,7 +305,9 @@ def setup_mturk_connection(self):
aws_access_key_id = self.config.get('AWS Access', 'aws_access_key_id')
aws_secret_access_key = self.config.get('AWS Access',
'aws_secret_access_key')

session_kwargs = {
'region_name': 'us-east-1'
}
if aws_access_key_id and aws_secret_access_key:
session_kwargs['aws_access_key_id'] = aws_access_key_id
session_kwargs['aws_secret_access_key'] = aws_secret_access_key
Expand Down
24 changes: 24 additions & 0 deletions psiturk/amt_services_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ def count_workers(self, codeversion='latest', mode='live', status='completed'):
worker_count = Participant.count_workers(query=query, group_bys=[])
return worker_count

@amt_services_wrapper_response
def notify_workers(self, worker_ids, m_subject, m_body):
"""Sends an email to all workers specified in worker_ids

Args:
workers (_type_): A list of worker ids (up to 100)
m_subject (_type_): The subject of the email (max 200 chars)
m_body (_type_): The body of the email (max 4096 chars)

Returns:
_type_: _description_
"""
if not worker_ids:
raise Exception("Worker IDs not specified!")
return self.amt_services.notify_workers(worker_ids, m_subject, m_body)

@amt_services_wrapper_response
def count_available(self, hits=None):
if not hits:
Expand Down Expand Up @@ -230,6 +246,14 @@ def count_maybe_will_complete(self, hits=None):
elif status == 'Unassignable':
maybe_will_complete_count += hit.options['number_assignments_pending']
return maybe_will_complete_count

@amt_services_wrapper_response
def get_bonuses(self, hit_id=None, assignment_ids=None):
"""
Returns all bonuses if hit_id is set, or specific assignment bonuses.
"""
bonus_data = self.amt_services.get_bonuses(hit_id, assignment_ids).data
return {'bonuses': bonus_data}

@amt_services_wrapper_response
def get_assignments(self, hit_ids=None, assignment_status=None, all_studies=False):
Expand Down