MikelWL commited on
Commit
903beb7
·
1 Parent(s): 3bb02d3

Docs: overhaul roadmap and config persistence

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. docs/development.md +1 -1
  3. docs/persistence.md +2 -2
  4. docs/roadmap.md +24 -61
README.md CHANGED
@@ -90,7 +90,7 @@ Backend listens on `http://localhost:8000`, Gradio on `http://localhost:7860`.
90
 
91
  1. Open the UI URL.
92
  2. If `APP_PASSWORD` is set, enter it on the login page to unlock the app.
93
- 3. (Optional) Open **Configuration** to choose personas and add per-role prompt additions.
94
  4. Click **Start Conversation**.
95
  5. Wait for the conversation to complete to see analysis results.
96
  - Note: **Stop Conversation** currently aborts the run and may skip post-conversation analysis.
 
90
 
91
  1. Open the UI URL.
92
  2. If `APP_PASSWORD` is set, enter it on the login page to unlock the app.
93
+ 3. (Optional) Open **Configuration** to edit shared prompts and personas (server-canonical; stored in SQLite at `DB_PATH`).
94
  4. Click **Start Conversation**.
95
  5. Wait for the conversation to complete to see analysis results.
96
  - Note: **Stop Conversation** currently aborts the run and may skip post-conversation analysis.
docs/development.md CHANGED
@@ -60,7 +60,7 @@ The primary demo UI is served by `frontend/react_gradio_hybrid.py` and includes
60
 
61
  When running outside Docker, you typically run the backend and the web UI separately; when running in Docker/HF, the backend is mounted under `/api` inside the same server.
62
 
63
- The UI includes a **Configuration** view used to edit persona-specific settings (local-only, stored in the browser). Persona selection for actually running conversations is done in the **AI-to-AI** and **Human-to-AI** panels.
64
 
65
  ## Making Changes Safely
66
 
 
60
 
61
  When running outside Docker, you typically run the backend and the web UI separately; when running in Docker/HF, the backend is mounted under `/api` inside the same server.
62
 
63
+ The UI includes a **Configuration** view used to edit app-wide settings and personas stored in SQLite at `DB_PATH` (shared across users on HF). Persona selection for actually running conversations is done in the **AI-to-AI** and **Human-to-AI** panels.
64
 
65
  ## Making Changes Safely
66
 
docs/persistence.md CHANGED
@@ -51,7 +51,7 @@ Persistence means:
51
  1. When a session ends as a **sealed run** (conversation finished and analysis succeeded), we write a **Run record** to durable storage:
52
  - transcript (messages)
53
  - analysis outputs (resource agent JSON, evidence catalog, schema versions)
54
- - configuration snapshot (LLM backend/model/params, selected personas, prompt additions, etc.)
55
  - persona snapshots for historical fidelity (see below)
56
  2. We expose APIs to:
57
  - list prior runs (chronological)
@@ -214,7 +214,7 @@ Primary key:
214
  - `timeout`, `max_retries`, `retry_delay`
215
  - any generation params used (temperature, max_tokens, top_p, etc.)
216
  - Mode-specific:
217
- - AI↔AI: surveyor/patient persona IDs (and/or names), prompt additions
218
  - Human↔AI: same + human mode flags
219
  - Text analysis: `source_name`, optional file metadata (original filename, sha256)
220
  - App versions:
 
51
  1. When a session ends as a **sealed run** (conversation finished and analysis succeeded), we write a **Run record** to durable storage:
52
  - transcript (messages)
53
  - analysis outputs (resource agent JSON, evidence catalog, schema versions)
54
+ - configuration snapshot (LLM backend/model/params, selected personas, and the effective shared settings used)
55
  - persona snapshots for historical fidelity (see below)
56
  2. We expose APIs to:
57
  - list prior runs (chronological)
 
214
  - `timeout`, `max_retries`, `retry_delay`
215
  - any generation params used (temperature, max_tokens, top_p, etc.)
216
  - Mode-specific:
217
+ - AI↔AI: surveyor/patient persona IDs (and persona version ids / snapshots)
218
  - Human↔AI: same + human mode flags
219
  - Text analysis: `source_name`, optional file metadata (original filename, sha256)
220
  - App versions:
docs/roadmap.md CHANGED
@@ -15,93 +15,56 @@ _Last updated: 2026-01-22_
15
  - Hosted LLM support via OpenRouter (`LLM_BACKEND=openrouter`)
16
  - Hugging Face Spaces (Docker) deployment
17
 
18
- ## Near-Term Priorities
19
 
20
- 1. **Evidence Output: remove hard caps**
21
- Remove any fixed limits (e.g., “max 3 evidence snippets”) and let the model return as many evidence references as needed.
22
 
23
- 2. **Evidence Traceability (jump-to-source)**
 
24
  Implemented: evidence entries are clickable and jump/scroll to the cited transcript message with a temporary highlight.
25
 
