-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates to clean up the code and to take in more data types
- Loading branch information
Tom Gotsman
committed
May 15, 2024
1 parent
df8effd
commit a86425b
Showing
8 changed files
with
5,080 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Oops, something went wrong.