feat: 添加paper字段
This commit is contained in:
parent
be6a75bd45
commit
c39fd7d990
|
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 4.2.27 on 2026-01-26 06:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('resm', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='paper',
|
||||
name='has_abstract_xml',
|
||||
field=models.BooleanField(db_index=True, default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='paper',
|
||||
name='has_fulltext_pdf',
|
||||
field=models.BooleanField(db_index=True, default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='paper',
|
||||
name='has_fulltext_xml',
|
||||
field=models.BooleanField(db_index=True, default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='paper',
|
||||
name='search_word_first',
|
||||
field=models.TextField(default='cement'),
|
||||
),
|
||||
]
|
||||
|
|
@ -21,7 +21,10 @@ class Paper(BaseModel):
|
|||
oa_url = models.TextField(null=True, blank=True)
|
||||
# ===== 状态位(调度核心)=====
|
||||
has_abstract = models.BooleanField(default=False, db_index=True)
|
||||
has_abstract_xml = models.BooleanField(default=False, db_index=True)
|
||||
has_fulltext = models.BooleanField(default=False, db_index=True)
|
||||
has_fulltext_xml = models.BooleanField(default=False, db_index=True)
|
||||
has_fulltext_pdf = models.BooleanField(default=False, db_index=True)
|
||||
fetch_status = models.CharField(
|
||||
max_length=20,
|
||||
default="meta_only", # meta_only / abstract_ready / fulltext_ready / parsed / failed
|
||||
|
|
@ -38,6 +41,7 @@ class Paper(BaseModel):
|
|||
default="openalex",
|
||||
verbose_name="元数据来源"
|
||||
)
|
||||
search_word_first = models.TextField(default="cement")
|
||||
|
||||
class PaperAbstract(BaseModel):
|
||||
paper = models.OneToOneField(
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ def get_paper_meta_from_openalex(publication_year:int, search_key:str):
|
|||
if record["doi"] and (record["display_name"] or record["title"]):
|
||||
paper = Paper()
|
||||
paper.id = idWorker.get_id()
|
||||
paper.search_word_first = search_key
|
||||
paper.source = "openalex"
|
||||
paper.type = "article"
|
||||
paper.openalex_id = record["id"].split("/")[-1]
|
||||
paper.doi = record["doi"].replace("https://doi.org/", "")
|
||||
|
|
@ -51,3 +53,9 @@ def get_paper_meta_from_openalex(publication_year:int, search_key:str):
|
|||
papers.append(paper)
|
||||
Paper.objects.bulk_create(papers, ignore_conflicts=True)
|
||||
cache.set(cache_key, next_cursor, timeout=None)
|
||||
|
||||
|
||||
ELSEVIER_APIKEY = 'aa8868cac9e27d6153ab0a0acd7b50bf'
|
||||
@shared_task(base=CustomTask)
|
||||
def get_abstract_from_elsevier(publication_year:int):
|
||||
pass
|
||||
Loading…
Reference in New Issue