26
- 3. **Evidence Export (Metadata Download)**
27
  Add a “Download” UI action to export transcript + analysis output + provenance metadata (e.g., evidence pointers, prompt/schema versions). Start with JSON (lossless), then add CSV/Excel-friendly formats as needed.
28
  ✅ Implemented: Download Excel (.xlsx, multi-sheet) as primary; Download JSON as lossless export.
29
 
30
- 4. **Analysis on pasted/uploaded text**
31
  Add a panel to paste text or upload a file, run the same analysis pipeline, render results, and allow download.
32
  ✅ Implemented: “Upload Text” tab supports paste, text-file upload, and best-effort PDF text extraction; exports work (Excel + JSON).
33
 
34
- 5. **Modularization / Separation of Concerns (refactor)**
35
  Before adding more major UI modes, refactor to keep the codebase maintainable:
36
  - Split the growing frontend UI logic (currently concentrated in `frontend/pages/main_page.py`) into smaller, focused modules/components.
37
  - Split API routers (e.g., `backend/api/*_routes.py`) so endpoints aren’t concentrated in a single catch-all module.
38
  - Keep behavior unchanged (refactor-only); validate by running Conversation, Upload Text, Configuration, exports, and evidence jump.
39
  ✅ Verified: refactor-only; UI and API behavior unchanged after smoke testing.
40
 
41
- 6. **Human ↔ Surveyor chat mode**
42
  Add a panel where a human chats as the patient with the surveyor agent (text input), while keeping the same analysis pipeline at end-of-session.
43
  ✅ Implemented: “Human-to-AI” tab supports human patient turns; “End session” runs analysis + enables exports.
44
 
45
- 7. **Persistent storage (HF Spaces `/data`)**
46
  Add a simple storage layer and persist runs (transcript + analysis) and user-created personas so they survive restarts/redeploys.
47
- ✅ Implemented (runs): sealed-run persistence to SQLite at `DB_PATH`, `GET /api/runs` + `GET /api/runs/{run_id}`, and server-canonical exports via `/api/runs/{run_id}/export/*`.
48
- ⏳ Remaining (personas): persona CRUD + server-side persistence/versioning.
49
 
50
- 8. **Run history browser**
51
- Make persisted runs usable from the UI:
52
- ✅ Implemented:
53
  - List sealed runs (sort by recency).
54
  - Select a run to rehydrate transcript + analysis (read-only replay).
55
  - Export from the selected run (server-canonical).
56
  - (Optional later) delete/retain controls and basic metadata (title/notes).
57
 
58
- 9. **Configuration UX (local-first, non-CRUD)**
59
- Improve “Configuration” as a first-class control surface (even before full CRUD), focusing on clarity and “what applies on the next run”:
60
- - **9.1 Surveyor controls v2 (Attributes list)**:
61
- - Simplify surveyor controls into an “Attributes” list (keep question bank first-class).
62
- - Decouple persona selection for **editing** (Configuration) from persona selection for **running** (AI-to-AI / Human-to-AI panels).
63
- - Follow-ups:
64
- - Improve Human-to-AI turn-taking clarity (make it obvious who should speak next, especially when AI role = Patient).
65
- - Make persona ids backend-oriented and avoid showing raw ids in user-facing dropdowns (prefer friendly display names only).
66
- - **9.2 Patient controls v1 (Attributes list)**
67
- Implemented: patient persona attributes list (local-first), compiled into the patient prompt and captured in run snapshots.
68
- - **9.3 Analysis Agent controls v1 (Attributes list)** ✅
69
- Implemented: analysis agent attributes list (local-first) + “Apply defaults”, wired into both post-conversation analysis and Upload Text.
70
- - **9.4 System controls v1**: (candidate removal) effective runtime config panel may be omitted for PI-facing simplicity.
71
- - **9.5 Validation + guardrails**: schema versioning, reset-to-defaults, and explicit “applies next run” UX.
72
- - **9.6 Roadmap override (Personas v2 scaffolding)** ✅
73
- Implemented:
74
- - Universal type-wide system prompt per persona type (Surveyor, Patient) with ���Apply defaults”.
75
- - Default personas converted to attributes-only (no persona-specific system prompts) with a small immutable default set.
76
- - Configuration UI adjusted to review defaults read-only; system prompts remain editable.
77
- ✅ Implemented (partial, foundational pieces):
78
- - Split Configuration into panes (Surveyors / Patients / Analysis Agent / System).
79
- - Surveyor knobs wired end-to-end (UI → WS payload → prompt compilation → stored config snapshot).
80
- - Surveyor question bank (UI list) wired end-to-end with deterministic “selected question id” tracking.
81
-
82
- 10. **Server-side persistence + CRUD (Personas + Analysis Templates)**
83
- Add create/update/delete flows backed by persistent storage, with versioning and run snapshots:
84
- - **10.1 DB-canonical personas (including defaults)**:
85
- - Add DB schema/migrations for personas + persona versions.
86
- - Seed a small immutable default set (e.g., 3 surveyors + 3 patients) into the DB on startup.
87
- - Retire YAML as the runtime source of truth once DB seeding exists.
88
- - Universal system prompts (Surveyor + Patient) become DB-backed shared settings.
89
- - **10.2 Persona CRUD API**:
90
- - Create/update/delete user personas (no description field in v1).
91
- - Defaults are immutable (view-only; cannot update/delete).
92
- - Updates create new versions; deletes are soft deletes.
93
- - **10.3 CRUD UI**:
94
- - Create/duplicate/delete personas in Configuration.
95
- - Default personas remain read-only; user personas are editable.
96
- - **10.4 Run snapshot integrity**:
97
- - Sealed runs reference persona_id + persona_version_id and store snapshots to prevent drift.
98
- - **10.5 Analysis templates (later)**:
99
- - Optional follow-up once persona CRUD is stable.
100
-
101
- 11. **Evaluation / test coverage chapter (separate)**
102
- Treat evaluation as its own milestone rather than a “basic tests” checkbox:
103
- - Integration smoke tests + golden runs for core modes.
104
- - Deterministic checks where possible (schema validation, exports, persistence invariants).
105
 
