Back to profile

2024

Medical platform microservices

Patient records, shared settings and geospatial services for calls and ambulance movement. Realtime map updates via WebSocket/Centrifugo, with Kafka messaging between services.

Backend engineer

The challenge

New functionality required clear service boundaries and data exchange with the existing system.

What I built

  • Implemented a geospatial service for call geotags/distribution and ambulance movement, with realtime updates via WebSocket and Centrifugo.
  • Implemented a centralized settings service for the other services.
  • Implemented a client data service for patient records.
  • Built a Kafka module for the internal PHP framework, including producers, consumers and topics.
  • Worked with PostgreSQL and integration with the existing application.

Results

  • Implemented patient, configuration and geodata services, plus a shared Kafka integration module.
Components & connections

Legacy system

  • PHP monolithExisting functionality migrated incrementally.

Event exchange

  • Shared Kafka · moduleA shared internal PHP framework module for producers, consumers and topics.
  • Kafka brokerAsynchronous messaging between the application and extracted services.

Domain services

  • Geospatial · Calls · Ambulance movementCall geotags, call distribution on the map and ambulance movement.
  • Shared · settingsCentralized settings for the other services.
  • Patient · recordsClient data and patient records.

Data

  • PostgreSQL · Service dataRelational storage for services.

Realtime map

  • Centrifugo · WebSocketRealtime delivery of geospatial updates.
  • Call map · Ambulance movementDisplay of call geotags and ambulance movement.
  1. PHP monolith↔Shared Kafka · moduleevents
  2. Shared Kafka · module↔Kafka brokerpublish/consume
  3. Kafka broker↔Geospatial · Calls · Ambulance movementevent exchange
  4. Geospatial · Calls · Ambulance movement↔PostgreSQL · Service datastorage
  5. Kafka broker↔Shared · settingsevent exchange
  6. Shared · settings↔PostgreSQL · Service datastorage
  7. Kafka broker↔Patient · recordsevent exchange
  8. Patient · records↔PostgreSQL · Service datastorage
  9. Shared · settings→Geospatial · Calls · Ambulance movementshared settings
  10. Shared · settings→Patient · recordsshared settings
  11. Geospatial · Calls · Ambulance movement→Centrifugo · WebSocketgeo updates
  12. Centrifugo · WebSocket→Call map · Ambulance movementWebSocket

Engineering takeaway

Context

An emergency medical software platform.

  • The monolith and new services had to coexist.
  • Sensitive data and consistent contracts between services.

Approach

Gradually extracted functional areas into services and connected them to shared messaging.

  • Service boundaries based on the domain.
  • A common Kafka module for consistent messaging.

Lessons

  • System decomposition starts with responsibility boundaries and data contracts.

Products, systems and ideas brought to life in working software.