Skip to content

Commit

Permalink
Merge pull request #4567 from broadinstitute/loading-failed-status
Browse files Browse the repository at this point in the history
"Loading Failed" analysis status
  • Loading branch information
hanars authored Jan 6, 2025
2 parents b697e9a + 583b82a commit 4be5729
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ def _load_new_samples(cls, metadata_path, genome_version, dataset_type, run_vers
failed_families_by_guid = {f['guid']: f for f in Family.objects.filter(
guid__in={family for families in failed_family_samples.values() for family in families}
).values('guid', 'family_id', 'project__name')}
if failed_families_by_guid:
Family.bulk_update(
user=None, update_json={'analysis_status': Family.ANALYSIS_STATUS_LOADING_FAILED},
guid__in=failed_families_by_guid, analysis_status=Family.ANALYSIS_STATUS_WAITING_FOR_DATA
)
failures_by_project_check = defaultdict(lambda: defaultdict(list))
for check, check_failures in failed_family_samples.items():
for family_guid, failure_data in check_failures.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ def test_command(self, mock_email, mock_airtable_utils):
{'analysis_status': 'I', 'analysis_status_last_modified_date': None},
{'analysis_status': 'I', 'analysis_status_last_modified_date': None},
])
self.assertSetEqual(
set(Family.objects.filter(guid__in=['F000001_1', 'F000002_2', 'F000003_3']).values_list('analysis_status', flat=True)),
{'F'},
)
self.assertEqual(Family.objects.get(guid='F000014_14').analysis_status, 'Rncc')

# Test airtable PDO updates
Expand Down
18 changes: 18 additions & 0 deletions seqr/migrations/0079_alter_family_analysis_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.16 on 2025-01-03 19:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('seqr', '0078_rename_submit_to_clinvar_variantnote_report'),
]

operations = [
migrations.AlterField(
model_name='family',
name='analysis_status',
field=models.CharField(choices=[('S', 'S'), ('S_kgfp', 'S'), ('S_kgdp', 'S'), ('S_ng', 'S'), ('ES', 'E'), ('Sc_kgfp', 'S'), ('Sc_kgdp', 'S'), ('Sc_ng', 'S'), ('Rcpc', 'R'), ('Rncc', 'R'), ('C', 'C'), ('PB', 'P'), ('P', 'P'), ('I', 'A'), ('Q', 'W'), ('F', 'L'), ('N', 'N')], default='Q', max_length=10),
),
]
2 changes: 2 additions & 0 deletions seqr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class Family(ModelWithGUID):
ANALYSIS_STATUS_PARTIAL_SOLVE = 'P'
ANALYSIS_STATUS_PROBABLE_SOLVE = 'PB'
ANALYSIS_STATUS_WAITING_FOR_DATA='Q'
ANALYSIS_STATUS_LOADING_FAILED = 'F'
SOLVED_ANALYSIS_STATUS_CHOICES = (
('S', 'Solved'),
('S_kgfp', 'Solved - known gene for phenotype'),
Expand All @@ -308,6 +309,7 @@ class Family(ModelWithGUID):
(ANALYSIS_STATUS_PARTIAL_SOLVE, 'Partial Solve - Analysis in Progress'),
(ANALYSIS_STATUS_ANALYSIS_IN_PROGRESS, 'Analysis in Progress'),
(ANALYSIS_STATUS_WAITING_FOR_DATA, 'Waiting for data'),
(ANALYSIS_STATUS_LOADING_FAILED, 'Loading failed'),
('N', 'No data expected'),
)
SOLVED_ANALYSIS_STATUSES = [status for status, _ in SOLVED_ANALYSIS_STATUS_CHOICES]
Expand Down
3 changes: 2 additions & 1 deletion seqr/views/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def match_and_update_search_samples(
updated_samples = Sample.objects.filter(guid__in=activated_sample_guids)

family_guids_to_update = [
family_guid for family_guid, analysis_status in included_families.items() if analysis_status == Family.ANALYSIS_STATUS_WAITING_FOR_DATA
family_guid for family_guid, analysis_status in included_families.items()
if analysis_status in {Family.ANALYSIS_STATUS_WAITING_FOR_DATA, Family.ANALYSIS_STATUS_LOADING_FAILED}
]
Family.bulk_update(
user, {'analysis_status': Family.ANALYSIS_STATUS_ANALYSIS_IN_PROGRESS}, guid__in=family_guids_to_update)
Expand Down
2 changes: 2 additions & 0 deletions ui/shared/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const FAMILY_STATUS_CLOSED = 'C'
const FAMILY_STATUS_PARTIAL_SOLVE = 'P'
const FAMILY_STATUS_ANALYSIS_IN_PROGRESS = 'I'
const FAMILY_STATUS_WAITING_FOR_DATA = 'Q'
const FAMILY_STATUS_LOADING_FAILED = 'F'
const FAMILY_STATUS_NO_DATA = 'N'

const DEPRECATED_FAMILY_ANALYSIS_STATUS_OPTIONS = [
Expand All @@ -184,6 +185,7 @@ export const SELECTABLE_FAMILY_ANALYSIS_STATUS_OPTIONS = [
{ value: FAMILY_STATUS_PARTIAL_SOLVE, color: '#288582', name: 'Partial Solve - Analysis in Progress' },
{ value: FAMILY_STATUS_ANALYSIS_IN_PROGRESS, color: '#4682B4', name: 'Analysis in Progress' },
{ value: FAMILY_STATUS_WAITING_FOR_DATA, color: '#FFC107', name: 'Waiting for data' },
{ value: FAMILY_STATUS_LOADING_FAILED, color: '#ba4c12', name: 'Loading failed' },
{ value: FAMILY_STATUS_NO_DATA, color: '#646464', name: 'No data expected' },
]
export const ALL_FAMILY_ANALYSIS_STATUS_OPTIONS = [
Expand Down

0 comments on commit 4be5729

Please sign in to comment.