Skip to content

Commit

Permalink
updates to clean up the code and to take in more data types
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gotsman committed May 15, 2024
1 parent df8effd commit a86425b
Show file tree
Hide file tree
Showing 8 changed files with 5,080 additions and 62 deletions.
22 changes: 22 additions & 0 deletions data_visualisation/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Data App

This app is used to showcase and edit tabular data live in an app.

## Use the app

There are 4 custom database Models defined here `Customer`, `Cereals`, `Covid` and `Countries`. Three of these come with datasets that load data automatically into the table when the app is loaded and the last is an empty table, where the user can add data from scratch. For all of these tables the user can add, edit or delete data and this will update the data in the database itself. The data file types currently supported are `csv`, `xlsx` and `json`, but it is very easy to extend this to any data type by just writing your own `loading_data` function inside of the `data_loading.py` file. There is also in-built sorting based on any column heading.


To use the app, set the `MODEL` parameter to the table of your choice defined in the `models.py` file. If you wish to load data set the `data_file_path` parameter.


## Add your own data file


You can add your own data by creating an `rx.Model` class in the `models.py` file. It is critical that the names of the `keys` in the model match up EXACTLY to the names of the columns in your data source. Here are some examples:

* Heading: `Name`, key must be `Name` and not `name`
* Heading: `State/UT`, this name must be changed to something that can be written in python such as `state`.
* Heading: `people count`, heading must be changed to be `people_count`

You can load other data types by defining your own `loading_data` function inside of the `data_loading.py` file.
File renamed without changes.
Binary file added data_visualisation/data_sources/covid_data.xlsx
Binary file not shown.
Loading

0 comments on commit a86425b

Please sign in to comment.