diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be4e08..05b5728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.16.1 + +- Ручные основания больше не возвращают книги и другие недопущенные виды в предварительные счётчики совета. Дополнительные виды учитываются только при подтверждённой разрешающей политике и согласованном виде материала. +- Повреждение одного квартильного каталога не блокирует метрики исправного второго. Общее предупреждение о снимке отделено от проблем конкретной публикации; страница и XLSX сохраняют доступные проверенные сведения. + ## 0.16.0 - Проверка публикационных критериев совета расширена на кандидатов наук и PhD. Выбирается высшая степень из истории; сотрудники без публикаций остаются видимыми. Добавлены дата ходатайства, отрасль оценки, пороги пунктов 5–6 и отдельный минимум монографий. diff --git a/README.md b/README.md index 7eb9277..4811e5a 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ node --check app/static/admin.js Тесты с данными используют временную SQLite; отдельные API smoke-тесты запускают приложение с его текущей конфигурацией. Браузерная проверка: `pip install playwright`, `python -m playwright install chromium`, затем `python tests/browser_admin.py`. Она проверяет реальный рендеринг страниц, клавиатуру, диалог, фильтры и восстановление прогресса после ошибки. Скриншоты сохраняются во временную папку; путь выводится в конце. -Версия сервиса: `0.16.0`. Админка всегда показывает версии backend и frontend в footer. +Версия сервиса: `0.16.1`. Админка всегда показывает версии backend и frontend в footer. ## Разовый импорт публикаций diff --git a/app/services/council.py b/app/services/council.py index 821ec41..cb87051 100644 --- a/app/services/council.py +++ b/app/services/council.py @@ -19,7 +19,10 @@ from app.models import Employee from app.services.academic_degrees import academic_degrees from app.services.council_source import _doi, _journal_names, _name, _quartiles, load_reference from app.services.council_catalog import catalog, publication_catalog -from app.services.council_assessment import BRANCHES, assess_candidate, degree_level, evidence, iso_date, publication_proofs +from app.services.council_assessment import ( + BRANCHES, assess_candidate, degree_level, evidence, iso_date, publication_proofs, + publication_type_allowed, sourced, +) EXPORT = Path(__file__).resolve().parents[1] / "data" / "council_articles.json" @@ -259,6 +262,13 @@ def council_candidates(db: Session, today: date | None = None, q: str = "", offs articles = _unique_articles([*csv_articles, *(_database_article(p) for p in employee.publications)], start, end) for article in articles: proofs = publication_proofs(employee_evidence, article) + kinds = {proof["kind"] for proof in proofs if proof.get("kind") and sourced(proof.get("kind_evidence"))} + kind = next(iter(kinds)) if len(kinds) == 1 else None + preliminary_type_allowed = len(kinds) <= 1 and publication_type_allowed( + article["types"], kind, verified.get("policy", {}), preliminary=True) + if not preliminary_type_allowed: + for flag in ("q1", "q2", "k1", "k2", "rsci"): + article[flag] = False identifiers = [*article["issns"], *(value for proof in proofs for value in proof.get("issns", []))] for name in article["journals"]: canonical = _k1_journals().get(_journal_key(name)) @@ -266,9 +276,11 @@ def council_candidates(db: Session, today: date | None = None, q: str = "", offs article["catalog_records"], article["catalog_issues"] = publication_catalog(identifiers, article["journals"], specialty) for record in article["catalog_records"]: for metric in record["metrics"]: - if article["year"] == metric["year"] and start.year <= article["year"] <= end.year and metric["quartile"] in {"Q1", "Q2"} and not article["catalog_issues"] and (not article["types"] or article["types"] == ["Статья"]): + if article["year"] == metric["year"] and start.year <= article["year"] <= end.year and metric["quartile"] in {"Q1", "Q2"} and not article["catalog_issues"] and preliminary_type_allowed: article[metric["quartile"].lower()] = True for proof in proofs: + if not preliminary_type_allowed: + continue for basis in proof.get("bases", []): if not isinstance(basis, dict) or basis.get("applicable_year") != article["year"] or article["year"] is None or not start.year <= article["year"] <= end.year: continue diff --git a/app/services/council_assessment.py b/app/services/council_assessment.py index 356fb71..4cd2e48 100644 --- a/app/services/council_assessment.py +++ b/app/services/council_assessment.py @@ -21,6 +21,8 @@ for names, minimum, monographs in [ for name in names.split("|"): BRANCHES[name] = (minimum, monographs) SYSTEMS = {"Web of Science", "Scopus", "PubMed", "MathSciNet", "zbMATH", "Chemical Abstracts", "Springer", "GeoRef"} +TYPE_LABELS = {"article": "Статья", "monograph": "Книга", "book": "Книга", "chapter": "Глава книги", + "report": "Доклад", "patent": "Патент", "preprint": "Препринт", "conference_paper": "Материал конференции"} def iso_date(value): @@ -39,6 +41,17 @@ def sourced(record): return True +def publication_type_allowed(types, kind, policy, *, preliminary=False): + if kind is None: + return preliminary and (not types or types == ["Статья"]) + if types and types != [TYPE_LABELS.get(kind)]: + return False + if kind == "article": + return True + admitted = policy.get("publication_types", {}) + return sourced(admitted) and kind in admitted.get("values", []) + + def degree_level(degree): if re.fullmatch(r"доктор\b.+\bнаук", degree, re.I): return 2 @@ -144,17 +157,12 @@ def assess_article(article, proofs, start, end, level, branch, specialty, policy if len(types) != 1: reasons.append("Вид материала не подтверждён или расходится") kind = next(iter(types)) if len(types) == 1 else None - type_labels = {"article": "Статья", "monograph": "Книга", "book": "Книга", "chapter": "Глава книги", - "report": "Доклад", "patent": "Патент", "preprint": "Препринт", "conference_paper": "Материал конференции"} - type_conflict = len(types) > 1 or bool(article["types"] and kind and article["types"] != [type_labels.get(kind)]) + type_conflict = len(types) > 1 or bool(article["types"] and kind and article["types"] != [TYPE_LABELS.get(kind)]) if type_conflict: reasons.append("Виды материала в источниках расходятся") - eligible_kind = kind == "article" - if kind and kind != "article": - admissible = policy.get("publication_types", {}) - eligible_kind = sourced(admissible) and kind in admissible.get("values", []) - if not eligible_kind: - reasons.append("Зачёт этого вида материала в общий минимум не подтверждён") + eligible_kind = publication_type_allowed(article["types"], kind, policy) + if kind and kind != "article" and not eligible_kind: + reasons.append("Зачёт этого вида материала в общий минимум не подтверждён") bases = [] basis_year = exact.year if exact else article["year"] for proof in proofs: diff --git a/app/services/council_catalog.py b/app/services/council_catalog.py index ece4e38..d859fa2 100644 --- a/app/services/council_catalog.py +++ b/app/services/council_catalog.py @@ -142,7 +142,9 @@ def catalog(): def publication_catalog(identifiers, names, specialty=""): data = catalog() matches = set().union(*(data["by_issn"].get(issn(value), set()) for value in identifiers)) - issues = list(data["issues"]) + # Snapshot failures are reported once in the assessment context. Only + # problems with this journal may prevent use of its validated metrics. + issues = [] if len(matches) > 1: return [], [*issues, "ISSN указывают на разные журналы — требуется проверка"] records = data["journals"].get(next(iter(matches)), []) if matches else [] diff --git a/app/version.py b/app/version.py index 4f53a4a..7328ad1 100644 --- a/app/version.py +++ b/app/version.py @@ -1,3 +1,3 @@ -APP_VERSION = "0.16.0" -FRONTEND_VERSION = "0.16.0" -BACKEND_VERSION = "0.16.0" +APP_VERSION = "0.16.1" +FRONTEND_VERSION = "0.16.1" +BACKEND_VERSION = "0.16.1" diff --git a/pyproject.toml b/pyproject.toml index fc97ea1..dfd5aaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "miem-workers" -version = "0.16.0" +version = "0.16.1" description = "MIEM employees parser, admin API, and web admin" requires-python = ">=3.11" dependencies = [ diff --git a/tests/test_api.py b/tests/test_api.py index d44f02e..7bcf02e 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -18,7 +18,7 @@ def test_health_returns_versions(): response = TestClient(app).get("/api/health") assert response.status_code == 200 - assert response.json()["backend_version"] == "0.16.0" + assert response.json()["backend_version"] == "0.16.1" def test_api_employees_and_stats_require_admin_session(): diff --git a/tests/test_council.py b/tests/test_council.py index 672baac..fefb2c4 100644 --- a/tests/test_council.py +++ b/tests/test_council.py @@ -218,7 +218,7 @@ def test_public_page_data_minimization_and_safe_links(db_session, export): assert "<script>" in response.text and "