# Fields and Elements used in the GNUmed User Interface

## Input Fields

### The Phrasewheel

A phrasewheel is a special kind of text field which makes suggestions as you type-in phrases. Most of the time, you will notice this when inputting data into a form, say, when creating a new patient. The suggestions offered often come directly from your current GNUmed database. This way, the phrasewheel learns which words and phrases you and your group use, and adapts to that. The phrasewheel uses three strategies to search for suggestions (Of course, the suggestions will be context-sensitive. A phrasewheel for entering family names will not suggest drugs and vice versa contrary to what the example below might suggest):

If in doubt whether a particular text field really is of phrasewheel type (because you think it ought to offer suggestions, but doesn't appear to do so) you can type the `*` (asterisk) into the empty field (or simply press the <Cursor-Down> key). If the field is a phrasewheel it should dropdown a list of all available suggestions (on account of your not having typed anything, everything will match). Note that this may take rather long, especially when the programmer did not take care to constrain the maximum number of suggestions returned.

Also note that if you are a rapid typist, some phrasewheels may not appear to bring up suggestions. That is so because suggestions are only generated after a brief period of inactivity (eg. no typing) which is typically configured to something like 300 milliseconds.

#### start-of-phrase suggestions

This is used when you have typed only very few characters. It will make suggestions which start with what you have already typed. That way the list of suggestions for `su` will include

- `sullivan`
- `sutherton`
- `Surber` (yes, case insensitive)
- `summary of stay` (for example as a document type)

but neither of

- `McSullivan` (not at start of phrase)
- `The Sutherton Clan` (start of word but not start of phrase)
- `Smith` (sm does not match su)
- `foo bar` (well ... )

Usually this will happen after you typed one or two characters.

#### start-of-word suggestions

If you keep on typing, more characters the phrasewheel assumes the list of suggestions isn't adequate. It starts searching for suggestions matching at word boundaries within phrases. Given the above example, both of

- `The Sutherton Clan` (start of second word matches)
- `in the sullen landscape of Italy` (sullen matches)
- `Discharge Summaries` (Summaries matches)

would be added to the list of suggestions for `su`.

This usually kicks in after typing 3-5 characters.

#### substring suggestions

Still the suggestions may not contain anything helpful to you so you keep on typing away. The phrasewheel then starts making suggestions based on matches anywhere within a phrase. So the following suggestions are added to the list:

- `McSullivan`
- `insulin regime`
- `the insurgency rises`

This sort of generating suggestions typically happens after you type more than 5 characters.

Note that you can always bring up the list of all suggestions by typing `*` within an empty phrasewheel.

#### Phrasewheel types

There are two types of phrasewheels: Those in which you must use a phrase that's on the list of suggestions (selection-only) and those which will accept new input, too (free-text).

##### selection-only input

Here you must either select a suggestion from the list or enter a term exactly as it appears on the list of suggestions. Basically this is akin to a drop-down list field which lets you type what you mean and drops down a narrowed down list of possible matches. You can always drop down the entire list of possible inputs by entering `*` into the empty field or pressing the <Cursor-Down> key.

A typical use would be in selecting a document type out of a list of pre-configured types.

##### free-text input

This phrasewheel will not constrain what you enter. If the phrase you type is not on the list of suggestions GNUmed will happily use it anyways. This may lead to a new phrase ending up in the database ready for being suggested the next time around. This is how GNUmed learns your language habits.

Here a typical use would be entering the street of an address. New streets are learned by GNUmed as addresses are entered.

### The Timestamp field

This is a special version of the phrasewheel. It allows entering dates in various formats and - as you type - makes suggestions for dates you might mean. Those suggestions make sense medically. It is possible to enter fuzzy timestamps where you don't know the month, day, or time of day.

### Programming notes

In order for items (like episode names) to be included in dropdown lists, such names must be at least two characters in length.

Next: Understanding the GNUmed EMR