Skip to content

Commit

Permalink
MINOR: added standardise_result function
Browse files Browse the repository at this point in the history
  • Loading branch information
anujavenkatachalam04 committed Apr 13, 2024
1 parent e18fe81 commit 7fdd330
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/epipipeline/standardise/dengue/functions/standardise_result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import re
import numpy as np

def standardise_result(x) -> str:
"""This function standardises results to positive or negative
Args:
x (str/int): Result in the raw dataset
Returns:
str: Negative, Positive or NaN
"""
if isinstance(x, str) or isinstance(x, int):
if re.search(r"-ve|Neg|Negative|No|0", str(x), re.IGNORECASE):
return "NEGATIVE"
elif re.search(r"NS1|IgM|D|Yes|\+ve|Pos|Positive|1", str(x), re.IGNORECASE):
return "POSITIVE"
return np.nan

0 comments on commit 7fdd330

Please sign in to comment.