Bulk record upload inserts rows that already exist or repeat within the file, silently duplicating data
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 18/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
- 领域
- database, full-stack
调研方向
Start in InstrumentRecordsService.upload, which handles POST /instrument-records/upload, and read the single-record POST /instrument-records path beside it. The issue asks for a decision first: reject with a 409 or skip duplicates and report counts, and whether to store a content hash on the record. Confirm that choice with maintainers before coding. Done means duplicate rows are detected on the server, with unit and e2e tests, and the web upload shows the counts before submit.
由索引模型根据 Issue 内容生成。
描述
Problem
POST /instrument-records/upload (InstrumentRecordsService.upload) inserts every row it receives. It does not check:
- for rows repeated inside the same request, or
- for rows that already exist (same subject, instrument, date and data).
So if a user uploads the same CSV again, or the browser sends the request again, all data is silently doubled. Nothing tells the user that the rows were already present.
Observed
A production instance (v2.5.2) holds 28,177 MOUSE_WEIGHT_FORM records that contain only 1,317 unique measurements for 402 subjects:
- 7 upload batches over two days (2024-12-04 and 2025-01-07) put the same file in again, both in a group and with no group.
- Inside one batch of 3,520 rows, 1,100 measurements occur 3 times, a few seconds apart. Either the CSV had repeated rows, or the request was sent again.
- Each duplicate also has its own session (see the companion issue about deleting sessions).
About 38 smaller groups of exact duplicates come from forms submitted twice a few minutes apart.
Proposal (needs decision)
- Server: before insert, find the existing records that match (
subjectId,instrumentId,date, canonical JSON ofdata) and the matching rows inside the batch. Then either reject the request with a 409 that lists them, or skip them and return a count of created and skipped rows. A content hash stored on the record would make this an indexed lookup. - Web: show "N rows already exist, M rows repeated in the file" before the submit, with an explicit choice. The current page hides the form while the upload runs, but the server must not depend on the client for this.
- The single-record
POST /instrument-recordsmay need the same guard against a double submit (a short time window, or an idempotency key).
Each change needs a unit test and an e2e test.
- 主要语言
- TypeScript
- 星标
- 119
- 派生
- 19
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 61
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DouglasNeuroInformatics/OpenDataCapture 的其他 Issue
-
Area: API Bug Difficulty: Low Priority: Low
难度 2/5 1-3 小时 新手友好度 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
维护者通常 1 天内回复
-
Area: Infrastructure Bug Difficulty: Low Priority: Medium Security
难度 2/5 1-3 小时 新手友好度 72/100
DouglasNeuroInformatics/OpenDataCapture#1916 ·
维护者通常 1 天内回复
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
难度 2/5 1-3 小时 新手友好度 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
维护者通常 1 天内回复
-
Area: Instruments Bug Difficulty: Low Priority: Low
难度 2/5 1-3 小时 新手友好度 78/100
DouglasNeuroInformatics/OpenDataCapture#1824 · 1 条评论 ·
维护者通常 1 天内回复
-
Completing a series instrument logs a TypeError "Cannot read properties of undefined (reading 'kind')"可能已有人在做 @SAY-5 于 3 天前认领。 未关闭Area: Shared Bug Difficulty: Low Priority: Low
难度 2/5 1-3 小时 新手友好度 70/100
DouglasNeuroInformatics/OpenDataCapture#1813 · 1 条评论 ·
维护者通常 1 天内回复
查看 DouglasNeuroInformatics/OpenDataCapture 的全部 Issue
相似的 Issue
-
infra needs-triage
难度 2/5 1 小时以内 新手友好度 82/100
LucasSantana-Dev/Lucky#3331 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kOaDT/oss-oopssec-store#381 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
nocobase/nocobase#11669 · 1 条评论 ·
维护者通常 1 天内回复
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaude未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复