Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<th>Approved (%)</th>
<th>Decision time (days, median)</th>
<th>Time to contact reference (days, median)</th>
<th>Reference response time (days, median)</th>
<th>Reference response time (hours, median)</th>
</tr>
{% for year, value in stats.items %}
<tr>
Expand Down
6 changes: 3 additions & 3 deletions physionet-django/console/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2367,15 +2367,15 @@ def credentialing_stats(request):
except (AttributeError, StatisticsError):
stats[y]['time_to_ref'] = None

# Time taken for the reference to respond
# Time taken for the reference to respond (in hours)
time_to_reply = apps.annotate(tm=Cast(F('reference_response_datetime')
- F('reference_contact_datetime'),
DurationField())).values_list('tm', flat=True)
for y in stats:
durations = time_to_reply.filter(application_datetime__year=y)
try:
days = [d.days for d in durations if d and d.days >= 0]
stats[y]['time_to_reply'] = median(days)
hours = [round(d.total_seconds() / 3600, 2) for d in durations if d and d.total_seconds() >= 0]
stats[y]['time_to_reply'] = median(hours)
except (AttributeError, StatisticsError):
stats[y]['time_to_reply'] = None

Expand Down
Loading