Skip to content

feat: store labels in a JSON Lines file (UC-1.7) #13

Backlog

Description

@Akadib

Problem

As a developer, I want labels in a plain file that I can read, diff and append to safely.

Proposed solution

  • LabelStore(path): add(record), latest() (newest record per image_id), history(image_id), query(**filters).
  • Records follow schema version 1 (below). Unknown fields are kept. Missing required fields raise ValueError.
  • image_id = f"{run_stem}_f{frame_index:04d}" where run_stem is the master file name without _master.h5.
  • Appends use one write call per record and flush.

Schema version 1:

{
  "schema": 1,
  "image_id": "L_A07_0007_f0153",
  "sample_id": "A07",
  "puck": "A",
  "position": "07",
  "run": "0007",
  "master_file": "/data/A07/L_A07_0007_master.h5",
  "frame_index": 153,
  "omega_deg": 15.3,
  "label": "ice",
  "ice_severity": "light",
  "note": "",
  "source": "human",
  "labeled_by": "adib",
  "confidence": null,
  "datetime": "2026-12-03T21:14:03+11:00",
  "beamline": "MX2",
  "detector": "Dectris EIGER2 Si 9M",
  "wavelength_A": 0.9537,
  "distance_mm": 250.01,
  "beam_center_px": [1502.10, 1659.76]
}

label is one of good, ice, empty. ice_severity is null
unless the label is ice. source is human or model. beam_center_px is
(x = column, y = row).

Done when

  • Unit tests for add, latest, history, query, bad records
  • News file added

Activity

  1. added theissue type on Dec 1, 2026
  2. added
    enhancement
    good first issue
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions