Closed richard-jones closed 10 years ago
To do this we will integrate with the google books lookup.
On the "New Advert" page, the user will be presented with only the ISBN input box, and a "Fetch" button. They enter the ISBN and hit the button, which queries the Google Books API. The response will be one of the following:
3b is more work than 3a
The user will be able to change the ISBN at any time and hit "Fetch" again, and we will overwrite any existing content in the form.
@mjb295 - could you confirm that this is the behaviour that you'd like in the ISBN lookup, and make a call on 3a vs 3b.
Yes looks ok, we should be looking to complete option '3b'.
Agreed that we will actually go with option 3a.
@Nimphal - assigning this to you first, so you can get on with implementing the API calls to google. If you could implement the following and then assign back to me:
A new module called isbn_lookup has been created. It takes as an argument an ISBN and returns a JSON representation of the Google Books API response. A URL rool at /advert/isbn/<isbn>
calls this module and returns a JSON of the book. If no book or more than one result found (I have yet to encounter this case), it returns an empty dictionary. Assigning to @richard-jones, please assign back if I've missed something.
The isbn_lookup should take the google books data and crosswalk it into the book json format that uniboard uses.
The root now returns a book object containing only the data relevant to the form. If no data is found in the response from google, the value is set to none
(apparently there are books out there that don't have publishers, go figure).
An example book object:
{
publisher: null,
authors: [
"George Clarke",
"Jane Field-Lewis"
],
subjects: [
"Architecture, Domestic"
],
isbn: [
{
identifier: "1849493391",
type: "ISBN_10"
},
{
identifier: "9781849493390",
type: "ISBN_13"
}
],
title: "Amazing Spaces",
image: "http://bks0.books.google.co.uk/books?id=eN2GnAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
year: 2013
}
Front-end has now been bound to the back end.
Oh, one minor thing - could you make the back-end normalise any ISBN that comes in. For example 1843341387 works, but if you input it as written on a book then it doesn't (1-84334-138-7). Probably enough to strip whitespace and replace non-numeric characters with the empty string.
This should now work, all characters that are not numbers are stripped before the Books API is called. As a result ISBNs as they appear in books are now okay.
2014-08-18 23:57 GMT+01:00 Richard Jones notifications@github.com:
Reopened #49 https://github.com/CottageLabs/uniboard/issues/49.
— Reply to this email directly or view it on GitHub https://github.com/CottageLabs/uniboard/issues/49#event-154218280.
tested and is working
Integrate with google books or something similar to auto-populate the book metadata