SSWSpencer / NASA-APOD-v2

In the past I did a project for my school utilizing NASA's APOD API. This is a project I made over a period of a few days in a better-styled and more-responsive way, with a few added features.

Home Page:nasa-apod-v2.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NASA's Atronomy Photo of the Day

This is a few-day project I made based on a previous project I had to do for school. For school, I basically had to create a webpage that would fetch data from NASA's APOD API and display it to the browser. In this project, over a year after doing it for school, I expanded on the premise and added some extra functionality.

In the first version, it was very cut-and-dry. It made a call to the API, stored the response in local state, and displayed the image alongside its title, date, and description.

In this version, I created a redux store to hold the information of the past two weeks' of photos, and display them in a carousel. There is also the option to select a specific date (for example, one's birthday), and the application will automatically display that day's photo instead. Above all, and the feature I am most proud of, is the search function, which allows the user to filter through over 9,540 entries posted by NASA since June 16, 1995 (a feature that is not directly supported by the API). This is probably not the most well-implemented feature due to the fact that it requires manual updating to keep the records up-to-date, but it was done by copy/pasting the entire archive from NASA's website (https://apod.nasa.gov/apod/archivepixFull.html) into the file ArchiveList.txt. Then I created the Python file, APODArchiveToJson.py to scan through the entire text document, and convert the text-based strings to json data. The generated json file is imported into Search.js, and the results are filtered and returned based on what a user searches for. On top of that, each search result includes a link to the original photo on NASA's website. This was made possible by the format of NASA's links to their pictures, such as https://apod.nasa.gov/apod/ap210728.html. Towards the end of the link, following /apod/ap and before .html, there is a 6 digit number, which is just the date of the picture in YY-MM-DD format. So given the exact date of a specific photo, one is able to splice the year into two digits, convert the alphabetical month into a two-digit number, and add on the day as a two-digit number, and get the link to that picutre. So while this is an imperfect way of creating a pseudo-search engine, it works well in its current state, and should work all the way up until NASA starts changing the format of their links (Which will likely be some time around the end of 2094, when they realize there's a finite number of dates that can be represented with only 6 numbers. But let's hope that by then you (the person reading this) and I are already retired, and don't have to worry about it!)

About

In the past I did a project for my school utilizing NASA's APOD API. This is a project I made over a period of a few days in a better-styled and more-responsive way, with a few added features.

nasa-apod-v2.vercel.app


Languages

Language:JavaScript 52.0%Language:CSS 31.6%Language:Python 9.1%Language:HTML 7.4%