Spaces:
Running on Zero
Running on Zero
Fix premature sex validation warnings
Browse files- Only warn about invalid sex values (not Male/Female), not empty/None
- Empty or None sex values will be validated at analysis time
- Prevents annoying warnings when settings are first created
- Improve warning message to show the invalid value
180 unmodified lines181182183184185186187188189180 unmodified linesf"Slide {slide_name}: Unknown site type. Valid types are: Metastatic, Primary. ")settings_df.at[idx, "Site Type"] = "Primary"if row["Sex"] not in SEX_OPTIONS and row["Sex"] != "" and row["Sex"] is not None:warnings.append(f"Slide {slide_name}: Invalid sex value. Valid options are: {', '.join(SEX_OPTIONS)}. ")settings_df.at[idx, "Sex"] = ""if row["Tissue Site"] not in tissue_sites:180 unmodified lines181182183184185186187188189190191192180 unmodified linesf"Slide {slide_name}: Unknown site type. Valid types are: Metastatic, Primary. ")settings_df.at[idx, "Site Type"] = "Primary"# Only warn about invalid sex values that are not empty/None# Empty/None will be validated at analysis timesex_value = row["Sex"]if sex_value and sex_value not in SEX_OPTIONS:warnings.append(f"Slide {slide_name}: Invalid sex value '{sex_value}'. Valid options are: {', '.join(SEX_OPTIONS)}. ")settings_df.at[idx, "Sex"] = ""if row["Tissue Site"] not in tissue_sites:
src/mosaic/ui/utils.py+5-2