generated from john/python-template
UI updates, changes sync'd to UI docs
This commit is contained in:
@@ -9,7 +9,7 @@ Acceptance criteria: acceptance-criteria.md
|
||||
|
||||
- Table: Document
|
||||
- Primary key: `id` (UUID)
|
||||
- Related entities: `Source`, `Job`, `DocumentPerson`
|
||||
- Related entities: `Source`, `Job`, `DocumentPerson`, `Person`
|
||||
- Canonical schema references:
|
||||
- `src/transcription/db/models.py`
|
||||
- `docs/schema_v2.md`
|
||||
@@ -26,8 +26,8 @@ This document uses three lenses:
|
||||
| Field | DB Type | Nullable | Default/Auto Value | Intended UI Treatment | Notes |
|
||||
|---|---|---|---|---|---|
|
||||
| id | UUID | No | `uuid4()` | Hidden, system-managed | Primary key |
|
||||
| name | str | No | None | Shown, editable on create and future edit | Required |
|
||||
| document_type | str | Yes | None | Shown, editable on create and future edit | Required by intended UX |
|
||||
| name | str | No | None | Shown, editable on create and edit | Required |
|
||||
| document_type | str | Yes | None | Shown, editable on create and edit | Required by intended UX |
|
||||
| document_date | date | Yes | None | Shown, editable | Canonical exact date when present |
|
||||
| document_date_raw | str | Yes | None | Shown, editable | Approximate or unknown date text |
|
||||
| location_created | str | Yes | None | Shown, editable | Optional metadata |
|
||||
@@ -64,38 +64,37 @@ Related records during intended create:
|
||||
|
||||
### 4.2 Current Implementation
|
||||
|
||||
Current entry point: upload page
|
||||
Current user action: upload file via upload widget
|
||||
Current backend path: upload page submit callback -> `create_upload_job()` -> `_create_upload_records()`
|
||||
Current entry point: `/documents` page
|
||||
Current user action: open create form, fill metadata, optionally select an existing Person
|
||||
Current backend path: document page submit callback -> `DocumentService.create_document()` -> optional `DocumentService.create_document_person()`
|
||||
|
||||
| Field | Current Value at Create | Source | Visible to User | Evidence |
|
||||
|---|---|---|---|---|
|
||||
| id | Generated UUID | System | No | `Document` default factory in `src/transcription/db/models.py` |
|
||||
| name | Basename of uploaded filename | User file name transformed by service | Indirectly | Set in `src/transcription/services/store.py` |
|
||||
| document_type | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| document_date | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| document_date_raw | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| location_created | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| notes | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| archive_identifier | `None` | Service default | No | Not set in `src/transcription/services/store.py` |
|
||||
| name | User-provided | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_type | User-provided or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_date | Parsed from date input or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_date_raw | User-provided or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| location_created | User-provided or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| notes | User-provided or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| archive_identifier | User-provided or None | User input | Yes | `src/transcription/ui/pages/documents_page.py` |
|
||||
| created_at | Current UTC timestamp | System | No | Default factory in `src/transcription/db/models.py` |
|
||||
| updated_at | Current UTC timestamp | System | No | Default factory in `src/transcription/db/models.py` |
|
||||
|
||||
Current related-record behavior:
|
||||
- `Job` is created automatically.
|
||||
- `Source` is created automatically.
|
||||
- `JobSource` is created automatically.
|
||||
- No `Person` or `DocumentPerson` records are created.
|
||||
- User may optionally select an existing `Person`.
|
||||
- If selected, `DocumentPerson` is created with role `author`.
|
||||
- `Job` is not created during Document create.
|
||||
- `Source` is not created during Document create.
|
||||
|
||||
### 4.3 Gap to Target
|
||||
|
||||
To satisfy the intended Create flow, implementation must add:
|
||||
To satisfy the intended Create flow, implementation now includes:
|
||||
1. a Document page and dedicated create form
|
||||
2. user-entered metadata fields for `document_type`, `document_date`, `document_date_raw`, `location_created`, `notes`, and `archive_identifier`
|
||||
3. optional Person lookup and inline Person creation
|
||||
3. optional Person lookup through a dropdown of existing people
|
||||
4. optional `DocumentPerson` link creation when a person is chosen
|
||||
5. post-submit routing to a Document detail page
|
||||
6. removal of the assumption that Document creation always starts with file upload
|
||||
|
||||
## 5. READ Mapping
|
||||
|
||||
@@ -110,29 +109,27 @@ On the Document detail page, the user should be able to see:
|
||||
|
||||
### 5.2 Current Implementation
|
||||
|
||||
Current Document visibility in the UI is indirect.
|
||||
Current Document visibility in the UI is direct.
|
||||
|
||||
| Field | Current Rendering | Visible to User | Notes | Evidence |
|
||||
|---|---|---|---|---|
|
||||
| name | Indirect filename context in jobs list and job detail | Yes, indirect | The UI shows source/job filename, not a dedicated Document page | `src/transcription/ui/pages/jobs_page.py`, `src/transcription/ui/components/table/jobs.py` |
|
||||
| id | Not shown as Document id | No | Job id is shown instead | `src/transcription/ui/pages/jobs_page.py` |
|
||||
| document_type | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| document_date | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| document_date_raw | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| location_created | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| notes | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| archive_identifier | Not rendered | No | Hidden metadata | no current UI field |
|
||||
| created_at | Not rendered as Document timestamp | No | Job timestamps are shown instead | `src/transcription/ui/components/table/jobs.py` |
|
||||
| updated_at | Not rendered as Document timestamp | No | Job metadata is shown instead | `src/transcription/ui/components/transcript.py` |
|
||||
| name | Rendered as title and detail heading | Yes | Dedicated Document detail page | `src/transcription/ui/pages/documents_page.py` |
|
||||
| id | Not shown as raw id | No | Internal identifier remains hidden | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_type | Rendered | Yes | Shown on detail and editable on create/edit | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_date | Rendered | Yes | Exact date shown when present | `src/transcription/ui/pages/documents_page.py` |
|
||||
| document_date_raw | Rendered | Yes | Approximate date shown when present | `src/transcription/ui/pages/documents_page.py` |
|
||||
| location_created | Rendered | Yes | Optional metadata shown | `src/transcription/ui/pages/documents_page.py` |
|
||||
| notes | Rendered | Yes | Optional metadata shown | `src/transcription/ui/pages/documents_page.py` |
|
||||
| archive_identifier | Rendered | Yes | Optional metadata shown | `src/transcription/ui/pages/documents_page.py` |
|
||||
| created_at | Rendered read-only | Yes | System timestamp shown on detail | `src/transcription/ui/pages/documents_page.py` |
|
||||
| updated_at | Rendered read-only | Yes | System timestamp shown on detail | `src/transcription/ui/pages/documents_page.py` |
|
||||
|
||||
### 5.3 Gap to Target
|
||||
|
||||
To satisfy the intended Read flow, implementation must add:
|
||||
1. a Document detail page
|
||||
2. metadata rendering for Document fields
|
||||
3. linked people rendering
|
||||
4. Sources and Jobs sections with empty states
|
||||
5. filtered navigation from the detail page into document-specific Jobs and Sources views
|
||||
To satisfy the intended Read flow, implementation now includes:
|
||||
1. metadata rendering for Document fields
|
||||
2. linked people rendering
|
||||
3. document-scoped Sources and Jobs navigation views
|
||||
|
||||
## 6. UPDATE Mapping
|
||||
|
||||
@@ -171,10 +168,10 @@ Intended system-managed fields:
|
||||
|
||||
### 6.3 Gap to Target
|
||||
|
||||
Implementation must add:
|
||||
Implementation now includes:
|
||||
1. Document edit controls in the UI
|
||||
2. validation and save behavior for Document metadata
|
||||
3. a consistent `updated_at` update policy if metadata edits are introduced
|
||||
3. author relationship controls through the edit flow
|
||||
|
||||
## 7. DELETE Mapping
|
||||
|
||||
@@ -191,11 +188,11 @@ Rules:
|
||||
|
||||
| Action | UI Exposed | Backend Capability | Notes |
|
||||
|---|---|---|---|
|
||||
| Delete Document | No | Yes | `DocumentService.delete_document()` exists, but no dedicated UI guard flow exists |
|
||||
| Delete Document | Yes | Yes | `DocumentService.delete_document()` exists and the UI blocks dependent deletes |
|
||||
|
||||
### 7.3 Gap to Target
|
||||
|
||||
Implementation must add:
|
||||
Implementation includes:
|
||||
1. a Document delete control in the UI
|
||||
2. pre-delete dependency checks for Jobs and Sources
|
||||
3. user-facing messaging when deletion is blocked
|
||||
|
||||
Reference in New Issue
Block a user