Automation library · AI assistants

Route patients to the best nearby hospital with Google Maps

Started by another system calling it. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to OpenAI. 23 steps, 2 loops or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

23 stepsLarge: read it before trusting it with anything live
0Branches: places the flow splits
2Loops or waits
0Services by connector: it calls them over plain HTTP

The flow

Starts it 4Model 2Logic 11Service 6

The steps in the order they run, from what starts it.

  1. 1Webhook - Emergency RequestWebhookStarts it
  2. 2Poll - Periodic Facility RefreshSchedule triggerStarts it
  3. 3OpenAI Chat ModelLm Chat Open AiModel
  4. 4Prepare Location ContextSetLogic
  5. 5AI - Generate Routing MessageAgentModel
  6. 6Python - Validate & Score SeverityCodeLogic
  7. 7JS - Format Final OutputCodeLogic
  8. 8Filter - Valid LocationFilterLogic
  9. 9Wait - Review BufferWaitLogic
  10. 10Fetch Nearby HospitalsHttp RequestService
  11. 11Fetch Nearby ClinicsHttp RequestService
  12. 12Error - Invalid LocationCodeLogic
  13. 13Send SMS Routing AlertHttp RequestService
  14. 14Log to Google Sheet TrackerHttp RequestService
  15. 15JS - Merge & Deduplicate FacilitiesCodeLogic
  16. 16Wait For ResultWaitLogic
  17. 17Webhook Response - Send ResultRespond To WebhookStarts it
  18. 18Fetch Facility CapacityHttp RequestService
  19. 19Webhook Response - ErrorRespond To WebhookStarts it
  20. 20JS - Enrich with CapacityCodeLogic
  21. 21Fetch Travel TimeHttp RequestService
  22. 22Python - Score FacilitiesCodeLogic
  23. 23JS - Select Best FacilityCodeLogic

How it's built

Starts on
Another system calling it
Steps
23, 2 loops or waits
Size
Large: read it before trusting it with anything live
Connects to
Nothing by connector; it calls services over plain HTTP
Model
OpenAI

Questions

What does it need to run?

An n8n account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 23 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 23 steps before you point it at anything that matters.