Delivery journal · The context behind the implementationDiscuss a similar challenge ↗
Case study, United States

Medical supply EDI integration: moving a distributor off middleware without losing an order

A US wholesale distributor sells 85,211 SKUs from 38 suppliers to clinics on contract prices. We connected its suppliers, online store, CRM and accounting into one record, and moved its supplier EDI from a third-party middleware onto a direct AS2 link it owns.

November 29, 2026 · 11 min read · Jitendra Choudhary, CTO & Co-Founder

Medical supply EDI integration: supplier feeds and direct EDI flowing into one platform serving the online store, CRM, marketplaces, AI assistants and clinics

88%

of orders go to the supplier by direct EDI

163 of 185 orders, October 2026

~2.5 min

to price a 549-line usage file

Median of 5 runs, 2.3 to 3.3 min

83%

of usage lines matched automatically

453 of 549, high confidence

62%

of chats resolved with no person

88 of 142 chats, November 2026

The business: integration is the operation

A medical supply distributor's margin is thin and its stock mostly sits with other companies, so every sale depends on another company's system answering.

The client sells medical supplies wholesale to US clinics, practices and other licensed providers. Many buy on buying-group contracts, so each clinic has its own price for the same box of gloves. Most of what the client sells ships from distributors and makers. A sale is only finished when those companies take the order, confirm it, ship it and invoice it.

One number shaped every decision. The store lists 85,211 SKUs from 38 suppliers and 369 manufacturers, and one national distributor supplies about 99% of them. That distributor got a direct, fully tracked EDI link. The other suppliers run through a clean manual path, and one order can use both.

Explore our healthcare interoperability solutions for supplier, payer and EHR data exchange.

We started as the build team for phase 1 and stayed on as the client's technical partner. A team of about eight runs the platform with the client's operators, in short cycles planned against what sales and operations need next. The client owns the code, the cloud account, the runbooks and the debug logs.

What a clinic or MSO buying supplies gets

  • Its own contract price on every line, set per site and ship-to address.
  • A savings quote built from its own purchase history, accepted without a login.
  • Backorder dates and tracking numbers on the order page, straight from the supplier.
  • Reorders by text or chat, with every cart change confirmed by the buyer.
  • Prescription and license-gated items routed to a rep, never added by a bot. See our pharmacy integration work for prescription flows.

Why the first EDI integration was not enough

The middleware delivered orders, but the team could not see how, could not split an order, and heard about failures from the clinics.

Before: integration middlewareAfter: direct EDI the team owns
Checked for ready orders every few minutes and took each order wholeSaving an order starts the EDI pipeline, nothing polls
An order with items from two suppliers had no clean pathEach order splits into one purchase order per supplier
Retries and errors lived in someone else's toolEvery message has a state in the platform's own database
Orders could sit in processing with nobody toldA supplier that goes quiet raises an alert before the clinic calls
A license fee, plus middleware work for every new supplierA new supplier is a partner record and a test round
X12 EDI order flow between clinic, platform and supplier: 850 purchase order, 997 receipt, 855 line answers, 856 shipping notice and 810 invoice

Every arrow is a stored message with a state.

The old website chatbot had the same problem. In a sample of 28 real chats, about 40% asked for the price and stock of a known item, and about a fifth each asked for order status or specifications. The platform held that data. The chatbot could not reach it, so each chat became a ticket.

The cutover: nine days on a live supplier link

Moving EDI off middleware means getting another company's gateway to trust yours while real orders keep moving. This is the record from the team's debug log.

We moved the flow into the platform. Saving an order now splits it into one purchase order per supplier and sends each over AS2, the signed and encrypted channel suppliers use for X12 EDI. The old middleware endpoint now returns an error, so a forgotten job fails loudly.

Date (2026)What happened
May 18A new production certificate is created for the direct link.
May 25Cutover starts. The distributor is still receiving live orders through the old middleware address.
May 26The first receipts fail. The new private key is deployed and decryption works within the hour. Then a new error: messages arrive without a signature we can verify.
May 29A test purchase order is rejected as "authentication failed". Our own tracker still marked it as sent, and we logged that as a bug.
June 1An audit of every certificate shows the cause. The distributor's production channel still trusted the old middleware's certificate. Its test channel had been updated, production had not.
June 2The right certificate is installed and both directions verify. One setting remains on the distributor's side: signing its outbound messages.

Our first explanation, that the distributor was not signing, turned out to be wrong. We tested it against the logs and dropped it when the certificate evidence came in.

We could have made the last error go away by accepting unsigned messages. That would also let anyone send a forged order or invoice. The check stayed on.

Direct EDI went live on June 2, 2026. In June, 52 of 112 orders (46%) went to the supplier by EDI. By October it was 163 of 185 (88%), with order confirmations, ship notices and invoices coming back the same way.

Orders sent to the supplier by direct EDI per month, June to October 2026, rising from 46% to 88% of all orders

Orders placed versus orders sent by direct EDI. November is left out because it is not over.

See how we run integration monitoring and support after go-live.

