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_statsview. If a user updates the selection in the data explorer's dashboard, a POST request is instead sent to theupdate_data_statsview 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
DataexplorerForminstance 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_querywith this cleaned form data. In this function, the selected dataset specifications are loaded from the SQLite database. Using these specs, the actualpandas.DataFrameis loaded from the GitHub repository (if requested for the first time) or from thejoblibcache (in all subsequent calls). It returns a filteredpandas.DataFramethat 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_tableclassmethod). It is apydantic.BaseModelthat 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 | utils |
Utility functions for data exploration and visualization. |
| Module | views |
Orchestrate the logic of the dashboard. |