units-of-measurement / units-of-measurement-server

A small Flask server to demonstrate UCUM code to linked data conversion
0 stars 1 forks source link

Add a text field for inputting a UCUM code #4

Open jamesaoverton opened 2 years ago

jamesaoverton commented 2 years ago

The main page needs a text field to let users subject one UCUM code. Maybe we also want this on the top of each unit page.

It would be even better to allow for multiple codes, one-per-line. I start to worry about performance, and people submitting too many codes.

jamesaoverton commented 2 years ago

@kaiiam suggests that this input should be dropdown with the ~310 UCUM base units. Maybe these need longer labels to clarify them. This could possibly also include various common examples.

If we do it this way, we'll use Typeahead, like most of our other projects.

jamesaoverton commented 2 years ago

I'm being dumb: There is already a UCUM search box on the index page.

But we should add Typeahead to this box, which should include a fixed list of (1) units from si_input.csv and (2) some common examples (to be determined). The Typeahead should fill the UCUM unit, but display and match the English label for users to search and read.

beckyjackson commented 2 years ago

This is done and in the code. Currently this is just using very basic substring matching - another option is fuzzy string matching if we want to go there, but that might not be necessary.

kaiiam commented 2 years ago

The idea was it might be nice for people to be able to see the base UCUM codes' English labels as they add to the typehead. Not sure the best way to go about this maybe just a link to the table (or a subset of it) is sufficient. But it could be nice to have a view or drop down of the available codes and what they mean. Not an essential feature could just be useful for a UI perspective.