Skip to content

Let Data API writes reach samples pruned after archiving - #108

Merged
EmmaBrass merged 1 commit into
CederGroupHub:mainfrom
XuHuang0:data-api-archived-samples
Oct 16, 2026
Merged

EmmaBrass merged 1 commit into
CederGroupHub:mainfrom
XuHuang0:data-api-archived-samples

Conversation

@XuHuang0

Copy link
Copy Markdown

Summary

  • After Ending, prune_archived_unplaced_from_live removes the live sample, but /analysis/pending, /analysis/claim, /analysis/results and POST /samples/<id>/measurements only look at the live collection. An analysis that finishes after the operator confirms Ending can't be written back, and a SEM ref registered after the sample left the lab gets a 404.
  • These routes now try the live sample first, as before, and fall back to the copy in Alab(completed) when the live one is gone. Live samples behave the same as before.

Additional dependencies introduced (if any)

None.

Checklist

  • Ruff clean on the changed files.
  • New tests in tests/test_analysis_data_api.py for a pruned sample (pending, claim, release, result, measurement ref).

Once an experiment is archived and its samples leave the lab, the live
sample is pruned. The analysis routes and the measurements POST only
looked at the live collection, so analysis results and SEM refs that
arrive after that point got a 404.

Fall back to the archived copy when the sample is no longer live.
@EmmaBrass
EmmaBrass merged commit c1e0be4 into CederGroupHub:main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants