Module: routes/v1

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

Methods

(async, inner) addEdition(isbn) → {Promise:.<Edition:>}

Adds an edition to the database using OpenLibrary API if it doesn't exist in our database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
edition
Type
Promise:.<Edition:>

(inner) base64_encode(filePath) → {string}

Encodes a file to base64
Parameters:
Name Type Description
filePath string
Source:
Returns:
Type
string

(inner) generateSpineImagePath() → {string}

Generates a new unique spine image path using the current date and a random number
Source:
Returns:
path
Type
string

(async, inner) getBookInfo(isbn) → {Promise:.<(object:|null:)>}

Get book information via ISBN from the database
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getBookInfo(bookId) → {Promise:.<object:>}

Get book information from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getBooksByTitle(title) → {Promise:.<(object:|null:)>}

Get book information via title from the database
Parameters:
Name Type Description
title string
Source:
Returns:
Type
Promise:.<(object:|null:)>

(async, inner) getImagePixelArray(image, width, height) → {Promise:.<Array:.<number:>>}

Converts an image to an array of pixel values
Parameters:
Name Type Default Description
image Jimp
width number 100
height number 100
Source:
Returns:
Type
Promise:.<Array:.<number:>>

(async, inner) getOLAuthorInfo(authorKey) → {Promise:.<object:>}

Get author info from OpenLibrary API using author key
Parameters:
Name Type Description
authorKey string
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getOLBookInfo(isbn) → {Promise:.<object:>}

Get book info from OpenLibrary API using ISBN
Parameters:
Name Type Description
isbn ISBN
Source:
Returns:
Type
Promise:.<object:>

(async, inner) getSpineFilepaths(bookId) → {Promise:.<Array:.<string:>>}

Get spine image filepaths from the database
Parameters:
Name Type Description
bookId number
Source:
Returns:
Type
Promise:.<Array:.<string:>>

(async, inner) getSpineSimilarity(image1_path, image2_path) → {Promise:.<number:>}

Calculates the cosine similarity between two images
Parameters:
Name Type Description
image1_path string
image2_path string
Source:
Returns:
Type
Promise:.<number:>

(inner) parseDate(date_str) → {date}

Parses a date string into a date object
Parameters:
Name Type Description
date_str any
Source:
Returns:
parsedDate
Type
date

(async, inner) searchForBooks(ocrElements, image_filepath, min_conf) → {Promise:.<Array:.<Book:>>}

Initiate search for books based on text from OCR and spine image
Parameters:
Name Type Default Description
ocrElements Array:.<string:>
image_filepath string null (default null)
min_conf number 0 (default 0)
Source:
Returns:
possibleBooks
Type
Promise:.<Array:.<Book:>>

(async, inner) segmentImage(imagePath) → {Promise:.<any:>}

Run the DAHLS model on the image
Parameters:
Name Type Description
imagePath string
Source:
Returns:
Type
Promise:.<any:>

(async, inner) startScan(scanId, userId, imagePath) → {Promise:.<void:>}

Start the scan process
Parameters:
Name Type Description
scanId number
userId number
imagePath string
Source:
Returns:
Type
Promise:.<void:>

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.

(inner) stringSimilarity(str1, str2, substringLengthopt, caseSensitiveopt)

Calculate similarity between two strings
Parameters:
Name Type Attributes Default Description
str1 string First string to match
str2 string Second string to match
substringLength number <optional>
2 Optional. Length of substring to be used in calculating similarity. Default 2.
caseSensitive boolean <optional>
false Optional. Whether you want to consider case in string matching. Default false;
Source:
Returns:
Number between 0 and 1, with 0 being a low match score.