Skip to content

Update models.py#139

Open
jacksonjacobs1 wants to merge 1 commit into
v2.0from
jacksonjacobs1-patch-1
Open

Update models.py#139
jacksonjacobs1 wants to merge 1 commit into
v2.0from
jacksonjacobs1-patch-1

Conversation

@jacksonjacobs1
Copy link
Copy Markdown
Collaborator

@jacksonjacobs1 jacksonjacobs1 commented May 21, 2026

Image names within a project should be unique.

  • This prevents collisions when existing annotations are uploaded and QA internally matches annotations to images by name.
  • It also prevents images from being uploaded twice by accident.

We should also consider implementing similar idempotent behavior for existing annotation uploads and tissue mask generation

  1. Only allow existing annotations to be uploaded to an image containing no annotations for a given annotation class
  2. Only allow tissue masks to be generated for images containing no tissue mask annotations

Image names within a project should be unique
@jacksonjacobs1 jacksonjacobs1 requested a review from Copilot May 21, 2026 16:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to enforce unique image names within a project at the database level to prevent collisions during annotation import/QA matching and accidental duplicate uploads.

Changes:

  • Add a (project_id, name) uniqueness constraint to the image table.
  • Minor formatting/indentation adjustment in get_model_column_names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

notifications = relationship("Notification", backref='image', lazy=True)

__table_args__ = (
UniqueConstraint('project_id', 'name', name='uq_image_project_name'),
Comment on lines +66 to +68
__table_args__ = (
UniqueConstraint('project_id', 'name', name='uq_image_project_name'),
)
Comment on lines 216 to +219
Returns:
List[str]: A list of column names.
"""
return [getattr(model, column.name) for column in model.__table__.columns] No newline at end of file
return [getattr(model, column.name) for column in model.__table__.columns]
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