Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SQLite joins should be on ImageNumber,TableNumber and not ImageNumber #378

Merged
merged 5 commits into from
Mar 23, 2024

Conversation

shntnu
Copy link
Member

@shntnu shntnu commented Mar 22, 2024

Description

I had introduced a new cyto_tool (cell_locations) in #257.
I had missed a crucial aspect of the way the SQLite files are created.
As described in cytomining/CytoTable#30, ImageNumber is guaranteed to be unique only within an Image.csv but not across all Image.csv files in a dataset. This means that any join between compartment tables and the Image table must be on both, ImageNumber and TableNumber but I was only joining on ImageNumber.

Why didn't this fail before? Because I was also creating the test fixtures without TableNumber, and this still would work because the majority but not all SQLite files do have unique ImageNumbers.

I have now fixed

  • Test fixtures
  • Code to create test fixtures
  • Tests
  • Join logic

What is the nature of your change?

  • Bug fix (fixes an issue).

Checklist

Please ensure that all boxes are checked before indicating that a pull request is ready for review.

  • I have read the CONTRIBUTING.md guidelines. Sorry for not following the fork-branch -- will do in future.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have deleted all non-relevant text in this pull request template.

@codecov-commenter
Copy link

codecov-commenter commented Mar 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.96%. Comparing base (9dd98ac) to head (5fa1930).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #378   +/-   ##
=======================================
  Coverage   94.96%   94.96%           
=======================================
  Files          56       56           
  Lines        3136     3137    +1     
=======================================
+ Hits         2978     2979    +1     
  Misses        158      158           
Flag Coverage Δ
unittests 94.96% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shntnu shntnu marked this pull request as ready for review March 23, 2024 11:46
@shntnu shntnu changed the title Join in ImageNumber,TableNumber SQLite joins should be on ImageNumber,TableNumber and not ImageNumber Mar 23, 2024
Copy link
Member

@kenibrewer kenibrewer left a comment

Choose a reason for hiding this comment

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

This looks good to me. Great discovery and the clean modification to the existing tests.

@kenibrewer kenibrewer changed the title SQLite joins should be on ImageNumber,TableNumber and not ImageNumber fix: SQLite joins should be on ImageNumber,TableNumber and not ImageNumber Mar 23, 2024
@kenibrewer kenibrewer merged commit af5a4ef into main Mar 23, 2024
11 checks passed
@kenibrewer kenibrewer deleted the cell_loc_tablenumber branch March 23, 2024 13:21
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.

3 participants