DatasetMeta

Metadata of one dataset, in the style of pyreadstat’s metadata object.

Usage

Source

DatasetMeta(
    dataset,
    collection,
    file_label,
    structure,
    number_rows,
    column_names,
    column_labels,
    column_types,
    column_mandatory,
    column_roles,
)

A read-only view: the field names and parallel-tuple layout follow pyreadstat, extended with the CDISC dimensions (structure, mandatory, role). The data itself is reached through the module attribute of the same name (e.g. pharmaverseadam.adsl).

Attributes

dataset: str

The dataset name, e.g. "adsl".

collection: str

The collection it belongs to, e.g. "pharmaverseadam".

file_label: str or None

The dataset label, equivalent to a SAS dataset label.

structure: str or None

The CDISC structure, e.g. "One record per subject"; None when the source specifications do not provide one.

number_rows: int

Row count, read from the parquet footer without loading any data.

number_columns: int

Column count, i.e. len(column_names).

column_names: tuple of str

The column names, in column order.

column_labels: tuple of str or None

The column labels, parallel to column_names.

column_types: tuple of str or None

The column types, parallel to column_names.

column_mandatory: tuple of str or None

The CDISC mandatory flags, parallel to column_names.

column_roles: tuple of str or None

The CDISC roles, parallel to column_names.

file_format: str

Always "parquet", the storage format of every dataset.

file_encoding: str
Always "utf-8": the encoding of the shipped parquet data, not of the original source file.

Examples

>>> meta = pharmaverseadam.meta("adsl")
>>> meta.dataset
'adsl'
>>> meta.file_label
'Subject Level Analysis'
>>> meta.column_names_to_labels["STUDYID"]
'Study Identifier'
>>> (meta.number_rows, meta.number_columns)
(306, 55)

Attributes

Name Description
column_names_to_labels The column names mapped to their labels, in column order.
number_columns Column count, i.e. len(column_names).
specs Column-level specifications of the dataset, in the active format.

column_names_to_labels

The column names mapped to their labels, in column order.

column_names_to_labels: dict[str, str | None]

Examples

>>> pharmaverseadam.adsl_meta.column_names_to_labels["AGE"]
'Age'

number_columns

Column count, i.e. len(column_names).

number_columns: int


specs

Column-level specifications of the dataset, in the active format.

specs: pa.Table | pl.DataFrame | pd.DataFrame

Examples

>>> pharmaverseadam.adsl_meta.specs.columns
['variable', 'label', 'type', 'mandatory', 'role']

Methods

Name Description
__repr__() One line: which dataset, and how big.

__repr__()

One line: which dataset, and how big.

Usage

Source

__repr__()