Skip to content

Data engineering · Pharma distribution

W-Connection — business process automation

30 Excel formats become one clean database. A corporate system automating reporting and business processes: sales, distribution, plan-vs-actual, KPIs and an AI consultant over company data.

Automation30 networks · 18 parsers2.1M fact rowsAI writes code, not data
wires-connection.app
The import page: month upload, KPIs and per-network sanity checks

View the case

What we have to deal with

The legacy .xls format1C files missing sharedStringsHierarchy encoded in row indentsInconsistent sheet namesSystem files inside foldersMixed data types in keysMerged cellsSubtotals inside the tablesInconsistent network namesDuplicate source files
Industry
Corporate sector
Status
In production
Networks in the registry
30
Parsers
18
Months in the database
7
Tables in the schema
14
PythonpandasStreamlitSQLiteClaude API

Challenge

Company staff spent days manually assembling sales and distribution reports from different systems and spreadsheets, plan-vs-actual and KPIs were computed with errors and delays, and answers about the state of the business had to be chased across departments.

Solution

We built W-Connection — a single loop for the company's business processes: sales reports, numeric distribution, order allocation, plan-vs-actual and employee KPIs are assembled automatically, dashboards update in real time, and a built-in AI consultant answers employees' questions drawing on all company data.

The pipeline

A month imports in one click

The analyst drops in a month's folder and clicks a button. The system does the rest: parsers process every network, dictionaries enrich the rows, sanity checks catch anything suspicious. Run the import:

  • Неман·
  • Фармамир·
  • АМТ·
  • Саян·
  • Эрай·
  • Лекарь·
  • Медсервис·
  • Линь·
  • Бимед·
  • Заман·

0

rows in the database

The core principle

AI writes the code. The code processes the data

Numbers never pass through a language model and cannot be distorted by it. Only a description of the file structure goes into the prompt, and the finished parser runs deterministically at no cost.

Only when a format changes

Network fileStructure dumpClaudeparser.py

The prompt gets the sheet structure, not the numbers

Every month

Month filesparser.pyclean + enrichSanitySQLite

Deterministic, free, with a control reconciliation

01

A structure fingerprint

Every file is hashed by structure. If a network sends its report in a new shape, the system catches it before import and offers to generate a parser.

02

A parser is written once

From then on it processes files for months with no tokens and no surprises. AI joins only for new formats and name matching.

03

Numbers come from cells only

A project rule: no clever guessing in parsers. Every value is read from a specific cell and verified with checksums.

Data quality

Data quality is confirmed by reconciliation

The bar for a parser is strict: match the analyst's manual totals down to the last unit. All 18 parsers pass that check.

9,637

unmatched rows before the unification dictionary

252

left after rollout: a 99.9% match rate

Reconciled to zero

A parser without a control reconciliation against the reference is not considered done. That's a project rule, not a wish.

Sanity before writing

Volumes are compared with the previous month; foreign products and new structures are flagged before the data lands in the database.

Retroactive improvements

A late parser fix cleans already-imported months retroactively: one fix cut about 5,000 junk rows across three past months.

wires-connection.app
The data page: raw rows after parsing, with filters and export
The data page: raw rows after parsing, with filters and export
wires-connection.app
Dictionaries: mapping network names to the canon and the review queue
Dictionaries: mapping network names to the canon and the review queue

Reports

Consolidated analytics across all networks

Summary reports across all connected networks are built from the clean database in seconds: sales, month-over-month dynamics, stock, expiry dates and plan-vs-actual.

SalesDynamicsStockExpiry datesPlan vs actual
wires-connection.app
Summary reports: sales, dynamics, stock, expiry dates and plan-vs-actual

The system in numbers

2,087,027

fact rows in the database

30

networks in the registry

18

parsers with reconciliation

3912

pharmacies in the dictionary

1749

product names

3025

files processed

Under the hood

The engineering behind it

Three Excel engines

openpyxl, xlrd and calamine: real files arrive corrupted, and a 1C xlsx without sharedStrings breaks the standard reading library.

18 tests against the reference

One test per parser: aggregates are checked against the analyst's manual totals. Every parser change runs through the whole suite.

A single-file database

A 763 MB SQLite file holds 2.1M rows and all the dictionaries. The user launches the system on Windows in two clicks, no servers.

A product UI on top of Streamlit

A dark sidebar, KPI cards with sparklines, status chips. Interface screenshots are verified automatically with Playwright.

Python 3.11pandasStreamlitSQLiteClaude APIcalaminerapidfuzzuvPlaywright

Result

Preparing regular reports went from days to minutes, data stopped diverging between departments, and employees get business answers from the AI consultant in seconds instead of email threads and meetings.

Next project

W-CRM — CRM for medical representatives