AstroScope is an interactive dashboard that visualizes near-Earth asteroid data from NASA's NeoWs API. It provides insights into asteroid sizes, velocities, miss distances, and potential hazards.
- Data Fetching: Automatically fetches asteroid data from NASA's NeoWs API
- Data Analysis: Calculates risk scores, identifies anomalies, and generates time series data
- Interactive Dashboard: Visualizes asteroid data with interactive charts and tables
- Filtering: Filter data by date range and risk threshold
- Risk Heatmap Calendar: GitHub-style calendar heatmap of daily average risk scores
- Daily Closest Miss Table: Ranks the top 10 dates by the closest asteroid approach, with details per day
- Responsive Design: Works on desktop and mobile devices
- Python 3.7 or higher
- NASA API key (get one at https://api.nasa.gov)
- Go to https://api.nasa.gov.
- In the "Generate API Key" form, fill in the required fields:
- First Name (required)
- Last Name (required)
- Email (required)
- How will you use the APIs? (optional)
- Submit the form and check your email to receive your API key.
- Add the key to your
.env
file:NASA_API_KEY="YOUR_KEY_HERE"
-
Clone the repository:
git clone https://github.com/ArjunCodess/astroscope.git cd astroscope
-
Install dependencies:
pip install -r requirements.txt
-
Duplicate the
.env.example
file to create a.env
file in the project root directory and update theNASA_API_KEY
with your own key:NASA_API_KEY=""
The application can be configured using environment variables in the .env
file:
NASA_API_KEY
: Your NASA API key (required)DATA_FETCH_DAYS
: Number of days to fetch asteroid data for (default: 30)DATA_DIR
: Directory to store data files (default: "data")API_CHUNK_SIZE
: Maximum number of days per API request (default: 7, NASA API limit)RISK_THRESHOLD
: Threshold for classifying asteroids as high risk (default: 0.6)
Start the Streamlit dashboard with a single command:
python -m streamlit run app.py
The dashboard will be available at http://localhost:8501.
The application will automatically:
- Check if data files exist
- If not, fetch asteroid data from NASA's NeoWs API
- Process the raw data into a clean format
- Analyze the data to calculate risk scores and generate time series data
- Display the interactive dashboard
- Includes a "Daily Closest Miss" table showing the closest approach per day and ranking the top 10 dates by proximity
Note: You can still run the data pipeline steps separately if needed:
python -m lib.data_fetcher
- Fetch data onlypython -m lib.data_processing
- Process data onlypython -m lib.analysis
- Analyze data only
app.py
: Main Streamlit applicationlib/
: Library modulesdata_fetcher.py
: Fetches data from NASA's NeoWs APIdata_processing.py
: Processes raw data into clean formatanalysis.py
: Analyzes data and calculates risk scoresvisualizer.py
: Creates visualizations for the dashboard
data/
: Data directory (created automatically)docs/
: DocumentationPRD.md
: Product Requirements Document
This project is licensed under the MIT License - see the LICENSE file for details.