package documentation
The app that makes the data interactively explorable by the user.
The data explorer manages the loading, querying, computation of statistics, and visualization of the lymphatic progression data that we provide. Below we give a rough overview over the order in which the various submodules are called when the user interacts with the dashboard. To better understand the code and be able to modify it, it probably makes sense to dive into the docs in the order they are listed below:
- The user navigates to the data explorer, which sends a GET request to the
render_data_stats
view. If a user updates the selection in the data explorer's dashboard, a POST request is instead sent to theupdate_data_stats
view that the uses AJAX to update the rendered HTML. This makes the interface a little less clunky, because the user does not have to wait for a full page reload. In terms of the logic, both views work nearly identically. - Both views create a
DataexplorerForm
instance with the data from the request data. The form validates the selections the unser made in the dashboard. Unless the validation fails, the form now has an attribute cleaned_data that contains query parameters in a standardized format. - The view then calls
execute_query
with this cleaned form data. In this function, the selected dataset specifications are loaded from the SQLite database. Using these specs, the actualpandas.DataFrame
is loaded from the GitHub repository (if requested for the first time) or from thejoblib
cache (in all subsequent calls). It returns a filteredpandas.DataFrame
that contains only the data that matches the user's selection. - The view then returns a dynamically created instance of the Statistics class
(using the
BaseStatistics.from_table
classmethod). It is apydantic.BaseModel
that creates a set of statistics (like the count of patients with positive, negative, or unknown HPV status) from the filtered dataset. These statistics can then be serialized into e.g. JSON format and sent back to the frontend. - Lastly, the web app either assembles the HTML from the statistics and returns that to the user, or it updates the already loaded HTML with the new serialized stats in JSON format, depending on whether a GET or POST request was made.
Module | admin |
Register the models for the admin interface. |
Module | apps |
Code that Django needs to register and load the app. |
Module | forms |
Defines the fields that can be used to query the patient records. |
Package | management |
Undocumented |
Package | migrations |
Undocumented |
Module | models |
Defines a minimal model representing a dataset. |
Module | query |
Querying and generating statistics from the table of patients. |
Module | subsites |
Tumor subsites as ICD-10 codes with the respective names. |
Module | urls |
Defines the URLs within the dashboard app. |
Module | views |
Orchestrate the logic of the dashboard. |