|
7 | 7 | from classification.models import DiscordanceReportTriage, ClinVarExportBatch, ClinVarExportBatchStatus
|
8 | 8 | from eventlog.models import Event, ViewEvent
|
9 | 9 | from library.guardian_utils import bot_group
|
10 |
| -from library.health_check import health_check_signal, HealthCheckRequest, HealthCheckRecentActivity |
| 10 | +from library.health_check import health_check_signal, HealthCheckRequest, HealthCheckRecentActivity, \ |
| 11 | + health_check_overall_stats_signal, HealthCheckTotalAmount |
11 | 12 | from snpdb.models import UserPreview
|
12 | 13 |
|
13 | 14 |
|
@@ -102,19 +103,17 @@ def discordance_triage_health_check(sender, health_request: HealthCheckRequest,
|
102 | 103 | )
|
103 | 104 |
|
104 | 105 |
|
105 |
| -@receiver(signal=health_check_signal) |
| 106 | +@receiver(signal=health_check_overall_stats_signal) |
106 | 107 | def clinvar_export_batch_healthcheck(sender, health_request: HealthCheckRequest, **kwargs):
|
107 | 108 |
|
108 |
| - accepted_statuses = [ClinVarExportBatchStatus.AWAITING_UPLOAD, ClinVarExportBatchStatus.UPLOADING] |
109 |
| - recent_batches = ClinVarExportBatch.objects.filter(status__in=accepted_statuses, |
110 |
| - created__gte=health_request.since, |
111 |
| - created__lt=health_request.now) |
| 109 | + accepted_statuses = (ClinVarExportBatchStatus.AWAITING_UPLOAD, ClinVarExportBatchStatus.UPLOADING) |
| 110 | + recent_batches = ClinVarExportBatch.objects.filter(status__in=accepted_statuses) |
112 | 111 |
|
113 | 112 | if count := recent_batches.count():
|
114 |
| - return HealthCheckRecentActivity( |
| 113 | + return HealthCheckTotalAmount( |
115 | 114 | emoji=":package:",
|
116 |
| - name="ClinVar Export Batches", |
| 115 | + name="Pending ClinVar Export Batches", |
117 | 116 | amount=count,
|
118 |
| - extra=", ".join([f'{batch.clinvar_key.name} - *{batch.get_status_display()}*' for batch in recent_batches]), |
119 |
| - stand_alone=True, |
| 117 | + extra=", ".join([f'{batch.clinvar_key.name} *{batch.get_status_display()}*' for batch in recent_batches]) |
120 | 118 | )
|
| 119 | + |
0 commit comments