The implementation of BioMap is centered on a robust set of API endpoints that connect our user interface with the powerful backend services for model building and simulation. The user interface is broken down into three functional sections: the Project Dashboard, the Model Building Interface, and the Simulation & Analysis view.
Project Dashboard
Upon logging in, the user is presented with their project dashboard. This view is populated by making a GET request to the /projects/{user_id} endpoint, which retrieves all projects associated with their account. Users can initiate a new modeling workflow by clicking "New Project," which triggers a POST request to /projects/create. This action also automatically creates an initial chat session, seamlessly navigating the user to the Model Building Interface to begin their work.
Model Building (Chat Interface)
This is the core of BioMap, where natural language is translated into a formal systems biology model. The interface supports two primary methods for model creation:
- Conversational Input: The user describes their biological system in plain English. Each message is sent via a
POST request to the /chat/ endpoint. The backend then packages this message with the current JSON representation of the model and sends it to the OpenAI GPT-4o service. The AI's response, a JSON object containing a conversational reply and the updated model state (new_model_state), is parsed and displayed. A dedicated React component renders the new_model_state in real-time, providing the user with a continuously updated, structured view of their species, reactions, and events.
- SBML Upload: Users can import existing models by uploading an SBML file (
.xml or .sbml), which sends the file's content to the POST /chat/upload_sbml endpoint. The backend then parses this file to establish the initial model state for the session.
The sidebar in this view allows for full management of chat sessions within a project, using POST, PUT, and DELETE requests to endpoints like /chat/create and /chat/{chat_id} to handle creation, renaming, and deletion.
Simulation & Analysis
When a user is ready to simulate, they navigate to the "Simulation" tab. This action triggers a POST request to /model/finalize/{session_id}, where the backend converts the session's final JSON model into a valid SBML string. The frontend then calls the POST /simulate endpoint, sending the model_id and simulation settings (e.g., start/end time).
The results are rendered in an interactive graph using Plotly.js. A key feature of this view is the real-time parameter tuning. A control panel displays sliders for every parameter in the model. Adjusting a slider instantly triggers a new call to the /simulate endpoint with the updated parameter value, allowing users to perform rapid "what-if" analysis and observe how the system's dynamics change.
The "Report Summary" section integrates a rich text editor with our AI. Users can write their own observations or click "Generate" (POST /model/{model_id}/regenerate-summary) to have the AI produce a structured, scientific summary of the simulation results. For collaboration and documentation, users can export the model as an SBML file (.xml), the time-series data as a CSV file, or the plot as a PNG image.
Automated Model Refinement
In addition to the user-facing features, we have implemented an automated process to enhance model robustness. Before a model is finalized for simulation, the backend analyzes the reaction network to intelligently identify species that act only as sources (only ever produced) or sinks (only ever consumed). It then automatically sets the boundaryCondition attribute for these species to true. This automated step prevents common simulation errors related to mass balance and improves the validity of the model without requiring expert intervention from the user.