gbv / coli-ana

API to analyze DDC numbers
https://coli-conc.gbv.de/coli-ana/app/
MIT License
2 stars 0 forks source link

Number building interface and api #46

Open nichtich opened 2 years ago

nichtich commented 2 years ago

Given a method to check whether a DDC number is valid, we can provide a simple number building interface with this algorithm:

nextBuildableNotations(notation, maxDepth): // given a start notation, try to add at most maxDepth digits
  narrower=[]
  for digit in 0...9:
    build = notation.length === 3 ? notation + "." + suffix : notation.suffix
    if isValidNotation(build): // found a digit that can be added
      narrower.push(build)
    else if maxDepth > 0: // try adding multiple digits at once
      narrower.append(nextNotations(build, maxDepth - 1))  
  return narrower

This basically results in JSKOS API method narrower for the virtual hierarchy of all possibly composable DDC notations.

nichtich commented 2 years ago

Here is a possible Mockup. The building part should be collapsible. Clicking on the ↳ should truncate the current number.

image

nichtich commented 2 years ago

Another place where to put the selection of narrower classes could be the input field via typeahead (#62).