# AUTO-GENERATED by dartfx.cdif.codegen — DO NOT EDIT MANUALLY.
"""CDIF Data Description profile extending Discovery with variableMeasured, physical mapping, and stats."""
from __future__ import annotations
from typing import Annotated, Any, ClassVar
from pydantic import Field
from rdflib import URIRef
from dartfx.cdif.models._base import CdifBaseModel
from dartfx.cdif.models.common import (
CategoryStatistics,
CdifCodelistConcept,
CdifConcept,
CdifConceptOrTermOrString,
CdifInstanceVariable,
CdifKey,
CdifPhysicalMapping,
Concept,
DefinedTerm,
Identifier,
LanguageTaggedValue,
ObjectReference,
SkosConceptLanguageTaggedValue,
Statistics,
StatisticsCollection,
ValueAndConceptDescription,
)
from dartfx.cdif.models.profiles.discovery import CdifDiscoveryDataset
from dartfx.cdif.namespaces import CDIF, SCHEMA
from dartfx.rdf.pydantic import RdfProperty
[docs]
class CdifDataDescriptionMixin(CdifBaseModel):
"""
Additional constraints for CDIF data description level. Adds cdif:physicalDataType requirement on variableMeasured
items and distribution-level cdi properties for file characterization (characterSet, fileSize, fileSizeUofM).
"""
cdif_required_fields: ClassVar[tuple[str, ...]] = ("schema:variableMeasured",)
has_primary_key: Annotated[
CdifKey | ObjectReference | URIRef | str | list[CdifKey | ObjectReference | URIRef | str] | None,
RdfProperty(CDIF.hasPrimaryKey),
] = Field(
default=None,
alias="cdif:hasPrimaryKey",
description=(
"Primary key of the dataset: a cdif:Key whose cdif:isComposedOf is an ordered list of "
"cdi:InstanceVariables (from schema:variableMeasured) that uniquely identify each data instance."
),
)
statistics: Annotated[
(
Statistics
| CategoryStatistics
| StatisticsCollection
| ObjectReference
| URIRef
| str
| list[Statistics | CategoryStatistics | StatisticsCollection | ObjectReference | URIRef | str]
| None
),
RdfProperty(CDIF.statistics),
] = Field(
default=None,
alias="cdif:statistics",
description=(
"**Dataset-scope** summary statistics — statistics that describe the dataset as a whole rather than "
"any single variable (e.g. row count, dataset-wide totals, table-level checksums). Each entry is "
"a..."
),
)
[docs]
class CdifDataDescriptionDataset(CdifDiscoveryDataset, CdifDataDescriptionMixin):
"""CDIF Data Description profile extending Discovery with variableMeasured, physical mapping, and stats."""
rdf_type: ClassVar[Any] = [SCHEMA.Dataset]
cdif_profile_uri: ClassVar[str | None] = "https://w3id.org/cdif/data_description/2.0"
cdif_required_fields: ClassVar[tuple[str, ...]] = ("schema:variableMeasured",)
cdif_any_of_required: ClassVar[tuple[tuple[str, ...], ...]] = (
(
"schema:license",
"schema:conditionsOfAccess",
),
(
"schema:url",
"schema:distribution",
),
)
CdifDataDescriptionMixin.model_rebuild()
CdifDataDescriptionDataset.model_rebuild()
__all__ = [
"CategoryStatistics",
"CdifCodelistConcept",
"CdifConcept",
"CdifConceptOrTermOrString",
"CdifDataDescriptionDataset",
"CdifDataDescriptionMixin",
"CdifInstanceVariable",
"CdifPhysicalMapping",
"Concept",
"DefinedTerm",
"Identifier",
"LanguageTaggedValue",
"ObjectReference",
"SkosConceptLanguageTaggedValue",
"Statistics",
"StatisticsCollection",
"ValueAndConceptDescription",
]