MetaBrainz Foundation

BB: Dynamic default alias implementation

In the near future, we would like to be able to remove the "default alias" field from the database, as it isn't storing any useful data (only a display hint). It should be possible to implement an algorithm in the site code to select the correct alias to display to the user without this flag. The details of the algorithm are below:

  1. Obtain a list of aliases for an entity, and the user's native language
  2. Filter the list of aliases to find any primary aliases for the user's native language - if there is one, use this
  3. Filter the list of aliases to find any primary alias which matches the language of the entity (where applicable) - if there is one, use this
  4. Filter the list of aliases to find any primary alias in English - if there is one, use this
  5. Filter the list of aliases to find any primary alias - if there is one, use this
  6. If there are no primary aliases, use the first alias in the alias list
  7. If there are no aliases, use "(untitled)" or "(unnamed)"

For now, this algorithm should be implemented in the web service, and used to set a field "display_alias" on the JSON object returned for each entity type.

References:

Task tags

  • json
  • bookbrainz
  • javascript

Students who completed this task

Stan Szczesniak

Task type

  • code Code
  • web Design
close

2015