diff --git a/golden/expected_osv_parse/synthetic/s18_inn_row_above.json b/golden/expected_osv_parse/synthetic/s18_inn_row_above.json index 017da22..cc37424 100644 --- a/golden/expected_osv_parse/synthetic/s18_inn_row_above.json +++ b/golden/expected_osv_parse/synthetic/s18_inn_row_above.json @@ -8,8 +8,8 @@ "rows": 7, "warnings": [ "sheet=Лист_1 hierarchy=outline", - "строка 13: ИНН 7701234567 над строкой 14 отнесён к ней как к контрагенту", - "строка 18: ИНН 5001234567 над строкой 19 отнесён к ней как к контрагенту" + "строка 13: ИНН 7701234560 отнесён к контрагенту в строке 14", + "строка 18: ИНН 5001234561 отнесён к контрагенту в строке 19" ] }, "documents": [ @@ -97,7 +97,7 @@ "group_name": "Контрагенты", "account_code_raw": "60.01", "counterparty_name": "ООО Альфа", - "counterparty_inn": "7701234567", + "counterparty_inn": "7701234560", "data_type": "BU", "opening_debit": null, "opening_credit": "250000.50", @@ -173,7 +173,7 @@ "group_name": "Контрагенты", "account_code_raw": "60.02", "counterparty_name": "ООО Гамма", - "counterparty_inn": "5001234567", + "counterparty_inn": "5001234561", "data_type": "BU", "opening_debit": "120000.00", "opening_credit": null, diff --git a/golden/expected_osv_parse/synthetic/s20_inn_above_sibling_blank.json b/golden/expected_osv_parse/synthetic/s20_inn_above_sibling_blank.json new file mode 100644 index 0000000..5a1fc42 --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s20_inn_above_sibling_blank.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 13: ИНН 7701234560 отнесён к контрагенту в строке 14", + "строка 15: ИНН 7707654321 отнесён к контрагенту в строке 16", + "строка 19: ИНН 5001234561 отнесён к контрагенту в строке 20", + "строка 21: ИНН 500100732259 отнесён к контрагенту в строке 22" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 14, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 16, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 20, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 22, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s21_inn_above_sibling_sums.json b/golden/expected_osv_parse/synthetic/s21_inn_above_sibling_sums.json new file mode 100644 index 0000000..5a1fc42 --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s21_inn_above_sibling_sums.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 13: ИНН 7701234560 отнесён к контрагенту в строке 14", + "строка 15: ИНН 7707654321 отнесён к контрагенту в строке 16", + "строка 19: ИНН 5001234561 отнесён к контрагенту в строке 20", + "строка 21: ИНН 500100732259 отнесён к контрагенту в строке 22" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 14, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 16, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 20, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 22, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s22_inn_above_parent_blank.json b/golden/expected_osv_parse/synthetic/s22_inn_above_parent_blank.json new file mode 100644 index 0000000..5a1fc42 --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s22_inn_above_parent_blank.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 13: ИНН 7701234560 отнесён к контрагенту в строке 14", + "строка 15: ИНН 7707654321 отнесён к контрагенту в строке 16", + "строка 19: ИНН 5001234561 отнесён к контрагенту в строке 20", + "строка 21: ИНН 500100732259 отнесён к контрагенту в строке 22" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 14, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 16, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 20, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 22, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s23_inn_above_parent_sums.json b/golden/expected_osv_parse/synthetic/s23_inn_above_parent_sums.json new file mode 100644 index 0000000..5a1fc42 --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s23_inn_above_parent_sums.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 13: ИНН 7701234560 отнесён к контрагенту в строке 14", + "строка 15: ИНН 7707654321 отнесён к контрагенту в строке 16", + "строка 19: ИНН 5001234561 отнесён к контрагенту в строке 20", + "строка 21: ИНН 500100732259 отнесён к контрагенту в строке 22" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 14, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 16, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 20, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 22, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s24_inn_below_child_blank.json b/golden/expected_osv_parse/synthetic/s24_inn_below_child_blank.json new file mode 100644 index 0000000..cb9d10f --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s24_inn_below_child_blank.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 14: ИНН 7701234560 отнесён к контрагенту в строке 13", + "строка 16: ИНН 7707654321 отнесён к контрагенту в строке 15", + "строка 20: ИНН 5001234561 отнесён к контрагенту в строке 19", + "строка 22: ИНН 500100732259 отнесён к контрагенту в строке 21" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 13, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 15, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 19, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 21, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s25_inn_below_child_sums.json b/golden/expected_osv_parse/synthetic/s25_inn_below_child_sums.json new file mode 100644 index 0000000..cb9d10f --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s25_inn_below_child_sums.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 14: ИНН 7701234560 отнесён к контрагенту в строке 13", + "строка 16: ИНН 7707654321 отнесён к контрагенту в строке 15", + "строка 20: ИНН 5001234561 отнесён к контрагенту в строке 19", + "строка 22: ИНН 500100732259 отнесён к контрагенту в строке 21" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 13, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 15, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 19, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 21, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s26_inn_below_sibling_sums.json b/golden/expected_osv_parse/synthetic/s26_inn_below_sibling_sums.json new file mode 100644 index 0000000..cb9d10f --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s26_inn_below_sibling_sums.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 14: ИНН 7701234560 отнесён к контрагенту в строке 13", + "строка 16: ИНН 7707654321 отнесён к контрагенту в строке 15", + "строка 20: ИНН 5001234561 отнесён к контрагенту в строке 19", + "строка 22: ИНН 500100732259 отнесён к контрагенту в строке 21" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 13, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 15, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 19, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 21, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s27_inn_below_sibling_blank.json b/golden/expected_osv_parse/synthetic/s27_inn_below_sibling_blank.json new file mode 100644 index 0000000..cb9d10f --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s27_inn_below_sibling_blank.json @@ -0,0 +1,234 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "done", + "metrics": { + "rows": 8, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 14: ИНН 7701234560 отнесён к контрагенту в строке 13", + "строка 16: ИНН 7707654321 отнесён к контрагенту в строке 15", + "строка 20: ИНН 5001234561 отнесён к контрагенту в строке 19", + "строка 22: ИНН 500100732259 отнесён к контрагенту в строке 21" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 13, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": "7701234560", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 15, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 19, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 21, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/golden/expected_osv_parse/synthetic/s28_inn_bad_checksum.json b/golden/expected_osv_parse/synthetic/s28_inn_bad_checksum.json new file mode 100644 index 0000000..f7e7f7e --- /dev/null +++ b/golden/expected_osv_parse/synthetic/s28_inn_bad_checksum.json @@ -0,0 +1,253 @@ +{ + "schema_version": "1.2", + "service": { + "name": "tabular-parser" + }, + "status": "needs_check", + "metrics": { + "rows": 9, + "warnings": [ + "sheet=Лист_1 hierarchy=outline", + "строка 13: похожа на ИНН 7701234567, но контрольная сумма не сходится — строка оставлена как есть", + "строка 15: ИНН 7707654321 отнесён к контрагенту в строке 16", + "строка 19: ИНН 5001234561 отнесён к контрагенту в строке 20", + "строка 21: ИНН 500100732259 отнесён к контрагенту в строке 22" + ] + }, + "documents": [ + { + "document_type": "OSV", + "locator": "sheet:Лист_1", + "header": { + "organization_name": "ООО \"Тестовая организация\"", + "organization_inn": null, + "account_code_raw": "60", + "period_text": "1 квартал 2025 г.", + "period_year": 2025, + "period_quarter": "Q1", + "is_cumulative": true, + "period_start": "2025-01-01", + "period_end": "2025-03-31", + "is_from_year_start": true, + "data_type": "BU", + "currency": "RUB", + "header_variant": 1 + }, + "group_schema": [ + { + "type": "ACCOUNT", + "name": "Счет" + }, + { + "type": "COUNTERPARTY", + "name": "Контрагенты" + } + ], + "columns": { + "opening_debit": "E", + "opening_credit": "F", + "turnover_debit": "G", + "turnover_credit": "H", + "closing_debit": "I", + "closing_credit": "J" + }, + "rows": [ + { + "row_number": 11, + "level": 0, + "parent_row_number": null, + "row_value": "60", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + }, + { + "row_number": 12, + "level": 1, + "parent_row_number": 11, + "row_value": "60.01", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.01", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": "253000.50", + "turnover_debit": "273000.25", + "turnover_credit": "460000.00", + "closing_debit": "65000.00", + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 13, + "level": 2, + "parent_row_number": 12, + "row_value": "7701234567", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "7701234567", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": null, + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 14, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Альфа", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Альфа", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "250000.50", + "turnover_debit": "180000.25", + "turnover_credit": "420000.00", + "closing_debit": null, + "closing_credit": "490000.25", + "extra": null + }, + { + "row_number": 16, + "level": 2, + "parent_row_number": 12, + "row_value": "ООО Бета", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "ООО Бета", + "counterparty_inn": "7707654321", + "data_type": "BU", + "opening_debit": "15000.00", + "opening_credit": null, + "turnover_debit": "90000.00", + "turnover_credit": "40000.00", + "closing_debit": "65000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 17, + "level": 2, + "parent_row_number": 12, + "row_value": "Иванов Иван", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.01", + "counterparty_name": "Иванов Иван", + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": null, + "opening_credit": "3000.00", + "turnover_debit": "3000.00", + "turnover_credit": null, + "closing_debit": null, + "closing_credit": null, + "extra": null + }, + { + "row_number": 18, + "level": 1, + "parent_row_number": 11, + "row_value": "60.02", + "group_type": "ACCOUNT", + "group_name": "Счет", + "account_code_raw": "60.02", + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": "1500.00", + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 20, + "level": 2, + "parent_row_number": 18, + "row_value": "ООО Гамма", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ООО Гамма", + "counterparty_inn": "5001234561", + "data_type": "BU", + "opening_debit": "120000.00", + "opening_credit": null, + "turnover_debit": "30000.00", + "turnover_credit": "100000.00", + "closing_debit": "50000.00", + "closing_credit": null, + "extra": null + }, + { + "row_number": 22, + "level": 2, + "parent_row_number": 18, + "row_value": "ИП Сидоров", + "group_type": "COUNTERPARTY", + "group_name": "Контрагенты", + "account_code_raw": "60.02", + "counterparty_name": "ИП Сидоров", + "counterparty_inn": "500100732259", + "data_type": "BU", + "opening_debit": null, + "opening_credit": "1500.00", + "turnover_debit": null, + "turnover_credit": null, + "closing_debit": null, + "closing_credit": "1500.00", + "extra": null + }, + { + "row_number": 23, + "level": 0, + "parent_row_number": null, + "row_value": "Итого", + "group_type": "TOTAL", + "group_name": null, + "account_code_raw": null, + "counterparty_name": null, + "counterparty_inn": null, + "data_type": "BU", + "opening_debit": "135000.00", + "opening_credit": "254500.50", + "turnover_debit": "303000.25", + "turnover_credit": "560000.00", + "closing_debit": "115000.00", + "closing_credit": "491500.25", + "extra": null + } + ], + "checks": { + "total_row_matches_root": true, + "balance_identity_violations": [], + "parent_sum_violations": [] + } + } + ] +} diff --git a/osv/synthetic/README.md b/osv/synthetic/README.md index b555ad9..2520b2c 100644 --- a/osv/synthetic/README.md +++ b/osv/synthetic/README.md @@ -42,12 +42,23 @@ cd tabular-parser/api | `s15_group_title_synonyms.xlsx` | названия групп сумм: лист «ОСВ 60» — «Входящее сальдо»/«Конечное сальдо», лист «ОСВ 62» — «Начальное сальдо»/«Исходящее сальдо» | два документа, все шесть колонок сумм найдены, `done` | | `s16_header_synonyms.xlsx` | лист «ОСВ 60»: нет названия организации, период «2024», валюта «RUB (код 643)», «Счет» и «Контрагенты» отдельными строками под «Дебет/Кредит»; лист «ОСВ 62» (вариант 2): «Детализация по субсчетам: Номенклатура, Статьи затрат, Нематериальные активы, Валюта» | `organization_name=""` + предупреждение, `Q4`/2024, `currency=RUB`, схема листа 62 — `ACCOUNT` + четыре `OTHER` | | `s17_inn_in_name.xlsx` | колонки ИНН нет, ИНН записан в текст названия контрагента: «ООО Альфа, 7701234567», «ООО Бета (ИНН 7707654321)», «ООО Гамма ИНН: 5001234567», «ИП Сидоров 500100732259» (OQ-100) | `counterparty_inn` — цифры, `counterparty_name` — без ИНН и разделителя, `row_value` не меняется; физлицо без ИНН — `null`; `done` | -| `s18_inn_row_above.xlsx` | у «ООО Альфа» и «ООО Гамма» ИНН стоит отдельной строкой над названием (без сумм, тот же уровень), колонки ИНН нет (OQ-130) | строка с ИНН в `rows` не попадает и не уходит в `OTHER`; ИНН — у контрагента, предупреждение «ИНН … над строкой … отнесён к ней»; `done` | +| `s18_inn_row_above.xlsx` | у «ООО Альфа» и «ООО Гамма» ИНН с верной контрольной суммой (`7701234560`, `5001234561`) стоит отдельной строкой над названием (без сумм, тот же уровень), колонки ИНН нет (OQ-130); без подсказки в шапке строка с неверной контрольной суммой не склеивается (#35) | строка с ИНН в `rows` не попадает и не уходит в `OTHER`; ИНН — у контрагента, предупреждение «строка N: ИНН … отнесён к контрагенту в строке M»; `done` | | `s19_inn_kpp_cell.xlsx` | колонка «ИНН/КПП»: в ячейках склеенное «7701234567/770101001» (OQ-100) | `counterparty_inn` — только ИНН; колонка распознана как колонка ИНН; `done` | +| `s20_inn_above_sibling_blank.xlsx` | ИНН строкой **над** наименованием, сосед того же уровня, **без сумм** (#35) | ИНН — у своего контрагента, строк ИНН в `rows` нет, `done` | +| `s21_inn_above_sibling_sums.xlsx` | ИНН строкой над наименованием, сосед, **с теми же суммами** | то же; пара — по равенству сумм | +| `s22_inn_above_parent_blank.xlsx` | строка ИНН — **родитель** наименования (уровень выше), без сумм | наименование поднимается на её место, ИНН — ему, `done` | +| `s23_inn_above_parent_sums.xlsx` | строка ИНН — родитель наименования, с суммами | то же | +| `s24_inn_below_child_blank.xlsx` | строка ИНН — **ребёнок** наименования (уровень ниже), без сумм | ИНН — родителю, строка из `rows` уходит, `done` | +| `s25_inn_below_child_sums.xlsx` | строка ИНН — ребёнок наименования, с суммами (как «Контрагенты.ИНН» в 1С, но без подсказки в шапке) | то же | +| `s26_inn_below_sibling_sums.xlsx` | ИНН строкой **под** наименованием, сосед, с суммами | ИНН — своему контрагенту, `done` | +| `s27_inn_below_sibling_blank.xlsx` | ИНН строкой под наименованием, сосед, без сумм (дефект main: ИНН уходил следующему контрагенту) | ИНН — своему контрагенту; направление — по блоку 60.02, кончающемуся строкой ИНН; `done` | +| `s28_inn_bad_checksum.xlsx` | раскладка `s20` («над, не в дереве, без сумм»), но у ООО Альфа строка ИНН `7701234567` с неверной контрольной суммой (#35) | строка остаётся обычной, у Альфы ИНН нет, предупреждение «похожа на ИНН … контрольная сумма не сходится», `needs_check`; остальные контрагенты — со своими ИНН (направление «над» — по блоку 60.02) | `s17`–`s19` — регрессия извлечения ИНН из текста (issue #9). `s14`–`s16` добавлены тестом покрытия словарей `tabular-parser` (`rules/*.yaml`, решение R-22): каждая запись словаря должна сработать на реальных или синтетических файлах; эти файлы закрывают записи, которых нет в реальных ОСВ. +`s20`–`s27` — восемь раскладок строки ИНН рядом с контрагентом (issue tabular-parser#35); ИНН с верной контрольной суммой — без подсказки в шапке другие не склеиваются. + ## О файле xlsb `s13_no_outline_indent.xlsb` собран **не Excel и не LibreOffice** (их на машине разработки нет), а минимальным diff --git a/osv/synthetic/s18_inn_row_above.xlsx b/osv/synthetic/s18_inn_row_above.xlsx index 55cf1d0..e81d6f0 100644 Binary files a/osv/synthetic/s18_inn_row_above.xlsx and b/osv/synthetic/s18_inn_row_above.xlsx differ diff --git a/osv/synthetic/s20_inn_above_sibling_blank.xlsx b/osv/synthetic/s20_inn_above_sibling_blank.xlsx new file mode 100644 index 0000000..ba927d2 Binary files /dev/null and b/osv/synthetic/s20_inn_above_sibling_blank.xlsx differ diff --git a/osv/synthetic/s21_inn_above_sibling_sums.xlsx b/osv/synthetic/s21_inn_above_sibling_sums.xlsx new file mode 100644 index 0000000..743d2ce Binary files /dev/null and b/osv/synthetic/s21_inn_above_sibling_sums.xlsx differ diff --git a/osv/synthetic/s22_inn_above_parent_blank.xlsx b/osv/synthetic/s22_inn_above_parent_blank.xlsx new file mode 100644 index 0000000..a027bad Binary files /dev/null and b/osv/synthetic/s22_inn_above_parent_blank.xlsx differ diff --git a/osv/synthetic/s23_inn_above_parent_sums.xlsx b/osv/synthetic/s23_inn_above_parent_sums.xlsx new file mode 100644 index 0000000..873c9cb Binary files /dev/null and b/osv/synthetic/s23_inn_above_parent_sums.xlsx differ diff --git a/osv/synthetic/s24_inn_below_child_blank.xlsx b/osv/synthetic/s24_inn_below_child_blank.xlsx new file mode 100644 index 0000000..d29c454 Binary files /dev/null and b/osv/synthetic/s24_inn_below_child_blank.xlsx differ diff --git a/osv/synthetic/s25_inn_below_child_sums.xlsx b/osv/synthetic/s25_inn_below_child_sums.xlsx new file mode 100644 index 0000000..800e23f Binary files /dev/null and b/osv/synthetic/s25_inn_below_child_sums.xlsx differ diff --git a/osv/synthetic/s26_inn_below_sibling_sums.xlsx b/osv/synthetic/s26_inn_below_sibling_sums.xlsx new file mode 100644 index 0000000..8c88465 Binary files /dev/null and b/osv/synthetic/s26_inn_below_sibling_sums.xlsx differ diff --git a/osv/synthetic/s27_inn_below_sibling_blank.xlsx b/osv/synthetic/s27_inn_below_sibling_blank.xlsx new file mode 100644 index 0000000..2598ede Binary files /dev/null and b/osv/synthetic/s27_inn_below_sibling_blank.xlsx differ diff --git a/osv/synthetic/s28_inn_bad_checksum.xlsx b/osv/synthetic/s28_inn_bad_checksum.xlsx new file mode 100644 index 0000000..3798264 Binary files /dev/null and b/osv/synthetic/s28_inn_bad_checksum.xlsx differ