Andrey Epifancev 3df179b7a3 feat: шаг 7 — посчитанные соотношения §7, abs_terms, допуск и округление, упрощённый набор, подстроки
Добавлены evaluation.py (EvalLine/EvalValue/is_check_line) и checks.py
(form_variant, subline_parents, evaluate_relations, checks_from).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJKMLHdxMwSUeYcdkwqX4W
2026-10-18 13:50:17 +04:00

37 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Общий вид строк шагов 6–8 у сервиса и ядра."""
from dataclasses import dataclass
from decimal import Decimal
from arm_statements.model import LineStatus
@dataclass(frozen=True, slots=True)
class EvalValue:
column: str # ключ колонки: str(column_index) у сервиса, ключ хоста у ядра
amount: Decimal | None
text: str | None
confidence: float | None
is_recognized: bool
fixed: bool = False # правлено или подтверждено аналитиком
@dataclass(frozen=True, slots=True)
class EvalLine:
key: str # ref у сервиса, ключ хоста у ядра
order: int | None # row_index; у ядра None — строка правки
line_status: LineStatus
line_code: str | None
code_confidence: float | None
code_fixed: bool
values: tuple[EvalValue, ...]
def is_check_line(line: EvalLine) -> bool:
"""Строка участвует в §7: `ok` с кодом; строка правки (`order is None`) — только с суммой (P1-8)."""
if line.line_status is not LineStatus.OK or line.line_code is None:
return False
if line.order is None:
return any(value.amount is not None for value in line.values)
return True