How cambiegroup/flowchem works
Main Components
• Core Application: At the center is the main Flowchem application (located in the src/flowchem folder) that handles orchestration.
• Configuration Module: The configuration parser (see src/flowchem/server/configuration_parser.py) reads the configuration file with device connection details.
• Device Drivers & Components: The devices are modularized into drivers – look into folders like src/flowchem/devices, src/flowchem/components, and their subdirectories for specific device implementations (e.g., pumps, valves, sensors). These driver modules abstract the details of communication with each instrument.
• Communication & API Layer: The server components, especially in src/flowchem/server, include FastAPI-based endpoints (e.g., src/flowchem/server/fastapi_server.py) and other communication pathways (like zeroconf in src/flowchem/server/zeroconf_server.py) to expose device capabilities via a web interface.
• Client Interfaces: There are client modules (found under src/flowchem/client) that provide Python and possibly other language integrations, making the system accessible to both a web browser and programmatic clients.
Relationships and Data Flow
• Device Manager/Connection Layer: From the core application, indicate connections to multiple “Device Driver” modules. Each driver (or group of drivers, such as pumps, valves, sensors, etc.) represents the abstraction layer for a specific type of device.
• API / Server Layer: Link the Core Application to the “API Server” (FastAPI, Zeroconf Server) that handles HTTP requests, thereby exposing endpoints to control devices.
Architectural Patterns and Design Principles
• Modular Design: Emphasize that each device type is implemented as a separate module (see the various directories under src/flowchem/devices and src/flowchem/components). This supports extensibility as new device types can be plugged in.
• Separation of Concerns: Clearly delineate configuration management, device abstraction, API routing, and client communication.
• Single Unified API: Stress that regardless of underlying protocols or command syntax of each device, Flowchem provides a consistent API layer.
Technologies and Frameworks
• Python 3.10+ as the programming language.
• FastAPI for building the server web API (including asynchronous client support as seen in src/flowchem/client/async_client.py).
• GitHub Actions for CI/CD (workflows are in .github/workflows).
Final Touches
• Clarity and detail – do not shy away from dividing the core application into as many components as needed to capture the essential architectural elements.