Skip to content

Make a compound unique key constraint in mongo for biosamples #1417

@aclum

Description

@aclum

Is your feature request related to a problem? Please describe.
on biosample set a compound key of name + associated-studies should be unique

Screenshots
If applicable, add screenshots to help explain your problem.

Describe the solution you'd like
This is to prevent duplicate sample names with a given study, see microbiomedata/nmdc-schema#2878

Example user story template:
AS A {user|persona|system},
[INSTEAD OF {current condition}]
I WANT TO {action} [IN {mode} TIME | IN {differentiating performance units} TO {utility performance units}]
[SO THAT {value or justification}]
[NO LATER THAN {best by date}]

Acceptance Criteria

  • Submissions to nmdc-runtime post endpoints that do not have a unique value for name + associated studies for biosample_set records return errors.
  • this should be true for new submissions (via json:submit) and through endpoints which modify records like queries:run and changesheets.

Example scenario-based template:
Given (some given context or precondition), when (I take this action), then (this will be the specific outcome).

Describe alternatives you've considered
Not enforcing this may lead to duplicate sample names in mongo which then requires subsequent cleanup.

Additional context

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions