Enhance pending documents API

未关闭
#277 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
22/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api, backend, database

调研方向

This is a design-level API change: infer current pending-document handling from the existing documents list/filter by pending status, then introduce a processing-jobs model (start/end, progress, origin, unread/dismissed) plus date/origin filters and a streaming list endpoint. Start by locating the current pending-documents API and any related polling clients; done means jobs persist after processing, clients can filter and stream without polling, and bulk reprocess no longer floods the web indicator. No files or tests are named in the issue.

由索引模型根据 Issue 内容生成。

描述

processing
Problems
  • We have to poll for changes to processing state. If the API provided a streaming response, we could avoid hitting the endpoint multiple times.
  • Once the document is done processing, it’s removed from the results. Because we’re polling for data, once the document is done, it disappears from our processing list.
  • When dispatching a bulk reprocess from the API, all those documents will appear in the web indicator
  • https://github.com/MuckRock/documentcloud/issues/230
  • https://github.com/MuckRock/documentcloud/issues/211
Proposed Solutions
  • Document processing jobs are inferred by filtering documents for a “pending” status. We should consider creating a new table for processing jobs, that track details like:
    • start time and end time
    • a value to track job progress
    • relation to the document, or documents, involved in the job
    • track the client origin of a processing job: did it come from the web client, an API client, someplace else
    • optionally, some kind of human-readable summary or description of the job: “Applying OCR to 15 documents”
    • a boolean “unread” or “dismissed” status, so that clients know which completed jobs to display to users
  • Provide date and origin filters for processing jobs, so that the client can make a request like “send me all pending or non-dismissed completed jobs created from the frontend client in the last week”
  • Provide a streaming endpoint so that the client only has to make one request for the list of processing documents, instead of continuously polling the endpoint.
主要语言
Python
星标
55
派生
10
平均合并
1 天 13 小时
30 天内合并 PR
22

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MuckRock/documentcloud 的其他 Issue

查看 MuckRock/documentcloud 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。