col_test_result

transform.col_test_result(subtype: str)

WDRS Test Result

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

subtype : str

subtype column

Examples

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

df = pl.DataFrame({
    "ResultTextConclusion": [
        "Influenza A virus detected by RT-PCR {58}",
        "Influenza A(2009 H1N1) virus detected by RT-PCR {65}", 
        "Influenza A(H3) virus detected by RT-PCR {64}", 
        "Influenza A(H5) virus detected by RT-PCR {70}",
        "Influenza A(H7) virus detected by RT-PCR",
        "Influenza B virus detected by RT-PCR {59}",
        "Influenza B/Victoria lineage detected by RT-PCR {91}",
        "Influenza B/Yamagata lineage detected by RT-PCR {91}",
        "Inconclusive - Invalid Result {68}",
        "Influenza A virus detected by RT-PCR; Subtype undetected {66}",
        "None"
    ]

    
})

df = (
    df
    .with_columns(
        TEST_RESULT=tf.col_test_result(
            subtype='ResultTextConclusion'
        )
    )
)

helpers.gt_style(df_inp=df)
index ResultTextConclusion TEST_RESULT
0 Influenza A virus detected by RT-PCR {58} Influenza A detected
1 Influenza A(2009 H1N1) virus detected by RT-PCR {65} Influenza A (09 Pdm H1N1) detected
2 Influenza A(H3) virus detected by RT-PCR {64} Influenza A (H3) detected
3 Influenza A(H5) virus detected by RT-PCR {70} Influenza A (H5) detected
4 Influenza A(H7) virus detected by RT-PCR Influenza A (H7) detected
5 Influenza B virus detected by RT-PCR {59} Influenza B detected
6 Influenza B/Victoria lineage detected by RT-PCR {91} Influenza B (Victoria) detected
7 Influenza B/Yamagata lineage detected by RT-PCR {91} Influenza B (Yamagata) detected
8 Inconclusive - Invalid Result {68} Influenza not detected
9 Influenza A virus detected by RT-PCR; Subtype undetected {66} Influenza not detected
10 None Influenza not detected

WDRS Variable Mapping

Below are all distinct options in WDRS for the WDRS_RESULT variable and how the values map to LIMS data.

LIMS Test Results
All distinct values found
AnalyteSynonym
2009pandemic Influenza A {1049}
H1 2009pandemic {1050}
H1
H3
Influenza A(H5)a {1062}
Influenza A(H5)b {1063}
Influenza A(H7)Eu {1069}
B(Victoria) {1095}
B(Yamagata) {1094}
Influenza B
None
Adenovirus
CPE {1052}
H275
I223
Parainfluenza Type 1
Parainfluenza Type 2
Parainfluenza Type 3
Respiratory Syncytial Virus
RP
WDRS Test Results
All distinct values found
WDRS_RESULT
Influenza A (09 Pdm H1N1) detected
Influenza A (H3) detected
Influenza A (H3N2) detected
Influenza A (H5) detected
Influenza A (H7) detected
Influenza A detected
Influenza A, other detected
Influenza B (Victoria) detected
Influenza B (Yamagata) detected
Influenza B, other detected
Influenza not detected
Specimen inadequate
Manual review
Other, specify