-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate tab now accepts copy & pasted json data (#15)
- Loading branch information
Showing
9 changed files
with
393 additions
and
350 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,9 @@ | ||
import streamlit as st | ||
import streamlit.components.v1 as components | ||
|
||
def dashboard_tab(): | ||
st.markdown(""" | ||
Use Neodash below to create a simple data dashboard from a Neo4j database. Requires knowledge of [Cypher](https://neo4j.com/docs/getting-started/cypher-intro/) | ||
""") | ||
# Neodash interface | ||
components.iframe("https://neodash.graphapp.io", height=1000, scrolling=True) |
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
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,67 @@ | ||
# Now the new Generate Tab | ||
|
||
import streamlit as st | ||
from constants import * | ||
from io import StringIO | ||
from models.mapping import Mapping | ||
from logic.generate_mapping import mapping_from_json | ||
from generate import generate_zip | ||
|
||
def import_tab(): | ||
|
||
with st.expander("Instructions"): | ||
st.write( | ||
""" | ||
1. Import a file created from the ① Ideate or ② Design tabs | ||
2. The mock graph data generator will automatically generate a .zip file containing .csv and .json files. The .csvs can be independently imported into any database that supports .csv imports. The .json file is specifically formatted for the Neo4j Data Importer. | ||
3. Download the .zip file | ||
4. Proceed to the '④ Data Importer' tab | ||
""" | ||
) | ||
|
||
|
||
st.markdown("--------") | ||
|
||
c1, c2 = st.tabs(["Copy & Paste", "Import File"]) | ||
with c1: | ||
filename = st.text_input("Name of file", value="mock_data") | ||
txt = st.text_area("Paste arrows.app JSON here", height=500, help="Click out of the text area to generate the .zip file.") | ||
if txt is not None and txt != "": | ||
# Process .json text | ||
st.session_state[MAPPINGS] = Mapping.empty() | ||
generators = st.session_state[GENERATORS] | ||
mapping = mapping_from_json( | ||
txt, | ||
generators) | ||
zip = generate_zip(mapping) | ||
st.download_button( | ||
label = "Download .zip file", | ||
data = zip, | ||
file_name = f"{filename}.zip", | ||
mime = "text/plain" | ||
) | ||
with c2: | ||
uploaded_file = st.file_uploader("Upload an arrows JSON file", type="json") | ||
if uploaded_file is not None: | ||
# To convert to a string based IO: | ||
stringio = StringIO(uploaded_file.getvalue().decode("utf-8")) | ||
# To read file as string: | ||
current_file = stringio.read() | ||
|
||
# Save to session state | ||
st.session_state[MAPPINGS] = Mapping.empty() | ||
|
||
name = uploaded_file.name.split(".")[0] | ||
if current_file is not None: | ||
# TODO: Verfiy file is valid arrows JSON | ||
generators = st.session_state[GENERATORS] | ||
mapping = mapping_from_json( | ||
current_file, | ||
generators) | ||
zip = generate_zip(mapping) | ||
st.download_button( | ||
label = "Download .zip file", | ||
data = zip, | ||
file_name = f"{name}.zip", | ||
mime = "text/plain" | ||
) |
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import streamlit as st | ||
|
||
def get_help_tab(): | ||
st.write("Version 0.5.0") | ||
st.write("Email [email protected] for help.") | ||
version = st.secrets["VERSION"] | ||
st.write(f"Version {version}") | ||
st.markdown(""" | ||
Post issues and comments in this [github repo](https://github.com/jalakoo/mock-graph-data-generator/issues) | ||
""") |
This file was deleted.
Oops, something went wrong.
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