Module: factory.core/ObjVersionMixin.py
Product: Axion
Universal version history tracking mixin for Axion compute modules. Designed to be mixed into classes that inherit from ObjData.
All versioned modules are registered in a central dict. The mixin resolves table names automatically based on the class hierarchy:
| Module | main_table | nodes_table | history_table | name_column |
|---|---|---|---|---|
| ObjDecisionSwitch | def_decision_tree | def_decision_treenodes | def_decision_tree_history | DecisionName |
| ObjScorecard | def_scorecard_context | def_scorecard | def_scorecard_history | Scorecard |
| ObjDecisionRuleset | def_decision_ruleset | def_decision_ruleset_rules | def_decision_ruleset_history | RulesetName |
| ObjDecisionSegmentation | def_decision_segment | def_decision_segment_columns | def_decision_segment_history | SegmentName |
| ObjWorkflow | def_workflow | def_workflows | def_workflow_history | WorkflowName |
| ObjCalculation | def_calculation | def_calculations | def_calculation_history | CalculationGroup |
| ObjDecisionMatrix | def_decision_matrix | def_decision_matrix_cells | def_decision_matrix_history | MatrixName |
| ObjFeatureStore | def_feature | def_features | def_feature_version | FeatureCode |
Registry-based (recommended):
# Auto-resolves tables from VERSION_REGISTRY
self.ensure_versioned("credit_scoring")
self.record_version("credit_scoring", version=3, node_count=45)
history = self.get_version_history("credit_scoring")
html = self.version_history_html("credit_scoring")
latest = self.get_latest_version("credit_scoring")
Explicit (for non-registered modules):
self._ensure_versioned(
component_name="my_component",
package=package,
main_table="def_custom",
nodes_table="def_custom_items",
history_table="def_custom_history",
name_column="ComponentName",
)
ensure_versioned(component_name, package="")Idempotent schema migration. Adds Version columns, creates history table, backfills existing data. Safe to call multiple times.
record_version(component_name, version, ...)Record a version entry with three-word label, node count, change metadata.
get_version_history(component_name, package="")Returns list of version records, newest first.
get_latest_version(component_name, package="")Returns the highest version number, or 0.
version_history_html(component_name, package="", max_rows=5)Render version history as an HTML table using templates from ObjVersionMixin.yaml.
get_three_words()Generates a random three-word label like bold-amber-fox.
_ensure_versioned(...) — schema migration with explicit table names_record_version(...) — insert history with explicit table names_get_version_history(...) — query with explicit table names_get_latest_version(...) — query with explicit table namesbuild_version_history_html(...) — render with explicit table namesDefined in ObjVersionMixin.yaml:
history_table — table header with styled columnshistory_row — single version rowhistory_th — header cell stylehistory_td — data cell styleCreated automatically by _ensure_versioned():
| Column | Type | Purpose |
|---|---|---|
Guid |
VARCHAR(64) | Unique record ID |
{NameColumn} |
VARCHAR(255) | Component name |
Package |
VARCHAR(50) | Package |
Module |
VARCHAR(255) | Module reference |
Version |
INT | Version number |
ThreeWords |
VARCHAR(255) | Human-readable label |
VersionDate |
DATETIME | When version was created |
NodeCount |
INT | Number of child nodes |
ChangedBy |
VARCHAR(255) | Who made the change |
ChangeType |
VARCHAR(50) | IMPORT, BACKFILL, etc. |
ChangeNotes |
TEXT | Freeform notes |
CreatedAt |
DATETIME | Record creation timestamp |