Skip to content

Commit e4f3401

Browse files
committed
add typing hint
1 parent f011f0e commit e4f3401

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

genie/database_to_staging.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
import re
99
import subprocess
10-
from typing import List
10+
from typing import List, Tuple
1111

1212
import pandas as pd
1313
import pyranges
@@ -104,7 +104,7 @@
104104

105105

106106
# TODO: Add to transform.py
107-
def _to_redact_interval(df_col):
107+
def _to_redact_interval(df_col: : pd.Series) -> Tuple[pd.Series, pd.Series]:
108108
"""
109109
Determines year values that are "<18" and interval values >89 that need to be redacted
110110
Returns bool because BIRTH_YEAR needs to be redacted as well based
@@ -131,7 +131,7 @@ def _to_redact_interval(df_col):
131131

132132

133133
# TODO: Add to transform.py
134-
def _redact_year(df_col):
134+
def _redact_year(df_col: pd.Series) -> pd.Series:
135135
"""Redacts year values that have < or >
136136
137137
Args:
@@ -149,7 +149,7 @@ def _redact_year(df_col):
149149
return df_col
150150

151151

152-
def _redact_ped_year(df_col):
152+
def _redact_ped_year(df_col: pd.Series) -> pd.Series:
153153
"""Redacts year values that have <
154154
155155
Args:
@@ -166,7 +166,7 @@ def _redact_ped_year(df_col):
166166

167167

168168
# TODO: Add to transform.py
169-
def _to_redact_difference(df_col_year1, df_col_year2):
169+
def _to_redact_difference(df_col_year1: pd.Series, df_col_year2: pd.Series) -> pd.Series:
170170
"""Determine if difference between year2 and year1 is > 89
171171
172172
Args:
@@ -186,8 +186,8 @@ def _to_redact_difference(df_col_year1, df_col_year2):
186186

187187
# TODO: Add to transform.py
188188
def redact_phi(
189-
clinicaldf, interval_cols_to_redact=["AGE_AT_SEQ_REPORT", "INT_CONTACT", "INT_DOD"]
190-
):
189+
clinicaldf: pd.DataFrame, interval_cols_to_redact=["AGE_AT_SEQ_REPORT", "INT_CONTACT", "INT_DOD"]: list
190+
) -> pd.DataFrame:
191191
"""Redacts the PHI by re-annotating the clinical file
192192
193193
Args:

0 commit comments

Comments
 (0)