Feature nwp 2117 sample file creation#219
Merged
golharam merged 3 commits intofeature-NWP-2117-sample-files-responsefrom Apr 9, 2026
Merged
Feature nwp 2117 sample file creation#219golharam merged 3 commits intofeature-NWP-2117-sample-files-responsefrom
golharam merged 3 commits intofeature-NWP-2117-sample-files-responsefrom
Conversation
added 3 commits
April 8, 2026 22:22
…on models - Add SampleFileInput: lightweight file input for inline file creation during sample creation (uri, tags, hashes, role, source, etc.) - Add optional 'files' field to SampleCreate for both single and bulk endpoints - Add files_created and files_skipped counters to BulkSampleItemResponse and BulkSampleCreateResponse for file creation reporting
…into both sample creation endpoints - _create_sample_files(): shared helper creating File, FileProject, FileSample, FileHash, FileTag records within the caller's transaction - Hash-aware dedup: if URI already linked to sample and hashes match (or no hashes provided), skip; if hashes differ, create new version - bulk_create_samples(): calls helper per sample, accumulates file counts - add_sample_to_project(): calls helper when sample_in.files is present
- TestBulkSampleWithFiles: happy path, idempotent resubmission (no hashes and matching hashes), hash mismatch creating new version, mixed samples with/without files, backward compatibility - TestSingleSampleWithFiles: single sample with files, file dedup, backward compatibility without files
b56459c
into
feature-NWP-2117-sample-files-response
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When parsing a manifest, we want to be able to atomically create a sample record with its associated files. This PR extends the single- and bulk- sample creation endpoints to allow submission of file records at the same time.
Importantly - we don't want to create duplicate records if the sample/file association already exists (eg a new manifest containing existing sample records) so we compare hashes first if available.