feat : Improve Batch Analytics with CSV Upload
What does this MR do and why?
This MR resolves the issue of the Batch Analytics page previously only supporting .txt file uploads, which created unnecessary friction for users managing team data in spreadsheets. It introduces full support for .csv file imports while simultaneously fixing critical backend connection bugs.
Key Features & Fixes:
-
Added CSV Import Support: The file uploader in
batch.pyhas been updated to accept.csvfiles. It utilizespandasto intelligently parse the file, automatically looking for headers likeusername/GitLab Usernameandcollege/institutioncolumn to map users. If no headers exist, it falls back to parsing the first columns automatically. - Backward Compatibility: Manual text area entry continues to work perfectly. The logic deduplicates and merges users if they are entered in both the text area and the uploaded CSV.
-
UI & Export Adjustments: Re-formatted the placeholder text in the manual entry box to clarify the
user, collegeformat, and removed the Excel export button per requirements.
References
Issue Number : #66 (closed)
Screenshots or screen recordings
(Please upload screenshots here showing the new CSV upload box, the updated placeholder text, and the final rendered Batch data table)
Before
After
How to set up and validate locally
-
Pull the
feature/csv-import-batch-analyticsbranch locally. -
Run the application:
uv run streamlit run app.py -
Navigate to the Batch Analytics page from the sidebar.
-
Test CSV Upload: Upload a
.csvfile containing ausernameand (optionally) acollegecolumn. -
Test Manual Entry: Type
your_username, your_collegein the text area. -
Click Run Unified Analysis.
-
Verify that the application successfully fetches data, correctly attributes the "College" field in the table, and does not crash with a
Timeout context managererror in your terminal. -
Verify that the Excel download option is no longer visible at the bottom of the page.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
-
Tested CSV imports with and without headers. -
Verified backward compatibility with manual entry. -
Verified Timeout context managererror is completely resolved for large batch sizes. -
Token changes successfully invalidate the UI cache.


