-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4110 from broadinstitute/dev
Dev
- Loading branch information
Showing
59 changed files
with
1,277 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Generated by Django 3.2.25 on 2024-05-02 17:45 | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
from seqr.models import _slugify | ||
|
||
MAX_GUID_SIZE = 30 | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('seqr', '0063_dynamicanalysisgroup'), | ||
] | ||
|
||
def update_guids(apps, schema_editor): | ||
PhenotypePrioritization = apps.get_model('seqr', 'PhenotypePrioritization') | ||
db_alias = schema_editor.connection.alias | ||
pps = PhenotypePrioritization.objects.using(db_alias).all() | ||
individual_id_map = dict(pps.values_list('id', 'individual__individual_id')) | ||
for pp in pps: | ||
ids_as_str = "%s:%s:%s" % (individual_id_map[pp.id], pp.gene_id, pp.disease_id) | ||
pp.guid = 'PP%07d_%s' % (pp.id, _slugify(str(ids_as_str)))[:MAX_GUID_SIZE] | ||
PhenotypePrioritization.objects.using(db_alias).bulk_update(pps, ['guid'], batch_size=1000) | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='phenotypeprioritization', | ||
name='created_by', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='phenotypeprioritization', | ||
name='created_date', | ||
field=models.DateTimeField(db_index=True, default=django.utils.timezone.now), | ||
), | ||
migrations.AddField( | ||
model_name='phenotypeprioritization', | ||
name='guid', | ||
field=models.CharField(default='', max_length=30), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='phenotypeprioritization', | ||
name='last_modified_date', | ||
field=models.DateTimeField(blank=True, db_index=True, null=True), | ||
), | ||
migrations.RunPython(update_guids, reverse_code=migrations.RunPython.noop), | ||
# Add uniqueness constraint to guid after default is replaced by update_guids | ||
migrations.AlterField( | ||
model_name='phenotypeprioritization', | ||
name='guid', | ||
field=models.CharField(db_index=True, unique=True, max_length=30), | ||
), | ||
] |
Oops, something went wrong.