Managing Component Categories
Applies to: CoModel cloud modeling & simulation platform (v1.15+)
1. Overview
As the custom component files you upload or write online accumulate, keeping every file at one flat level becomes hard to manage. The Category management feature of the CoModel platform lets you:
- Organize library files into different categories (e.g. "Power Electronics", "Thermal Management", "Hydraulic Systems")
- Browse custom components in the component tree under a category → file → component hierarchy
- Quickly locate the component you need through the category filter
Category management has three aspects:
| Aspect | Description | Who |
|---|---|---|
| Personal category maintenance | Create, edit, and delete your own personal categories | All signed-in users |
| Official category maintenance | Create, edit, and delete official categories shared with everyone | Administrators |
| File categorization | Assign a category to a library file | File owner |
| Component tree rendering | Show custom components under the category hierarchy | Automatic |
2. Three sources of categories
Every category carries a source property that determines its visibility and editability:
| Source | Identifier | Description | Visibility | Editable |
|---|---|---|---|---|
| Built-in categories | builtin |
The 6 domains of the standard library (Electrical, Mechanical, Thermal, Hydraulic, Magnetic, Blocks) | All users | ❌ Read-only |
| Official categories | official |
Shared categories created by administrators | All users | Admins only |
| Personal categories | user |
Categories a user creates for themselves (source badge shows "User"; the Categories page section is "My Categories") | Creator only | Creator only |
2.1 Visibility rules
- Personal categories are a private resource: only the creator sees them in category lists, upload dropdowns, and the component tree; no other user can see them (including other administrators).
- Different users can therefore each create personal categories with the same name (two people can both have a "Power Electronics"), without conflict and invisible to each other.
- The category list API returns, per signed-in identity: built-in categories + official categories + your own personal categories.
2.2 Name uniqueness
Category names are unique within the same ownership scope:
- A user's personal categories must not share a name;
- Built-in and official categories must not share a name with each other;
- Personal categories of different users may share a name;
- A personal category may share a name with a built-in or official category (only MTK module names are subject to reserved-word constraints).
Duplicate names are rejected on create/rename (HTTP 409, message "Category name ... already exists in this scope").
2.3 Flat structure
Categories do not nest: every new category is a top-level category.
3. Managing categories
Entry point: Sidebar → Categories (visible to all signed-in users; permissions are scoped by section within the page).
Top to bottom, the page has three sections:
| Section | Content | Actions |
|---|---|---|
| Builtin | The 6 built-in categories | Read-only (hover a category name for its description) |
| Official | List of official categories | Admins can add/edit/delete; regular users read-only |
| My Categories | Your own personal categories | Add/edit/delete |

3.1 Add a category
- In the My Categories section, click Add Category (administrators can also create official categories in the Official section)
- Fill in:
- English name (required, unique within the ownership scope)
- Chinese name (shown in the Chinese UI)
- Project description (optional, shown when hovering the category name)
- Administrators additionally see the Category source radio: "User" (visible only to you) or "Official" (visible to everyone); defaults to "User"
- Confirm to create
Categories created by regular users are always personal categories (owned by you). Once created, a new category is immediately available in the category dropdown when you upload or edit component files.

