wdrs_specimen_type

transform.wdrs_specimen_type(wdrs_spec_type_col: str)

WDRS Specimen Type

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_type_col : str

specimen type column

Examples

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

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

# here's how to apply the function to a dataframe
df = (
    df
    .with_columns(
        WDRS_SPECIMEN_TYPE=tf.wdrs_specimen_type(wdrs_spec_type_col='SpecimenSource')
    )
)

# here's a table of the results
helpers.gt_style(df_inp=df)
index submitter SpecimenSource WDRS_SPECIMEN_TYPE
0 PHL Resipiratory: nasal swab None
1 PHL Nasopharyngeal Swab (NP) G_SWAB-NP
2 PHL Conjunctival Swab None