106
  ## Longer-Term Ideas
107
 
 
15
  - Hosted LLM support via OpenRouter (`LLM_BACKEND=openrouter`)
16
  - Hugging Face Spaces (Docker) deployment
17
 
18
+ ## Status
19
 
20
+ As of 2026-01-22, the v1 feature set is in place:
 
21
 
22
+ - Evidence output: no hard caps in UI rendering.
23
+ - Evidence Traceability (jump-to-source) ✅
24
  Implemented: evidence entries are clickable and jump/scroll to the cited transcript message with a temporary highlight.
25
 
26
+ - Evidence Export (Metadata Download)
27
  Add a “Download” UI action to export transcript + analysis output + provenance metadata (e.g., evidence pointers, prompt/schema versions). Start with JSON (lossless), then add CSV/Excel-friendly formats as needed.
28
  ✅ Implemented: Download Excel (.xlsx, multi-sheet) as primary; Download JSON as lossless export.
29
 
30
+ - Analysis on pasted/uploaded text
31
  Add a panel to paste text or upload a file, run the same analysis pipeline, render results, and allow download.
32
  ✅ Implemented: “Upload Text” tab supports paste, text-file upload, and best-effort PDF text extraction; exports work (Excel + JSON).
33
 
34
+ - Modularization / Separation of Concerns (refactor)
35
  Before adding more major UI modes, refactor to keep the codebase maintainable:
36
  - Split the growing frontend UI logic (currently concentrated in `frontend/pages/main_page.py`) into smaller, focused modules/components.
37
  - Split API routers (e.g., `backend/api/*_routes.py`) so endpoints aren’t concentrated in a single catch-all module.
38
  - Keep behavior unchanged (refactor-only); validate by running Conversation, Upload Text, Configuration, exports, and evidence jump.
39
  ✅ Verified: refactor-only; UI and API behavior unchanged after smoke testing.
40
 
41
+ - Human ↔ Surveyor chat mode
42
  Add a panel where a human chats as the patient with the surveyor agent (text input), while keeping the same analysis pipeline at end-of-session.
43
  ✅ Implemented: “Human-to-AI” tab supports human patient turns; “End session” runs analysis + enables exports.
44
 
45
+ - Persistent storage (HF Spaces `/data`)
46
  Add a simple storage layer and persist runs (transcript + analysis) and user-created personas so they survive restarts/redeploys.
47
+ ✅ Implemented: sealed-run persistence to SQLite at `DB_PATH`, run history APIs, server-canonical exports, and DB-canonical personas + shared settings.
 
48
 
49
+ - Run history browser
 
 
50
  - List sealed runs (sort by recency).
51
  - Select a run to rehydrate transcript + analysis (read-only replay).
52
  - Export from the selected run (server-canonical).
53
  - (Optional later) delete/retain controls and basic metadata (title/notes).
54
 
55
+ Configuration & personas are now fully server-canonical:
56
+
57
+ - Surveyor/Patient/Analysis Agent system prompts are shared DB-backed settings (with “Apply defaults” + warning gating in UI).
58
+ - Personas are DB-canonical with CRUD (defaults immutable; user personas editable; updates are versioned).
59
+ - Run snapshots store persona versions and persona snapshots to prevent drift.
60
+
61
+ ## Remaining roadmap item
62
+
63
+ 1. **Analysis templates: editable codebook-driven top-down UI**
64
+ Make the analysis “top-down codes” and related UI structure editable/extensible (codebook/categories), while preserving:
65
+ - strict JSON output contract,
66
+ - historical run fidelity (snapshots),
67
+ - exports compatibility.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  ## Longer-Term Ideas
70