Skip to content

Feat: update geometry logic on community stat api#259

Merged
susilnem merged 3 commits into
developfrom
feature/update-community-stat-logic
Jun 15, 2026
Merged

Feat: update geometry logic on community stat api#259
susilnem merged 3 commits into
developfrom
feature/update-community-stat-logic

Conversation

@susilnem

@susilnem susilnem commented Jun 2, 2026

Copy link
Copy Markdown
Member

Changes

  • Update the project update fields
  • add new migration file to backfill geometry metadata from project GEOMETRY model.

Findings

Checked on the MapSwipe Backend Alpha 2 instance.

Projects with both centroid and aoi_geometry set to NULL

from django.db.models import Count

Project.objects.filter(
    centroid__isnull=True,
    aoi_geometry__isnull=True,
).values(
    "project_type",
).annotate(
    count=Count("id"),
).order_by("project_type")

Result:

[
    {'project_type': ProjectTypeEnum.FIND, 'count': 8},
    {'project_type': ProjectTypeEnum.VALIDATE, 'count': 21},
    {'project_type': ProjectTypeEnum.COMPARE, 'count': 1},
    {'project_type': ProjectTypeEnum.COMPLETENESS, 'count': 2},
    {'project_type': ProjectTypeEnum.STREET, 'count': 2},
    {'project_type': ProjectTypeEnum.VALIDATE_IMAGE, 'count': 19},
]

A total of 53 projects currently have both centroid and aoi_geometry set to NULL.

Project.objects.filter(
    centroid__isnull=True,
    aoi_geometry__isnull=True,
).count()

# 53

Projects with a populated centroid but missing aoi_geometry

Project.objects.filter(
    centroid__isnull=False,
    aoi_geometry__isnull=True,
).count()

# 0

There are no projects where the project-level centroid is populated while aoi_geometry is missing. In other words, whenever a project has a centroid value, it also has an associated aoi_geometry.

This PR doesn't introduce any:

  • temporary files, auto-generated files or secret keys
  • n+1 queries
  • flake8 issues
  • print
  • typos
  • unwanted comments

This PR contains valid:

  • tests
  • permission checks (tests here too)
  • translations

@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.60%. Comparing base (9796476) to head (b6dee48).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
apps/project/serializers.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #259      +/-   ##
===========================================
- Coverage    87.60%   87.60%   -0.01%     
===========================================
  Files          211      211              
  Lines        12792    12793       +1     
  Branches      1084     1084              
===========================================
  Hits         11207    11207              
- Misses        1188     1189       +1     
  Partials       397      397              

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

@susilnem susilnem linked an issue Jun 2, 2026 that may be closed by this pull request
@susilnem susilnem requested a review from tnagorra June 2, 2026 09:46
@susilnem susilnem force-pushed the feature/update-community-stat-logic branch 4 times, most recently from 03a037c to 6f1c798 Compare June 9, 2026 03:16
tnagorra
tnagorra previously approved these changes Jun 11, 2026
@susilnem susilnem force-pushed the feature/update-community-stat-logic branch from 6f1c798 to b6dee48 Compare June 11, 2026 10:34
@susilnem susilnem merged commit aafd5a4 into develop Jun 15, 2026
4 of 6 checks passed
@susilnem susilnem deleted the feature/update-community-stat-logic branch June 15, 2026 09:27
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.

User Group HeatMap

2 participants