Skip to content

Commit 4360c9c

Browse files
authored
Relationship Updates (#3)
* Add Generator tab updated * Mapping tab notice and update expander titles after user updates label or types * New generator tab updated to support creating relationship generators * Streamlit multipage app structure added * Property mapping shifted certain properties to be optional + moved loading state functions from overview to default_state widget * WIP node mapping and relationship mapping row widgets started * nav bar added but commented out * Import page refactored * secondary mappings and mapping widgets removed - returned to single mappings page (temp was Properties page) * Assignment generator type added * Original SPA tab app updated * Exhaustive assignment generator mostly working * Generator importing from csv + GeneratorArg now includes hints and descriptions * Copy & Paste json import added * Minor UI copy updates * Empty node and relationship mappings added + mapping page support for non imported scenarios * WIP No import option support - new empty nodes supported * Relationship nodes updated to support non-imported scenarios * Minor clean up * Globals simplified * Fixes for adding and removing nodes and relationships when no imported data used * MAJOR cleanup + data import tab added
1 parent 23e8d93 commit 4360c9c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+18385
-987
lines changed

β€ŽREADME.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# MOCK DATA GENERATOR
2-
An app for generating mock graph data for [Neo4j](https://neo4j.com/) database instances.
1+
# MOCK GRAPH DATA GENERATOR
2+
This is a prototype app for generating mock graph data for [Neo4j](https://neo4j.com/) database instances.
33

44
## Requirements
55
[Poetry](https://python-poetry.org/) should be installed. Code in this repo uses Poetry for managing dependencies and running a virtual environment.
@@ -8,4 +8,4 @@ The app uses [Streamlit](https://streamlit.io/) to create and manage the UI inte
88

99
## Running
1010
Locally
11-
`poetry run streamlit run mock_generators/app.py`
11+
`poetry run streamlit run mock_generators/app.py`

β€Žmock_generators/app.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from tabs.generate_tab import generate_tab
88
from tabs.export_tab import export_tab
99
from tabs.importing_tab import import_tab
10-
from models.generator import Generator
10+
from tabs.design_tab import design_tab
11+
from tabs.data_importer import data_importer_tab
1112
from models.mapping import Mapping
12-
from models.node_mapping import NodeMapping
13-
from models.relationship_mapping import RelationshipMapping
14-
from models.property_mapping import PropertyMapping
13+
1514

1615
# SETUP
1716
st.set_page_config(layout="wide")
@@ -34,6 +33,10 @@
3433
# TODO: Replace with reference to selected import file
3534
if IMPORTED_FILE not in st.session_state:
3635
st.session_state[IMPORTED_FILE] = None
36+
if IMPORTED_NODES not in st.session_state:
37+
st.session_state[IMPORTED_NODES] = []
38+
if IMPORTED_RELATIONSHIPS not in st.session_state:
39+
st.session_state[IMPORTED_RELATIONSHIPS] = []
3740
if EXPORTS_PATH not in st.session_state:
3841
st.session_state[EXPORTS_PATH] = DEFAULT_EXPORTS_PATH
3942
if CODE_TEMPLATE_FILE not in st.session_state:
@@ -50,25 +53,32 @@
5053
generators = None
5154
imported_file = None
5255

53-
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(["Config >", "Import >", "Mapping >", "Generators >", "New Generator >", "Generate >", "Export"])
56+
# Streamlit runs from top-to-bottom from tabs 1 through 8. This is essentially one giant single page app. Earlier attempt to use Streamlit's multi-page app functionality resulted in an inconsistent state between pages.
57+
tab1, tab2, tab3, tab4, tab5, tab6, tab7, tab8, tab9 = st.tabs(["Config >", "Design >", "Import >", "Mapping >", "Search Generators >", "Add New Generator >", "Generate >", "Export >", "Data Importer"])
5458

5559
with tab1:
5660
config_tab()
5761

5862
with tab2:
59-
import_tab()
63+
design_tab()
6064

6165
with tab3:
62-
mapping_tab()
66+
import_tab()
6367

6468
with tab4:
65-
generators_tab()
69+
mapping_tab()
6670

6771
with tab5:
68-
create_tab()
72+
generators_tab()
6973

7074
with tab6:
71-
generate_tab()
75+
create_tab()
7276

7377
with tab7:
74-
export_tab()
78+
generate_tab()
79+
80+
with tab8:
81+
export_tab()
82+
83+
with tab9:
84+
data_importer_tab()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
These files used as base classes in the original schema to make generator implementations. However, issues were encountered with the generators accessing these abstract base classes. They are retained here for reference.

β€Žmock_generators/base_generators/bool_generator.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from abc import ABC, abstractmethod
2+
from dataclasses import dataclass
23

34
class BoolGenerator(ABC):
45
def __init__(self):

β€Žmock_generators/constants.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,38 @@
1313
GENERATORS = "generators"
1414
SPEC_FILE = "spec_filepath"
1515
CODE_FILE = "code_filepath"
16-
IMPORTED_FILE = "uploaded_file" # Old key for selected import file
16+
IMPORTED_FILE = "uploaded_file" # Old key for selected import file, this is the raw imported file
1717
IMPORTED_FILENAME = "imported_filename"
18+
IMPORTED_NODES = "imported_nodes"
19+
IMPORTED_RELATIONSHIPS = "imported_relationships"
1820
SAMPLE_ARROWS_FILE= "sample_arrows"
1921
IMPORTS_PATH = "imports_path"
2022
EXPORTS_PATH = "exports_path"
2123
ZIPS_PATH = "zips_path"
2224
CODE_TEMPLATE_FILE = "templates_file"
2325
DEFAULT_DATA_IMPORTER_FILENAME = "neo4j_importer_model"
26+
NEW_GENERATOR_ARGS = "new_generator_args"
2427

2528
# TODO: Can Streamlit's st.session hold all the data we'll be generating?
2629
MAPPINGS = "mappings"
30+
31+
# TODO: Add page titles
32+
# OVERVIEW_PAGE_TITLE = "🏠 Overview"
33+
# DESIGN_PAGE_TITLE = "✍️ Design"
34+
# IMPORT_PAGE_TITLE = "πŸ”Ό Import"
35+
# SETTINGS_PAGE_TITLE = "βš™οΈ Settings"
36+
# MAPPINGS_PAGE_TITLE = "πŸ”€ Mapping"
37+
# GENERATORS_PAGE_TITLE = "πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Generators"
38+
# GENERATE_PAGE_TITLE = "πŸƒβ€β™‚οΈ Generate"
39+
# EXPORT_PAGE_TITLE = "πŸ”½ Export"
40+
# PROPERTIES_PAGE_TITLE = "🧩 Properties"
41+
42+
# OVERVIEW_SHORT_TITLE = "Overview"
43+
# DESIGN_SHORT_TITLE = "Design"
44+
# IMPORT_SHORT_TITLE = "Import"
45+
# PROPERTIES_SHORT_TITLE = "Properties"
46+
# MAPPINGS_SHORT_TITLE = "Mapping"
47+
# GENERATE_SHORT_TITLE = "Generate"
48+
# EXPORT_SHORT_TITLE = "Export"
49+
# SETTINGS_SHORT_TITLE = "Settings"
50+
# GENERATORS_SHORT_TITLE = "Generators"

β€Žmock_generators/datasets/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sample datasets of files that can be used by some of the generators.

0 commit comments

Comments
Β (0)