How wahidmubarrat/emercare works
EmerCare connects unauthenticated emergency seekers and service accounts to nearby hospitals, blood donors, and ambulance services. The user workflow runs from location-aware discovery or account registration through direct contact and service-availability management; a separate assistant enriches chat responses with nearby facility and donor information. The graph follows documented routes and sampled call relationships. Several controller and frontend implementations were not sampled, so their internal wiring is shown only where supported by the tree, README, or excerpts.
Main entry points: index.js HTTP application · App.jsx App routing · api.js API client · ambulanceController.js Ambulance workflows
Components 32
Web experience
- App routing
frontend/src/App.jsx - Service discovery
frontend/src/pages - Account registration
frontend/src/pages - Profiles and availability
frontend/src/pages - Hospital service management
frontend/src/pages/ManageHospitalServices.jsx - Assistant chat
frontend/src/components/ChatBot.jsx - Location capture
frontend/src/hooks/useGeolocation.js - API client
frontend/src/services/api.js
API and workflows
- HTTP application
backend/src/index.js - Donor routes
backend/src/routes/donorRoutes.js - Hospital routes
backend/src/routes/hospitalRoutes.js - Ambulance routes
backend/src/routes/ambulanceRoutes.js - Vehicle routes
backend/src/routes/ambulanceVehicleRoutes.js - Hospital service routes
backend/src/routes/hospitalServiceRoutes.js - Assistant route
backend/src/routes/aiRoutes.js - Donor workflows
backend/src/controllers/donorController.js - Hospital workflows
backend/src/controllers/hospitalController.js - Ambulance workflows
backend/src/controllers/ambulanceController.js - Vehicle workflows
backend/src/controllers/ambulanceVehicleController.js - Hospital service workflows
backend/src/controllers/hospitalServiceController.js - Nearby AI context
backend/src/controllers/aiController.js
Healthcare records
- Donor records
backend/src/models/Donor.js - Hospital records
backend/src/models/Hospital.js - Ambulance records
backend/src/models/Ambulance.js - Vehicle records
backend/src/models/AmbulanceVehicle.js - Service profiles
backend/src/models/HospitalServiceProfile.js - MongoDB connection
backend/src/config/database.js
External services
- Cloudinary storage
- Geocoding service
- OpenRouter AI
Other components
- Emergency seeker
- Service account
Connections 42
- Emergency seeker → App routing: opens
- Service account → App routing: opens
- App routing → Service discovery: routes to
- App routing → Account registration: routes to
- App routing → Profiles and availability: routes to
- App routing → Hospital service management: routes to
- App routing → Assistant chat: renders
- Service discovery → Location capture: captures location
- Service discovery → API client: requests results
- Account registration → Location capture: captures location
- Account registration → API client: submits account
- Profiles and availability → API client: updates profile
- Hospital service management → API client: manages services
- Assistant chat → API client: sends chat
- API client → HTTP application: HTTP requests
- HTTP application → MongoDB connection: connects
- HTTP application → Donor routes: mounts
- HTTP application → Hospital routes: mounts
- HTTP application → Ambulance routes: mounts
- HTTP application → Vehicle routes: mounts
- HTTP application → Hospital service routes: mounts
- HTTP application → Assistant route: mounts
- Donor routes → Donor workflows: dispatches
- Hospital routes → Hospital workflows: dispatches
- Ambulance routes → Ambulance workflows: dispatches
- Vehicle routes → Vehicle workflows: dispatches
- Hospital service routes → Hospital service workflows: dispatches
- Assistant route → Nearby AI context: dispatches
- Donor workflows → Donor records: queries and updates
- Hospital workflows → Hospital records: queries and updates
- Ambulance workflows → Ambulance records: queries and updates
- Ambulance workflows → Vehicle records: loads vehicles
- Vehicle workflows → Vehicle records: queries and updates
- Hospital service workflows → Service profiles: queries and updates
- Nearby AI context → Hospital records: finds nearby
- Nearby AI context → Donor records: finds nearby
- Nearby AI context → Service profiles: loads facility context
- Nearby AI context → OpenRouter AI: requests completion
- Donor workflows → Cloudinary storage: uploads images
- Ambulance workflows → Cloudinary storage: uploads images
- Donor workflows → Geocoding service: resolves location
- Ambulance workflows → Geocoding service: resolves location