Skip to content

Commit dc6a808

Browse files
committed
2 parents 3e6acf9 + 7258b5a commit dc6a808

5 files changed

Lines changed: 30 additions & 30 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ CSV interactive visualization
88
| Current Tool Version | [commit-hash](link-to-commit-hash) |
99

1010

11+
![](./assets/Interface.png)
12+
13+
1114
## ODTP command
1215

1316
```
@@ -27,7 +30,7 @@ No parameter
2730

2831
| File/Folder | Description |
2932
| --- | --- |
30-
| Input | Folder where streamlit compatible files are located |
33+
| *.csv | Any number of csv files |
3134

3235
### Output Files
3336

@@ -37,13 +40,15 @@ No output
3740

3841
### How to run this component as docker
3942

40-
Build the dockerfile
43+
1. Build the dockerfile
4144

4245
```
4346
docker build -t odtp-pygwalker .
4447
```
4548

46-
Run the following command. Mount the correct volumes for input/output folders.
49+
2. Create a folder called `odtp-input` and place some `.csv` files inside.
50+
51+
3. Run the following command. Mount the correct volumes for input/output folders.
4752

4853
```
4954
docker run -it --rm \

app/app.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@
1111
)
1212

1313
st.sidebar.title('ODTP PyGWalker')
14-
st.sidebar.write('Please select a file from the sidebar to start exploring the data. These are the csv files located on `/odtp/odtp-input`.')
14+
st.sidebar.write('Metadata and data exploration tool for ODTP data using PyGWalker.')
15+
16+
17+
st.write('Please select a file from the sidebar to start exploring the data. These are the csv files located on `/odtp/odtp-input`.')
18+
19+
def find_all_files(directory):
20+
file_paths = []
21+
for root, dirs, files in os.walk(directory):
22+
for file in files:
23+
if file.endswith(".csv"):
24+
file_paths.append(os.path.join(root, file))
25+
return file_paths
1526

1627
# Credit: https://discuss.streamlit.io/t/server-side-file-select/60704/2
1728
def file_selector(folder_path='.'):
18-
filenames = os.listdir(folder_path)
19-
selected_filename = st.sidebar.selectbox('Select a file', filenames)
29+
filenames = find_all_files(folder_path)
30+
selected_filename = st.selectbox('Select a file', filenames)
2031

2132
if len(filenames) == 0:
22-
st.sidebar.error('No files found in the selected folder. Please upload a file.')
33+
st.sidebar.error('No files found in the selected folder. Please load files in odtp-input.')
2334
return None
2435
else:
2536
output_path = os.path.join(folder_path, selected_filename)
@@ -33,24 +44,8 @@ def file_selector(folder_path='.'):
3344
# filename = st.sidebar.file_uploader("Upload a CSV file", type="csv")
3445
# st.sidebar.write('You selected `%s`' % filename)
3546

36-
37-
38-
if st.sidebar.button('Load CSV'):
47+
if st.button('Load CSV'):
3948
df = pd.read_csv(filename)
4049
pyg_app = StreamlitRenderer(df)
4150
pyg_app.explorer()
4251

43-
44-
45-
46-
# # You should cache your pygwalker renderer, if you don't want your memory to explode
47-
# @st.cache_resource
48-
# def get_pyg_renderer(file) -> "StreamlitRenderer":
49-
# df = pd.read_csv("./bike_sharing_dc.csv")
50-
# # If you want to use feature of saving chart config, set `spec_io_mode="rw"`
51-
# return StreamlitRenderer(df, spec="./gw_config.json", spec_io_mode="rw")
52-
53-
54-
# renderer = get_pyg_renderer()
55-
56-
# renderer.explorer()

app/app.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# While the output is managed by ODTP and placed in /odtp/odtp-output/
3131
#########################################################
3232

33-
streamlit run --server.port $PORT /odtp/odtp-app/app.py
33+
streamlit run /odtp/odtp-app/app.py
3434

3535
#########################################################
3636
# 5. OUTPUT FOLDER MANAGEMENT

assets/Interface.png

662 KB
Loading

odtp.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ build-args: null
3030
ports:
3131
- name: PORT
3232
description: Port for the streamlit app
33-
port-value: 8051
33+
port-value: 8501
3434

3535
# If applicable, parameters exposed by the component
3636
# Datatype can be str, int, float, or bool.
3737
parameters: null
3838

3939
# If applicable, data-input list required by the component
4040
data-inputs:
41-
- name: input
42-
type: Folder
43-
path: ./input
44-
description: Input folder containing compatible csvs
41+
- name: csv files
42+
type: `.csv`
43+
path: *.csv
44+
description: Any number of csv files
4545

4646
# If applicable, data-output list produced by the component
4747
data-output: null

0 commit comments

Comments
 (0)