The five EDI messages behind every drop-ship order

EDI is the fixed text format companies use to swap orders, receipts, shipping notices and invoices. These five carry every drop-ship order.

MessageSent byWhat the platform does with it
850 Purchase orderPlatformOne per supplier, with a control number unique to that partner. Order 58213 part 0 is sent as 58213-0.
997 ReceiptSupplierStored with a duplicate-proof key, so a resent copy is processed once.
855 Line answersSupplierAccepted lines and backorder dates. The clinic sees the date on its order page.
856 Shipping noticeSupplierTracking for the part that shipped. No 856 after a 997 raises a daily alert.
810 InvoiceSupplierChecked against the order before customer invoices go to accounting.
EDI exceptions dashboard listing purchase orders accepted but not shipped, retries, unmatched replies and backorders

The operations view lists only orders that need a person. Recreated screen, sample data.

One order's EDI timeline from 850 purchase order to 810 invoice

One order, every reply.

Winning a clinic from its purchase history

Clinics already have a supplier, so a rep has to prove savings on what they buy today, line by line.

A rep uploads the clinic's usage file. Each line is matched by the maker's part number first, then by meaning, then checked by an AI model that scores its confidence. Uncertain lines go to the rep, never straight onto the quote. Every match is priced at that clinic's contract price, and prescription and license-gated items are held back as "Contact sales".

See how our healthcare AI agents handle matching and checking work with a person in the loop.

Quote desk review screen matching a clinic's usage lines to the catalog with confidence scores

Review: the rep checks only what needs an eye. Recreated from the real product with sample data.

Contract-priced quote summary with match confidence and monthly spend by manufacturer

The quote, with what cannot be sold online.

Clinic quote page with today's spend, monthly total, annual impact and a one-click cart

The clinic accepts with no login, and the cart fills in one step.

A 549-line usage file goes from upload to a priced quote in about 2.5 minutes (median of 5 runs, 2.3 to 3.3 minutes). An 8,319-line file covering eight months took 22 minutes. On the 549-line file, 83% of lines (453) matched with high confidence and 90% (494) got a usable match. Only 10% came back weak, and three later runs of the same file landed between 88% and 93% usable.

QA ran the same real file and found three pricing faults. Each one is now a guard in the pricing code.

Lines hitWhat went wrongThe guard now
32A bare container word such as "Bottle" or "Kit" with no count blanked the clinic's current price, so the saving looked far bigger than it was. One disinfectant alone hid $2,339.84 a month of spend.A bare container counts as a pack of one.
68A roll of 1,200 sheets was read as 1,200 rolls. One line would have quoted $876,148.When the two per-unit prices differ tenfold or more, the line stops and is marked as a pack-size conflict.
13Low-confidence "different form" matches reached quotes, such as glucagon matched to an epinephrine kit.Different-form matches under 60% go to the not-quotable list.

A line can hit more than one guard, so the three counts do not add up.

Guards like these come from our healthcare quality engineering practice: test the real file, then turn each fault into a rule.

Assistants that read the real system

The same integrations feed a web assistant and SMS ordering, so they answer from the clinic's own prices, live stock and real orders.

In November 2026 the web assistant resolved 62% of real chats with no person involved (88 of 142). 6% needed a person and 32% ended unresolved, usually because the shopper left or asked for something the store does not carry. It has handled 2,865 chats since August 2025.

The assistant reads the same live catalog, contract prices and order records the store uses. It can suggest cart changes, and the buyer confirms each one. A license-gated item is never added by a bot. It goes to a rep, who can take over any chat and hand it back.

Web assistant answering stock and contract price for a syringe
SMS reorder of exam gloves with buyer confirmation
Sales rep inbox taking over a chat about a license-gated item

Recreated screens, sample data.

What the platform expects to go wrong

Most of the work in an integration is the cases nobody draws on the whiteboard.

SituationWhat happens
A supplier accepts but never shipsA daily check finds receipts with no shipping notice and alerts the team.
The same reply arrives twiceIt is processed once.
A reply has no clear senderIt is matched by order, then PO number, then the item's supplier.
A receipt hides a rejectionThe tracker reads the receipt, not just the HTTP status.
A message arrives unsignedIt is refused.
The supplier's server is downThree retries a minute apart, then an exception for a person.
One line is backorderedThe date reaches the clinic's order page.
An order spans EDI and manual suppliersIt is split and flagged as EDI plus manual.
A supplier changes its pack sizeUnits convert to one base unit, and ordered items keep their SKU.
A huge stock file arrives at nightIt is split into chunks on its own worker pool, away from orders.

How it is built

One Django core holds products, prices, customers and orders, with separate worker pools for supplier intake, EDI and urgent work.

A big stock load never slows an order. Changes go out once to the store, the CRM, two marketplaces and Google Shopping. It runs on AWS Kubernetes, built with Terraform, with a preview environment for every change.

Discover our healthcare product engineering approach to platforms like this one.

Medical supply EDI and ecommerce integration architecture: suppliers, channels, core lanes and technology stack

