| """Multi-file PDF/image uploader component for clinical documents.""" | |
| from __future__ import annotations | |
| _ACCEPTED_TYPES = ["pdf", "png", "jpg", "jpeg"] | |
| def render_file_uploader_spec() -> dict: | |
| """Return a render spec for the clinical document uploader widget.""" | |
| return { | |
| "label": "Upload clinical documents (PDF, images)", | |
| "accepted_types": list(_ACCEPTED_TYPES), | |
| "accept_multiple_files": True, | |
| "help_text": "Upload clinic letters, pathology reports, lab results", | |
| "widget_key": "clinical_docs_uploader", | |
| } | |
| def format_file_info(filename: str, size_bytes: int) -> str: | |
| """Format file name + size for display.""" | |
| if size_bytes >= 1_000_000: | |
| return f"{filename} ({size_bytes / 1_000_000:.1f} MB)" | |
| return f"{filename} ({size_bytes / 1_000:.1f} KB)" | |