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

make titiler tile endpoints consistent with tile cache service #169

Merged
merged 14 commits into from
Nov 1, 2024

Conversation

solomon-negusse
Copy link
Member

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Check the commit's or even all commits' message styles matches our requested structure.
  • [] Check your code additions will fail neither code linting checks nor unit test.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the new behavior?

Titiler endpoints use the same pattern as tile cache service

Does this introduce a breaking change?

  • Yes
  • No

Other information

@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 89.87342% with 8 lines in your changes missing coverage. Please review.

Project coverage is 80.29%. Comparing base (397763f) to head (a7ca04f).

Files with missing lines Patch % Lines
app/routes/titiler/umd_glad_dist_alerts.py 68.00% 8 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #169      +/-   ##
==========================================
+ Coverage   80.24%   80.29%   +0.05%     
==========================================
  Files          59       61       +2     
  Lines        1954     2005      +51     
==========================================
+ Hits         1568     1610      +42     
- Misses        386      395       +9     
Flag Coverage Δ
unittests 80.29% <89.87%> (+0.05%) ⬆️

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.

@solomon-negusse solomon-negusse requested review from gtempus, danscales, dmannarino and manukala6 and removed request for gtempus October 25, 2024 20:43
# tags=["Raster Tiles"],
# response_description="PNG Raster Tile",
# )
@router.get(
Copy link
Member Author

Choose a reason for hiding this comment

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

the /titiler endpoint for integrated alerts here is temporary to deploy this and test it without replacing the existing dynamic implementation. there is an item in the roadmap to fully implement this later.

Copy link
Contributor

@gtempus gtempus left a comment

Choose a reason for hiding this comment

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

@solomon-negusse and I walked through this together yesterday. I'm fine with the temporary titiler implementation. Moving away from the auto-magic titiler endpoints is worth it, even though it's a little more work. The URLs are much cleaner 🧹

Thanks, Solomon! 💪

Copy link
Contributor

@danscales danscales left a comment

Choose a reason for hiding this comment

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

Just a few comments/suggested improvements, but otherwise looks good.

start_date: Optional[str] = None
end_date: Optional[str] = None
alert_confidence: Optional[str] = None
render_type: Optional[RenderType] = RenderType.true_color
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't render_type just be RenderType - not Optional[RenderType]. You've given it a default value, and it really should be true_color or encoded, not None, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, thanks.

app/main.py Outdated
@@ -42,6 +42,8 @@
from .routes import preview

from .routes.titiler import routes as titiler_routes
from .routes.titiler.integrated_alerts import router as alerts_router
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor: Maybe rename "alerts_router" to "integrated_alerts_router" for consistency with next line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


_versions = get_versions(dataset, TileCacheType.cog)
for _version in _versions:
extend_enum(GfwIntegratdAlertsVersions, _version, _version)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add comments on what GfwIntegratedAlertsVersions() is for? I don't see it used anywhere, so then it seems like a lot of work to create an enum with all the integrated alerts versions going back for several years.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added back the use of that enum in the view function which will show to the user the available valid versions to use.

tags=["Raster Tiles"],
response_description="PNG Raster Tile",
)
async def glad_dist_alerts_raster_tile(
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should get rid of glad_ here and in the name of the file? So file name is just umd_dist_alerts.py and name here is dist_alerts_raster_tile. Would be more parallel with integrated_alerts. Also, including glad may confuse with the glad-L and glad-S2 alerts.

Copy link
Member Author

Choose a reason for hiding this comment

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

i added gfw_ prefix to integrated alerts. {org}_optional{group} prefix is used consistently in other route files. GLAD is just the name of the UMD research group.

@danscales
Copy link
Contributor

Your new changes in response to some of my comments look good. I guess you just have to figure out the test failure, then you can merge the PR.

@solomon-negusse solomon-negusse merged commit bc349c0 into dev Nov 1, 2024
4 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.

4 participants