zettelkasten.dashboard.backend.routes.citations¶
zettelkasten.dashboard.backend.routes.citations ¶
Citation detail, source-citation, promote/unlink, and search routes.
Split out of the former flat routes.py; behaviour is unchanged.
get_citation ¶
Bibliographic detail for a single citation (the global _citations/ store).
A pure citation is a work with no writable source folder, so it has no note detail to show — this surfaces its stored bibliographic metadata for the dashboard right pane. Federated-repo citation detail is out of scope; a non-local id simply 404s.
Source code in zettelkasten/dashboard/backend/routes/citations.py
get_source_citations ¶
The citation works connected to a source via its _meta.yaml.
Surfaces the references (works this source cites — backward) and
cited_by (works that cite this source — forward) id lists, hydrated from
the global _citations/ store, so the source pane can show an expandable
list instead of citations floating loose in _citations/. Unresolvable
ids (a stub that was promoted or deleted) are reported separately rather
than silently dropped. Promoted ids become navigable source links.
Source code in zettelkasten/dashboard/backend/routes/citations.py
promote_citation_to_source ¶
Promote an OpenAlex citation into an owned source (a graph), gated on Zotero.
The write-side action behind the per-citation "promote to a graph" button:
it confirms the work already lives in the user's Zotero library (matching by
DOI/title), then pulls in the PDF, ingests it, promotes the citation stub
into an owned source folder, and wires the full text — preserving the
citation edges that already point at the stub. When the work isn't in Zotero
yet, NOTHING is mutated and the result asks the user to add it to Zotero first
(status="not_in_zotero").
Promotion is a WRITE that also removes the citation stub, so it is blocked
with 403 under ZK_DISABLE_WRITE / ZK_DISABLE_DELETE (mirroring the
review-action barrier). An unexpected raise is returned as a clean structured
failed result rather than a 500. status is one of acquired |
already_owned | not_in_zotero | zotero_unconfigured | failed.
Source code in zettelkasten/dashboard/backend/routes/citations.py
unlink_citation_from_scope ¶
Remove a "proposed" citation's links from the graph — scoped or globally.
The write-side action behind the per-citation "Unlink / Remove" button in the
Papers view. Two tiers (selected by remove_global):
- Unlink from this view (default): drops the
graph="_citations"note links that point at the citation within the scope (a project's sources, or a single source graph) and clears it from those sources' references/cited_by lists. The global citation entity is KEPT. Classified as a WRITE — refused underZK_DISABLE_WRITEonly. - Remove everywhere (
remove_global=true): also scrubs every other graph and deletes_citations/<id>.yaml. A DELETE, so additionally refused underZK_DISABLE_DELETE(mirroring the promote route).
LOCAL-ONLY: a federated/read-only scope is rejected. Clears the papers/claims caches so the removed work disappears from the scored views.