DomoCard
DomoCard ¶
DomoCard Package
This package provides comprehensive card management functionality for Domo instances, including card operations and dataset associations.
Classes:
| Name | Description |
|---|---|
DomoCard_Default |
Core card operations and management |
DomoCard |
Card factory class |
DomoCard_DatasetsManager |
Manager for datasets associated with a card |
DomoCard_OwnerManager |
Manager for owners associated with a card |
DomoCard_PageManager |
Manager for pages associated with a card |
DomoCard_DefinitionManager |
Manager for kpi definition (columns, formulas, filters) |
DomoCardAccessController |
Access control controller |
Raises:
| Type | Description |
|---|---|
Card_DownloadSourceCodeError
|
Raised when card source code download fails |
BarCardBuilder
dataclass
¶
BarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
ColumnMapping
dataclass
¶
ColumnMapping(
column: str | None = None,
formula_id: str | None = None,
mapping: str | None = None,
aggregation: str | None = None,
extras: dict[str, Any] = dict(),
)
A column mapped to a chart axis in a subscription.
Either column (raw dataset field) or formula_id (beast mode reference)
will be set, not both.
Attributes:
| Name | Type | Description |
|---|---|---|
column |
str | None
|
Raw dataset column name (or None if formula_id) |
formula_id |
str | None
|
Beast mode calculation ID (or None if raw column) |
mapping |
str | None
|
Chart axis mapping (e.g., "ITEM", "VALUE", "LABEL") |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this ColumnMapping was parsed from.
Omits keys whose value is None; preserves any unmodeled keys
(alias, format, calendar, ...) captured in extras.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
ColumnRef
dataclass
¶
ColumnRef(column_name: str, column_position: int)
A column reference within a formula's columnPositions.
Attributes:
| Name | Type | Description |
|---|---|---|
column_name |
str
|
Column name (may include backticks in raw form) |
column_position |
int
|
Character position in the formula string |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this ColumnRef was parsed from.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
93 94 95 96 97 98 | |
ColumnSchema
dataclass
¶
ColumnSchema(
id: str = "",
name: str = "",
type: str | None = None,
is_calculation: bool = False,
is_aggregatable: bool = True,
source_id: str | None = None,
hidden: bool = False,
order: int = 0,
)
A column in the dataset schema from the kpi definition.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Column ID (usually same as name) |
name |
str
|
Column display name |
type |
str | None
|
Data type (e.g., "numeric", "string") |
is_calculation |
bool
|
Whether this is a beast mode column |
is_aggregatable |
bool
|
Whether the column can be aggregated |
source_id |
str | None
|
Source dataset ID |
hidden |
bool
|
Whether the column is hidden |
order |
int
|
Column order in the dataset |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict for this column schema (typed subset).
NOTE: the parser reads only a subset of the dataset schema fields, so
this is intentionally lossy (isEncrypted, isControlled,
value, templateId are not modeled and are not emitted).
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
ComboCardBuilder
dataclass
¶
ComboCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Combo chart: bar + line on the same card (dimension + measure + series).
Useful for showing amounts as bars and a ratio/trend as a line on the same chart (e.g. Revenue as bars + Margin % as a line).
Set big_number_column to add a summary number above the chart.
DomoCard
dataclass
¶
DomoCard(
auth: DomoAuth,
id: str,
raw: dict,
Lineage: DomoLineage | None = None,
Definition: DomoCard_DefinitionManager | None = None,
Datasets: DomoCard_DatasetsManager | None = None,
Owners: DomoCard_OwnerManager | None = None,
Pages: DomoCard_PageManager | None = None,
Access: DomoCardAccessController | None = None,
BeastModes: DomoCard_BeastModesManager | None = None,
title: str | None = None,
description: str | None = None,
type: str | None = None,
urn: str | None = None,
chart_type: str | None = None,
badge_type: str | None = None,
dataset_id: str | None = None,
datastore_id: str | None = None,
domo_collections: list[Any] = list(),
domo_source_code: Any = None,
certification: dict | None = None,
_init_owners: InitVar[list[Any] | None] = None,
pages: list[Any] = list(),
)
Bases: DomoCard_Default
DomoCard factory class that uses composition for federated support
create
async
classmethod
¶
create(
auth: DomoAuth,
chart_type: str,
dataset_id: str,
title: str,
*,
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] | None = None,
order_by: list[Any] | None = None,
overrides: dict[str, Any] | None = None,
description: str | None = None,
definition: dict[str, Any] | None = None,
return_raw: bool = False,
context: RouteContext | None = None,
**context_kwargs
) -> DomoCard
Create a new KPI card and return the hydrated :class:DomoCard.
This is the high-level entry point that ties the kpi_builder write
side to the create_card route. It builds the card definition from
the supplied chart parameters (or accepts a pre-built definition),
binds it to dataset_id, and returns a fully-loaded card.
Passing the builder output straight through is deliberately safe: this
method sends the inner definition to the route, so callers never have
to unwrap the {"definition": ...} envelope themselves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
DomoAuth instance. |
required |
chart_type
|
str
|
Friendly chart-type name (e.g. |
required |
dataset_id
|
str
|
The dataSourceId to bind the card to. |
required |
title
|
str
|
Card title. |
required |
measure_column
|
str | None
|
VALUE column (aggregated numeric measure). |
None
|
aggregation
|
str
|
Aggregation applied to |
'SUM'
|
dimension_column
|
str | None
|
ITEM / primary groupBy column. |
None
|
series_column
|
str | None
|
Optional SERIES / secondary grouping column. |
None
|
filters
|
list[Any] | None
|
Optional filters (raw dicts or |
None
|
order_by
|
list[Any] | None
|
Optional sorts (raw dicts or |
None
|
overrides
|
dict[str, Any] | None
|
Chart overrides ( |
None
|
description
|
str | None
|
Optional card description. |
None
|
definition
|
dict[str, Any] | None
|
Escape hatch — a pre-built inner definition dict
(from |
None
|
return_raw
|
bool
|
Return the raw create response instead of a DomoCard. |
False
|
context
|
RouteContext | None
|
Optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
DomoCard
|
The created card, hydrated via :meth: |
DomoCard
|
response when |
Raises:
| Type | Description |
|---|---|
CardApiError
|
If the create call fails. |
ValueError
|
If the create response has no resolvable card id. |
Source code in src/crew_dcs/classes/DomoCard/core.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
delete
async
¶
delete(
*, context: RouteContext | None = None, **context_kwargs
) -> Any
Delete this card.
Source code in src/crew_dcs/classes/DomoCard/core.py
127 128 129 130 131 132 133 134 135 136 137 138 139 | |
from_dict
classmethod
¶
from_dict(
auth: DomoAuth,
obj: dict,
owners: list[Any] | None = None,
pages: list[Any] | None = None,
is_published: bool = False,
parent_auth_retrieval_fn: Callable | None = None,
parent_auth: DomoAuth | None = None,
**kwargs
) -> DomoCard
Convert API response dictionary to DomoCard instance.
For federated cards, use composition via card.Federation helper.
Source code in src/crew_dcs/classes/DomoCard/core.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
DomoCardAccessController ¶
DomoCardAccessController(auth: DomoAuth, parent)
Bases: DomoAccessRelationshipController
Access controller for Domo cards.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
26 27 28 29 | |
add_owners
async
¶
add_owners(
domo_users: list[Any] | None = None,
domo_groups: list[Any] | None = None,
user_ids: list[str | int] | None = None,
group_ids: list[str | int] | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> bool
Add owners to the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
create_relationship
async
¶
create_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Create an access relationship for the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
get_accesslist
async
¶
get_accesslist(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Relationship]
Get access list for the card as relationships.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
get_direct_relationships
async
¶
get_direct_relationships() -> list[Relationship]
Get direct relationships for the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
35 36 37 | |
get_owner_entities
async
¶
get_owner_entities(
is_suppress_errors: bool = True,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Resolve owner entities (users/groups) for this card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_suppress_errors
|
bool
|
When True, suppress DomoError resolution failures. |
True
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
list[Any]
|
list of DomoUser/DomoGroup entities |
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
get_owners
async
¶
get_owners(
*, context: RouteContext | None = None, **context_kwargs
) -> list[Relationship]
Get owner relationships for the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
remove_owners
async
¶
remove_owners(
domo_users: list[Any] | None = None,
domo_groups: list[Any] | None = None,
user_ids: list[str | int] | None = None,
group_ids: list[str | int] | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> bool
Remove owners from the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |
remove_relationship
async
¶
remove_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Remove an access relationship for the card.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
share
async
¶
share(
domo_users: list[Any] | None = None,
domo_groups: list[Any] | None = None,
user_ids: list[str | int] | None = None,
group_ids: list[str | int] | None = None,
message: str | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> bool
Share the card with users or groups.
Source code in src/crew_dcs/classes/DomoCard/access_controller.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
DomoCard_BeastModesManager
dataclass
¶
DomoCard_BeastModesManager(
parent: DomoEntity,
beast_modes: list[DomoBeastMode] = list(),
)
Bases: DomoSubEntity
Manager for beast modes associated with a DomoCard.
Provides typed access to all beast modes linked to a card.
Usage
bms = await card.BeastModes.get() card.BeastModes.beast_modes # list[DomoBeastMode]
get
async
¶
get(
*, context: RouteContext | None = None, **context_kwargs
) -> list[DomoBeastMode]
Fetch beast modes linked to this card.
Delegates to DomoBeastModes.get_by_card and caches the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
RouteContext | None
|
Optional RouteContext for request configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
list[DomoBeastMode]
|
List of DomoBeastMode instances linked to this card |
Source code in src/crew_dcs/classes/DomoCard/manager_beastmodes.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
DomoCard_DatasetsManager
dataclass
¶
DomoCard_DatasetsManager(
auth: DomoAuth,
parent: DomoCard_Default = None,
datasets: list[Any] = list(),
)
Bases: DomoManager
Manager for datasets associated with a DomoCard.
Provides access to all datasets used by a card through its datasources. Inherits from DomoManager to follow standard entity manager patterns.
get
async
¶
get(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
parent_auth_retrieval_fn: (
Callable[[str], Any] | None
) = None,
**context_kwargs
) -> list[Any]
Get all datasets associated with this card.
This retrieves datasets from the card's datasources and returns DomoDataset instances for each one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
Optional httpx session for request reuse |
None
|
Returns:
| Type | Description |
|---|---|
list[Any]
|
list[DomoDataset]: List of dataset objects associated with the card |
Source code in src/crew_dcs/classes/DomoCard/manager_dataset.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
DomoCard_Default
dataclass
¶
DomoCard_Default(
auth: DomoAuth,
id: str,
raw: dict,
Lineage: DomoLineage | None = None,
Definition: DomoCard_DefinitionManager | None = None,
Datasets: DomoCard_DatasetsManager | None = None,
Owners: DomoCard_OwnerManager | None = None,
Pages: DomoCard_PageManager | None = None,
Access: DomoCardAccessController | None = None,
BeastModes: DomoCard_BeastModesManager | None = None,
title: str | None = None,
description: str | None = None,
type: str | None = None,
urn: str | None = None,
chart_type: str | None = None,
badge_type: str | None = None,
dataset_id: str | None = None,
datastore_id: str | None = None,
domo_collections: list[Any] = list(),
domo_source_code: Any = None,
certification: dict | None = None,
_init_owners: InitVar[list[Any] | None] = None,
pages: list[Any] = list(),
)
Bases: DomoEntity_w_Lineage
Base DomoCard implementation with core functionality
datasets
property
¶
datasets: list[Any]
Legacy property access - prefer using Datasets.get() for async operations
entity_name
property
¶
entity_name: str
Get the display name for this card.
Cards use the 'title' field as their display name.
Returns:
| Type | Description |
|---|---|
str
|
Card title, or card ID as fallback |
name
property
¶
name: str
Get the display name for this card.
Implements abstract property from DomoEntity_w_Lineage. Cards use the 'title' field as their display name.
Returns:
| Type | Description |
|---|---|
str
|
Card title, or "Untitled Card {id}" as fallback |
add_owners
async
¶
add_owners(
owners: list[Any],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Add owners (users or groups) to this card.
Source code in src/crew_dcs/classes/DomoCard/card_default.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
from_dict
classmethod
¶
from_dict(
auth: DomoAuth,
obj: dict[str, Any],
owners: list[Any] | None = None,
pages: list[Any] | None = None,
)
Synchronous factory method for dict → Card construction.
Build a DomoCard_Default instance from a metadata dictionary and owners list.
This method does not invoke any other class methods or perform additional API calls. All required data must be provided in the arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
DomoAuth instance for authentication |
required |
obj
|
dict[str, Any]
|
Card metadata dictionary (from API) |
required |
owners
|
list[Any] | None
|
List of owner entities (DomoUser/DomoGroup), optional |
None
|
Returns:
| Type | Description |
|---|---|
|
DomoCard_Default instance |
Source code in src/crew_dcs/classes/DomoCard/card_default.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
card_id: str,
optional_parts: str = "metadata,certification,datasources,drillPath,owners,properties,domoapp",
check_if_published: bool | None = None,
resolve_pages: bool | None = None,
resolve_datasources: bool | None = None,
parent_auth_retrieval_fn: Callable | None = None,
parent_auth: DomoAuth | None = None,
max_subscriptions_to_check: int | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
return_raw: bool = False,
is_suppress_errors: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Retrieve a DomoCard by ID, including publication/certification status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
DomoAuth instance |
required |
card_id
|
str
|
Card ID to retrieve |
required |
optional_parts
|
str
|
Comma-separated metadata parts to include (owners, certification, etc.) |
'metadata,certification,datasources,drillPath,owners,properties,domoapp'
|
check_if_published
|
bool | None
|
When True, checks if card is published (federated + subscriptions). If None and either parent_auth or parent_auth_retrieval_fn is provided, defaults to True. |
None
|
resolve_pages
|
bool | None
|
When True, resolve page entities from metadata and link in lineage. If None, preserves current behavior (resolve pages if present). |
None
|
resolve_datasources
|
bool | None
|
When True, resolve dataset entities from datasources and link in lineage. If None, defaults to False (no dataset resolution). |
None
|
parent_auth_retrieval_fn
|
Callable | None
|
Callable returning publisher auth when given publisher domain |
None
|
parent_auth
|
DomoAuth | None
|
Pre-existing publisher auth (alternative to parent_auth_retrieval_fn) |
None
|
max_subscriptions_to_check
|
int | None
|
Optional limit when scanning subscriptions |
None
|
debug_api
|
bool
|
Enable API debug logging |
False
|
session
|
AsyncClient | None
|
Optional httpx session |
None
|
return_raw
|
bool
|
If True, return raw API response |
False
|
is_suppress_errors
|
bool
|
If True, suppress errors during owner resolution (handled via Access) |
False
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoCard_Default instance (or raw response if return_raw) |
Processing steps
- Fetch card metadata from API (includes owners, certification, datasources, etc.)
- If return_raw, return API response directly
- If card is federated and check_if_published is True, run additional check for publication status
- Build DomoCard_Default instance
Source code in src/crew_dcs/classes/DomoCard/card_default.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | |
get_owners
async
¶
get_owners(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Refresh owners for this card.
Source code in src/crew_dcs/classes/DomoCard/card_default.py
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | |
get_pages
async
¶
get_pages(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Refresh pages this card appears on.
Source code in src/crew_dcs/classes/DomoCard/card_default.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
hydrate_card_metadata
async
classmethod
¶
hydrate_card_metadata(
cards: list[DomoCard_Default],
auth: DomoAuth,
*,
context: RouteContext | None = None,
**context_kwargs
) -> None
Batch-hydrate card metadata (chartType/badge_type) from the API.
The lineage API does not include card metadata. This method fetches metadata for all cards in a single batch request and updates their badge_type and chart_type fields in-place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cards
|
list[DomoCard_Default]
|
List of DomoCard instances to hydrate |
required |
auth
|
DomoAuth
|
Authentication object |
required |
context
|
RouteContext | None
|
Optional RouteContext |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Source code in src/crew_dcs/classes/DomoCard/card_default.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
remove_owners
async
¶
remove_owners(
owners: list[Any],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Remove owners (users or groups) from this card.
Source code in src/crew_dcs/classes/DomoCard/card_default.py
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
to_dict ¶
to_dict(
override_fn: Callable | None = None,
return_snake_case: bool = False,
) -> dict
Serialize card for export/debugging with safe owner serialization.
Source code in src/crew_dcs/classes/DomoCard/card_default.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
DomoCard_DefinitionManager
dataclass
¶
DomoCard_DefinitionManager(
parent: DomoCard_Default = None,
kpi: KpiDefinition | None = None,
)
Bases: DomoSubEntity
Manager for a card's kpi definition.
Provides typed access to: - KpiDefinition with subscriptions, formulas, and column schema - Convenience properties: used_columns, available_columns, unused_columns
Usage
await card.Definition.get() card.Definition.kpi # KpiDefinition card.Definition.used_columns # set[str] card.Definition.available_columns # list[str] card.Definition.kpi.main.columns # list[ColumnMapping] card.Definition.kpi.formula_by_id # dict[str, Formula]
With dataset beast mode resolution
await card.Definition.get(is_resolve_dataset_beastmodes=True)
Now formula_by_id includes dataset-level beast modes¶
and filter/group_by columns resolve calculation_xxx IDs¶
available_columns
property
¶
available_columns: list[str]
All available columns from the dataset schema. Empty if not loaded.
unused_columns
property
¶
unused_columns: set[str]
Dataset columns NOT used by this card. Empty if not loaded.
used_columns
property
¶
used_columns: set[str]
Columns used by this card. Empty if definition not loaded.
get
async
¶
get(
is_resolve_dataset_beastmodes: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> KpiDefinition
Fetch the kpi definition for this card.
Populates self.kpi with a typed KpiDefinition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_resolve_dataset_beastmodes
|
bool
|
If True, also fetch the card's
datasets and resolve any |
False
|
context
|
RouteContext | None
|
Optional RouteContext for request configuration |
None
|
Returns:
| Type | Description |
|---|---|
KpiDefinition
|
KpiDefinition instance with typed access to all definition data. |
Source code in src/crew_dcs/classes/DomoCard/manager_definition.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
DomoCard_OwnerManager
dataclass
¶
DomoCard_OwnerManager(
auth: DomoAuth | None = None,
parent: DomoCard_Default | None = None,
owners: list[Any] = list(),
)
Bases: DomoRelationshipController
Manager for owners associated with a DomoCard.
add_owners
async
¶
add_owners(
owners: list[Any],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Add owners (users or groups) to this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
create_relationship
async
¶
create_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Create an owner relationship for this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
get
async
¶
get(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Get owners for this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
get_direct_relationships
async
¶
get_direct_relationships() -> list[Relationship]
Get owner relationships for this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
38 39 40 41 42 43 44 45 46 47 | |
remove_owners
async
¶
remove_owners(
owners: list[Any],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Remove owners (users or groups) from this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
remove_relationship
async
¶
remove_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Remove an owner relationship for this card.
Source code in src/crew_dcs/classes/DomoCard/manager_owner.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
DomoCard_PageManager
dataclass
¶
DomoCard_PageManager(
auth: DomoAuth | None = None,
parent: DomoCard_Default | None = None,
pages: list[Any] = list(),
)
Bases: DomoRelationshipController
Manager for pages associated with a DomoCard.
add_pages
async
¶
add_pages(
page_ids: list[str | int],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Add this card to the specified pages.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
create_relationship
async
¶
create_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Create a card -> page relationship by adding the card to a page.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
get
async
¶
get(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Get pages that include this card.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
get_direct_relationships
async
¶
get_direct_relationships() -> list[Relationship]
Get relationships between this card and its pages.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
remove_pages
async
¶
remove_pages(
page_ids: list[str | int],
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> list[Any]
Remove this card from the specified pages.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
remove_relationship
async
¶
remove_relationship(
target_entity_id: str,
target_entity_type: EntityType,
relationship_type: RelationshipType,
**kwargs
) -> bool
Remove a card -> page relationship by removing the card from a page.
Source code in src/crew_dcs/classes/DomoCard/manager_page.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
DomoLineageLink_Card
dataclass
¶
DomoLineageLink_Card(
auth: DomoAuth,
id: str,
entity: Any,
_type: str | None = None,
dependencies: list[DomoLineage_Link] = list(),
dependents: list[DomoLineage_Link] = list(),
)
Bases: DomoLineage_Link
get_entity
async
¶
get_entity(
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context=None
)
Get the entity associated with this lineage link.
Source code in src/crew_dcs/classes/DomoCard/lineage.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
DomoLineage_Card
dataclass
¶
DomoLineage_Card(
auth: DomoAuth,
parent: Any = None,
lineage: list[DomoLineage_Link] = list(),
immediate_dependencies: list[DomoLineage_Link] = list(),
immediate_dependents: list[DomoLineage_Link] = list(),
downstream_lineage: list[DomoLineage_Link] = list(),
)
Bases: DomoLineage
Lineage handler for card entities.
Overrides _resolve_publisher_entity to handle indirect publication:
cards that are published as part of a page rather than directly.
validate_datasources ¶
validate_datasources() -> dict[str, Any]
Validate that this card has at most one datasource.
CustomApp/EnterpriseApp cards (identified by having a datastore_id) are allowed to have multiple datasources. Regular cards should have at most one.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with validation results: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
Source code in src/crew_dcs/classes/DomoCard/lineage.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
DonutCardBuilder
dataclass
¶
DonutCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Donut chart (dimension + measure).
Useful for revenue mix, cost structure visualization.
Filter
dataclass
¶
Filter(
column: str | None = None,
values: list[Any] = list(),
filter_type: str | None = None,
operand: str | None = None,
data_type: str | None = None,
extras: dict[str, Any] = dict(),
)
A filter applied to a subscription.
The column field can be a raw column name or a formula ID
(starting with "calculation_").
Attributes:
| Name | Type | Description |
|---|---|---|
column |
str | None
|
Column name or formula ID |
values |
list[Any]
|
Filter values |
filter_type |
str | None
|
Filter type (e.g., "LEGACY") |
operand |
str | None
|
Filter operand (e.g., "IN", "NOT_IN", "EQUALS") |
data_type |
str | None
|
Data type of the column (e.g., "string", "numeric") |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this Filter was parsed from.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
Formula
dataclass
¶
Formula(
id: str = "",
name: str = "",
formula: str = "",
resolved_formula: str | None = None,
status: str | None = None,
data_type: str | None = None,
column_positions: list[ColumnRef] = list(),
non_aggregated_columns: list[str] = list(),
template_id: int | None = None,
variable: bool = False,
persisted_on_data_source: bool = False,
used_by_other_cards: bool = False,
reference_count: int = 0,
is_controlled: bool = False,
is_aggregatable: bool = True,
)
A beast mode formula in a card's definition.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique formula ID (e.g., "calculation_272e5ef4-...") |
name |
str
|
Display name |
formula |
str
|
SQL expression |
status |
str | None
|
Validation status (e.g., "VALID") |
data_type |
str | None
|
Output data type (e.g., "DECIMAL", "STRING", "LONG") |
column_positions |
list[ColumnRef]
|
Columns referenced in the formula |
non_aggregated_columns |
list[str]
|
Columns used without aggregation |
template_id |
int | None
|
Formula template ID |
variable |
bool
|
Whether this is a variable |
persisted_on_data_source |
bool
|
Whether persisted to the dataset |
used_by_other_cards |
bool
|
Whether other cards reference this formula |
reference_count |
int
|
Number of cards referencing this formula |
is_controlled |
bool
|
Whether this is a controlled formula |
is_aggregatable |
bool
|
Whether the formula result is aggregatable |
referenced_columns
property
¶
referenced_columns: set[str]
All dataset columns referenced by this formula.
Combines columnPositions and nonAggregatedColumns, stripping backticks from column names.
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict for this formula (typed subset).
NOTE: the parser reads only a subset of a beast mode's fields, so this
is intentionally lossy relative to the original payload (fields such as
cacheWindow, locked, owner, isAnalytic, bignumber
are not modeled and are therefore not emitted).
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | |
FunnelCardBuilder
dataclass
¶
FunnelCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Funnel chart (dimension + measure). EXPERIMENTAL: badge_funnel is
unverified against a live instance.
Useful as a P&L waterfall alternative: Revenue -> COGS -> Gross Profit -> Operating Expenses -> Net Income. Each stage is a dimension value.
GaugeCardBuilder
dataclass
¶
GaugeCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Filled-gauge chart (single measure, no dimension).
Useful for liquidity ratios (Current Ratio, Debt-to-Equity) and other
single-value KPIs that benefit from a visual range indicator. Uses
badge_filledgauge (a chartType confirmed present on live instances);
badge_compgauge is the comparative-gauge alternative.
GroupByColumn
dataclass
¶
GroupByColumn(
column: str | None = None,
formula_id: str | None = None,
extras: dict[str, Any] = dict(),
)
A group-by column in a subscription.
Attributes:
| Name | Type | Description |
|---|---|---|
column |
str | None
|
Raw column name (or None if formula_id) |
formula_id |
str | None
|
Beast mode calculation ID (or None if raw column) |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this GroupByColumn was parsed from.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
312 313 314 315 316 317 318 319 320 | |
GroupedBarCardBuilder
dataclass
¶
GroupedBarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
HeatmapCardBuilder
dataclass
¶
HeatmapCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Heatmap chart (dimension + measure + series).
Useful for period-over-period comparison (e.g. monthly revenue by account type across years).
HorizontalBarCardBuilder
dataclass
¶
HorizontalBarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Horizontal bar chart (dimension + measure).
Useful for P&L line items where account names are long and read better on the y-axis.
HorizontalGroupedBarCardBuilder
dataclass
¶
HorizontalGroupedBarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Horizontal grouped/multi bar chart (dimension + measure + series).
EXPERIMENTAL: badge_horiz_multibar is unverified; the confirmed
grouped-bar type is the vertical badge_vert_multibar (grouped_bar).
Useful for Actual vs Budget comparisons by account category.
HorizontalStackedBarCardBuilder
dataclass
¶
HorizontalStackedBarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Horizontal stacked bar chart (dimension + measure + series).
Useful for balance sheet composition (Assets/Liabilities/Equity stacked by account type).
KpiCardBuilder
dataclass
¶
KpiCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Base builder for a Domo KPI card definition.
Subclasses register themselves with :func:register_card_type, which sets
the friendly_name and chart_type class attributes. Behavioural
flags (requires_dimension, supports_series, is_single_value)
control how the main subscription is assembled.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_id |
str
|
Source dataset id. Retained for the caller to bind at POST time; NOT embedded in the emitted definition. |
title |
str
|
Card title. |
measure_column |
str | None
|
The VALUE column (aggregated numeric measure). |
aggregation |
str
|
Aggregation applied to |
dimension_column |
str | None
|
The ITEM / primary groupBy column. |
series_column |
str | None
|
Optional SERIES / secondary grouping column. |
filters |
list[Any]
|
Optional filters (raw dicts or :class: |
order_by |
list[Any]
|
Optional sorts (raw dicts or :class: |
overrides |
dict[str, Any]
|
Chart overrides (e.g. |
description |
str | None
|
Optional card description. |
allow_table_drill |
bool
|
Whether table drill is allowed (default True). |
build ¶
build() -> KpiDefinition
Assemble and return a fully-typed :class:KpiDefinition.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
build_columns ¶
build_columns() -> list[ColumnMapping]
Build the main subscription column mappings.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
316 317 318 319 320 321 322 323 324 325 326 327 | |
build_group_by ¶
build_group_by() -> list[GroupByColumn]
Build the main subscription groupBy columns.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
329 330 331 332 333 334 335 336 | |
to_dict ¶
to_dict() -> dict[str, Any]
Build the card and return the full create/definition envelope.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
459 460 461 | |
KpiDefinition
dataclass
¶
KpiDefinition(
subscriptions: dict[str, Subscription] = dict(),
formulas: list[Formula] = list(),
charts: dict[str, Any] = dict(),
segments: dict[str, Any] = dict(),
conditional_formats: list[dict] = list(),
annotations: list[dict] = list(),
slicers: list[dict] = list(),
title: str | None = None,
description: str | None = None,
chart_version: str | None = None,
allow_table_drill: bool = False,
input_table: bool = False,
modified: int | None = None,
columns_schema: list[ColumnSchema] = list(),
)
Typed representation of a card's kpi definition.
Provides structured access to subscriptions, formulas, and column schema with convenience properties for common queries.
Usage
kpi = KpiDefinition.from_dict(api_response) kpi.main.columns # list[ColumnMapping] kpi.formula_by_id[...] # Formula lookup kpi.used_columns # set[str] of all columns used kpi.available_columns # list[ColumnSchema] of all dataset columns
available_columns
property
¶
available_columns: list[str]
All available column names from the dataset schema.
beast_modes
property
¶
beast_modes: list[Formula]
All beast mode formulas (non-variable calculations).
definition
property
¶
definition: dict[str, Any]
The inner definition dict of the create/GET envelope.
formula_by_id
property
¶
formula_by_id: dict[str, Formula]
Lookup dict of formulas by their calculation ID.
used_columns
property
¶
used_columns: set[str]
All dataset columns used by this card.
Resolves formula references to their underlying columns. Combines columns from: - Subscription column mappings - Subscription filters - Subscription orderBy - Subscription groupBy - All formula columnPositions and nonAggregatedColumns
from_dict
classmethod
¶
from_dict(obj: dict[str, Any]) -> KpiDefinition
Build a KpiDefinition from the kpi definition API response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
dict[str, Any]
|
Full API response dict (includes top-level 'definition' and 'columns') |
required |
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
resolve_domo_beast_mode_refs
async
¶
resolve_domo_beast_mode_refs(
auth: Any, *, context: Any = None, **context_kwargs
) -> None
Resolve DOMO_BEAST_MODE(nnn) references in all formulas.
Domo beast modes can reference other beast modes using the syntax
DOMO_BEAST_MODE(template_id). This method fetches the referenced
templates and populates resolved_formula on each Formula that
contains such references.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
Any
|
Authentication object for API requests |
required |
context
|
Any
|
Optional RouteContext for request configuration |
None
|
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | |
resolve_unresolved_formulas ¶
resolve_unresolved_formulas(dataset_formulas: Any) -> None
Resolve formula IDs that aren't in the card's own formulas list.
Card definitions only include card-level beast modes. Dataset-level
beast modes are referenced by their calculation_xxx legacy ID
but their definitions live in the template API. This method resolves
them using the dataset's Formulas manager.
After calling this, formula_by_id will include dataset-level
formulas, and used_columns will correctly resolve them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_formulas
|
Any
|
DomoDataset_FormulasManager with loaded beast modes |
required |
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the full create/definition envelope.
Returns the {"definition": {...}, "columns": [...]} envelope.
Important: The Domo Content API has different formats for GET vs CREATE (PUT /content/v3/cards/kpi):
- GET (read existing card):
formulas,annotations, andconditionalFormatsare returned as arrays. -
CREATE (PUT new card):
formulas,annotations, andconditionalFormatsmust be objects with change-tracking sub-keys: -
formulas:{"dsUpdated": [], "dsDeleted": [], "card": [...]} annotations:{"new": [], "modified": [], "deleted": []}conditionalFormats:{"card": [...], "datasource": []}
This method produces the CREATE format. If you need the GET format
(e.g. for round-trip comparison), use :meth:to_get_dict.
The subscriptions, charts and "chrome" fields round-trip exactly; the
formulas and dataset columns are reconstructed from the typed
subset the parser reads and are therefore lossy (see Formula.to_dict
and ColumnSchema.to_dict).
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | |
to_get_dict ¶
to_get_dict() -> dict[str, Any]
Reconstruct the GET-format envelope (arrays for formulas/annotations/conditionalFormats).
Use this when you want to compare against the raw API GET response.
For card creation, use :meth:to_dict (the CREATE format).
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | |
LineCardBuilder
dataclass
¶
LineCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Line/line-bar combo chart (dimension + measure, optional series).
Useful for trend over time (Revenue, Expenses, Net Income).
ParetoCardBuilder
dataclass
¶
ParetoCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Pareto chart (dimension + measure). EXPERIMENTAL: badge_pareto is
unverified against a live instance.
Shows the 80/20 rule — useful for identifying which accounts or cost categories drive the majority of revenue or expense.
PieCardBuilder
dataclass
¶
PieCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Pie chart (dimension + measure).
Useful for asset allocation, expense distribution, revenue mix.
SingleValueCardBuilder
dataclass
¶
SingleValueCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
SortColumn
dataclass
¶
SortColumn(
column: str | None = None,
formula_id: str | None = None,
order: str | None = None,
aggregation: str | None = None,
extras: dict[str, Any] = dict(),
)
A sort specification in a subscription.
Attributes:
| Name | Type | Description |
|---|---|---|
column |
str | None
|
Raw column name (or None if formula_id) |
formula_id |
str | None
|
Beast mode calculation ID (or None if raw column) |
order |
str | None
|
Sort direction ("ASCENDING" or "DESCENDING") |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this SortColumn was parsed from.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
270 271 272 273 274 275 276 277 278 279 280 281 282 | |
StackedBarCardBuilder
dataclass
¶
StackedBarCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Subscription
dataclass
¶
Subscription(
name: str = "",
columns: list[ColumnMapping] = list(),
filters: list[Filter] = list(),
order_by: list[SortColumn] = list(),
group_by: list[GroupByColumn] = list(),
fiscal: bool = False,
projection: bool = False,
distinct: bool = False,
extras: dict[str, Any] = dict(),
)
A subscription within a kpi definition (typically "main").
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Subscription name (e.g., "main") |
columns |
list[ColumnMapping]
|
Column-to-axis mappings |
filters |
list[Filter]
|
Applied filters |
order_by |
list[SortColumn]
|
Sort specifications |
group_by |
list[GroupByColumn]
|
Group-by columns |
fiscal |
bool
|
Whether fiscal calendar is used |
projection |
bool
|
Whether projection is enabled |
distinct |
bool
|
Whether DISTINCT is applied |
to_dict ¶
to_dict() -> dict[str, Any]
Reconstruct the API dict this Subscription was parsed from.
Preserves unmodeled subscription-level keys (limit, dateGrain,
dateRangeFilter, ...) captured in extras so the round-trip is
exact.
Source code in src/crew_dcs/classes/DomoCard/kpi_definition.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |
TableCardBuilder
dataclass
¶
TableCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Basic table card.
A table lists one or more VALUE columns and does not require a dimension /
groupBy. The base build_columns emits an ITEM + VALUE pair; for a table
we emit the measure as a plain VALUE column with no groupBy.
TreemapCardBuilder
dataclass
¶
TreemapCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Treemap chart (dimension + measure + series). EXPERIMENTAL:
badge_treemap is unverified; badge_sunburst is the confirmed
hierarchical alternative.
Useful for hierarchical financial data — shows account hierarchy as nested rectangles sized by amount.
TrendlineCardBuilder
dataclass
¶
TrendlineCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Trend line chart (dimension + measure). EXPERIMENTAL: badge_trendline
is unverified; confirmed line-ish alternatives are badge_rttrendline,
badge_two_trendline and badge_symbolline.
Useful for showing financial trends over time (revenue growth, cost trends, margin trajectory).
WaterfallCardBuilder
dataclass
¶
WaterfallCardBuilder(
dataset_id: str = "",
title: str = "",
measure_column: str | None = None,
aggregation: str = "SUM",
measure_formula: dict[str, Any] | None = None,
measure_beastmode: dict[str, Any] | None = None,
dimension_column: str | None = None,
series_column: str | None = None,
filters: list[Any] = list(),
order_by: list[Any] = list(),
overrides: dict[str, Any] = dict(),
description: str | None = None,
allow_table_drill: bool = True,
date_grain: dict[str, Any] | None = None,
big_number_column: str | None = None,
big_number_aggregation: str = "SUM",
big_number_formula_id: str | None = None,
)
Bases: KpiCardBuilder
Waterfall-style chart using vertical bar (dimension + measure).
Domo does not expose a dedicated badge_waterfall chartType via the
Content API. This builder uses badge_vert_bar as the closest
substitute — the card can be switched to waterfall display in the
Domo UI after creation. Each dimension value becomes a step in the
P&L bridge (Revenue -> COGS -> Gross Profit -> Net Income).
build_kpi_card_definition ¶
build_kpi_card_definition(
chart_type: str, **kwargs: Any
) -> dict[str, Any]
Build a card definition envelope for a friendly chart type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chart_type
|
str
|
Friendly chart-type name (see :func: |
required |
**kwargs
|
Any
|
Passed through to the :class: |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The full envelope |
dict[str, Any]
|
ready-to-send inner definition is available at |
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |
card_type_map ¶
card_type_map() -> dict[str, str]
Return the friendly-name -> Domo-chartType mapping.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
225 226 227 | |
get_card_builder_class ¶
get_card_builder_class(
friendly_name: str,
) -> type[KpiCardBuilder]
Return the builder class registered for a friendly chart-type name.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the friendly name is not registered. |
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
192 193 194 195 196 197 198 199 200 201 202 203 204 | |
get_registered_card_types ¶
get_registered_card_types() -> list[str]
Return all registered friendly chart-type names.
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
207 208 209 | |
register_card_type ¶
register_card_type(friendly_name: str, chart_type: str)
Decorator registering a :class:KpiCardBuilder subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
friendly_name
|
str
|
Human-friendly key (e.g. |
required |
chart_type
|
str
|
Domo |
required |
Source code in src/crew_dcs/classes/DomoCard/kpi_builder.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |