44 lines
2.3 KiB
Markdown
44 lines
2.3 KiB
Markdown
# Plan: Hide Severity Selector from Public Observation Form
|
|
|
|
## Problem
|
|
The public observation submission page (`/public/`) still shows a visible severity selector (Low/Medium/High/Critical buttons) that allows patients to set severity. The severity should be automatically determined by the AI backend task, not by users.
|
|
|
|
## Root Cause
|
|
The actual public form is rendered by `templates/core/public_submit.html` (not `templates/observations/public_new.html` which was previously edited). This template contains:
|
|
1. Visible severity selector buttons with class `.severity-option`
|
|
2. Hidden input `<input type="hidden" name="severity" id="severityInput" value="medium">`
|
|
3. JavaScript event listeners for severity option clicks
|
|
4. CSS styles for `.severity-option` elements
|
|
|
|
## Solution
|
|
Remove the severity UI entirely from the public form. The backend view (`apps/core/views.py:public_observation_submit`) already defaults to `"medium"` if severity is missing from POST data, and the AI analysis task (`analyze_observation_with_ai`) will overwrite it with AI-determined severity.
|
|
|
|
## Files to Change
|
|
|
|
### 1. `templates/core/public_submit.html`
|
|
- **Lines 501-518**: Remove the entire severity section from the form HTML (the second column of the grid with Category)
|
|
- **Change**: Convert the 2-column grid to a single full-width Category field
|
|
- **Lines 578-590**: Remove JavaScript event listeners for `.severity-option` clicks
|
|
|
|
### 2. E2E Tests (will break and need updating)
|
|
The following test files reference `.severity-option` selectors:
|
|
- `e2e/helpers/helpers.ts:90` - clicks severity option
|
|
- `e2e/tests/security/input-validation.spec.ts:68` - clicks severity
|
|
- `e2e/tests/workflows/observation-lifecycle.spec.ts` - multiple severity clicks
|
|
- `e2e/tests/public-forms/observations.spec.ts` - checks severity visibility/count
|
|
- `e2e/tests/public-pages.spec.ts:56` - checks severity count
|
|
|
|
These tests need to be updated to remove severity interactions/assertions.
|
|
|
|
## Expected Result
|
|
The public observation form will show only:
|
|
- Category (optional)
|
|
- Title (optional)
|
|
- Description (required)
|
|
- Location (optional)
|
|
- When (optional)
|
|
- Attachments (optional)
|
|
- Reporter info (optional)
|
|
|
|
No severity field will be visible or submitted. The backend will default severity to `"medium"` and the AI task will determine the final severity.
|