From 5a8487e48724b4f872a3950b5d280c2792de9edc Mon Sep 17 00:00:00 2001 From: Leah Tacke genannt Unterberg <leah.tgu@pads.rwth-aachen.de> Date: Wed, 3 May 2023 13:44:08 +0200 Subject: [PATCH] json header support --- pages/upload_page.py | 8 ++++++-- poetry.lock | 30 ++++++++++++++---------------- pyproject.toml | 6 ++++-- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/pages/upload_page.py b/pages/upload_page.py index bc41f0d..9a4a4ba 100644 --- a/pages/upload_page.py +++ b/pages/upload_page.py @@ -13,7 +13,7 @@ import_type = st.selectbox('Import Type', ['csv', 'hdf']) files = {} if import_type == 'csv': - csv_header_upload = st.file_uploader("Upload a header csv file", type='.csv') + csv_header_upload = st.file_uploader("Upload a header csv or json file", type=['.csv', '.json']) csv_data_upload = st.file_uploader("Upload a data csv file", type='.csv') files['csv_header_upload'] = csv_header_upload files['csv_data_upload'] = csv_data_upload @@ -33,7 +33,11 @@ def import_hdf(f): # @st.experimental_memo def import_csv(hf, df): - return read_machine_data(hf, df, validity_checking=False) + if 'csv' in hf.type: + header_type = 'csv' + elif 'json' in hf.type: + header_type = 'json' + return read_machine_data(hf, df, validity_checking=False, header_type=header_type) @st.cache_data diff --git a/poetry.lock b/poetry.lock index c8159a6..b6d87ec 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1671,23 +1671,21 @@ version = "0.1.0" description = "" category = "main" optional = false -python-versions = "^3.9" -files = [] -develop = true +python-versions = ">=3.9,<4.0" +files = [ + {file = "mdata-0.1.0-py3-none-any.whl", hash = "sha256:89a08590331acaeb5a1ba1ec64d2797a00c208afc6b82f483205190b7af23c73"}, + {file = "mdata-0.1.0.tar.gz", hash = "sha256:33b18e70b1240a098edba312cb3d0025b7a793295d938b929c7954f4cfbe45f9"}, +] [package.dependencies] -bokeh = "^2.4.3" -jupyter = "^1.0" -matplotlib = "^3.7.1" -pandas = {version = "^1.5", extras = ["all", "performance"]} -plotly = "^5.14.1" -pm4py = "^2.7.3" -tables = "^3.8.0" -tsdownsample = "^0.1.2" - -[package.source] -type = "directory" -url = "../mdata" +bokeh = ">=2.4.3,<3.0.0" +jupyter = ">=1.0,<2.0" +matplotlib = ">=3.7.1,<4.0.0" +pandas = {version = ">=1.5,<2.0", extras = ["all", "performance"]} +plotly = ">=5.14.1,<6.0.0" +pm4py = ">=2.7.3,<3.0.0" +tables = ">=3.8.0,<4.0.0" +tsdownsample = ">=0.1.2,<0.2.0" [[package]] name = "mdurl" @@ -3644,4 +3642,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.9,!=3.9.7" -content-hash = "ac96a4ac5737561fdeee2f5476848ef21b65a267c2d918bce83f8b01eb81f740" +content-hash = "11a05b92a05d57495d3766cddd43974c2971f21424e983eeb40fd1ae1f5a13f9" diff --git a/pyproject.toml b/pyproject.toml index 590d94f..d33636c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,14 @@ packages = [{ include = "mdata_app" }] readme = "README.md" license = "MIT" + [tool.poetry.dependencies] python = "^3.9,!=3.9.7" # flask = "^2.2.3" streamlit = "^1.21" -mdata = { path = "C:/Users/Leah/PycharmProjects/mdata", develop = true } -# mdata = { git = "git@git-ce.rwth-aachen.de:leah.tgu/mdata.git", branch = "master" } +# mdata = "^0.1.0" +# mdata = { path = "C:/Users/Leah/PycharmProjects/mdata", develop = true } +mdata = { git = "git@git-ce.rwth-aachen.de:leah.tgu/mdata.git", branch = "master" } seaborn = "^0.12.2" plotly = "^5.14.1" tsdownsample = "^0.1.2" -- GitLab