plaid.viewer.models¶
plaid.viewer.models
¶
Data models for the gdataset viewer.
Contains both immutable dataclasses used by services (SampleRef,
ParaviewArtifact) and pydantic models used as FastAPI response payloads.
plaid.viewer.models.SampleRef
dataclass
¶
Reference to a PLAID sample.
Attributes:
-
dataset_id(str) –Identifier of the dataset (typically the dataset directory name for local datasets, or the
org/repoid for Hub datasets). -
split(str | None) –Optional split name (
"train","test", ...).Nonewhen the dataset is not split. -
sample_id(str) –Identifier of the sample within the split. For disk-backed datasets this is the zero-based index rendered as a string.
plaid.viewer.models.SampleRef.encode
¶
Return a URL-safe string identifier usable as a route parameter.
plaid.viewer.models.SampleRef.decode
classmethod
¶
Parse a string produced by :meth:encode.
Source code in plaid/viewer/models.py
plaid.viewer.models.ParaviewArtifact
dataclass
¶
A ParaView-readable artifact produced from a PLAID sample.
For time-dependent samples, cgns_path points to a .cgns.series
sidecar file that groups multiple CGNS files into a single time sequence.
For single-timestep samples, it points to the single CGNS file directly.
Attributes:
-
artifact_id(str) –Stable identifier used in API routes. Derived from the cache key.
-
cgns_path(Path) –Path to the file ParaView should open. Either a
.cgns.seriessidecar (multi-time) or a.cgnsfile. -
state_path(Path | None) –Optional ParaView state file (
.pvsm) providing a reasonable default scene. -
metadata_path(Path | None) –Optional JSON metadata file describing the artifact.
-
cache_key(str) –Deterministic SHA256 key over the artifact inputs.
-
created(bool) –Trueif the artifact was newly created,Falseif it was already present in the cache.
plaid.viewer.models.DatasetInfo
¶
Summary information about an available dataset.
is_streaming distinguishes datasets opened with
:func:plaid.storage.init_from_disk (False) from Hugging Face
repositories streamed through
:func:plaid.storage.init_streaming_from_hub (True). Streamed
datasets do not always expose a total sample count and may need to be
navigated sequentially through a streaming cursor.
plaid.viewer.models.DatasetDetail
¶
Full detail view of a dataset.
splits maps each split name to its sample count. The count is
None for streaming datasets where the total is unknown.
plaid.viewer.models.SampleRefDTO
¶
Serializable form of :class:SampleRef used by the API.
plaid.viewer.models.SampleRefDTO.from_ref
classmethod
¶
Build the DTO from a :class:SampleRef.
plaid.viewer.models.SampleSummary
¶
Minimal metadata describing a PLAID sample.
plaid.viewer.models.ValidationResult
¶
Validation outcome for a PLAID sample.
plaid.viewer.models.ArtifactInfo
¶
Public view of a :class:ParaviewArtifact.
plaid.viewer.models.ViewerUrl
¶
Response model for the viewer-url endpoint.