Defines the fields that can be used to query the patient records.
Basically, this defines what buttons, dropdowns, and checkboxes are displayed on the
dashboard and to some extent also how they look. Here, we also define the
ThreeWayToggle
button that is used to select between three states: positive, negative,
and unknown. The ThreeWayToggle
button is used for selecting HPV status, nicotine
abuse, LNL involvement and more.
Typically, when calling one of the dataexplorer.views
functions, an instance of the
DataexplorerForm
is created with the user's permissions and the initial data from the
DataexplorerForm.from_initial
class method. This initial data is then used to display
the dashboard. Then, the user applies filters to the data and submits the form by
pressing the "Compute" button. The form is then validated and cleaned
(form.is_valid()), also in the dataexplorer.views
module.
Note: the DataexplorerForm
is not strictly used as Django intends forms to be used.
In Django's logic, a form just after creation is "unbound" and in that state expects
user input (think of a login form with empty fields). However, in our dashboard, no
fields are ever "empty". Even when you first load the dashboard, the ThreeWayToggle
buttons are already set to a value (None). Therefore, we never have this "unbound"
state of the form. Instead, we always work with bound and validated forms, either
created from the initial defaults or from the user's input.
Class |
|
Form for querying the database. |
Class |
|
Simple subclass that provides a convenience method to create subsite fields. |
Class |
|
Field to choose one of three options: True, None and False. |
Class |
|
Widget that renders the three-way toggle button. |
Function | format |
Create a list of tuples for the dataset choices. |
Function | get |
Return the choices for the modality field. |
Function | trio |
Transform -1, 0, and +1 to False, None and True respectively. |
Type Variable | T |
Undocumented |
Variable | checkbox |
Undocumented |
Variable | logger |
Undocumented |