Code Monkey home page Code Monkey logo

asteroid_hunter's Introduction

asteroid_hunter

Getting started

  • Clone this repo to your machine
  • Get a nasa api key here: https://api.nasa.gov/
  • Add your API_KEY to .env in the root file. ex: API_KEY=MY_KEY
  • If you are getting this error: ModuleNotFoundError: No module named 'dotenv', run sudo pip3 install python-dotenv. This means the dependency in the lockfile is not properly working

Running Tests

  • Run the test suite with pytest

Functions (Held in asteroid_tracker.py)

  • asteroid_closest_approach
    • Finds the closest approach out of all of Nasa's NEO data
    • How it works:
      • Gets every approach from each NEO and sorts by closest approach until there are no more pages left to retrieve. The first result is returned in json format.
  • month_closest_approaches(result_size, year, month)
    • Finds the closest N amount of approaches in a given month
    • How it works:
      • Gets every approach from each NEO in a given week and sorts by closest approach. Does this for each week in the month until the final week has been retrieved and sorted.
  • asteroid_closest_approaches(result_size = 10)
    • Finds the closest N amount of approaches out of all of Nasa's NEO data. Default result size is ten closest approaches
    • How it works:
      • Gets every approach from each NEO and sorts by closest approach until there are no more pages left to retrieve. The first N results are returned in json format.

Tradeoffs and considerations

  • Considered creating an asteroid class but I didn't think that efficiency in code would be improved by adding it. I think it would've made logic and data unraveling more approachable but might have taken away from performance.
  • Capped the nearest misses to 200 pages. While this isn't ideal it helped me write and debug code without having to worry too much about hitting the request limit. This also allowed me to delete and reload cassettes when needed.

Future iterations

  • Would love to implement some sort of caching. This would improve the runtime a lot and make the end user experience better.

asteroid_hunter's People

Contributors

lkriffell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.