pdstools.utils.streamlit_utils

Functions

cached_sample()

cached_datamart(**kwargs)

Load ADMDatamart with caching.

cached_sample_prediction()

cached_prediction_table(**kwargs)

Load Prediction with caching.

import_datamart(extract_pyname_keys[, infer_schema_length])

Import ADMDatamart data from various sources.

from_uploaded_file(extract_pyname_keys, codespaces[, ...])

from_file_path(extract_pyname_keys, codespaces[, ...])

model_selection_df(df, context_keys)

filter_dataframe(→ polars.LazyFrame)

Adds a UI on top of a dataframe to let viewers filter columns

model_and_row_counts(df)

Returns unique model id count and row count from a dataframe

configure_predictor_categorization()

convert_df(df)

st_get_latest_pdstools_version()

Module Contents

cached_sample()
cached_datamart(**kwargs)

Load ADMDatamart with caching.

Parameters:

**kwargs – Arguments passed to ADMDatamart.from_ds_export

cached_sample_prediction()
cached_prediction_table(**kwargs)

Load Prediction with caching.

Parameters:

**kwargs – Arguments passed to Prediction.from_ds_export

import_datamart(extract_pyname_keys: bool, infer_schema_length: int = 10000)

Import ADMDatamart data from various sources.

Parameters:
  • extract_pyname_keys (bool) – Whether to extract additional keys from pyName column

  • infer_schema_length (int, default 10000) – Number of rows to scan for schema inference when reading CSV/JSON files. For large production datasets, increase this value (e.g., 200000) if columns are not being detected correctly.

from_uploaded_file(extract_pyname_keys, codespaces, infer_schema_length=10000)
from_file_path(extract_pyname_keys, codespaces, infer_schema_length=10000)
model_selection_df(df: polars.LazyFrame, context_keys: list)
Parameters:
  • df (polars.LazyFrame)

  • context_keys (list)

filter_dataframe(df: polars.LazyFrame, schema: dict | None = None, queries=[]) polars.LazyFrame

Adds a UI on top of a dataframe to let viewers filter columns

Parameters:
  • df (pl.DataFrame) – Original dataframe

  • schema (Optional[dict])

Returns:

The filtered LazyFrame

Return type:

pl.LazyFrame

model_and_row_counts(df: pdstools.utils.types.ANY_FRAME)

Returns unique model id count and row count from a dataframe

Parameters:

df (Union[pl.DataFrame, pl.LazyFrame]) – The input dataframe

Returns:

unique model count row count

Return type:

Tuple[int, int]

configure_predictor_categorization()
convert_df(df)
st_get_latest_pdstools_version()