Skip to content

Adds /landslide endpoint to API for use by the Kuti Landslide Risk Dashboard - #732

Merged
cstephen merged 10 commits into
mainfrom
kuti_update_db
Jul 13, 2026
Merged

Adds /landslide endpoint to API for use by the Kuti Landslide Risk Dashboard#732
cstephen merged 10 commits into
mainfrom
kuti_update_db

Conversation

@BobTorgerson

Copy link
Copy Markdown
Contributor

This PR adds the /landslide endpoint to the API for use by the Kuti Landslide Risk Dashboard. It queries the database holding the 12 hour forecast and returns the data in an ordered JSON. I have added documentation related to the landslide endpoint along with tests to highlight what happens when we get into various states of database or API unhappiness.

To run the /landslide route, you must enter the following environment variables:
DB_NAME, DB_HOST, DB_USER, DB_PASSWORD

All of those environment variables can be found in our Keeper under Landslide Database Read-Only User

For testing, there are only two places you can test currently, which matches the dashboard, Craig and Kasaan. To access them go to:
Craig
http://localhost:5000/landslide/AK91

Kasaan
http://localhost:5000/landslide/AK182

Let me know if you have any questions!

@BobTorgerson
BobTorgerson requested a review from cstephen July 13, 2026 20:47

@cstephen cstephen 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.

This looks good, generally! I kicked the tires on this a bit, tried both the Craig and Kasaan URLs and made sure they returned data. I also looked through the code diff to make sure it made sense. Some of the code related to community filtering has changed in this PR, so I made sure community filtering is still working as expected for other webapps (Arctic-EDS, Alaska Wildfire Explorer, Northern Climate Reports).

The only issues I noticed are that two of the pytest tests failed:

$ pytest tests/test_landslide.py
...
====================================================== short test summary info ======================================================
FAILED tests/test_landslide.py::test_landslide_ak91 - AssertionError: Missing required key: block_24hr
FAILED tests/test_landslide.py::test_landslide_ak182 - AssertionError: Missing required key: block_24hr
============================================== 2 failed, 6 passed, 7 warnings in 1.22s ==============================================

Looks like there is indeed no block_24hr in the data response, so I'm thinking maybe the two failed pytest tests are outdated?

The only thing I noticed is that the structure of expected data response shown in the API documentation doesn't match the actual API response. I'm thinking the documentation is just outdated?

Otherwise, this is looking great!

@cstephen
cstephen self-requested a review July 13, 2026 23:12

@cstephen cstephen 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.

False alarm! I was running the branch off a very old commit (from March) during my previous review. After pulling the latest commit, all pytests are working and the documentation matches the data response. Everything looks good!!

@cstephen
cstephen merged commit 20335f5 into main Jul 13, 2026
1 check failed
@cstephen
cstephen deleted the kuti_update_db branch July 13, 2026 23:13
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