Skip to content

Commit cbd072f

Browse files
committed
tests
1 parent e3cf021 commit cbd072f

5 files changed

+7
-254
lines changed

phenex/phenotypes/continuous_coverage_phenotype.py

-107
This file was deleted.

phenex/phenotypes/sex_phenotype.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SexPhenotype(Phenotype):
2424
def __init__(
2525
self,
2626
name: str = "sex",
27-
allowed_values: List[str] = ["male", "female"],
27+
allowed_values: Optional[List[str]] = None,
2828
domain: str = "PERSON",
2929
):
3030
self.name = name
@@ -37,7 +37,8 @@ def _execute(self, tables: Dict[str, Table]) -> PhenotypeTable:
3737
person_table = tables[self.domain]
3838
assert is_phenex_person_table(person_table)
3939

40-
sex_filter = CategoricalFilter(column_name="SEX", allowed_values=self.allowed_values)
41-
filtered_table = sex_filter._filter(person_table)
40+
if self.allowed_values is not None:
41+
sex_filter = CategoricalFilter(column_name="SEX", allowed_values=self.allowed_values)
42+
person_table = sex_filter._filter(person_table)
4243

43-
return filtered_table.mutate(VALUE=filtered_table.SEX, EVENT_DATE= ibis.null())
44+
return person_table.mutate(VALUE=person_table.SEX, EVENT_DATE= ibis.null())

phenex/test/phenotype_test_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def df_from_test_info(test_info):
139139
if "date" in col.lower():
140140
schema[col] = datetime.date
141141
elif "value" in col.lower():
142-
schema[col] = float
142+
schema[col] = str if isinstance(df[col].iloc[0], str) else float
143143
elif "boolean" in col.lower():
144144
schema[col] = bool
145145
else:

phenex/test/phenotypes/test_continuous_coverage_phenotype.py

-141
This file was deleted.

phenex/test/phenotypes/test_sex_phenotype.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def define_input_tables(self):
2929

3030
column_types_person = {}
3131
input_info_person = {
32-
"name": "person",
32+
"name": "PERSON",
3333
"df": df_person,
3434
"column_types": column_types_person,
3535
}

0 commit comments

Comments
 (0)