Skip to content

Commit ce8b34b

Browse files
committed
fix nan
1 parent 40be4f3 commit ce8b34b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

reproschema/redcap2reproschema.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,15 @@ def process_row(
420420
# )
421421

422422
elif key in ADDITIONAL_NOTES_LIST and value:
423-
notes_obj = {"source": "redcap", "column": key, "value": value}
423+
# Convert value to string, handling NaN explicitly
424+
value_str = "NaN" if pd.isna(value) else str(value).strip()
425+
if not value_str: # Skip empty strings
426+
continue
427+
notes_obj = {
428+
"source": "redcap",
429+
"column": key,
430+
"value": f'"{value_str}"' # Add quotation marks
431+
}
424432
rowData.setdefault("additionalNotesObj", []).append(notes_obj)
425433

426434
it = Item(**rowData)

0 commit comments

Comments
 (0)