Universal classification system: tags and categories for any entity
| Tier | domain |
| Role | unclassified (baselined) |
| Path | crates/domain/taxonomy |
| Edition | 2021 |
| Targets | domain_taxonomy |
| Public items | 0 across 0 modules |
| Tests | 31 |
What it is for
domain-taxonomy: Universal classification system
Overview
This crate provides a universal tagging and classification system that can be relationships, allowing tags to be applied to CatalogItems, Documents, Orders, or any other entity type without hard-coded foreign keys.
Layer
Domain - depends on: library crates-core, foundation-basemodels
Key Types
Tag- A label that can be attached to entitiesTagGroup- Organizes related tagsTagging- Links a tag to an entity via EntityRefEntityRef- Generic reference to any entity typeTaxonomyService- High-level business operations
Example
use domain_taxonomy::{TaxonomyService, EntityRef, CreateTagRequest};
let service = TaxonomyService::new(pool);
// Create a tag
let (tag, event) = service.create_tag(CreateTagRequest {
tenant_id,
name: "Featured".to_string(),
slug: None,
group_id: None,
description: Some("Featured products".to_string()),
color: Some("#ff0000".to_string()),
icon: None,
}).await?;
// Attach to a catalog item
let entity = EntityRef::new("CatalogItem", item_id);
let (tagging, event) = service.attach_tag(tag.id, &entity).await?;
// List tags on an entity
let tags = service.list_entity_tags(&entity).await?;
// Find all entities with a tag
let entities = service.find_entities_by_tag(tag.id).await?;
Capabilities
No public items.
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
No public items.
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (41 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/domain/taxonomy |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
slug | ^0.1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^1 | — | no | always |
uuid | ^1 | v4, serde | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full, test-util | no | always |
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_taxonomy["application-taxonomy"] -->|uses| SELF n_platform_privacy_scan_api["platform-privacy-scan-api"] -->|uses| SELF SELF["domain-taxonomy"] SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | domain_taxonomy | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: application-taxonomy, platform-privacy-scan-api.
Verification
| Kind | Count |
|---|---|
| Unit tests | 31 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
What the tests establish, by name:
test_already_tagged—src/errors.rstest_duplicate_slug—src/errors.rstest_tag_group_not_found—src/errors.rstest_tag_not_found—src/errors.rstest_validation_error—src/errors.rstest_event_serialization—src/events.rstest_tag_created_event—src/events.rstest_tagged_event—src/events.rstest_cross_primitive_tagging—src/lib.rstest_tag_workflow—src/lib.rstest_taxonomy_events—src/lib.rstest_tenant_isolation_by_design—src/lib.rstest_breadcrumb_nested—src/models.rstest_breadcrumb_root—src/models.rstest_entity_ref_new—src/models.rstest_is_descendant_false—src/models.rstest_is_descendant_true—src/models.rstest_tag_group_new—src/models.rstest_tag_group_with_description—src/models.rstest_tag_in_group—src/models.rstest_tag_new—src/models.rstest_tag_soft_delete—src/models.rstest_tag_with_color_and_icon—src/models.rstest_tag_with_parent—src/models.rstest_tag_with_slug—src/models.rstest_tagging_created_by—src/models.rstest_tagging_entity_ref—src/models.rstest_tagging_new—src/models.rstest_validate_no_cycle_ok—src/models.rstest_validate_no_cycle_self—src/models.rs- _… 1 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 0 | 0 |
Public modules with a //! block | 0 | 0 |
Metrics
| Metric | Value |
|---|---|
| Rust source files | 6 |
| Source lines | 1846 |
| Code lines | 1360 |
| Public API items | 0 |
| Public modules | 0 |
| Tests | 31 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 9 |
| Workspace reverse dependencies | 2 |
pie showData
title Rust source composition
"Code" : 1360
"Blank or comment" : 486
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.