"""种子数据:对接《全球材料前沿动态简报》三、前沿科技 检索清单,补充期刊 / 关键词监控。 简报已列但 0009 已收录的期刊(Ceramics International / CCR / CCC / Construction and Building Materials)不重复添加;此处只补简报新增项: - 一级检索源(Nature/Science 系顶刊):Nature Materials、Nature Communications、 Communications Materials、Science Advances、Nature Reviews Materials、Scientific Reports - 二级检索源补充(建材 TOP):Engineering Structures、Materials Today - 统一检索关键词(简报第三节):低碳水泥 / 储能建材 / 碳化机理 / 固废基胶凝 / 建材碳捕集 等 (OpenAlex 语料为英文,故 value 用英文搜索词,name 标中文) 期刊监控只按 ISSN 过滤、不带主题词,Nature Communications / Scientific Reports 等综合性 大刊会拉入非建材论文;简报要求的"建材主题 + TOP5 筛选"需在下游按关键词二次筛选,本表不承担。 全部复用每天 05:00 的 monitor_papers 周期任务(0009 已注册),无需新增调度。 get_or_create 保证迁移可安全重跑。 """ from django.db import migrations from apps.utils.snowflake import idWorker # 一级检索源:Nature/Science 系材料类顶刊(简报「前沿科技」一级) JOURNALS_TIER1 = [ ("1476-1122", "Nature Materials"), ("2041-1723", "Nature Communications"), ("2662-4443", "Communications Materials"), ("2375-2548", "Science Advances"), ("2058-8437", "Nature Reviews Materials"), ("2045-2322", "Scientific Reports"), ] NOTE_TIER1 = "前沿顶刊" # 二级检索源补充:建材 / 无机非金属国际 TOP(简报已列、0009 未收录的) JOURNALS_TIER2 = [ ("0141-0296", "Engineering Structures"), ("1369-7021", "Materials Today"), ] NOTE_TIER2 = "建材TOP顶刊" # 统一检索关键词(简报第三节,英文搜索词 + 中文名) SEARCHES = [ ("low carbon cement", "低碳水泥"), ("energy storage building material", "储能建筑材料"), ("concrete carbonation", "混凝土碳化机理"), ("geopolymer", "工业固废基地聚物"), ("supplementary cementitious material", "固废基胶凝材料"), ("carbon capture cement", "建材碳捕集"), ] NOTE_SEARCH = "低碳建材前沿" def seed(apps, schema_editor): PaperMonitor = apps.get_model("resm", "PaperMonitor") for issn, name in JOURNALS_TIER1: PaperMonitor.objects.get_or_create( type="journal", value=issn, defaults={"id": idWorker.get_id(), "name": name, "note": NOTE_TIER1, "is_active": True, "days": 7}, ) for issn, name in JOURNALS_TIER2: PaperMonitor.objects.get_or_create( type="journal", value=issn, defaults={"id": idWorker.get_id(), "name": name, "note": NOTE_TIER2, "is_active": True, "days": 7}, ) for term, name in SEARCHES: PaperMonitor.objects.get_or_create( type="search", value=term, defaults={"id": idWorker.get_id(), "name": name, "note": NOTE_SEARCH, "is_active": True, "days": 7}, ) def unseed(apps, schema_editor): PaperMonitor = apps.get_model("resm", "PaperMonitor") journals = [i for i, _ in JOURNALS_TIER1] + [i for i, _ in JOURNALS_TIER2] PaperMonitor.objects.filter(type="journal", value__in=journals).delete() PaperMonitor.objects.filter(type="search", value__in=[t for t, _ in SEARCHES]).delete() class Migration(migrations.Migration): dependencies = [ ("resm", "0010_seed_ensure_fetch_running"), ] operations = [ migrations.RunPython(seed, unseed), ]