How crymeariva/igemapplication works
Purpose and Top-Level Shape
iGEM OSAGE is a laboratory hardware-control and experiment-cycle design application. It combines a React dashboard, a Node.js service with an LLM-backed agent, and separate Raspberry Pi/Arduino hardware code. The central product concept appears to be creating, saving, loading, and executing/representing experimental “cycles” composed of hardware nodes.
Runtime Entry Points
• React browser client: my-app/src/index.js mounts my-app/src/App.js; static hosting begins at my-app/public/index.html.
• Node backend: my-app/server/index.js is the server entry point, with persistence initialized through my-app/server/database.js.
• Arduino motor firmware: ArduinoScript/MotorScript/MotorScript.ino.
• Raspberry Pi I²C integration/legacy test script: PiScript/i2cTest.py.
Interactive Experiment Canvas
The frontend’s primary orchestration layer is my-app/src/App.js, which assembles the dashboard and likely owns canvas-level state. Hardware is modeled as distinct visual/configurable node types:
• my-app/src/Components/HardwareNodes/PeristalticPumpNode.js
• my-app/src/Components/HardwareNodes/SyringePumpNode.js
• my-app/src/Components/HardwareNodes/SpectrometerNode.js
• my-app/src/Components/HardwareNodes/ElectroporatorNode.js
• my-app/src/Components/HardwareNodes/ThermometerNode.js
This creates a boundary between experiment composition in the browser and device-specific execution/configuration.
Cycle Lifecycle and Persistence
Cycles move between canvas state, serialized storage, and restored canvas state:
• Canvas reconstruction: my-app/src/canvas/addCycleToCanvas.js
• Canvas serialization: my-app/src/utils/serializeCanvasContext.js
• Save/load/delete lifecycle hooks: my-app/src/hooks/useCycleSave.js, my-app/src/hooks/useCycleLoader.js, my-app/src/hooks/useCycleDelete.js
• Backend client boundary: my-app/src/api/cyclesApi.js
• Server persistence boundary: my-app/server/database.js
The load dialog and side menu are the user-facing access points for stored workflows: my-app/src/Components/LoadCycleDialog.js and my-app/src/Components/SideMenu/Sidemenu.js.
Agent-Assisted Cycle Generation
A backend agent pipeline interprets user requests and creates valid experimental cycles:
• Request/message coordination: my-app/server/agent/handleMessage.js
• Intent classification: my-app/server/agent/intent.js
• Cycle generation: my-app/server/agent/generateCycle.js
• Generated-cycle validation: my-app/server/agent/validateCycle.js
The frontend invokes this service through my-app/src/api/agentApi.js, with user controls in my-app/src/Components/AgentMenu/AgentMenu.js and settings in my-app/src/Components/AgentSettingsDialog/AgentSettingsDialog.js.
LLM and Knowledge Boundary
The LLM integration is isolated in my-app/server/llm.js; agent identity/configuration is separated in my-app/server/agentKeys.js. Prompt/domain knowledge is file-based under:
• my-app/server/context/INSTRUCTIONS.md
• my-app/server/context/GENERATE_CYCLE.md
• my-app/server/context/MOSMAGE.md
This keeps language-model prompting and agent policy on the server rather than exposing it to the browser.
Hardware Integration Boundary
The web system is architecturally separate from low-level device runtimes. Arduino C++ firmware controls motor behavior in ArduinoScript/MotorScript/MotorScript.ino; Raspberry Pi Python handles I²C-side communication in PiScript/i2cTest.py. The README labels Pi code as legacy, so the Node service and frontend should not be assumed to directly depend on it without confirming protocol wiring. Material runtimes are browser/React, Node.js, Python on Raspberry Pi, and Arduino firmware.
Components 21
React browser
- Browser entry
my-app/src/index.js - Experiment dashboard · Owns canvas-level experiment state.
my-app/src/App.js - Hardware canvas nodes · Configurable pump, spectrometer, electroporator, and thermometer nodes.
- Cycle library UI · Stored-cycle access via load dialog and side menu.
- Cycle lifecycle hooks · Save, load, and delete workflow actions.
- Canvas serializer
my-app/src/utils/serializeCanvasContext.js - Canvas reconstruction
my-app/src/canvas/addCycleToCanvas.js - Cycles API client
my-app/src/api/cyclesApi.js - Agent controls · Agent menu and settings dialog.
- Agent API client
my-app/src/api/agentApi.js
Node service
- Server entry
my-app/server/index.js - Cycle persistence
my-app/server/database.js
Agent pipeline
- Message handler
my-app/server/agent/handleMessage.js - Intent classifier
my-app/server/agent/intent.js - Cycle generator
my-app/server/agent/generateCycle.js - Cycle validator · Checks generated experimental cycles.
my-app/server/agent/validateCycle.js - LLM integration
my-app/server/llm.js - Prompt knowledge · Instructions and experiment-domain prompts remain server-side.
my-app/server/context/INSTRUCTIONS.md - Agent identity config
my-app/server/agentKeys.js
Device runtimes
- Raspberry Pi I²C script · Legacy I²C-side communication script.
PiScript/i2cTest.py - Motor firmware · Controls motor behavior.
ArduinoScript/MotorScript/MotorScript.ino
Connections 20
- Browser entry → Experiment dashboard: mounts
- Experiment dashboard → Hardware canvas nodes: composes
- Experiment dashboard → Cycle library UI: hosts
- Experiment dashboard → Agent controls: hosts
- Experiment dashboard → Cycle lifecycle hooks: uses
- Cycle lifecycle hooks → Canvas serializer: serializes
- Cycle lifecycle hooks → Canvas reconstruction: restores through
- Cycle lifecycle hooks → Cycles API client: calls
- Cycles API client → Server entry: cycle requests
- Server entry → Cycle persistence: persists cycles
- Agent controls → Agent API client: submits requests
- Agent API client → Server entry: agent requests
- Server entry → Message handler: routes messages
- Message handler → Intent classifier: classifies
- Intent classifier → Cycle generator: selects generation
- Cycle generator → Cycle validator: validates output
- Cycle generator → LLM integration: uses
- LLM integration → Prompt knowledge: loads prompts
- Message handler → Agent identity config: uses identity
- Raspberry Pi I²C script → Motor firmware: I²C-side integration · Protocol wiring to the web service is unconfirmed.