Skip to content

Commit

Permalink
Merge pull request PGScatalog#354 from fyvon/improve/embargoed_import
Browse files Browse the repository at this point in the history
Improving import of embargoed studies
  • Loading branch information
fyvon authored Apr 23, 2024
2 parents d8515ff + 16a625c commit b3c15d8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
6 changes: 5 additions & 1 deletion curation/imports/curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ def run_curation_import(self):
self.failed_studies[study_import.study_name] = 'curation tracker error'

if curation_pub != None:
curation_pub.curation_status = 'Imported - Awaiting Release'
curation_pub.pgp_id = study_import.study_publication.id
if study_import.study_publication.curation_status == 'E':
curation_pub.curation_status = 'Embargo Imported - Awaiting Publication'
else:
curation_pub.curation_status = 'Imported - Awaiting Release'
curation_pub.save()
print(" > Curation status updated in the Curation Tracker")

Expand Down
4 changes: 2 additions & 2 deletions curation_tracker/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def save_model(self, request, obj, form, change):

# Desembargo the study
if obj.embargoed == False and (not db_obj or db_obj.embargoed == True):
if obj.curation_status == 'Embargo Imported - Awaiting Release':
if obj.curation_status == 'Embargo Imported - Awaiting Publication':
if obj.doi or obj.PMID:
obj.curation_status = 'Imported - Awaiting Release'
elif obj.curation_status == 'Embargo Curated - Awaiting Import':
Expand All @@ -465,7 +465,7 @@ def save_model(self, request, obj, form, change):
if obj.curation_status == 'Curated - Awaiting Import':
obj.curation_status = 'Embargo Curated - Awaiting Import'
elif obj.curation_status == 'Imported - Awaiting Release':
obj.curation_status == 'Embargo Imported - Awaiting Release'
obj.curation_status = 'Embargo Imported - Awaiting Publication'

# Eligibility - part 2
if obj.curation_status == 'Abandoned/Ineligible':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.10 on 2024-04-19 14:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('curation_tracker', '0004_emailtemplate'),
]

operations = [
migrations.AlterField(
model_name='curationpublicationannotation',
name='curation_status',
field=models.CharField(blank=True, choices=[('Abandoned/Ineligible', 'Abandoned/Ineligible'), ('Pending author response', 'Pending author response'), ('Awaiting L1', 'Awaiting L1'), ('Awaiting L2', 'Awaiting L2'), ('Curated - Awaiting Import', 'Curated - Awaiting Import'), ('Imported - Awaiting Release', 'Imported - Awaiting Release'), ('Released', 'Released'), ('Embargo Curated - Awaiting Import', 'Embargo Curated - Awaiting Import'), ('Embargo Imported - Awaiting Publication', 'Embargo Imported - Awaiting Publication'), ('Embargo Lifted - Awaiting Release', 'Embargo Lifted - Awaiting Release'), ('Retired', 'Retired')], default='Awaiting L1', max_length=50, null=True, verbose_name='Curation Status'),
),
]
2 changes: 1 addition & 1 deletion curation_tracker/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CurationPublicationAnnotation(models.Model):
('Imported - Awaiting Release','Imported - Awaiting Release'),
('Released','Released'),
('Embargo Curated - Awaiting Import','Embargo Curated - Awaiting Import'),
('Embargo Imported - Awaiting Release','Embargo Imported - Awaiting Release'),
('Embargo Imported - Awaiting Publication','Embargo Imported - Awaiting Publication'),
('Embargo Lifted - Awaiting Release','Embargo Lifted - Awaiting Release'),
('Retired','Retired')
]
Expand Down
4 changes: 2 additions & 2 deletions curation_tracker/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def browse_release_ready(request):
import_ready = CurationPublicationAnnotation.objects.using(curation_tracker).filter(curation_status='Curated - Awaiting Import')
context['table_to_import'] = Browse_CurationPublicationAnnotationReleaseReady(import_ready)

release_ready_count = CurationPublicationAnnotation.objects.using(curation_tracker).filter(curation_status='Imported - Awaiting Release').count()
release_ready_count = CurationPublicationAnnotation.objects.using(curation_tracker).filter(curation_status__in=('Imported - Awaiting Release', 'Embargo Lifted - Awaiting Release')).count()
context['studies_to_release_count'] = release_ready_count
if release_ready_count:
release_ready = CurationPublicationAnnotation.objects.using(curation_tracker).filter(curation_status='Imported - Awaiting Release')
release_ready = CurationPublicationAnnotation.objects.using(curation_tracker).filter(curation_status__in=('Imported - Awaiting Release', 'Embargo Lifted - Awaiting Release'))
context['table_to_release'] = Browse_CurationPublicationAnnotationReleaseReady(release_ready)

if context:
Expand Down
2 changes: 1 addition & 1 deletion release/scripts/run_release_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def update_curation_tracker():
curation_pub.pgp_id = pgp_id
print(' - Updating curation_status on the Curation Tracker')
if publication.curation_status == 'E':
curation_pub.curation_status = 'Embargo Imported - Awaiting Release'
curation_pub.curation_status = 'Embargo Imported - Awaiting Publication'
else:
curation_pub.curation_status = 'Released'
curation_pub.release_date = new_release_date
Expand Down

0 comments on commit b3c15d8

Please sign in to comment.