feat(contract): v1.2 — DISCLOSURE, statementDocument.checks, границы периода ОСВ, примеры
Refs #26 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: cedd7915-2efe-41e5-988c-a9117033598b
This commit is contained in:
parent
ca8615eab1
commit
82ad2ab251
@ -1,5 +1,5 @@
|
||||
{
|
||||
"schema_version": "1.1",
|
||||
"schema_version": "1.2",
|
||||
"job_id": "3f2a9c1e-7b4d-4e0a-9d51-2c8e6a1b0f01",
|
||||
"file_id": "a1c4e7d2-5b36-4f89-8e12-9d0c3b7a4e02",
|
||||
"service": { "name": "tabular-parser", "version": "0.1.0" },
|
||||
@ -16,6 +16,9 @@
|
||||
"period_year": 2025,
|
||||
"period_quarter": "Q1",
|
||||
"is_cumulative": false,
|
||||
"period_start": "2025-01-01",
|
||||
"period_end": "2025-03-31",
|
||||
"is_from_year_start": true,
|
||||
"data_type": "BU",
|
||||
"currency": "RUB",
|
||||
"header_variant": 1
|
||||
|
||||
46
contracts/examples/result-statement-excel.json
Normal file
46
contracts/examples/result-statement-excel.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"schema_version": "1.2",
|
||||
"job_id": "3f1c7a2e-5b64-4d0a-9c1e-8a7b6d5e4f30",
|
||||
"file_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
|
||||
"service": { "name": "tabular-parser", "version": "0.3.0" },
|
||||
"status": "needs_check",
|
||||
"metrics": { "duration_ms": 412, "rows": 7, "warnings": ["sheet=Бухгалтерский баланс. Лист 1 значений с дробной частью при единице тыс. руб.: 3"] },
|
||||
"documents": [
|
||||
{
|
||||
"document_type": "BALANCE",
|
||||
"locator": "sheet:Бухгалтерский баланс. Лист 1,Бухгалтерский баланс. Лист 2",
|
||||
"header": { "form_name": "Бухгалтерский баланс", "organization_name": "ООО \"Пример\"", "organization_name_confidence": 100, "inn": "7700000000", "inn_confidence": 100, "report_date_text": "на 30 сентября 2025 г.", "report_date": "2025-09-30", "units": "тыс. руб.", "okud": "0710001", "okpo": "12345678" },
|
||||
"columns": [
|
||||
{ "column_index": 0, "label": "На 30 сентября 2025 г.", "period_date": "2025-09-30" },
|
||||
{ "column_index": 1, "label": "На 31 декабря 2024 г.", "period_date": "2024-12-31" }
|
||||
],
|
||||
"lines": [
|
||||
{ "line_code": "1110", "line_code_confidence": 100, "line_name": "Нематериальные активы", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "586260.26", "confidence": 100, "is_recognized": true }, { "column_index": 1, "amount": "905786.99", "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "11101", "line_code_confidence": 100, "line_name": "Нематериальные активы, готовые к использованию", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "586260.26", "confidence": 100, "is_recognized": true }, { "column_index": 1, "amount": "900000.00", "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "1100", "line_code_confidence": 100, "line_name": "Итого по разделу I", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "586260.26", "confidence": 100, "is_recognized": true }, { "column_index": 1, "amount": "905786.99", "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "1200", "line_code_confidence": 100, "line_name": "Итого по разделу II", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": null, "confidence": 100, "is_recognized": true }, { "column_index": 1, "amount": null, "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "1600", "line_code_confidence": 100, "line_name": "БАЛАНС", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "586260.26", "confidence": 100, "is_recognized": true }, { "column_index": 1, "amount": "905786.99", "confidence": 100, "is_recognized": true } ] }
|
||||
],
|
||||
"checks": { "relations_failed": [], "soft_relations_failed": [ { "column_index": 1, "relation": "1110 = 11101", "expected": "905786.99", "actual": "900000.00" } ], "duplicate_line_codes": [] }
|
||||
},
|
||||
{
|
||||
"document_type": "INCOME",
|
||||
"locator": "sheet:Отчет о финансовых результатах",
|
||||
"header": { "form_name": "Отчет о финансовых результатах", "organization_name": "ООО \"Пример\"", "organization_name_confidence": 100, "report_date_text": "за январь - сентябрь 2025 г.", "report_date": "2025-09-30", "units": "тыс. руб.", "okud": "0710002" },
|
||||
"columns": [ { "column_index": 0, "label": "За январь - сентябрь 2025 г.", "period_date": "2025-09-30" } ],
|
||||
"lines": [
|
||||
{ "line_code": "2110", "line_code_confidence": 100, "line_name": "Выручка", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "1000.00", "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "2120", "line_code_confidence": 100, "line_name": "Себестоимость продаж", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "-600.00", "confidence": 100, "is_recognized": true } ] },
|
||||
{ "line_code": "2100", "line_code_confidence": 100, "line_name": "Валовая прибыль (убыток)", "line_name_confidence": 100, "values": [ { "column_index": 0, "amount": "400.00", "confidence": 100, "is_recognized": true } ] }
|
||||
],
|
||||
"checks": { "relations_failed": [], "soft_relations_failed": [], "duplicate_line_codes": [] }
|
||||
},
|
||||
{
|
||||
"document_type": "DISCLOSURE",
|
||||
"locator": "sheet:Пояснения",
|
||||
"header": { "form_name": "Пояснения к бухгалтерскому балансу и отчету о финансовых результатах" },
|
||||
"columns": [],
|
||||
"lines": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"schema_version": "1.2",
|
||||
"job_id": "8d6b1f30-2e94-4a7c-b5d8-0f1e9c3a6b03",
|
||||
"file_id": "c7e2a9b4-1d58-4630-a2f7-6b4d8e0c1f04",
|
||||
"service": { "name": "scan-gateway", "version": "0.1.0" },
|
||||
@ -44,7 +44,8 @@
|
||||
{ "column_index": 1, "amount": "-12.30", "confidence": 90, "is_recognized": true }
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"checks": { "relations_failed": [], "soft_relations_failed": [], "duplicate_line_codes": [] }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "arm-ka/recognition-result/v1",
|
||||
"title": "Результат распознавания файла (tabular-parser / scan-gateway), контракт v1.1",
|
||||
"title": "Результат распознавания файла (tabular-parser / scan-gateway), контракт v1.2",
|
||||
"description": "Один файл (stored_file) → один job → N документов. Сервисы не знают БД: только структура файла. Нормализация счетов, резолв контрагентов, проверки — в arm-core.",
|
||||
"$comment": "Версионирование: schema_version = MAJOR.MINOR. MINOR (1.1) — необязательные поля и новые значения enum; MAJOR (2.0) — удаление/переименование полей, смена типов или семантики. Потребитель принимает тот же MAJOR и любой MINOR. Новый MINOR раскатывается сначала на потребителей (ядро и сервисы обновляют копии схем раньше, чем производитель начнёт слать 1.1), потому что закрытые enum отвергают незнакомые значения.",
|
||||
"type": "object",
|
||||
"required": ["schema_version", "job_id", "file_id", "service", "status", "documents"],
|
||||
"properties": {
|
||||
"schema_version": { "type": "string", "pattern": "^1\\.\\d+$", "description": "MAJOR.MINOR; производитель контракта v1.1 пишет \"1.1\"" },
|
||||
"schema_version": { "type": "string", "pattern": "^1\\.\\d+$", "description": "MAJOR.MINOR; производитель контракта v1.2 пишет \"1.2\"" },
|
||||
"job_id": { "type": "string", "format": "uuid" },
|
||||
"file_id": { "type": "string", "format": "uuid" },
|
||||
"service": {
|
||||
@ -53,6 +53,16 @@
|
||||
},
|
||||
"$defs": {
|
||||
"money": { "type": ["string", "null"], "pattern": "^-?\\d+(\\.\\d{1,2})?$", "description": "Decimal как строка, чтобы не терять копейки в JSON" },
|
||||
"failedRelation": {
|
||||
"type": "object",
|
||||
"required": ["column_index", "relation", "expected", "actual"],
|
||||
"properties": {
|
||||
"column_index": { "type": "integer" },
|
||||
"relation": { "type": "string", "examples": ["1600 = 1100 + 1200"] },
|
||||
"expected": { "$ref": "#/$defs/money", "description": "левая часть соотношения как в файле" },
|
||||
"actual": { "$ref": "#/$defs/money", "description": "правая часть, вычисленная по строкам" }
|
||||
}
|
||||
},
|
||||
"osvDocument": {
|
||||
"type": "object",
|
||||
"required": ["document_type", "locator", "header", "group_schema", "rows"],
|
||||
@ -70,6 +80,9 @@
|
||||
"period_year": { "type": ["integer", "null"] },
|
||||
"period_quarter": { "enum": ["Q1", "Q2", "Q3", "Q4", null] },
|
||||
"is_cumulative": { "type": ["boolean", "null"], "description": "по тексту; ядро может переопределить по данным (OQ-02)" },
|
||||
"period_start": { "type": ["string", "null"], "format": "date", "description": "начало периода по шапке: первое число квартала/года либо начало диапазона месяцев (OQ-131)" },
|
||||
"period_end": { "type": ["string", "null"], "format": "date", "description": "конец периода по шапке" },
|
||||
"is_from_year_start": { "type": ["boolean", "null"], "description": "period_start — 1 января; is_cumulative не переопределяет" },
|
||||
"data_type": { "enum": ["BU", "NU", "SUM", "CURRENCY", "QUANTITY", null] },
|
||||
"currency": { "type": ["string", "null"], "examples": ["RUB", "руб."] },
|
||||
"header_variant": { "enum": [1, 2] }
|
||||
@ -133,7 +146,7 @@
|
||||
"type": "object",
|
||||
"required": ["document_type", "locator", "header", "columns", "lines"],
|
||||
"properties": {
|
||||
"document_type": { "enum": ["BALANCE", "INCOME", "OTHER"] },
|
||||
"document_type": { "enum": ["BALANCE", "INCOME", "DISCLOSURE", "OTHER"] },
|
||||
"locator": { "type": "string", "examples": ["pages:1-2"] },
|
||||
"header": {
|
||||
"type": "object",
|
||||
@ -191,6 +204,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"checks": {
|
||||
"type": "object",
|
||||
"description": "Результаты самопроверки формы по соотношениям §7 (tabular-parser). Отсутствие объекта — «не проверялось» (OCR-путь); пустые массивы — «проверено, сошлось».",
|
||||
"properties": {
|
||||
"relations_failed": { "type": "array", "items": { "$ref": "#/$defs/failedRelation" }, "description": "нарушения жёстких соотношений: документ needs_check" },
|
||||
"soft_relations_failed": { "type": "array", "items": { "$ref": "#/$defs/failedRelation" }, "description": "нарушения мягких соотношений (OQ-12, подстроки «в том числе»): только предупреждение" },
|
||||
"duplicate_line_codes": { "type": "array", "items": { "type": "string" }, "description": "коды строк, встретившиеся в документе больше одного раза (осталась первая строка)" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user