Giter Site home page Giter Site logo

week3-taaa's Introduction

TEAM TAAA

WHY

We wanted to make an app which makes a second API call to generate multiple points of interests from the result of the first API call. Tube stations are a wealth of information for this.

User Stories

  • The user should to begin with a simplistic form allowing them to enter a tube journey. On clicking submit, a new section should appear showing the journey rendered as resources from the internet.
  • The app should have minimal load delay. since it it a relatively simple site, we expect the load delay to be due to the speed and order of API calls.
  • The results section should make sense and be easy to read as separate elements, whether it consists of few elements or many.
  • Entering and submitting the user's data should be as painless as possible, with any potential for error or ambiguity at this stage having been designed out.

WHAT

The user enters a tube journey via a pair of drop-downs and clicks submit.

The site fetches results and updates the DOM with a new section below. Each section corresponds to each station which the user passes and contains the station name, a youtube thumbnail and video title which both link to a youtube video somehow related to that part of London.

check out how it functions here

HOW - the journey

We first tried to connect to spotify to get links to music for each station. Spotify has an interface to simulate API queries which provides album covers and preview clips of songs. But spotify are all, like, we want your soul if you use our API. So it's youtube for teh win!

The TFL API is badly documented and has an annoying feature that reroutes queries to 'disambiguation' when the query is 'ambiguous' like 'Bank station to Westminster station'. The JSON reponses are also daunting-looking at first.

Some research confirmed that an alternative is available for sanitised input, using TFL's own ICS station numbers, which we then had to look up and reformat. When the query input is sanitised, the reponses are reasonably predictable for automatic parsing. Youtube's results are far more tolerant and we assume that some content will be found for any tube station name we pass it.

From the beginning, we prioritised the whole team's understanding of the whole codebase as we progressed. We did some research without pairing, but pair-programmed the entire project.

We really worried about API mess, but overnight research meant that we preempted problems and could fix them quickly during FAC time.

We tried to preempt problems by creating good structures in the code from the start. In the end, we didn't finish quickly enough to use these for strecth goals, but it feels like the time spent on preempting problems is less than the time we would have spent resolving them.

An example is the parallel function. In the end, it took a pair of us about an hour to write, which is little more than the callback would have taken alone, and considerably less than it would have taken to write an array of working callbacks and then convert them to run in parallel.

One difficulty we found was passing returned values through the program flow rather than storing them globally. This was because the program flow often went through a callback which was not immediately executed and therefore couldn't be simply modified to take extra arguments as a normally defined fucntion would.

Notes

Talk through the Why, What, How of your project How did you split up the work?

How did you choose to pair?

Walk us through the UX (user experience) i.e. demo your website

How well does it conform to your brief - the user stories

Walk us through your code. Prioritise the things you learned that were new to you, which the rest of your cohort could benefit from hearing about:

something you're proud of

something that you found really hard / struggled with

week3-taaa's People

Contributors

morkeltry avatar astroash avatar aseelm avatar

Watchers

James Cloos avatar  avatar Jen Spencer avatar

week3-taaa's Issues

Readme

Perhaps a little more content for the readme would be nice ;)

API keys

Ugh, you shouldn't have your API keys in your code!!

Station names cannot be seen in the unordered list

When I click send I do not see the stations name as a heading.

To fix this we should merge PR #24 so we have access to the station names, and then we could use DOM manipulation to append these station names to each li element.

Link DOM to api request

When you click submit button, it will take the two input fields and feed htem into the TFL API call.

Stretch Goal: Randomise the youtube search result

For our youtube api objects, we are using the property values from element zero from the response object. We should perhaps randomise this process, so instead of it always being the first search result, it will select one at random from the list.

e.g if there are 15 search results, then for each object we will pick an array value between 0 and 14.

Make music API call

Look into spotify or other music api to search for tracks and return usable information

Create parallel function for Yt API calls

Parallel function, taking in array of station name strings,
loops and generates URIs and makes the API calls,
manage which requests resulted in a response and how many resulted in a response,
handles responses by calling appropriate callback.

Station Name issue

When loading result the bullet points all show station name and is not cycling giving the relevant station name. So for example when you search for bank station it could be like the following:

  • Station name : Bank station

It just makes it easier to see what station it refers rather than having to look in the youtube link :)

Better error handling

Overall, you should account for errors that might occur.

For instance, if the users accidentally selects a journey from A to A (the same station), the existing page doesn't do anything. User might think that:

  • there is something wrong with your page and most likely he will find a better page doing the same thing (if you run a business, then that's it - you've just lost a potential customer) or
  • there is something wrong with the internet connection

Warn the users when something goes wrong so they know what's going on.

Where are your user stories?

I know you may not have had time, but it is good to focus on the user journey (as it says in the project brief), and break it up into stories if you can.
Worth mentioning this in your readme.
The user will ultimately be your reason for building things!

Tests

Consider adding some tests

Add favicon

takes 2 secs and makes a good first impression

DOM: When I click send more than once, previous results remain

When I click send more than once, the new elements I see on the screen are being attached to the previous list.

We should be able to reset the unordered list on each send request so when the results are ready, it wipes out the old one and replaces it with a new unordered list.

Parallel

Yay, glad to see you attempted this : ) I haven't cloned your repo so I don't know for sure that your code is all working but it looks good.

You could probs improve the naming of your functions and variables.

For example, on line 40 you have parallel(result)

Parallel is a very generic function name. Think about what your function is doing in your case. Maybe something like getYoutubeResultsInParallel would be better? And you could call result something like tflResultsArray.

JS in multiple files

Javascript is written in both main.js and ./public/js/logic.js.

It would be great if these could both be put in the same place

๐Ÿ‘

Create index.html

  1. Include class names and structure with accessibility labels
  2. Create two text fields to enter stations and a submit button
  3. One empty unordered list

Results refreshing to replace items on click

It would be ideal f the results are refreshed on the clicks. So rather than appending to the node every time, it might be an idea to replace the node items. This way every time you run a search you only get the items for the search rather than the ones from the previous ones. This just makes it easier to flow which ones are relevant.

To simplify this try cleaning the array before adding to it on each click as a quick fix :)

Add labels to your issues

The sooner you start doing this, the better.

You can create your own labels that are specific to the project.

Video description text style change suggestions

Just a quick suggestion of style changes for the video descriptions for the youtube links ๐Ÿ‘

  • Rather than have the link in the footer possibly get it in line with the centre of the video thumbnail:
    An easy way to do this is to apply : vertical-align : center to the image.

  • It might be an idea to apply a 'color' property to the form elements at a high level to prevent the blue underlined links

Just some suggestions just to get the page looking sharper. Looking great otherwise. Very cool concept ๐Ÿ‘

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.