A Flask-based server and web UI for accessing and visualizing SYSMOD SysML v2 models via the SysML v2 API.
Warning
Work in Progress β This project is under active development. Some features may be incomplete, use placeholder/dummy data, or behave unexpectedly. Contributions and feedback are welcome.
sysmod-sysmlv2-api is a demonstrator application for the SYSMOD methodology that connects to a SysML v2 repository server and provides a rich, interactive web-based viewer and wizard for your SysML v2 models.
Key highlights:
- π Connects to any SysML v2 API-compliant server (e.g., SysML v2 Reference Implementation)
- π SYSMOD Viewer β browse projects, commits, and SYSMOD model content (problem statements, system idea, contexts, stakeholders, use cases, requirements, feature trees, and more)
- π§ SYSMOD Wizard β step-by-step AI-assisted creation of new SysML v2 / SYSMOD models from scratch
- π€ OpenAI Integration β AI-powered suggestions for problem statements, system requirements, stakeholders, and architecture
- π¦ Built on
mbse4u-sysml-helpersβ reuses the MBSE4U SysML v2 Python API helper library
| Feature | Description |
|---|---|
| Project & Commit Selection | Browse SysML v2 projects and commits from a configured server |
| SYSMOD Project Overview | Displays the SYSMOD Atlas status grid with model completeness indicators |
| Problem Statement | Read and edit the problem statement directly via the SysML v2 API |
| System Idea | Displays the system idea description and AI-generated image |
| Context Diagrams | Visualizes Brownfield, System Idea, Requirement, Functional, Logical, and Product contexts |
| Stakeholders | Lists project stakeholders with attributes |
| Use Cases | Displays use cases from the model |
| Requirements | Lists system requirements with identifiers, priorities, and obligations |
| Feature Tree | Renders the feature tree in UVL format with Mermaid graph visualization |
| Feature Binding Matrix | Interactive matrix to manage feature binding dependencies |
| Quality Checks | Automated checks for SYSMOD model completeness |
| AI Suggestions | OpenAI GPT-4oβpowered suggestions to refine the problem statement |
| Cache Warmup | Bulk element loading to speed up subsequent queries |
A guided, multi-step wizard for AI-assisted creation of new SYSMOD / SysML v2 models:
| Step | Name | Description |
|---|---|---|
| 1 | Project Setup | Define the system name and description; generates SysML v2 model scaffold |
| 2 | Brownfield Analysis | Upload existing documents; AI extracts context and existing system information |
| 3 | Problem Statement | Describe the problem; AI generates a concise problem statement |
| 4 | Stakeholders | Identify stakeholders; AI suggests stakeholder attributes |
| 5 | System Idea | Define the system idea; AI generates description and conceptual image |
| 6 | System Requirements | Generate system requirements from prior context; AI outputs SysML v2 code |
| 7 | Use Cases | Generate use case definitions; AI outputs SysML v2 code |
| 8 | Product Architecture | Generate initial product architecture; AI outputs SysML v2 code |
sysmod-sysmlv2-api/
βββ sysmod_api_server.py # Main Flask application & REST API endpoints
βββ sysmod_api_helpers.py # SYSMOD-specific helper functions (queries, parsing)
βββ pleml_api_server.py # PLEML Flask Blueprint (feature tree & bindings endpoints)
βββ pleml_api_helpers.py # PLEML helper functions (feature tree, feature bindings)
βββ html/
β βββ index.html # Project / Commit / SYSMOD Project selection page
β βββ project.html # SYSMOD Viewer dashboard
β βββ sysmod-wizard.html # AI-assisted model creation wizard
βββ prompts/ # AI prompt templates for wizard steps
β βββ sysmod-model-template.txt
β βββ brownfield-prompt.txt
β βββ problem-statement-prompt.txt
β βββ stakeholders-prompt.txt
β βββ system-idea-prompt.txt
β βββ system-requirements-prompt.txt
β βββ use-cases-prompt.txt
β βββ product-arch-prompt.txt
βββ uploads/ # Uploaded reference documents (per system name)
βββ word/ # Word macro templates
βββ .env # Environment variables (API keys, not tracked)
| Module | Role |
|---|---|
sysmod_api_server.py |
Main Flask app; mounts pleml_blueprint and serves all SYSMOD endpoints |
sysmod_api_helpers.py |
SYSMOD model queries β problem statement, system idea, contexts, stakeholders, requirements, quality checks, etc. |
pleml_api_server.py |
Flask Blueprint for all PLEML/feature endpoints; can also run standalone on port 5001 |
pleml_api_helpers.py |
PLEML helper functions: feature tree (UVL), feature bindings, PLEML presence check |
- Python 3.8+
- A running SysML v2 API server (e.g., the SysML v2 Reference Implementation)
- An OpenAI API key (optional, required only for AI-assisted wizard steps and AI suggestions)
git clone https://github.com/MBSE4U/sysmod-sysmlv2-api.git
cd sysmod-sysmlv2-apiThis project depends on the mbse4u-sysml-helpers Python package, which provides the low-level SysML v2 API client functions.
pip install mbse4u-sysml-helpersInstall all required packages using the provided requirements.txt:
pip install -r requirements.txtTo enable PDF and Word document uploads in the wizard, also install:
pip install pypdf python-docxTo enable AI features (OpenAI GPT-4o / DALL-E 3), install:
pip install openaiCopy the example environment file and fill in your values:
copy .env.example .envThen edit .env:
OPENAI_API_KEY=your_openai_api_key_hereNote: The OpenAI API key can also be entered directly in the web UI within the wizard or viewer settings, without needing a
.envfile.
python sysmod_api_server.pyThe server starts on http://localhost:5000 by default (Flask debug mode).
Navigate to http://localhost:5000 in your browser.
- Enter the SysML v2 server URL (e.g.,
http://localhost:9000) - Click "Get Projects" to retrieve available projects from the server
- Select a project and select a commit
- Select a SYSMOD project β the viewer will open automatically
Or click "Start Creation Wizard" to create a new SYSMOD model from scratch.
The Flask server exposes the following REST API endpoints (all accept/return JSON unless noted):
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/projects |
List projects on a SysML v2 server |
POST |
/api/commits |
List commits for a project |
POST |
/api/cache/warmup |
Bulk-load elements into the in-memory cache |
POST |
/api/sysmod_projects |
List SYSMOD projects in a commit |
POST |
/api/sysmod_project |
Get SYSMOD project details (name, documentation) |
POST |
/api/element |
Get a generic model element by ID |
POST |
/api/problem-statement |
Get the problem statement |
POST |
/api/problem-statement/save |
Save an updated problem statement |
POST |
/api/system-idea |
Get the system idea description |
POST |
/api/sysmod-context |
Get a SYSMOD context diagram (Brownfield, System, Functional, β¦) |
POST |
/api/requirements |
Get system requirements |
POST |
/api/usecases |
Get use cases |
POST |
/api/stakeholders |
Get stakeholders |
POST |
/api/quality-checks |
Run SYSMOD model quality checks |
POST |
/api/sysmod-atlas |
Get SYSMOD Atlas status overview |
POST |
/api/ai-suggestion_problem_statement |
Get an AI-improved problem statement |
POST |
/api/wizard/project-setup |
Wizard Step 1 β generate SysML v2 project scaffold |
GET |
/api/wizard/files |
List previously uploaded files for a system |
POST |
/api/wizard/brownfield |
Wizard Step 2 β brownfield analysis with AI |
POST |
/api/wizard/problem |
Wizard Step 3 β problem statement generation |
POST |
/api/wizard/stakeholders |
Wizard Step 4 β stakeholder analysis |
POST |
/api/wizard/system-idea |
Wizard Step 5 β system idea generation with image |
POST |
/api/wizard/system-requirements |
Wizard Step 6 β system requirements generation |
POST |
/api/wizard/use-cases |
Wizard Step 7 β use case generation |
POST |
/api/wizard/product-arch |
Wizard Step 8 β product architecture generation |
These endpoints are provided by the pleml_blueprint Flask Blueprint and are registered in the main server. The pleml_api_server.py module can also be run standalone on port 5001 for PLEML-only deployments.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/check-pleml |
Check whether the project contains a PLEML feature model (has_pleml, feature_tree_count) |
POST |
/api/feature-bindings |
Get feature binding dependencies (annotated with @FB) |
POST |
/api/feature-bindings/toggle |
Create or delete a feature binding |
POST |
/api/feature-tree-uvl |
Get the UVL feature tree (from element annotated with @featureTree) |
POST |
/api/feature-tree-sysml |
Get the feature tree as a matrix + Mermaid graph (currently returns dummy data) |
| Package | Purpose |
|---|---|
mbse4u-sysml-helpers |
SysML v2 API client helpers (element queries, caching, metadata) |
flask |
Web framework and REST API server |
requests |
HTTP client for SysML v2 API communication |
python-dotenv |
Load environment variables from .env |
anytree |
Tree data structure for model traversal |
openai (optional) |
GPT-4o and DALL-E 3 integration for AI features |
pypdf (optional) |
PDF text extraction for document uploads |
python-docx (optional) |
Word document text extraction for document uploads |
- Tim Weilkiens β MBSE4U
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
- SYSMOD Methodology β The MBSE methodology this tool supports
- mbse4u-sysml-helpers on PyPI β The underlying SysML v2 Python API helper library
- SysML v2 Reference Implementation β The open-source SysML v2 API server