bdkiran / lyr-service Goto Github PK
View Code? Open in Web Editor NEWGo Rest API
Go Rest API
Create a readme to contain:
Use proper markdown syntax
Brief explanation about the repository
How to download
Dependencies
Utilizing gothic, authentication with google, facebook and apple should be implemented.
Create a query to return the "best" lyrics
Tests should be provided covering all functions, these unit tests should be small if scope but provide sufficient converage. These should exist in their own package :
Determine what to do with api calls functions to elastic-search
Determine how to test http handler functions
Upvote should reflect an upvote for a single user
Users id gets added to the upvoted users array in the lyric.
User can only appear once in this array.
If already present sent 400
If user is currently in the downvote array, remove them.
Endpoint: /upvote/{document_id}
Some Request require that the caller be authenticated/authorized to complete that action. We need to add a check.
Routes:
/upvote/{doc_id}
/downvote/{doc_id}
Check if request has auth bearer token, if not return 401
Check if token is valid (secret is kept in this service) if not return 401
Check if user id matches with token user sent
All functions should have all possible errors handled:
no _ for errors
Generic functions for error, to bubble up to the stack
Preventing errors from completely overwhelming the service
Message are able to be sent from the front end to the backend. However, information is not stored.
Add honeypot to reduce spam
Store the messages
^Decide where to store the messages? Mongo, Elastic-search, Postgres?
Upvote should reflect a downvote for a single user
Users id gets added to the downvoted users array in the lyric.
User can only appear once in this array.
If user is already present sent 400
If user is currently in the upvote array, remove them.
Endpoint: /downvote/{document_id}
The exact matching on keywords in the song_lyrics
index will cause an issue with the following scenario:
In the elastic-search document, there are songs by the artist roddy ricch
User searches for roddy
The user does not get any results back
This is because the keyword fields of artist
and title
are looking for an exact match, this needs to be adjusted so that these fields search is not so strict
Resources:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html#simple-query-string-syntax
https://stackoverflow.com/questions/54058630/multiple-words-act-as-single-word-in-search-elasticsearch
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
Create a new package that will handle all logging for the service
Include
Type of log: debug, info, warn, error
Timestamp
Package/File it was called
Change the / endpoint to a health check endpoint
Query elastic-search to get the health of the cluster
Send back a message on the status
Return 15-20 results instead of 10, or instead look at using a "scroll" function
The last data structure change in ES alleviated issues concerning duplicate lyrics.
When this was done the artist
and title
fields in our elastic-search documents were changed from text fields to Keyword fields. This change was made for the future in mind(for aggregations and such).
However, this has left us with an issue since the query performs and "exact" match search on these keyword fields.
For Example take the following document:
/song_lryics/doc1
{
'artist': 'drake'
'title': 'cool song'
...
}
When a match query is performed using Drake
this document would not be returned.
This is because the case difference is and issue with the exact match.
Come up with a way to store environment variables for:
Sometimes lyrics have duplicates such as the chorus. We only want one instance of each lyric to be returned to the user for a better experience
Sources
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.