Skip to content

feat: ingest motion-corrected micrograph image paths (ADR 0021, gates #308) #309

Description

@vredchenko

Per ADR 0021 — Micrograph Motion-Corrected Preview Image Ingestion and Serving (smartem-devtools, Proposed). This is the ingestion/persistence prerequisite that gates the serving endpoint (#308).

The scientifically meaningful micrograph image is the motion-corrected artefact cryoem-services already produces (a 2D .mrc and a downscaled .jpeg snapshot). SmartEM does not consume cryoem-services' spa.* Zocalo messages; instead it owns the POST /micrographs/{uuid}/motion_correction/completed contract, which is the seam to carry the paths in. We must not serve the stored high_res_path (raw multi-GB movie stack; 3D-array encode failure + OOM).

Scope (ADR items 1-2)

1. Persist two nullable paths on the micrograph

Add two nullable columns via an Alembic migration (no backfill; existing/dump rows stay null):

  • motion_corrected_image_path: str | None — the motion-corrected 2D average .mrc (cryoem-services mc_path / ISPyB micrograph_full_path).
  • motion_corrected_snapshot_path: str | None — the downscaled .jpeg snapshot (ISPyB micrograph_snapshot_full_path).

2. Extend the processing-feedback contract additively

Add both fields as optional (nullable, default None) to:

  • MotionCorrectionCompletedRequest (HTTP request model, api_server.py:1380)
  • MotionCorrectionCompleteBody (RabbitMQ body, model/mq_event.py:330)

Existing callers that omit them keep working (backward-compatible). Extend handle_motion_correction_complete (consumer.py:408) to persist whichever paths are present onto the micrograph row (it currently touches only QualityMetricStatistics and updated_at).

Notes

  • Serving (the micrograph_image endpoint) is tracked separately in feat(api): serve motion-corrected micrograph preview image (ADR 0021) #308, gated behind this issue.
  • The cryoem-services -> SmartEM adapter that supplies these paths is a separate coordination item.
  • Validation is by unit test: the current prod dump predates any processed-image path (all numeric metrics are also null), so it exercises the null/404 path only.
  • On completion a new release is warranted (schema migration + contract fields).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions