How ar1625517-gif/smart-ambulance-system works
This backend implements emergency dispatch and trip updates. A requester submits an SOS with location and emergency type; the dispatch route selects a nearby available ambulance and a nearby hospital with matching specialty and ER capacity, marks the ambulance busy, and returns trip details. Socket.IO separately relays driver location and patient vitals to clients joined to a trip. The tree shows no frontend source, so client behavior is represented only as external actors; persistence and runtime wiring are evidenced by the sampled server and route files.
Main entry points: server.js HTTP and socket server · dispatch.js Dispatch route · Ambulance.js Ambulance model · Hospital.js Hospital model
Components 12
SOS Dispatch
- Dispatch route
smart-ambulance-system/backend/routes/dispatch.js
Fleet And Hospitals
- Ambulance model
smart-ambulance-system/backend/models/Ambulance.js - Hospital model
smart-ambulance-system/backend/models/Hospital.js - MongoDB runtime
Trip Updates
- Trip room
smart-ambulance-system/backend/server.js - Live location relay
smart-ambulance-system/backend/server.js - Vitals alert relay
smart-ambulance-system/backend/server.js
Backend Runtime
- HTTP and socket server
smart-ambulance-system/backend/server.js - Sample data loader
smart-ambulance-system/backend/seed.js
Other components
- Emergency requester
- Driver client
- Hospital client
Connections 16
- Emergency requester → HTTP and socket server: sends SOS
smart-ambulance-system/backend/server.js - HTTP and socket server → Dispatch route: mounts routes
smart-ambulance-system/backend/server.js - Dispatch route → Ambulance model: finds and updates
smart-ambulance-system/backend/routes/dispatch.js - Dispatch route → Hospital model: searches capacity
smart-ambulance-system/backend/routes/dispatch.js - HTTP and socket server → Ambulance model: inserts samples
smart-ambulance-system/backend/server.js - HTTP and socket server → Hospital model: inserts samples
smart-ambulance-system/backend/server.js - Dispatch route → Emergency requester: returns trip
smart-ambulance-system/backend/routes/dispatch.js - Driver client → HTTP and socket server: sends updates
smart-ambulance-system/backend/server.js - Hospital client → HTTP and socket server: sends vitals
smart-ambulance-system/backend/server.js - HTTP and socket server → Trip room: joins trip
smart-ambulance-system/backend/server.js - HTTP and socket server → Live location relay: emits location
smart-ambulance-system/backend/server.js - HTTP and socket server → Vitals alert relay: emits vitals
smart-ambulance-system/backend/server.js - Trip room → Live location relay: targets trip
smart-ambulance-system/backend/server.js - Trip room → Vitals alert relay: targets trip
smart-ambulance-system/backend/server.js - Sample data loader → Ambulance model: seeds records
smart-ambulance-system/backend/seed.js - Sample data loader → Hospital model: seeds records
smart-ambulance-system/backend/seed.js