sachitcode / fastpages-sachit-blog

Apache License 2.0
0 stars 1 forks source link

Week 21 Hacks #15

Open sachitcode opened 1 year ago

sachitcode commented 1 year ago

Big Ideas 5.3 and 5.4

Tangible Artifact:

Backend: My feature uses 2 apis (one to convert a city’s name to its latitude and longitude coordinates and the other to use the latitude and longitude coordinates to find the nearest airport). With the first API, I needed to parse the data for the latitude and longitude values for the city the user inputed. With these latitude and logitude values I would concatenate them to get the link for the second API (which is depended on the latitude and longitude values). With this, the second API would return information about the nearest airport to the city inputed by the user. After parsing for the name, this value is then outputted to the user. Also, some of the airport names had the name of city before the name of the airport, so I had to make a code segment that removed this if the it's present.

Frontend: For the frontend, I first tried to make a new page, but I wasn't able to figure out how to do this. Later, I tried repurposing an existing page for my feature. I wasn't sure how to include python code in an html file, so I searched it up and learned about something called "pyscript". This allows you to include python code in an html file. Right now, the frontend for my project is not complete because I'm still not sure about how to incorporate pyscript. Figuring this out will probably be one of my main focuses for this week.

Backend Code:

Screenshot 2023-02-06 at 1 40 13 PM

Code Output (Paris Example):

Screenshot 2023-02-06 at 2 01 13 PM

Frontend Model:

Screenshot 2023-02-06 at 2 19 44 PM

Frontend Model (Paris Example):

Screenshot 2023-02-06 at 2 23 53 PM

Frontend Model Description: The page is titled "Nearest Airport". The name of the city that the user wants to visit is inputed by the user. The nearest airport to the city is outputed to the user.