Skip to content

Assemble worksheets (layout + QC analyses) through the API - #105

Open
ramonski wants to merge 2 commits into
feature/fix-ar-analyses-uid-listfrom
feature/worksheet-assembly
Open

Assemble worksheets (layout + QC analyses) through the API#105
ramonski wants to merge 2 commits into
feature/fix-ar-analyses-uid-listfrom
feature/worksheet-assembly

Conversation

@ramonski

Copy link
Copy Markdown
Contributor

Description

Setting a Worksheet's analyses field through the API only writes the back reference. The worksheet keeps its slot/position information in a separate Layout field (the analyses field is documented as "used for back references"), and the results view (manage_results) renders from Layout. So a worksheet assembled by plain field setting looks empty in the UI even though its analyses are catalog-linked. Only Worksheet.addAnalyses -> addAnalysis -> addToLayout builds the layout, and the API never called it. QC analyses (reference and duplicate) are likewise created only through addReferenceAnalyses / addDuplicateAnalyses, which were unreachable through the API.

This PR adds an IUpdate adapter for IWorksheet that routes assembly through the worksheet's own methods. It covers both create and update, because non-delegated creation builds a minimal (open) object and then applies the record via update_object_with_data, which uses this adapter. Every non-assembly key is still applied through the regular field managers; validation, any transition and reindex happen in the caller as before.

Recognised keys (all optional):

  • analyses: list of routine analysis UIDs (or {"uid": ...}) -> addAnalyses
  • reference_analyses: list of {"reference_uid": <ReferenceSample>, "services": [<uid>, ...], "slot": <int>} -> addReferenceAnalyses
  • duplicate_analyses: list of {"src_slot": <int>, "dest_slot": <int>} -> addDuplicateAnalyses

Current behavior before PR

A worksheet created/updated via the API with an analyses list has no Layout, so manage_results shows no analyses; QC (reference/duplicate) analyses cannot be created at all.

Desired behavior after PR is merged

The analyses list is routed through addAnalyses, building the layout so the worksheet renders correctly, and QC reference/duplicate analyses can be added through the API.

Stacked on #104.

@ramonski
ramonski requested a review from xispa July 27, 2026 13:59
@ramonski ramonski added the Enhancement ✨ Improvement to existing functionality label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement ✨ Improvement to existing functionality

Development

Successfully merging this pull request may close these issues.

1 participant