Skip to content

Feature nwp 2117 sample files response#218

Merged
golharam merged 3 commits intomainfrom
feature-NWP-2117-sample-files-response
Apr 9, 2026
Merged

Feature nwp 2117 sample files response#218
golharam merged 3 commits intomainfrom
feature-NWP-2117-sample-files-response

Conversation

@accumb3ns
Copy link
Copy Markdown
Contributor

@accumb3ns accumb3ns commented Apr 9, 2026

the backend worker needs files for each sample to construct samplesheets. however, the GET samples endpoint only returned attributes, not associated files.

this PR modifies the route to include an optional ?includes=files querystring param which keeps the existing return format by default, but optionally returns a new public model with the full files + tags included to enable samplesheet generation.

vasques1 added 3 commits April 8, 2026 21:23
…blic models

New response models to support returning file metadata inline with samples:
- SampleFilePublic: compact file with uri and flat-dict tags
- SampleWithFilesPublic(SamplePublic): extends SamplePublic with files list
- SamplesWithFilesPublic: paginated wrapper for the files-enriched response

Needed by backend workers to construct samplesheets from sample file data.
- Add include query parameter (list of strings) to get_project_samples route
- When include contains 'files', use selectinload to eagerly load
  Sample -> FileSample -> File -> FileTag in a single query
- Build SampleFilePublic objects with flattened tags dict per sample
- Return SamplesWithFilesPublic when files requested, SamplesPublic otherwise
- Avoids N+1 API calls for backend workers that need file URIs and tags
- Assert existing test_get_samples_for_a_project_with_samples verifies
  no 'files' key present without ?include=files
- test_get_samples_include_files_with_tagged_files: R1/R2 FASTQs, flat tags
- test_get_samples_include_files_sample_with_no_files: files is null
- test_get_samples_include_files_with_untagged_files: tags is null
- test_get_samples_include_files_pagination_works: pagination correctness
- test_get_samples_include_files_mixed_samples: with and without files
@accumb3ns accumb3ns requested a review from golharam April 9, 2026 02:11
@golharam golharam merged commit e575cda into main Apr 9, 2026
2 checks 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