Follow 1 to 10 from supplier file to invoice.

MeasureCount, from the code on Nov 29, 2026
Codebases7
Data models78
API routesAbout 311
Background tasks81, in 4 worker pools with 20 schedules
Test files253, of which 17 cover EDI
Backend codeAbout 104,000 lines of Python

Results

Every figure comes from the production database, the live store or the QA record, pulled by the client team on Nov 29, 2026.

163

orders a month by direct EDI

88% of all orders, October 2026, up from 52 in June

~2.5 min

to price a 549-line usage file

Median of 5 runs

83%

usage lines matched automatically

453 of 549 at high confidence, 90% usable

62%

chats resolved with no person

88 of 142, November 2026

$876,148

wrong quote line stopped

by the pack-size guard, one of three

85,211

SKUs live from 38 suppliers

369 manufacturers, November 2026

What the numbers mean for the business

Between June and October 2026, monthly orders grew 65% while the hand-placed orders the team had to chase fell by almost two thirds.

+65%

monthly orders

112 in June to 185 in October 2026

3.1x

orders sent by direct EDI

52 in June to 163 in October

60 to 22

orders placed by hand each month

June versus October, a 63% drop

8 months

of a clinic's purchases priced in 22 min

an 8,319-line usage file

The growth went to the direct EDI link, not to the operations team. Every extra order that reached the supplier by EDI arrived with a tracked receipt, line answers, a ship notice and an invoice, instead of an email or a phone call. The hand-placed orders that remain are for suppliers without EDI.

On the sales side, a rep can price a clinic's full eight months of purchases in about 22 minutes and a typical file in under 3. That turns a usage file into a savings quote on the same call, while the clinic is still interested.

Hand-placed orders are orders placed minus orders sent by EDI. They include orders for suppliers that have no EDI link.

Eight questions to ask before your own EDI cutover

The checklist we now run with every distributor, supplier or clearinghouse connection.

QuestionWhy it matters
Which suppliers carry most of your SKUs, and which can do EDI?Here one distributor carried about 99% of SKUs, so one deep link covered most orders.
Can an order with items from two suppliers be split today?Middleware that sends whole orders leaves mixed orders with no clean path.
Where do you see a receipt that never became a ship notice?If nobody sees it, the clinic finds out first.
Does your tracker read the delivery receipt or only the HTTP status?A delivery receipt can carry a rejection, as it did during this cutover.
Which certificate does each partner channel trust, in test and in production?Updating the test channel did not update production.
Do you refuse unsigned messages?Accepting them hides errors and lets anyone send a forged order.
Can a new supplier go live without middleware work?It should be a partner record and a test round.
Does every sales channel read the same price, or its own copy?Copies drift, and a contract buyer who sees list price stops trusting the store.

We open-sourced the patterns

x12-edi-kit is a free Python library that builds and reads 850, 855, 856, 810 and 997 messages, with AS2, control numbers, order splitting and missing-shipment alerts.

It is a clean-room rewrite of what made this connection reliable, with no client code or data, and 107 tests. Engineers can check how we work before they talk to us: github.com/Nirmitee-tech/x12-edi-kit.

The same X12 skills, on the claims side

The X12 format that carries these purchase orders also carries healthcare claims (837), payments (835), eligibility checks (270 and 271), prior authorization (278) and benefit enrollment files (834).

The hard parts are the same: partner certificates, control numbers, receipts that hide rejections and a tracker that tells the truth. Related: payer and clearinghouse integration, real-time eligibility verification, RCM integration, our claims intelligence and clearinghouse case study, the open-source clearinghouse simulator, and our earlier B2B medical supply marketplace case study.

Running orders through something you cannot see into? Send us your suppliers, channels and order flow. We will tell you where direct EDI pays off and where it does not. Explore our custom healthcare software development or talk to our team.Book a 30-min call

The client and its suppliers are not named. Screens are recreations of the real product with sample data. Figures come from the production database, the live store and QA records, pulled by the client team on Nov 29, 2026.

Questions buyers ask

What is the difference between EDI middleware and direct EDI?
Middleware sends your EDI for you, so retries, receipts and errors live in someone else's system. Direct EDI over AS2 keeps every message and its state in your own platform.
How long does a move off EDI middleware take?
The cutover with the distributor took nine days of certificate and gateway work, most of it on the partner's side, and direct EDI went live on June 2, 2026. Plan a test channel first, then production, and keep the old path open until production verifies both ways.
Which X12 messages does a medical supply distributor need?
The 850 purchase order, 997 receipt, 855 line answers, 856 shipping notice and 810 invoice. Each one is stored with a state so missing replies raise alerts.
Who owns the code?
The client owns the code, the cloud account, the runbooks and the debug logs.
How accurate is the AI product matching?
On a real 549-line usage file, 83% of lines matched with high confidence and 90% got a usable match. Exact part-number matches go first, and low-confidence matches go to a person instead of the quote.
Can you work alongside our team?
Yes. Here we act as the technical partner next to the client's operators, with a team of about eight.