I was scrolling through Instagram the other day and stumbled on a reel.

The creator was listing "APIs you shouldn't miss," and the very first one? NASA.

I paused. NASA. Space. Data.
That was enough to pull me down a rabbit hole.

I dug into their NeoWs API and before I knew it, I had an idea: why not make a dashboard that tracks near-Earth asteroids, highlights risks, and makes sense of all this space data?

What started as a casual scrolling session turned into a full-on data science and analysis project.

Check out the project for yourself: https://astroscope.streamlit.app/
GitHub repository: https://github.com/ArjunCodess/astroscope

Here is a quick demo of the dashboard:

Some screenshots:

Image

Image

Image Image

Breaking It Down

Step 1: Planning What I Wanted

Before writing a single line of code, I had to figure out what this project should actually do:

  • Fetch real asteroid data from NASA.
  • Show size, speed, and how close each asteroid comes to Earth.
  • Highlight which asteroids might be risky.
  • Visualise everything in charts and tables, not walls of JSON.
  • Make it smooth enough to work on both desktop and mobile.

That gave me a blueprint for tools, features, and project structure.


Step 2: Pulling Data from NASA's NeoWs API

NeoWs is powerful, but it has limits.
You can only fetch up to 7 days of data at a time.

So I had to:

  • Break the total range (like 30 days) into 7-day chunks.
  • Call the API for each chunk sequentially.
  • Save all the results locally so I wouldn't keep hammering NASA’s servers.

This was all handled in data_fetcher.py using Python's requests library.
I added retries and error handling because API calls fail, always.


Step 3: Cleaning Up NASA’s Raw Data

NASA sends massive JSON files, and most of it is noise.
I needed only the essentials:

  • ID, name, size
  • Approach date
  • Velocity
  • Miss distance
  • Hazard flag

I wrote data_processing.py to flatten everything into neat tables. pandas handled the heavy lifting.
I also converted units (like velocity into km/h) and saved the cleaned data as CSVs for faster loading later.


Step 4: Making Sense of It

Once the data was clean, I wanted to give it meaning. In analysis.py, I built a risk scoring system:

  • A risk score combining size, speed, and distance.
  • A threshold (0.6 by default) for high-risk asteroids.
  • Time series to show how risk changes over days.
  • Rankings for “closest approach” days.

This let me highlight outliers, giant rocks flying closer than usual.
pandas made all of this easy.


Step 5: Building the Dashboard

I used Streamlit because it lets you build web apps in Python without the headache of traditional frameworks.

Here’s what I added:

  • Date picker and risk slider for filtering.
  • GitHub-style heatmap showing average daily risk scores (brighter = scarier).
  • Top-10 closest approaches table with details.
  • Charts for asteroid sizes, speeds, and risk distributions.
  • Responsive layout for phones and laptops.

I also used plotly to make the graphs interactive and visually appealing.


Step 6: Configuration and Setup

I kept the app flexible with a .env file:

NASA_API_KEY=""
DATA_FETCH_DAYS=30
DATA_DIR="data"
API_CHUNK_SIZE=7
RISK_THRESHOLD=0.6
Enter fullscreen mode Exit fullscreen mode

This keeps sensitive info like the API key safe and allows easy changes to the project's parameters.


Step 7: Putting Everything Together

When you run the app:

  1. It checks if the data for the chosen days is already saved.
  2. If not, it fetches it from NASA.
  3. Then it processes and analyses the data.
  4. Finally, it serves the dashboard.

I also made it possible to run individual steps separately for debugging and testing.

Here's a high-level flow of how the app works:

Image


Final Thoughts

It's crazy how a 15-second reel led me to a full-fledged data project.

This dashboard is my little window to the space.
It's not perfect, but it works, it's extendable, and it's fun to explore.

If you're a coder or just a space nerd, try building your own.
Start small, play with real data, then push it further.
The universe is massive, unpredictable, and full of surprises.

Thanks for reading!