How naikaayush/employee-emergency works
1. Overall shape
- This repo is a three-part system for emergency evacuation: a client app, a Python computation/API backend, and a Node-based realtime server.
- The client is the primary product surface; the two servers support map processing, routing, positioning, and realtime coordination.
2. Client application boundary
- orange-ecc is an Ionic + Angular app that targets both mobile and web.
- It is packaged for mobile with Capacitor/Cordova-style mobile configuration and includes an Android APK artifact, Firebase config, and platform resources for Android/iOS.
3. Role-based client subsystems
- The app is split into separate Angular feature areas for Employee, ERT, and Command Center, each with its own module and route tree.
- This is a strong architectural boundary: each role gets its own login/auth flow, tab shell, and task-specific views.
4. Employee experience
- The Employee area includes auth screens plus tabs for chat, map, SOS, AR, and a chatbot.
- Supporting client-side services include trilateration, pathfinding, and websocket communication, showing that the device participates in position estimation and navigation rather than just rendering UI.
5. ERT experience
- The ERT area mirrors the employee structure with auth plus tabs for chat, map, status, and AR.
- It also has auth, trilateration, pathfinding, and websocket services, indicating it consumes the same realtime location and routing backbone but with different operational views.
6. Command Center experience
- The Command Center area is the administrative/control-plane UI.
- Its main tabs are overview, approve, emergency, map, and setup, plus a dedicated upload-map component, so this area is where maps are onboarded and emergency operations are coordinated.
7. Simulation subsystem
- command-center-simulation is a separate client feature used to test scenarios.
- It has its own map and emergency views, which suggests a self-contained sandbox for exercising the evacuation model without affecting live operations.
8. Shared client services and models
- The client contains shared business logic for authentication, websocket transport, trilateration, and shortest-path navigation.
- The employee map feature also defines explicit data models such as points, markers, map info, and choice info, which are likely the domain objects passed between map rendering, positioning, and routing.
9. Python backend: command-center-api
- server/command-center-api is the computational backend, implemented in Python.
- Its submodules show the main responsibilities clearly: image/map processing, beacon estimation, pathfinding, simulation, and shared data handling.
- This backend is the main algorithmic engine for turning uploaded floor plans into navigable graph data and beacon layouts.
10. Realtime backend: ws-api
- server/ws-api is a separate Node/Express websocket service.
- It likely carries live presence/location/chat events between employees, ERT, and the command center, distinct from the Python API that does heavier processing.
11. Data flow through the system
- A typical flow is: command center uploads a map image → Python backend extracts paths and beacon placements → routing and simulation data become available to the client → devices use trilateration and websocket updates to render live positions and navigation.
- Realtime chat and live map views depend on the websocket layer, while scenario setup and route computation depend on the Python backend.
12. External services and infrastructure
- Firebase Realtime Database is part of the architecture and is used alongside websockets for realtime synchronization.
- google-services.json indicates Android/Firebase integration on the client side.
- BLE beacons and WiFi APs are physical inputs to the indoor-positioning workflow; they are not just simulated data.
13. Non-runtime / supporting assets
- analysis contains offline beacon-data exploration notebooks and JSON data, which are useful for research but not part of the production runtime.
- screenshots is documentation only.
14. How to draw the diagram
- Model the system as one client tier with three role-based frontends, one Python computation service, one Node websocket service, and Firebase as a realtime datastore/sync layer.
- Show the command center as the source of maps and operational commands, employees/ERT as realtime mobile consumers, and the simulation module as a separate test path that reuses the same backend capabilities.
Main entry points: app.py Command API · app.module.ts App shell · index.js WS API · employee.module.ts Employee
Components 31
Client app
Ionic/Angular front-end with role-based experiences and mobile packaging.
- App shell · Top-level Angular application wiring and global bootstrap.
orange-ecc/src/app/app.module.ts - Home · Entry experience before role-specific access.
orange-ecc/src/app/home/home.module.ts - Employee · Employee-facing mobile/web experience.
orange-ecc/src/app/employee/employee.module.ts - Emp auth · Employee onboarding and authentication flow.
orange-ecc/src/app/employee/views/employee-auth/employee-sign-in/employee-sign-in.component.ts - Emp tabs · Employee tab navigation container.
orange-ecc/src/app/employee/views/employee-tabs/employee-tabs.module.ts - Emp features · Employee operational views for communication, navigation, SOS, AR, and assistant.
orange-ecc/src/app/employee/views/tabs/employee-chat/employee-chat.page.ts - Emp services · Shared client logic for indoor positioning, route computation, and realtime sync.
orange-ecc/src/app/employee/services/websocket/websocket.service.ts - ERT · Emergency response team experience.
orange-ecc/src/app/ert/ert.module.ts - ERT auth · ERT authentication flow.
orange-ecc/src/app/ert/views/ert-auth/ert-sign-in/ert-sign-in.component.ts - ERT tabs · ERT tab navigation container.
orange-ecc/src/app/ert/views/ert-tabs/ert-tabs.module.ts - ERT features · ERT operational views for coordination, map monitoring, and status.
orange-ecc/src/app/ert/views/tabs/ert-chat/ert-chat.page.ts - ERT services · ERT-side shared logic for auth, positioning, routing, and realtime updates.
orange-ecc/src/app/ert/services/websocket/websocket.service.ts - Command Center · Administrative and operational control-plane experience.
orange-ecc/src/app/command-center/command-center.module.ts - CC auth · Command center login boundary.
orange-ecc/src/app/command-center/views/command-center-auth/command-center-login/command-center-login.component.ts - CC tabs · Command center tab navigation container.
orange-ecc/src/app/command-center/views/command-center-tabs/command-center-tabs.module.ts - CC features · Operational dashboards and workflows for map review and incident coordination.
orange-ecc/src/app/command-center/views/tabs/command-center-overview/command-center-overview.page.ts - Map setup · Map onboarding and setup workflow, including upload component and API integration.
orange-ecc/src/app/command-center/views/tabs/command-center-setup/command-center-upload-map/command-center-upload-map.component.ts - Simulation · Standalone command-center simulation path for testing evacuation scenarios.
orange-ecc/src/app/command-center-simulation/command-center-simulation.module.ts - Sim tabs · Simulation tab container.
orange-ecc/src/app/command-center-simulation/views/command-center-simulation-tabs/command-center-simulation-tabs.module.ts - Sim features · Simulation views for map and emergency scenario exercise.
orange-ecc/src/app/command-center-simulation/views/tabs/command-center-simulation-map/command-center-simulation-map.page.ts - Map models · Employee map domain objects used by rendering and navigation.
orange-ecc/src/app/employee/views/tabs/employee-map/models/map-info.ts
Server backends
Python computation API and Node websocket service.
- Command API · Python backend entrypoint for map processing, pathfinding, beacon estimation, and simulation.
server/command-center-api/app/app.py - Processing · Floor-plan and map processing pipeline.
server/command-center-api/app/processing/map.py - Beacon estimator · Beacon placement and estimation logic.
server/command-center-api/app/beacon_estimator/beacon_estimator.py - Pathfinder · Backend route graph and path computation.
server/command-center-api/app/pathfinder/pathfinder.py - Backend sim · Python-side evacuation simulation engine.
server/command-center-api/app/simulator/simulator.py - Data layer · Backend data handling and serialization support.
server/command-center-api/app/data/data.py - WS API · Node/Express websocket service for live coordination and events.
server/ws-api/index.js
External inputs
Realtime datastore and physical positioning inputs used by the system.
- Firebase DB · External realtime synchronization layer used alongside websockets.
- Beacons/WiFi · Physical BLE beacon and WiFi AP inputs for positioning.
Supporting assets
Offline analysis and documentation material.
- Analysis · Notebook-based beacon analysis and supporting data.
analysis/beacons_data_analysis.ipynb
Connections 35
- App shell → Home: routes · Bootstrap lands in the home experience first.
- App shell → Employee: feature route · Registers the employee role application.
- App shell → ERT: feature route · Registers the ERT role application.
- App shell → Command Center: feature route · Registers the command center application.
- App shell → Simulation: feature route · Registers the simulation path.
- Employee → Emp auth: auth · Employee access begins with sign-in/up/verify.
- Employee → Emp tabs: shell · Employee tabs host the main experience.
- Emp tabs → Emp features: views · Tabs expose chat, map, SOS, AR, and chatbot.
- Emp features → Emp services: uses · UI consumes realtime, routing, and positioning services.
- Emp features → Map models: binds · Map views use shared domain models.
- ERT → ERT auth: auth · ERT access begins with sign-in/up/verify.
- ERT → ERT tabs: shell · ERT tabs host operational views.
- ERT tabs → ERT features: views · Tabs expose chat, map, status, and AR.
- ERT features → ERT services: uses · ERT UI consumes shared realtime and routing services.
- Command Center → CC auth: auth · Command center login gates the control plane.
- Command Center → CC tabs: shell · Tabs host administrative workflows.
- CC tabs → CC features: views · Overview, approval, emergency, map, and setup live here.
- CC features → Map setup: setup · Map onboarding is a dedicated control-center workflow.
- Map setup → Command API: uploads to · Uploaded map data is processed by the Python backend.
- Simulation → Sim tabs: shell · Simulation has its own navigation shell.
- Sim tabs → Sim features: views · Simulation exposes map and emergency scenarios.
- Sim features → Backend sim: drives · Simulation UI exercises the backend scenario engine.
- Command API → Processing: contains · Processing turns floor plans into navigable structures.
- Command API → Beacon estimator: contains · Backend estimates beacon placement/behavior.
- Command API → Pathfinder: contains · Backend computes evacuation paths.
- Command API → Backend sim: contains · Backend includes scenario simulation.
- Command API → Data layer: shares data · Backend uses shared data objects and serialization.
- Processing → Beacons/WiFi: derives from · Map processing is informed by physical indoor inputs.
- Beacon estimator → Beacons/WiFi: derives from · Beacon estimation uses BLE and WiFi signals.
- Pathfinder → Map models: feeds · Computed routes and map data are consumed by client map models.
- WS API → Firebase DB: syncs · Realtime state is coordinated through Firebase as well as websockets.
- Emp services → WS API: connects · Employee clients receive live updates through the websocket service.
- ERT services → WS API: connects · ERT clients receive live updates through the websocket service.
- CC features → WS API: observes · Control-center views consume live operational events.
- Analysis → Beacon estimator: informs · Offline research supports beacon-related computation.