User Story
As a project admin, I want to import multiple expert opinions at once via CSV or JSON file, so that I can efficiently set up projects with many experts without manual entry.
Problem Statement
Currently, admins must add expert opinions one by one through the UI. For projects with 20+ experts (like the budget and pendlers case studies), this manual process is time-consuming and error-prone.
Proposed Solution
Data Format Support
CSV Format:
expert_name,lower,peak,upper,comment
Expert1,5.0,10.0,15.0,Optional comment
Expert2,8.0,12.0,18.0,
JSON Format:
{
"opinions": [
{"name": "Expert1", "lower": 5.0, "peak": 10.0, "upper": 15.0, "comment": "Optional"},
{"name": "Expert2", "lower": 8.0, "peak": 12.0, "upper": 18.0}
]
}
Backend Requirements
POST /api/v1/projects/{project_id}/opinions/bulk
- Validate all opinions before inserting (atomic transaction)
- Return detailed error report with row numbers for failed validations
- Enforce fuzzy number constraint:
lower <= peak <= upper
- Respect project's
scale_min and scale_max settings
Frontend Requirements
- Drag-and-drop file upload component
- Preview table showing parsed data before import
- Progress indicator during import
- Error summary with clickable row navigation
- Download template button (CSV and JSON examples)
Acceptance Criteria
Definition of Done
Technical Notes
- Use existing
OpinionService patterns from api/services/opinion_service.py
- Follow validation patterns from
api/schemas/validators.py
- Frontend file upload can use native
<input type="file"> with drag-drop wrapper
Related
- Case study data format:
examples/data/README.md
- Opinion schema:
api/schemas/opinion.py
User Story
As a project admin, I want to import multiple expert opinions at once via CSV or JSON file, so that I can efficiently set up projects with many experts without manual entry.
Problem Statement
Currently, admins must add expert opinions one by one through the UI. For projects with 20+ experts (like the budget and pendlers case studies), this manual process is time-consuming and error-prone.
Proposed Solution
Data Format Support
CSV Format:
JSON Format:
{ "opinions": [ {"name": "Expert1", "lower": 5.0, "peak": 10.0, "upper": 15.0, "comment": "Optional"}, {"name": "Expert2", "lower": 8.0, "peak": 12.0, "upper": 18.0} ] }Backend Requirements
POST /api/v1/projects/{project_id}/opinions/bulklower <= peak <= upperscale_minandscale_maxsettingsFrontend Requirements
Acceptance Criteria
api/README.mdDefinition of Done
Technical Notes
OpinionServicepatterns fromapi/services/opinion_service.pyapi/schemas/validators.py<input type="file">with drag-drop wrapperRelated
examples/data/README.mdapi/schemas/opinion.py