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

Implementation and tests for TPI stats endpoints #3838

Merged
merged 8 commits into from
Aug 13, 2024
Merged

Conversation

conbrad
Copy link
Collaborator

@conbrad conbrad commented Aug 12, 2024

  • Adds TPI stats endpoint that returns the (assumed) single record for TPI stats for a specific run time and run parameters
    • Since TPI stats are counts of cells that hit HFI > 4k for each classification, this is returned as an area, count * pixel size in metres
  • Adds tests for authenticated and unauthenticated endpoint calls
  • Removes unnecessary mock JWT with roles in test suite

Test Links:

Landing Page
MoreCast
Percentile Calculator
C-Haines
FireBat
FireBat bookmark
Auto Spatial Advisory (ASA)
HFI Calculator

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.

Project coverage is 79.47%. Comparing base (7e055ba) to head (a8517bc).

Files Patch % Lines
api/app/routers/fba.py 78.26% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3838       /-   ##
==========================================
  Coverage   79.31%   79.47%    0.15%     
==========================================
  Files         295      295              
  Lines       10874    10887       13     
  Branches      518      518              
==========================================
  Hits         8625     8652       27     
  Misses       2105     2091      -14     
  Partials      144      144              

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

stats = await get_zonal_tpi_stats(session, fire_zone_id, run_type, run_datetime, for_date)
return FireZoneTPIStats(
fire_zone_id=fire_zone_id,
valley_bottom=stats.valley_bottom * stats.pixel_size_metres,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is pixel size stored as area? Or a 1-D length? If the latter, then we might want to square the pixel size.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ultimately it might not matter as we're just displaying percentages in the frontend, not absolute values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right it's 1-D length, I'll square it. Otherwise it may be confusing in the future / if another consumer uses the endpoint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in: a8517bc

Copy link

sonarcloud bot commented Aug 13, 2024

Copy link
Collaborator

@brettedw brettedw left a comment

Choose a reason for hiding this comment

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

Looks great!

@conbrad conbrad temporarily deployed to production August 13, 2024 16:27 Inactive
@conbrad conbrad merged commit aca5a2a into main Aug 13, 2024
28 checks passed
@conbrad conbrad deleted the task/tpi-stats-endpoint branch August 13, 2024 16:39
dgboss pushed a commit that referenced this pull request Aug 14, 2024
- Adds TPI stats endpoint that returns the (assumed) single record for TPI stats for a specific run time and run parameters
    - Since TPI stats are counts of cells that hit HFI > 4k for each classification, this is returned as an area, count * pixel size in metres
- Adds tests for authenticated and unauthenticated endpoint calls
- Removes unnecessary mock JWT with roles in test suite
vanislekahuna pushed a commit to vanislekahuna/wps that referenced this pull request Sep 19, 2024
- Adds TPI stats endpoint that returns the (assumed) single record for TPI stats for a specific run time and run parameters
    - Since TPI stats are counts of cells that hit HFI > 4k for each classification, this is returned as an area, count * pixel size in metres
- Adds tests for authenticated and unauthenticated endpoint calls
- Removes unnecessary mock JWT with roles in test suite
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.

3 participants