SAMU Autorotas

System that builds the transport routes for hemodialysis patients at the Belo Horizonte ambulance service (SAMU).

2025, React, TypeScript, PostgreSQL

Results

  • Routes: 3–5 days → seconds
  • Fleet: 1 vehicle fewer
  • Presented to SAMU BH and the Health Department

Context

The story

It didn’t move forward, but it was a great experience. At 18, I presented the software directly to the directors of SAMU (the emergency medical service) in Belo Horizonte and got it all the way to the city’s Health Department. The idea ended up going to public tender, and I didn’t go after winning it.

The problem

SAMU received a list of nephrology patients entitled to transport to a clinic for hemodialysis. The list changed every 15 days: patients lost the benefit, passed away, new ones came in, and the new ones had to be fitted into the right transport.

A lot went into the math:

  • outsourced cars with a monthly mileage limit;
  • ambulances reserved for specific patients;
  • patients who had to travel lying down or with a companion.

The spreadsheet was rebuilt by hand on every change and took SAMU staff 3 to 5 days. They tried to group patients who lived close to each other so as not to exceed the outsourced company’s mileage limit.

Task

Build the routes automatically, following every rule and without exceeding the mileage limit.

What I did

What it is

Auto Rotas takes the patient spreadsheet and the vehicle spreadsheet and builds the transport routes on its own, following all those rules.

How it works

  1. The team uploads the patient spreadsheet and the available vehicles spreadsheet.
  2. The system splits patients into groups by treatment days.
  3. Within each group, it splits by vehicle type (car or ambulance) and by region.
  4. It assigns patients to vehicles, grouping those who live close and respecting companions, patients lying down and the mileage limit.

Result

I built a prototype and presented it. Routes that took 3 to 5 days came out in seconds, and the assignment was so optimized that one vehicle was left over.