44from typing import List , Optional , Dict , Any
55from enum import Enum
66from datetime import datetime
7+ import textwrap
78
89
910class Severity (Enum ):
@@ -213,11 +214,9 @@ def summary(self) -> str:
213214 lines .extend (recommendations )
214215
215216 # Add note about including validation report in submission
216- lines .extend ([
217- "" ,
218- "Note: A validation report (PHYSIONET_REPORT.md) has been saved in your" ,
219- " dataset folder. Please include this file in your final submission." ,
220- ])
217+ note_text = "Note: A validation report (PHYSIONET_REPORT.md) has been saved in your dataset folder. Please include this file in your final submission."
218+ lines .append ("" )
219+ lines .extend (self ._wrap_text (note_text ))
221220
222221 return "\n " .join (lines ) + "\n "
223222
@@ -254,10 +253,11 @@ def _generate_recommendations(self) -> List[str]:
254253 size_gb = self .dataset_stats .total_size_bytes / (1024 ** 3 )
255254 if size_gb > 200 :
256255 recommendations .append ("\n Dataset Size:" )
257- recommendations . append (
256+ large_dataset_text = (
258257 f" ℹ Your dataset is very large ({ self ._format_size (self .dataset_stats .total_size_bytes )} ). "
259258 "If you need assistance uploading large files, please contact the PhysioNet team at [email protected] " 260259 )
260+ recommendations .extend (self ._wrap_text (large_dataset_text , indent = " " ))
261261
262262 # Collect unique suggestions from all issues
263263 suggestions_by_category = {}
@@ -295,7 +295,10 @@ def _generate_recommendations(self) -> List[str]:
295295 count = info ['count' ]
296296 icon = "✗" if info ['severity' ] == Severity .ERROR else "⚠"
297297 count_str = f" ({ count } file{ 's' if count != 1 else '' } )" if count > 1 else ""
298- recommendations .append (f" { icon } { suggestion } { count_str } " )
298+ suggestion_text = f" { icon } { suggestion } { count_str } "
299+ # Wrap long suggestions
300+ wrapped = self ._wrap_text (suggestion_text , indent = " " )
301+ recommendations .extend (wrapped )
299302
300303 return recommendations
301304
@@ -307,3 +310,10 @@ def _format_size(size_bytes: int) -> str:
307310 return f"{ size_bytes :.1f} { unit } "
308311 size_bytes /= 1024.0
309312 return f"{ size_bytes :.1f} PB"
313+
314+ @staticmethod
315+ def _wrap_text (text : str , width : int = 80 , indent : str = " " ) -> List [str ]:
316+ """Wrap text to specified width with continuation indent."""
317+ # Use textwrap to wrap the text
318+ wrapped = textwrap .fill (text , width = width , subsequent_indent = indent )
319+ return wrapped .split ('\n ' )
0 commit comments