- Draw a grid on the two header rows only, data cells stay borderless. - Align column names to the top so the start of a long name stays visible. - Narrow the 14 code columns to the length of their values; the rule matches by column name, so identical indicators in every block get equal widths. - Halve both payment system name columns (32 -> 16). - Give "Характеристика операции" the same width as "Назначение платежа". - Drop the group title above "Статус перевода": it duplicated the column name. The group cell stays in place so the header grid is not broken. - Pass the cell format to write_string. Identifier columns (БИК, ИНН, ОГРН, КПП, СВИФТ, account numbers) were written without one, so text wrapping and vertical alignment never applied to them - this is why БИК had no line break. The width padding and the header rotation are single constants: the customer has not confirmed yet whether "N знаков" means the value length (implemented) or an amount to subtract, and whether narrow headers should be rotated.
SFM Streamlit
Production-ready Streamlit приложение для обработки ФЭС XML файлов в Excel-отчет и протокол с доступом к файлам через SAMBA (rail_connectors).
Архитектура
main.py
app/
app_config.py # константы приложения и user-id
path_store.py # JSON-хранилище персональных путей
path_settings.py # UI-модалка изменения пути
samba_access.py # проверка доступа к SAMBA папке
auth/
service.py # orchestration auth/session
providers.py
mock_provider.py
pipeline/
config.py # шаблоны имен/путей пайплайна
file_manager.py # scan/move/upload/download в SAMBA
parser.py # namespace-aware парсер ФЭС XML
report.py # генерация report.xlsx
protocol.py # генерация protocol.xlsx
service.py # run_batch orchestration
tests/
unit/
smoke/
Основной поток
- Пользователь вводит SAMBA логин/пароль.
- При необходимости меняет персональный
input_dir(с pre-check доступа). - Нажимает
Запустить обработку xml в excel. - Пайплайн:
- сканирует входную папку;
- невалидные имена переносит в
Err; - валидные XML парсит и формирует строки отчета;
- создает
report.xlsx,protocol.xlsx,process.log; - сохраняет артефакты в
Out/YYYY/MM_YYYY/YYYYMMDD/run_number/; - успешные файлы переносит в
Processed.
- В UI отображаются счетчики и пути к артефактам.
Переменные окружения
Используются переменные авторизации Raisa (OPENBAO__SETTINGS__*).
SMBA source и дефолтный путь входа задаются в коде (app/app_config.py).
Быстрый старт
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
streamlit run main.py
Тесты и качество
pytest
ruff check .
black --check .
isort --check-only .
Pre-commit
pre-commit install
pre-commit run --all-files
Хуки:
blackisortruffruff-format
Description
Languages
Python
100%