Spaces:
Sleeping
Sleeping
Commit
·
0cc8d71
1
Parent(s):
95a8a14
change primary dataset filter
Browse files
app.py
CHANGED
|
@@ -285,16 +285,23 @@ class ValidationAnnotator:
|
|
| 285 |
]
|
| 286 |
|
| 287 |
def set_filter(self, filter_value: str):
|
| 288 |
-
"""Set the current filter and update filtered indices.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
self.current_filter = filter_value
|
| 290 |
|
| 291 |
if filter_value == "All":
|
|
|
|
| 292 |
self.filtered_indices = list(range(len(self.records)))
|
| 293 |
else:
|
| 294 |
# Filter by extraction_tag OR judge_tag matching the filter
|
|
|
|
| 295 |
self.filtered_indices = [
|
| 296 |
i for i, record in enumerate(self.records)
|
| 297 |
-
if record.get('extraction_tag') == filter_value or record.get('judge_tag') == filter_value
|
|
|
|
| 298 |
]
|
| 299 |
|
| 300 |
# Reset to first filtered record if current position is not in filtered set
|
|
|
|
| 285 |
]
|
| 286 |
|
| 287 |
def set_filter(self, filter_value: str):
|
| 288 |
+
"""Set the current filter and update filtered indices.
|
| 289 |
+
|
| 290 |
+
When 'All' is selected: Show all records including siblings
|
| 291 |
+
When a specific tag is selected: Show only primary samples with that tag (no siblings)
|
| 292 |
+
"""
|
| 293 |
self.current_filter = filter_value
|
| 294 |
|
| 295 |
if filter_value == "All":
|
| 296 |
+
# Show all records including siblings
|
| 297 |
self.filtered_indices = list(range(len(self.records)))
|
| 298 |
else:
|
| 299 |
# Filter by extraction_tag OR judge_tag matching the filter
|
| 300 |
+
# AND exclude siblings (only show primary samples)
|
| 301 |
self.filtered_indices = [
|
| 302 |
i for i, record in enumerate(self.records)
|
| 303 |
+
if (record.get('extraction_tag') == filter_value or record.get('judge_tag') == filter_value)
|
| 304 |
+
and record.get('is_primary', True) # Only primary samples, not siblings
|
| 305 |
]
|
| 306 |
|
| 307 |
# Reset to first filtered record if current position is not in filtered set
|