Context
The admin dashboard needs to allow editing bibliographic metadata for research papers (authors, venue, DOI, abstract). These fields are stored in metadata_json (a JSON string in ChromaDB), but the current PATCH /source/{source_id} endpoint only supports flat ChromaDB fields (person_entity, credibility_tier, etc.). metadata_json is explicitly blocked from updates.
This is a cross-repo dependency for admin-dashboard EPIC krisoye/admin-dashboard#20.
Design
Option A: Selective metadata_json updates (recommended)
Add a new request field metadata_updates: dict[str, Any] to UpdateMetadataRequest. The handler:
- Reads current
metadata_json string from ChromaDB
- Parses it as JSON
- Merges the provided updates (shallow merge)
- Re-serializes and stores back
class UpdateMetadataRequest(BaseModel):
# Existing fields...
metadata_updates: dict[str, Any] | None = None # New
Option B: Dedicated endpoint
PATCH /source/{source_id}/metadata-json with a JSON body of key-value pairs to merge.
Validation
- Whitelist allowed keys per source_type to prevent arbitrary data injection
- Research papers:
authors, venue, venue_tier, doi, abstract, peer_reviewed, citations, publication_year
- YouTube:
video_title (others are auto-populated)
Files to Modify
src/kb_server.py — UpdateMetadataRequest model, update_metadata endpoint
src/vector_kb.py — update_metadata() method to handle metadata_json merges
Acceptance Criteria
Dependencies
None — standalone KB API enhancement.
Related to krisoye/admin-dashboard#20
Context
The admin dashboard needs to allow editing bibliographic metadata for research papers (authors, venue, DOI, abstract). These fields are stored in
metadata_json(a JSON string in ChromaDB), but the currentPATCH /source/{source_id}endpoint only supports flat ChromaDB fields (person_entity, credibility_tier, etc.).metadata_jsonis explicitly blocked from updates.This is a cross-repo dependency for admin-dashboard EPIC krisoye/admin-dashboard#20.
Design
Option A: Selective metadata_json updates (recommended)
Add a new request field
metadata_updates: dict[str, Any]toUpdateMetadataRequest. The handler:metadata_jsonstring from ChromaDBOption B: Dedicated endpoint
PATCH /source/{source_id}/metadata-jsonwith a JSON body of key-value pairs to merge.Validation
authors,venue,venue_tier,doi,abstract,peer_reviewed,citations,publication_yearvideo_title(others are auto-populated)Files to Modify
src/kb_server.py— UpdateMetadataRequest model, update_metadata endpointsrc/vector_kb.py—update_metadata()method to handle metadata_json mergesAcceptance Criteria
metadata_updatesdictDependencies
None — standalone KB API enhancement.
Related to krisoye/admin-dashboard#20