-
Notifications
You must be signed in to change notification settings - Fork 20
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 #1601 from ResearchHub/author/structure
Setting up structure for authorship
- Loading branch information
Showing
8 changed files
with
284 additions
and
5 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,68 @@ | ||
# Generated by Django 4.1 on 2024-05-17 01:59 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user", "0104_author_country_code_author_i10_index"), | ||
("institution", "0004_institution_openalex_created_date_and_more"), | ||
("paper", "0123_paper_is_retracted_paper_language_paper_mag_id_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="WorkAuthorship", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created_date", models.DateTimeField(auto_now_add=True)), | ||
("updated_date", models.DateTimeField(auto_now=True)), | ||
( | ||
"author_position", | ||
models.CharField( | ||
choices=[ | ||
("first", "First"), | ||
("middle", "Middle"), | ||
("last", "Last"), | ||
], | ||
max_length=10, | ||
), | ||
), | ||
("is_corresponding", models.BooleanField(default=False)), | ||
( | ||
"raw_author_name", | ||
models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="authorships", | ||
to="user.author", | ||
), | ||
), | ||
( | ||
"institutions", | ||
models.ManyToManyField( | ||
blank=True, | ||
null=True, | ||
related_name="authors", | ||
to="institution.institution", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
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,32 @@ | ||
# Generated by Django 4.1 on 2024-05-17 11:35 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("institution", "0004_institution_openalex_created_date_and_more"), | ||
("paper", "0124_workauthorship"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="workauthorship", | ||
name="work", | ||
field=models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="authorships", | ||
to="paper.paper", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="workauthorship", | ||
name="institutions", | ||
field=models.ManyToManyField( | ||
related_name="authors", to="institution.institution" | ||
), | ||
), | ||
] |
77 changes: 77 additions & 0 deletions
77
src/paper/migrations/0126_authorship_delete_workauthorship.py
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,77 @@ | ||
# Generated by Django 4.1 on 2024-05-17 20:03 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user", "0105_remove_author_academic_verification_and_more"), | ||
("institution", "0004_institution_openalex_created_date_and_more"), | ||
("paper", "0125_workauthorship_work_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Authorship", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created_date", models.DateTimeField(auto_now_add=True)), | ||
("updated_date", models.DateTimeField(auto_now=True)), | ||
( | ||
"author_position", | ||
models.CharField( | ||
choices=[ | ||
("first", "First"), | ||
("middle", "Middle"), | ||
("last", "Last"), | ||
], | ||
max_length=10, | ||
), | ||
), | ||
("is_corresponding", models.BooleanField(default=False)), | ||
( | ||
"raw_author_name", | ||
models.CharField(blank=True, max_length=255, null=True), | ||
), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="authorships", | ||
to="user.author", | ||
), | ||
), | ||
( | ||
"institutions", | ||
models.ManyToManyField( | ||
related_name="authors", to="institution.institution" | ||
), | ||
), | ||
( | ||
"paper", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="authorships", | ||
to="paper.paper", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
migrations.DeleteModel( | ||
name="WorkAuthorship", | ||
), | ||
] |
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,51 @@ | ||
from django.db import models | ||
|
||
from utils.models import DefaultModel | ||
|
||
|
||
class Authorship(DefaultModel): | ||
FIRST_AUTHOR_POSITION = "first" | ||
MIDDLE_AUTHOR_POSITION = "middle" | ||
LAST_AUTHOR_POSITION = "last" | ||
|
||
POSITION_CHOICES = [ | ||
(FIRST_AUTHOR_POSITION, "First"), | ||
(MIDDLE_AUTHOR_POSITION, "Middle"), | ||
(LAST_AUTHOR_POSITION, "Last"), | ||
] | ||
|
||
institutions = models.ManyToManyField( | ||
"institution.Institution", | ||
related_name="authors", | ||
) | ||
|
||
paper = models.ForeignKey( | ||
"paper.paper", | ||
on_delete=models.CASCADE, | ||
related_name="authorships", | ||
blank=False, | ||
null=True, | ||
) | ||
|
||
author = models.ForeignKey( | ||
"user.Author", | ||
on_delete=models.CASCADE, | ||
related_name="authorships", | ||
) | ||
|
||
author_position = models.CharField( | ||
max_length=10, | ||
choices=POSITION_CHOICES, | ||
null=False, | ||
blank=False, | ||
) | ||
|
||
is_corresponding = models.BooleanField( | ||
default=False, | ||
) | ||
|
||
raw_author_name = models.CharField( | ||
max_length=255, | ||
null=True, | ||
blank=True, | ||
) |
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
23 changes: 23 additions & 0 deletions
23
src/user/migrations/0104_author_country_code_author_i10_index.py
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,23 @@ | ||
# Generated by Django 4.1 on 2024-05-17 01:52 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user", "0103_remove_author_linkedin_data"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="author", | ||
name="country_code", | ||
field=models.CharField(blank=True, max_length=20, null=True), | ||
), | ||
migrations.AddField( | ||
model_name="author", | ||
name="i10_index", | ||
field=models.IntegerField(default=0), | ||
), | ||
] |
25 changes: 25 additions & 0 deletions
25
src/user/migrations/0105_remove_author_academic_verification_and_more.py
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,25 @@ | ||
# Generated by Django 4.1 on 2024-05-17 02:03 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("user", "0104_author_country_code_author_i10_index"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="author", | ||
name="academic_verification", | ||
), | ||
migrations.RemoveField( | ||
model_name="author", | ||
name="merged_with", | ||
), | ||
migrations.RemoveField( | ||
model_name="author", | ||
name="orcid_account", | ||
), | ||
] |
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