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

Preserve points feature_key in queries #794

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

quentinblampey
Copy link
Contributor

@quentinblampey quentinblampey commented Nov 25, 2024

In bounding_box/polygon queries, the "feature_key" of points was not preserved.

  • preserve feature_key in bounding_box
  • preserve feature_key in polygon
  • tests added

While fixing that, I also found (and fixed) a minor issue in the PointsModel.parse method when passing feature_key. Indeed, if corresponding column is already a category, it is dropped from the dataframe, see the line below:

if feature_key is not None and data[feature_key].dtype.name != "category":
    table[feature_key] = data[feature_key].astype(str).astype("category")

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.80%. Comparing base (94f0a31) to head (d2be524).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #794   +/-   ##
=======================================
  Coverage   91.80%   91.80%           
=======================================
  Files          45       45           
  Lines        6954     6959    +5     
=======================================
+ Hits         6384     6389    +5     
  Misses        570      570           
Files with missing lines Coverage Δ
src/spatialdata/_core/query/spatial_query.py 95.50% <100.00%> (+0.03%) ⬆️
src/spatialdata/models/_utils.py 90.41% <ø> (ø)
src/spatialdata/models/models.py 87.84% <100.00%> (+0.05%) ⬆️
---- 🚨 Try these New Features:

@LucaMarconato LucaMarconato enabled auto-merge (squash) November 25, 2024 17:52
@LucaMarconato
Copy link
Member

Looks great to me thanks! Fixing the docs and then merging.

@LucaMarconato LucaMarconato merged commit 93615b2 into scverse:main Nov 25, 2024
8 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