Skip to content

datarobot_genai.drmcputils.panels.models

models

Panel data models.

Panels are typed, persisted analytical artifacts with lineage. Metadata is a small Pydantic record; bulky payloads (a Dataset's Parquet, a Chart's spec) are stored separately via a :class:~datarobot_genai.drmcputils.files.store.BlobStore and referenced here by payload_files_id (the Files container id), keeping the manifest cheap to list and serialize.

PanelType

Bases: StrEnum

Discriminator for the concrete panel types.

Source code in datarobot_genai/drmcputils/panels/models.py
class PanelType(StrEnum):
    """Discriminator for the concrete panel types."""

    DATASET = "dataset"
    CHART = "chart"
    TEXT = "text"
    JSON = "json"

BasePanel

Bases: BaseModel

Common metadata shared by every panel type.

id is assigned by the store on create (it is the manifest's Files container id) and is None until then. Inline-content types (Text, Json) carry their payload on the model; bulky types (Dataset, Chart) reference an external blob via payload_files_id.

Source code in datarobot_genai/drmcputils/panels/models.py
class BasePanel(BaseModel):
    """Common metadata shared by every panel type.

    ``id`` is assigned by the store on create (it is the manifest's Files
    container id) and is ``None`` until then. Inline-content types (Text, Json)
    carry their payload on the model; bulky types (Dataset, Chart) reference an
    external blob via ``payload_files_id``.
    """

    id: str | None = None
    type: PanelType
    title: str
    description: str | None = None
    parents: list[str] = Field(default_factory=list)
    execution_context: dict[str, Any] | None = None
    updated_by: str | None = None
    updated_at: str | None = None
    payload_files_id: str | None = None
    payload_name: str | None = None

panel_from_manifest

panel_from_manifest(raw: dict[str, Any]) -> Panel

Reconstruct the concrete panel type from a stored manifest dict.

Source code in datarobot_genai/drmcputils/panels/models.py
def panel_from_manifest(raw: dict[str, Any]) -> Panel:
    """Reconstruct the concrete panel type from a stored manifest dict."""
    panel_type = PanelType(raw["type"])
    model = PANEL_TYPE_TO_MODEL[panel_type]
    return model.model_validate(raw)  # type: ignore[return-value]