Skip to content

Commit

Permalink
Break ClinVar Batch health checks into one health check per status of…
Browse files Browse the repository at this point in the history
… interest
  • Loading branch information
TheMadBug committed Dec 5, 2023
1 parent 8baf1b5 commit f2adb15
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions eventlog/signals/active_users_health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ def discordance_triage_health_check(sender, health_request: HealthCheckRequest,


@receiver(signal=health_check_overall_stats_signal)
def clinvar_export_batch_healthcheck(sender, health_request: HealthCheckRequest, **kwargs):
def clinvar_export_batch_health_check(sender, health_request: HealthCheckRequest, **kwargs):

accepted_statuses = (ClinVarExportBatchStatus.AWAITING_UPLOAD, ClinVarExportBatchStatus.UPLOADING)
recent_batches = ClinVarExportBatch.objects.filter(status__in=accepted_statuses)
results: list[HealthCheckTotalAmount] = []

if count := recent_batches.count():
return HealthCheckTotalAmount(
emoji=":package:",
name="Pending ClinVar Export Batches",
amount=count,
extra=", ".join([f'{batch.clinvar_key.name} *{batch.get_status_display()}*' for batch in recent_batches])
)
for status in (ClinVarExportBatchStatus.AWAITING_UPLOAD, ClinVarExportBatchStatus.UPLOADING):
recent_batches = ClinVarExportBatch.objects.filter(status=status)

if count := recent_batches.count():
results.append(HealthCheckTotalAmount(
emoji=":package:",
name=f"ClinVar Export Batches in status of \"{status.label}\"",
amount=count,
extra=", ".join([f'{batch.clinvar_key.name} ({batch.pk})' for batch in recent_batches])
))
return results

0 comments on commit f2adb15

Please sign in to comment.