Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving import of embargoed studies #354

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading