Skip to content

Commit

Permalink
BUG: Fix CSV parsing of tiles dataset columns with commas (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxilse authored Jul 29, 2022
1 parent 090368c commit 87237db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hi-ml-cpath/src/health_cpath/datasets/default_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TCGA_CRCK_DATASET_ID = "TCGA-CRCk"

TCGA_PRAD_DATASET_ID = "TCGA-PRAD_20220712"
TCGA_PRAD_10X_TILES_DATASET_ID = "TCGA-PRAD_10X_tiles_20220722_103508_level1_224"
TCGA_PRAD_10X_TILES_DATASET_ID = "TCGA-PRAD_10X_tiles_20220728_123811_level1_224"

DEFAULT_DATASET_LOCATION = "/tmp/datasets/"
PANDA_5X_TILES_DATASET_DIR = DEFAULT_DATASET_LOCATION + PANDA_5X_TILES_DATASET_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ def format_csv_row(tile_info: Dict[TileKey, Any], keys_to_save: Iterable[TileKey
:return: The formatted CSV row.
"""
tile_slide_metadata = tile_info.pop(TileKey.SLIDE_METADATA)

fields = [str(tile_info[key]) for key in keys_to_save]
fields.extend(str(tile_slide_metadata[key]) for key in metadata_keys)
fields = ['"' + value + '"' if ',' in value else value for value in fields] # if field contains a , add extra " "

dataset_row = ','.join(fields)
return dataset_row

Expand Down

0 comments on commit 87237db

Please sign in to comment.