Skip to content

Add v4 property column stats API#5262

Open
nllong wants to merge 11 commits into
developfrom
add-v4-property-api
Open

Add v4 property column stats API#5262
nllong wants to merge 11 commits into
developfrom
add-v4-property-api

Conversation

@nllong

@nllong nllong commented Jul 8, 2026

Copy link
Copy Markdown
Member

Any background context you want to provide?

Inventory has a summary page which showed the count of entries in each field. More stats would be useful to really understand what data are in a SEED org's inventory.

What's this PR do?

  • remove v4/analyses which wasn't related to analysis, but was analyzing the data in the inventory.
  • created new column_summary endpoint on the v4 property endpoint

This PR currently includes updated from the fix-migrations PR #5261

How should this be manually tested?

Launch with SEED-platform/seed-angular#70 and go to inventory summary.

What are the relevant tickets?

Screenshots (if appropriate)

nllong and others added 9 commits July 7, 2026 07:26
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 replaces the v4 analyses stats endpoint with a new v4 properties/column_summary endpoint that returns richer per-column inventory statistics (including numeric aggregates, distribution stats, and unit metadata), and incorporates the referenced migration/order-determinism fixes.

Changes:

  • Removed v4/analyses and added v4/properties with a new column_summary action for column-level stats (including optional raw data).
  • Added deterministic tie-break ordering (id) to several “latest/ordered” queries to prevent nondeterministic results on timestamp ties.
  • Added/updated repair migrations to restore missing PK/unique constraints for production DBs; updated Angular static-file serving fallback paths.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
seed/views/v4/taxlot_properties.py Adds license header.
seed/views/v4/property.py New v4 properties API with column_summary stats endpoint.
seed/views/v4/organization_users.py Adds license header.
seed/views/v4/analyses.py Removes old v4 analyses stats endpoint.
seed/api/v4/urls.py Removes analyses route; registers properties route.
seed/tests/v4/test_analyses_views.py Updates v4 tests to cover properties-column-summary behavior.
seed/views/v3/properties.py Makes “latest file” selection deterministic on created ties.
seed/views/v3/events.py Makes event ordering deterministic on created ties.
seed/utils/tax_lot_properties.py Makes note ordering deterministic on created ties.
seed/utils/public.py Makes public feed ordering deterministic on updated ties.
seed/utils/match.py Makes match-merge ordering deterministic on updated ties.
seed/models/properties.py Makes audit-log selection deterministic (but still needs a None-guard fix).
seed/models/tax_lots.py Makes audit-log selection deterministic (but still needs a None-guard fix).
seed/models/certification.py Makes “previous log” selection deterministic on created ties.
seed/migrations/0250_remove_goal_current_cycle_goal_partner_note_and_more.py Adds guarded constraint-repair SQL before existing operations.
seed/migrations/0254_repair_referenced_primary_keys.py Adds follow-up guarded constraint-repair migration for already-migrated DBs.
seed/lib/superperms/orgs/migrations/0046_repair_organizationuser_constraints.py Adds guarded constraint-repair migration in orgs app.
ng_seed/views.py Adjusts Angular static-file serving to check additional build output paths (needs path traversal hardening).
.spelling.dic Adds new dictionary entries (one appears to include an unintended trailing quote).

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

Comment thread ng_seed/views.py
Comment thread seed/models/properties.py
Comment thread seed/models/tax_lots.py
Comment thread seed/views/v4/property.py
Comment on lines +672 to +674
for selected_cycle_id in selected_cycle_ids:
property_views_qs = _build_property_views_queryset(org_id, self.request.access_level_instance_id, [selected_cycle_id])
state_ids = list(property_views_qs.values_list("state_id", flat=True))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in commit where _build_property_views_queryset now accepts an AccessLevelInstance object directly (instead of fetching by ID), and the instance is fetched once before the cycle loop in column_summary.

Comment thread .spelling.dic Outdated
@nllong nllong added the Enhancement Add this label if functionality was generally improved but not a full feature or maintentance. label Jul 8, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot finished work on behalf of nllong July 8, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Add this label if functionality was generally improved but not a full feature or maintentance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants