-
Notifications
You must be signed in to change notification settings - Fork 24
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 #1617 from ResearchHub/revisions
Paper revisions
- Loading branch information
Showing
8 changed files
with
385 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,359 @@ | ||
# Generated by Django 4.2.13 on 2024-06-04 17:36 | ||
|
||
from django.conf import settings | ||
import django.contrib.postgres.search | ||
import django.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import simple_history.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("summary", "0014_alter_summary_summary"), | ||
("researchhub_document", "0058_researchhubunifieddocument_topics"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("paper", "0126_authorship_delete_workauthorship"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="HistoricalPaper", | ||
fields=[ | ||
( | ||
"id", | ||
models.IntegerField( | ||
auto_created=True, blank=True, db_index=True, verbose_name="ID" | ||
), | ||
), | ||
("created_date", models.DateTimeField(blank=True, editable=False)), | ||
("updated_date", models.DateTimeField(blank=True, editable=False)), | ||
("score", models.IntegerField(default=0)), | ||
( | ||
"is_public", | ||
models.BooleanField( | ||
default=True, help_text="Hides the paper from the public." | ||
), | ||
), | ||
( | ||
"is_removed", | ||
models.BooleanField( | ||
default=False, | ||
help_text="Hides the paper because it is not allowed.", | ||
), | ||
), | ||
( | ||
"is_removed_by_user", | ||
models.BooleanField( | ||
default=False, | ||
help_text="Hides the paper because it is not allowed.", | ||
), | ||
), | ||
( | ||
"is_pdf_removed_by_moderator", | ||
models.BooleanField( | ||
default=False, | ||
help_text="Hides the PDF because it infringes Copyright.", | ||
), | ||
), | ||
("bullet_low_quality", models.BooleanField(default=False)), | ||
("summary_low_quality", models.BooleanField(default=False)), | ||
("discussion_count", models.IntegerField(db_index=True, default=0)), | ||
("views", models.IntegerField(default=0)), | ||
("downloads", models.IntegerField(default=0)), | ||
("citations", models.IntegerField(default=0)), | ||
("open_alex_raw_json", models.JSONField(blank=True, null=True)), | ||
("automated_bounty_created", models.BooleanField(default=False)), | ||
( | ||
"file", | ||
models.TextField( | ||
blank=True, | ||
default=None, | ||
max_length=512, | ||
null=True, | ||
validators=[ | ||
django.core.validators.FileExtensionValidator(["pdf"]) | ||
], | ||
), | ||
), | ||
( | ||
"pdf_file_extract", | ||
models.TextField( | ||
blank=True, default=None, max_length=512, null=True | ||
), | ||
), | ||
( | ||
"edited_file_extract", | ||
models.TextField( | ||
blank=True, default=None, max_length=512, null=True | ||
), | ||
), | ||
( | ||
"file_created_location", | ||
models.CharField( | ||
blank=True, | ||
choices=[("PROGRESS", "Progress")], | ||
default=None, | ||
max_length=255, | ||
null=True, | ||
), | ||
), | ||
("retrieved_from_external_source", models.BooleanField(default=False)), | ||
( | ||
"is_open_access", | ||
models.BooleanField(blank=True, default=None, null=True), | ||
), | ||
( | ||
"oa_status", | ||
models.CharField(blank=True, default=None, max_length=8, null=True), | ||
), | ||
( | ||
"external_source", | ||
models.CharField( | ||
blank=True, default=None, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"paper_type", | ||
models.CharField( | ||
choices=[ | ||
("REGULAR", "REGULAR"), | ||
("PRE_REGISTRATION", "PRE_REGISTRATION"), | ||
], | ||
default="REGULAR", | ||
max_length=32, | ||
), | ||
), | ||
( | ||
"completeness", | ||
models.CharField( | ||
choices=[ | ||
("COMPLETE", "COMPLETE"), | ||
("PARTIAL", "PARTIAL"), | ||
("INCOMPLETE", "INCOMPLETE"), | ||
], | ||
default="INCOMPLETE", | ||
max_length=16, | ||
), | ||
), | ||
("title", models.CharField(max_length=1024)), | ||
( | ||
"tagline", | ||
models.CharField( | ||
blank=True, default=None, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"doi", | ||
models.CharField( | ||
blank=True, | ||
db_index=True, | ||
default=None, | ||
max_length=255, | ||
null=True, | ||
), | ||
), | ||
("alternate_ids", models.JSONField(blank=True, default=dict)), | ||
( | ||
"paper_title", | ||
models.CharField( | ||
blank=True, default=None, max_length=1024, null=True | ||
), | ||
), | ||
("paper_publish_date", models.DateField(blank=True, null=True)), | ||
("raw_authors", models.JSONField(blank=True, null=True)), | ||
("abstract", models.TextField(blank=True, default=None, null=True)), | ||
( | ||
"abstract_src", | ||
models.TextField( | ||
blank=True, | ||
default=None, | ||
help_text="\n Abstract_src is different field than abstract field.\n Abstract is legacy text field where as abstract_src field is a src field that is\n intended to be used along with different types of text editors from the frontend.\n ", | ||
max_length=512, | ||
null=True, | ||
), | ||
), | ||
( | ||
"abstract_src_type", | ||
models.CharField( | ||
choices=[ | ||
("CK_EDITOR", "CK_EDITOR"), | ||
("DRAFT_JS", "DRAFT_JS"), | ||
("TEXT_FIELD", "TEXT_FIELD"), | ||
], | ||
default="TEXT_FIELD", | ||
help_text="Indicates which text editor was used for abstract section.", | ||
max_length=32, | ||
null=True, | ||
), | ||
), | ||
( | ||
"publication_type", | ||
models.CharField( | ||
blank=True, default=None, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"url", | ||
models.URLField( | ||
blank=True, | ||
db_index=True, | ||
default=None, | ||
max_length=1024, | ||
null=True, | ||
), | ||
), | ||
( | ||
"pdf_url", | ||
models.URLField( | ||
blank=True, default=None, max_length=1024, null=True | ||
), | ||
), | ||
( | ||
"pdf_license", | ||
models.CharField( | ||
blank=True, default=None, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"pdf_license_url", | ||
models.URLField( | ||
blank=True, default=None, max_length=1024, null=True | ||
), | ||
), | ||
( | ||
"csl_item", | ||
models.JSONField( | ||
blank=True, | ||
default=None, | ||
help_text="bibliographic metadata as a single Citation Styles Language JSON item.", | ||
null=True, | ||
), | ||
), | ||
( | ||
"oa_pdf_location", | ||
models.JSONField( | ||
blank=True, | ||
default=None, | ||
help_text="PDF availability in Unpaywall OA Location format.", | ||
null=True, | ||
), | ||
), | ||
("external_metadata", models.JSONField(blank=True, null=True)), | ||
( | ||
"slug", | ||
models.SlugField( | ||
blank=True, | ||
help_text="Slug is automatically generated on a signal, so it is not needed in a form", | ||
max_length=1024, | ||
), | ||
), | ||
( | ||
"url_svf", | ||
django.contrib.postgres.search.SearchVectorField( | ||
blank=True, null=True | ||
), | ||
), | ||
( | ||
"pdf_url_svf", | ||
django.contrib.postgres.search.SearchVectorField( | ||
blank=True, null=True | ||
), | ||
), | ||
( | ||
"doi_svf", | ||
django.contrib.postgres.search.SearchVectorField( | ||
blank=True, null=True | ||
), | ||
), | ||
("work_type", models.CharField(blank=True, max_length=100, null=True)), | ||
( | ||
"openalex_id", | ||
models.CharField( | ||
blank=True, db_index=True, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"pubmed_id", | ||
models.CharField( | ||
blank=True, db_index=True, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"pubmed_central_id", | ||
models.CharField( | ||
blank=True, db_index=True, max_length=255, null=True | ||
), | ||
), | ||
( | ||
"mag_id", | ||
models.CharField( | ||
blank=True, db_index=True, max_length=255, null=True | ||
), | ||
), | ||
("is_retracted", models.BooleanField(blank=True, null=True)), | ||
("language", models.CharField(blank=True, max_length=10, null=True)), | ||
("history_id", models.AutoField(primary_key=True, serialize=False)), | ||
("history_date", models.DateTimeField(db_index=True)), | ||
("history_change_reason", models.CharField(max_length=100, null=True)), | ||
( | ||
"history_type", | ||
models.CharField( | ||
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")], | ||
max_length=1, | ||
), | ||
), | ||
( | ||
"history_user", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
( | ||
"summary", | ||
models.ForeignKey( | ||
blank=True, | ||
db_constraint=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="+", | ||
to="summary.summary", | ||
), | ||
), | ||
( | ||
"unified_document", | ||
models.ForeignKey( | ||
blank=True, | ||
db_constraint=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="+", | ||
to="researchhub_document.researchhubunifieddocument", | ||
), | ||
), | ||
( | ||
"uploaded_by", | ||
models.ForeignKey( | ||
blank=True, | ||
db_constraint=False, | ||
help_text="RH User account that submitted this paper. NOTE: user didnt necessarily had to be the author", | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="+", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "historical paper", | ||
"verbose_name_plural": "historical papers", | ||
"ordering": ("-history_date", "-history_id"), | ||
"get_latest_by": ("history_date", "history_id"), | ||
}, | ||
bases=(simple_history.models.HistoricalChanges, models.Model), | ||
), | ||
] |
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
Oops, something went wrong.