-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This ticket involves evolving the MVP's simple "Run Scan" form into a more powerful and user-friendly interface that allows users to upload documents. The primary goal is to enable users to submit files like pitch decks (.pdf, .pptx), financial statements (.xlsx, .csv), and other relevant materials for the AI agents to analyze.
Implementation Tips
- Django Form: Use Django's FileField or MultipleFileField in your scans/forms.py to handle the file inputs. Implement validation for file types and sizes to ensure users only upload supported formats.
- Frontend UX: To improve the user experience, consider using a JavaScript library like Dropzone.js to create a modern drag-and-drop file upload area. A simple is sufficient for the initial implementation.
- File Handling: Crucially, do not save uploaded files directly to the database. The view should handle the request.FILES in memory. The file objects should then be passed to a Celery background task, which will be responsible for uploading them to a persistent storage service like Google Cloud Storage (GCS). This is covered in ticket F2.7.
Acceptance Criteria (Checklist)
- The "Run Scan" page UI is updated to include a file upload component.
- The component supports selecting one or more files.
- The form correctly validates uploaded files based on type and size.
- On successful submission, the Django view correctly receives the file(s) from the request.
- The view dispatches a Celery task, successfully passing the file data to it.
Unit Tests
Create a scans/tests/test_forms.py and add to scans/tests/test_views.py.
Form Tests:
- Test that the form is valid with correctly mocked file uploads.
- Test that the form is invalid if unsupported file types are used.
View Tests:
- Use Django's SimpleUploadedFile to create mock files for testing.
- Test a POST request with valid data and mock files, and assert that the Celery task's .delay() method was called.
- Test a POST request with invalid data and assert that the form re-renders with errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels