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

remove unnecessary spatial calculations when processing feature specifications [MRXN23-602] #1658

Conversation

hotzevzl
Copy link
Member

@hotzevzl hotzevzl commented Mar 8, 2024

Remove leftover spatial queries that get executed on the tail end of the processing of feature specifications.

In practice, this query was used to calculate which features are present in each PU, and to set (geodb)scenarios_pu_data.feature_list which is then used in turn by the code that generates tiles for the scenario (so that binary view of features at scenario level can be rendered in scenario maps).

There's no need for an expensive spatial query here, though - given the list of features in a scenario, rendering them in binary view can be handled by either:

  • using the project-level endpoint for tiles of individual features - these include amount data, which could be ignored to obtain a plain presence/absence view (but will require changes to the frontend app)
  • compiling this same data from plain tabular data in feature_amounts_per_pu combined with the list of features active in a given scenario (will require no changes to frontend app)

Designs

N/A

Testing instructions

Run scenario feature specifications for a mildly complex project (~20 features, some thousand of regular PUs) - this should complete in seconds, not in hours (or take so long that the stale jobs reaper will eventually consider this as failed).

Feature relevant tickets

https://vizzuality.atlassian.net/browse/MRXN23-602


Checklist before submitting

  • Meaningful commits and code rebased on develop.
  • If this PR adds feature that should be tested for regressions when
    deploying to staging/production, please add brief testing instructions
    to the deploy checklist (docs/deployment-checklist.md)
  • Update CHANGELOG file

hotzevzl added 2 commits March 8, 2024 11:38
The rest of the flow is still needed to finish triggering completion
events, until we refactor this more cleanly.
Copy link

vercel bot commented Mar 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
marxan ✅ Ready (Inspect) Visit Preview Mar 8, 2024 11:47am

@hotzevzl hotzevzl self-assigned this Mar 8, 2024
@hotzevzl hotzevzl marked this pull request as ready for review March 8, 2024 11:47
@hotzevzl hotzevzl merged commit f261c38 into develop Mar 8, 2024
11 checks passed
@hotzevzl hotzevzl deleted the fix/api/MRXN23-602_remove-unnecessary-spatial-calculations-when-processing-feature-specifications branch March 8, 2024 11:47
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.

1 participant