Skip to content

Commit

Permalink
fix(kobo): support string calculate fields
Browse files Browse the repository at this point in the history
  • Loading branch information
yannforget committed Sep 26, 2024
1 parent 213a142 commit 49a6e63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openhexa/toolbox/kobo/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def cast_calculate(value: str) -> str:
if value == "NaN":
return None
try:
return float(value)
return str(value)
except ValueError:
return value

Expand Down Expand Up @@ -137,7 +137,7 @@ def cast_values(df: pl.DataFrame, survey: Survey) -> pl.DataFrame:

elif field.type == "calculate":
df = df.with_columns(
pl.col(column).map_elements(lambda x: cast_calculate(x), return_dtype=pl.Utf8, skip_nulls=False)
pl.col(column).map_elements(lambda x: cast_calculate(x), return_dtype=pl.String, skip_nulls=False)
)

elif field.type == "date":
Expand Down

0 comments on commit 49a6e63

Please sign in to comment.