HFI Calc: Stations missing in WFWX cause major issues for us
- Dominant language
- Python
- Stars
- 65
- Forks
- 11
- Avg merge
- 21h 25m
- Merged PRs (30d)
- 70
Description
**Describe the Bug**
We need better error handling for when a station is completely unavailable in WFWX (i.e., searching for the station by its station code returns no data).
**Expected Behaviour**
- check with @tessmgood - what should front end look like when a planning station no longer exists in WFWX?
**Actual Behaviour**
If there's a station assigned to a planning area in our `planning_weather_stations` DB table, but that station no longer exists in WFWX, it either may or does cause problems in our HFI Calc UI.
This happened already for station code 149 (Bear Lake) in PGFC, Prince George Zone. We made an emergency fix by simply deleting station 149 from `planning_weather_stations`, but we want to avoid this potentially happening again.
Example: there were 4 stations assigned to Prince George Zone in our DB, but only 3 of those stations could be found in WFWX, so only those 3 stations were being displayed in our UI. All 3 of those stations had weather data available, so HFI Calc should've calculated M/FIG, Prep Level, etc. for the zone, but instead it was displaying an error icon, because it was expecting 4 stations' of data, not only 3. This made HFI Calc unuseable for PGFC.
API logs (locally and in prod) show that there are already other stations in `planning_weather_stations` that aren't available in WFWX anymore. NWFC: station 157 (SMITHERS API (EC) - Bulkley Zone) & 103 (TERRACE (EC) - Skeena Zone). PGFC: station 122 (CHETWYND (EC) - Dawson Creek Zone). At the moment they don't appear to be causing critical errors in HFI Calc.
** Steps To Reproduce**
Steps to reproduce the behaviour:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start by reproducing the HFI Calc failure using the planning_weather_stations records for station codes 149, 157, 103, and 122, then trace the WFWX lookup and the calculation's expected station count. Confirm with @tessmgood what the front end should show when a station is missing. Done means unavailable stations no longer break valid calculations and the UI behavior is defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- backend, databases, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100