3.2 Edit a category
- Locate the category in its section and click Edit
- You can change: English name, Chinese name, project description
- Save
Permissions: personal categories can be edited only by their owner; official categories only by administrators; edit requests for built-in categories are rejected (403).
After renaming a category, the category display of all component files and components already assigned to it updates accordingly (categories are linked through the
category_idforeign key, so changes take effect immediately).
3.3 Delete a category
- Locate the category in its section and click Delete
- The system checks whether any component files or components belong to the category (including references that exist in other users' files):
- Occupied: the delete is rejected (409) with a message that component files or components exist under the category
- Empty: confirm to delete
Tip: if files still sit under the category you want to delete, first move those files to another category or set them to Uncategorized; only then can the category be deleted.
4. Assigning categories to component files
4.1 Assign a category at upload time
Whenever you upload or create components at the following entry points, pick the owner category in the dialog's Category dropdown:
- My Components → MTK Components: upload a
.jlfile or create one online - My Components → FMU Components: upload an FMU model
- My Components → AI Components: upload an ONNX model
- Saving a component from the graphical component editor
The dropdown contains: Uncategorized (default) + built-in categories + your personal categories + official categories, ordered by the unified convention (see Section 6).

Backend validation: category ownership is validated on write — you can only select Uncategorized, built-in, official, or your own personal categories; referencing another user's private category returns 400 ("Invalid category (not found or not yours)"). You will not hit this in normal operation: other users' private categories never appear in your dropdown.
4.2 Change the category of an existing file
Change it through the Meta Info feature:
- Locate the file in the file list on the My Components page
- Click the Meta Info button on the right of the row to open the Edit Meta Info dialog
- In the dialog you can:
- Rename: change the file's display name
- Change category: pick a new category from the dropdown, or choose Uncategorized to clear the category
- Administrators additionally see the Source setting (User / Official)
- Click Save

Category constraint on official publishing: when you publish a component or library file as official (source=official), its category must be a built-in category, an official category, or Uncategorized — it may not point to any personal category; the same applies when later changing the category of an already-official component or file. When publishing a library file as official, the categories of all component rows under the file are validated too. The front end pre-checks before saving and shows a message ("Official libraries must use a builtin or official category").
4.3 Category cascade updates
Important: categorization happens at the file level. After you change a file's category:
File category change
└── All components parsed from the file → inherit the new category automatically
This means you never edit component categories one by one. All components defined in one .jl file always keep the same category as their file.
4.4 Category display in the component library list
The file list on the My Components page has a Category column showing each file's current category. Above the list there is also a category filter bar: click a category to show only its files.

5. Rendering in the component tree
5.1 Component tree structure in graphical modeling
In the Component Browser on the left of the graphical modeling editor, components are organized as:
📂 Electrical ← built-in: standard library two-level tree (domain → subdomain, structure unchanged)
└── 📂 Analog
└── 📂 Digital
└── ...
📂 Mechanical
📂 ...
📁 User Components ← level 1: all custom content visible to you
├── 📂 Power Electronics ← level 2: category (personal/built-in/official categories can all appear)
│ ├── 📄 PowerModels.jl ← level 3: library file
│ │ ├── 🔌 MyConverter ← level 4: individual components in the file
│ │ └── 🔌 MyInverter
│ ├── 🔌 MyBuck ← FMU components hang directly under the category (no file level)
│ └── 🧠 MySurrogate ← same for AI components
├── 📂 Thermal Management
│ └── 📄 ThermalUtils.jl
│ └── 🔌 HeatExchanger
└── 📂 Uncategorized ← virtual category (see 5.3)
└── 📄 OldModels.jl
└── 🔌 LegacyComponent
📁 Official Components ← level 1: components published by the platform (MTK/FMU/AI)
└── 📂 Official category
└── 🔌 OfficialComponent
- User Components group: the MTK library files you uploaded expand over three levels, category → file → component; FMU/AI components you uploaded expand over two levels, category → component
- Official Components group: components with source=official, expanding over two levels, category → component
- When you assign a file to a built-in or official category, that category also appears inside the User Components group (sources are mixed within the group, still ordered by the unified convention)
5.2 Level rules
| Level | Node type | Display rule |
|---|---|---|
| 1 | User Components / Official Components | Shown only when the group has content |
| 2 | Category | Shown only when at least one component sits under it; empty categories do not appear |
| 3 | Library file | Only MTK library files have this level; shows the file display name |
| 4 | Component | Shows the component name; drag onto the canvas to use |
5.3 The Uncategorized virtual category
Component files created without a category default to the Uncategorized virtual category. It is a special node:
- Not shown on the Categories page (cannot be edited)
- Appears in the component tree and filter lists only when uncategorized content exists
- You can move files out of Uncategorized at any time through Meta Info
- Masked display: for components another user has made public that belong to their personal category, the server masks the category name when you view them (private category names are never leaked), and they display uniformly under Uncategorized
6. Category display order (unified convention)
Every place a category list appears uses the same display order:
Built-in → User (personal) → Official → Uncategorized (always last)
- Within groups: the built-in group sorts alphabetically by English name (matching the standard library scan order); personal/official groups use the backend's authoritative ordering
- Applies in five places (kept consistent): the filter tree on the left of the Component Library page, the category filter bars on the My Components (MTK) / FMU / AI pages, the category dropdowns in upload and Meta Info dialogs, and the category groups in the graphical modeling sidebar
7. FAQ
After I move a file from "Power Electronics" to "Thermal Management", do its components stay under "Power Electronics"?
No. Categories cascade: after the file's category changes, all components under the file move to the new category automatically and no longer appear under the old one.
Can one file belong to multiple categories at once?
No. Each library file takes exactly one category (or Uncategorized). If you want the same set of components in multiple categories, split them across different .jl files.
What happens to components after their category is deleted?
A category with content cannot be deleted directly. The system blocks the delete (409). Move all files out of the category (to other categories or Uncategorized) first; then you can delete it.
Can built-in categories (Electrical, Mechanical, etc.) be deleted or renamed?
No. These 6 built-in categories correspond to the standard library's physical domains and are the foundation of the system — no user (administrators included) can edit them.
Can regular users create new categories?
Yes (since v1.15). Category management is open to all signed-in users: what regular users create are personal categories, visible only to themselves and selectable only when they upload or edit files. For a category shared with everyone, ask an administrator to create an official category.
Why can't I see categories created by other users?
Personal categories are private and visible only to their creator (administrators are isolated from each other the same way). On the Categories page, in upload dropdowns, and in the component tree you always see "built-in + official + your own personal categories".
Why do some components show as Uncategorized?
Two possibilities:
- The component/file genuinely has no category;
- The component belongs to another user's personal category — to avoid leaking private category names, the server masks the name and your UI shows it uniformly as Uncategorized.
Why do I get "Official libraries must use a builtin or official category" when publishing an official component?
Official Components are visible to everyone, so their categories may not point to any personal (private) category. Before publishing, change the category to a built-in category, an official category, or Uncategorized in Meta Info; when publishing a library file, the categories of all component rows under the file are validated as well.