Asteroid Radar is now a working web app
Turned my asteroid danger-ranking model into a live Streamlit app today. Recap of what it does: it pulls a week of NASA near-Earth-object data, normalizes size, speed, and miss-distance onto a 0–1 scale, and combines them into a weighted danger score. I weighted it size-heavy on purpose (0.4 size / 0.3 speed / 0.3 distance) — my reasoning is that a large impactor is the bigger threat even from farther out, so the biggest rock should outrank the closest one.
The app has three pieces:
A full table of all asteroids, sorted by danger.
A top-10 horizontal bar chart. Ran into a fun bug here — Plotly draws bars bottom-up, so my “most dangerous” chart rendered upside down with the scariest asteroid at the bottom. Reversed the data feeding the chart to flip it right.
A dropdown to pick any asteroid and see its full stats.
Biggest thing I learned: Streamlit re-runs your entire script on every interaction, so the NASA API call was firing on every click. Wrapped it in @st.cache_data so it fetches once and reuses the result — now the dropdown updates instantly instead of re-hitting the API every time.
Also cleaned up for shipping: moved my API key into Streamlit secrets (out of the committed code) and pushed a clean repo to GitHub.