wdrs_specimen_source

transform.wdrs_specimen_source(wdrs_spec_source_col: str)

WDRS Specimen Source

Usage

The function can be called into a .with_columns() statement. It will reference the dataframe’s status column and output a cleaned version of it.

Parameters

wdrs_spec_source_col : str

specimen source column

Examples

import polars as pl
import wadoh_subtyping.transform as tf
from wadoh_raccoon.utils import helpers

df = pl.DataFrame({
    "SpecimenSource": [
        "Resipiratory: nasal swab",
        "Nasopharyngeal Swab (NP)",
        "Conjunctival Swab"
    ]
})

# here's how to apply the function
df = (
    df
    .with_columns(
        WDRS_SPECIMEN_SOURCE=tf.wdrs_specimen_source(wdrs_spec_source_col='SpecimenSource')
    )
)

# here's a table output
helpers.gt_style(df_inp=df)
index SpecimenSource WDRS_SPECIMEN_SOURCE
0 Resipiratory: nasal swab None
1 Nasopharyngeal Swab (NP) G_NP_SWAB
2 Conjunctival Swab G_EYE