normalized-schema-generator 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .ipynb_checkpoints/
10
+ .DS_Store
11
+ *.pen
12
+ .claude/
13
+ _requirements/
14
+ prompt.md
15
+ normalized_schema_widget.py
16
+ LocalTest.ipynb
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 rosikm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: normalized-schema-generator
3
+ Version: 0.1.0
4
+ Summary: An anywidget for Microsoft Fabric notebooks that visually configures normalized schema JSON for Process Mining data import.
5
+ Project-URL: Homepage, https://github.com/rosikm/normalized-schema-generator
6
+ Project-URL: Repository, https://github.com/rosikm/normalized-schema-generator
7
+ Project-URL: Issues, https://github.com/rosikm/normalized-schema-generator/issues
8
+ Author: rosikm
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: anywidget,fabric,jupyter,process-mining,widget
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: Jupyter
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Requires-Python: >=3.9
18
+ Requires-Dist: anywidget>=0.9.0
19
+ Requires-Dist: traitlets>=5.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Normalized Schema Generator
23
+
24
+ An [anywidget](https://anywidget.dev)-based Jupyter widget for **Microsoft Fabric** notebooks that visually configures a normalized schema JSON config for **Process Mining** data import.
25
+
26
+ Replaces manual JSON authoring by providing dropdowns, toggles, and inline forms to select lakehouses, tables, columns, and FK/PK relationships, then auto-generates the `dataSource` section of the config.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install normalized-schema-generator
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### In a Fabric notebook
37
+
38
+ ```python
39
+ from normalized_schema_generator import NormalizedSchemaWidget
40
+
41
+ w = NormalizedSchemaWidget()
42
+ w
43
+ ```
44
+
45
+ The widget auto-detects the Fabric environment and populates lakehouses, tables, and columns using `notebookutils` and Spark.
46
+
47
+ After configuring your schema, retrieve the generated JSON:
48
+
49
+ ```python
50
+ print(w.config_json)
51
+ ```
52
+
53
+ ### Local development
54
+
55
+ Outside Fabric, the widget uses mock data automatically — no `notebookutils` or Spark needed:
56
+
57
+ ```bash
58
+ pip install normalized-schema-generator jupyterlab
59
+ jupyter lab
60
+ ```
61
+
62
+ ## Features
63
+
64
+ - **Lakehouse selection** from the current workspace
65
+ - **Data source toggle**: Delta Tables or Files (CSV / Parquet)
66
+ - **Events table** (required): column checklist with data type badges, include/exclude toggles
67
+ - **Cases table** (optional): same column management, with required Events-to-Cases FK relationship
68
+ - **Reference management**: add/edit/remove FK joins to lookup tables, with target column selection
69
+ - **Auto-generated JSON**: full `inputDataBinding` config with `dataSource`, connection properties, and dataset definitions
70
+ - **Copy to clipboard** for the generated JSON
71
+ - **Fluent 2 styling** matching the Fabric design language
72
+
73
+ ## JSON output
74
+
75
+ The widget generates a complete normalized import config following the [Process Mining Normalized Import specification](https://learn.microsoft.com/en-us/power-automate/process-mining-overview):
76
+
77
+ - `dataSourceSchemaType: 1` (Normalized)
78
+ - `dataSourceType: 2` (OneLake)
79
+ - Proper `datasets[]` with Kind 0 (Event), 1 (Case), 2 (Join)
80
+ - FK columns excluded from `Columns[]` (exposed via `Join[].ExportName`)
81
+ - No nested joins on lookup datasets
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,64 @@
1
+ # Normalized Schema Generator
2
+
3
+ An [anywidget](https://anywidget.dev)-based Jupyter widget for **Microsoft Fabric** notebooks that visually configures a normalized schema JSON config for **Process Mining** data import.
4
+
5
+ Replaces manual JSON authoring by providing dropdowns, toggles, and inline forms to select lakehouses, tables, columns, and FK/PK relationships, then auto-generates the `dataSource` section of the config.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install normalized-schema-generator
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### In a Fabric notebook
16
+
17
+ ```python
18
+ from normalized_schema_generator import NormalizedSchemaWidget
19
+
20
+ w = NormalizedSchemaWidget()
21
+ w
22
+ ```
23
+
24
+ The widget auto-detects the Fabric environment and populates lakehouses, tables, and columns using `notebookutils` and Spark.
25
+
26
+ After configuring your schema, retrieve the generated JSON:
27
+
28
+ ```python
29
+ print(w.config_json)
30
+ ```
31
+
32
+ ### Local development
33
+
34
+ Outside Fabric, the widget uses mock data automatically — no `notebookutils` or Spark needed:
35
+
36
+ ```bash
37
+ pip install normalized-schema-generator jupyterlab
38
+ jupyter lab
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - **Lakehouse selection** from the current workspace
44
+ - **Data source toggle**: Delta Tables or Files (CSV / Parquet)
45
+ - **Events table** (required): column checklist with data type badges, include/exclude toggles
46
+ - **Cases table** (optional): same column management, with required Events-to-Cases FK relationship
47
+ - **Reference management**: add/edit/remove FK joins to lookup tables, with target column selection
48
+ - **Auto-generated JSON**: full `inputDataBinding` config with `dataSource`, connection properties, and dataset definitions
49
+ - **Copy to clipboard** for the generated JSON
50
+ - **Fluent 2 styling** matching the Fabric design language
51
+
52
+ ## JSON output
53
+
54
+ The widget generates a complete normalized import config following the [Process Mining Normalized Import specification](https://learn.microsoft.com/en-us/power-automate/process-mining-overview):
55
+
56
+ - `dataSourceSchemaType: 1` (Normalized)
57
+ - `dataSourceType: 2` (OneLake)
58
+ - Proper `datasets[]` with Kind 0 (Event), 1 (Case), 2 (Join)
59
+ - FK columns excluded from `Columns[]` (exposed via `Join[].ExportName`)
60
+ - No nested joins on lookup datasets
61
+
62
+ ## License
63
+
64
+ MIT
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "normalized-schema-generator"
7
+ version = "0.1.0"
8
+ description = "An anywidget for Microsoft Fabric notebooks that visually configures normalized schema JSON for Process Mining data import."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "rosikm" }]
13
+ keywords = ["anywidget", "jupyter", "widget", "fabric", "process-mining"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Framework :: Jupyter",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Scientific/Engineering",
20
+ ]
21
+ dependencies = [
22
+ "anywidget>=0.9.0",
23
+ "traitlets>=5.0",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/rosikm/normalized-schema-generator"
28
+ Repository = "https://github.com/rosikm/normalized-schema-generator"
29
+ Issues = "https://github.com/rosikm/normalized-schema-generator/issues"
30
+
31
+ [tool.hatch.metadata]
32
+ license-files = []
33
+
34
+ [tool.hatch.build]
35
+ artifacts = ["src/normalized_schema_generator/*.js", "src/normalized_schema_generator/*.css"]
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/normalized_schema_generator"]
@@ -0,0 +1,6 @@
1
+ """Normalized Schema Generator — anywidget for Microsoft Fabric Process Mining."""
2
+
3
+ from .widget import NormalizedSchemaWidget
4
+
5
+ __all__ = ["NormalizedSchemaWidget"]
6
+ __version__ = "0.1.0"
@@ -0,0 +1,125 @@
1
+ /* ── Fluent 2 tokens ── */
2
+ .nsw { --f-font: "Segoe UI Variable","Segoe UI",-apple-system,Helvetica,Arial,sans-serif; --f-mono: "Cascadia Code","Cascadia Mono","Consolas","SF Mono","Menlo","Courier New",monospace; --f-bg: #fff; --f-surface: #fafafa; --f-border: #e0e0e0; --f-border-strong: #d1d1d1; --f-text: #242424; --f-text2: #616161; --f-text3: #8a8a8a; --f-brand: #0F6CBD; --f-brand-hover: #115EA3; --f-brand-bg: #EBF3FC; --f-danger: #C4314B; --f-danger-bg: #FDF3F4; --f-success: #0E7A0D; --f-success-bg: #F1FAF1; --f-warn: #F7630C; --f-warn-bg: #FFF9F5; --f-shadow4: 0 2px 4px rgba(0,0,0,.06); --f-shadow8: 0 2px 8px rgba(0,0,0,.1); --f-radius: 8px; --f-radius-sm: 4px; }
3
+ .nsw { font-family: var(--f-font); max-width: 900px; color: var(--f-text); font-size: 13px; line-height: 1.5; }
4
+ .nsw *, .nsw *::before, .nsw *::after { box-sizing: border-box; }
5
+
6
+ /* Header */
7
+ .nsw-header { margin-bottom: 16px; }
8
+ .nsw-header h2 { font-size: 20px; font-weight: 600; margin: 0 0 2px; color: var(--f-text); }
9
+ .nsw-header p { font-size: 12px; color: var(--f-text2); margin: 0; }
10
+
11
+ /* Cards */
12
+ .nsw-card { border: 1px solid var(--f-border); border-radius: var(--f-radius); padding: 16px; margin-bottom: 12px; background: var(--f-bg); box-shadow: var(--f-shadow4); }
13
+ .nsw-card.events { border-left: 3px solid var(--f-brand); }
14
+ .nsw-card.cases { border-left: 3px solid #E8AB02; }
15
+ .nsw-card.output { border-left: 3px solid var(--f-text3); }
16
+ .nsw-card-title { font-size: 14px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
17
+ .nsw-card-title .badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: var(--f-radius-sm); text-transform: uppercase; letter-spacing: 0.04em; }
18
+ .nsw-card.events .badge { background: var(--f-brand-bg); color: var(--f-brand); }
19
+ .nsw-card.cases .badge { background: #FFF8E1; color: #7A6200; }
20
+
21
+ /* Form rows */
22
+ .nsw-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
23
+ .nsw-label { font-size: 12px; font-weight: 600; color: var(--f-text2); min-width: 90px; flex-shrink: 0; }
24
+ .nsw-label.sm { min-width: 70px; }
25
+
26
+ /* Fluent 2 select / input */
27
+ .nsw-select { font-family: var(--f-font); font-size: 13px; padding: 5px 28px 5px 8px; border: 1px solid var(--f-border-strong); border-bottom: 2px solid var(--f-border-strong); border-radius: var(--f-radius-sm); background: var(--f-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23616161'/%3E%3C/svg%3E") no-repeat right 8px center; appearance: none; cursor: pointer; min-width: 170px; color: var(--f-text); transition: border-color 0.15s; }
28
+ .nsw-select:focus { outline: none; border-bottom-color: var(--f-brand); }
29
+ .nsw-select:disabled { background-color: var(--f-surface); color: var(--f-text3); cursor: default; border-color: var(--f-border); }
30
+ .nsw-input { font-family: var(--f-font); font-size: 13px; padding: 5px 8px; border: 1px solid var(--f-border-strong); border-bottom: 2px solid var(--f-border-strong); border-radius: var(--f-radius-sm); min-width: 170px; color: var(--f-text); transition: border-color 0.15s; background: var(--f-bg); }
31
+ .nsw-input:focus { outline: none; border-bottom-color: var(--f-brand); }
32
+
33
+ /* Fluent 2 toggle group (segmented) */
34
+ .nsw-toggle { display: inline-flex; background: #e8e8e8; border-radius: var(--f-radius-sm); padding: 2px; gap: 2px; }
35
+ .nsw-toggle button { font-family: var(--f-font); font-size: 13px; padding: 5px 18px; border: none; background: transparent; color: var(--f-text2); cursor: pointer; transition: all 0.15s; border-radius: 3px; font-weight: 400; }
36
+ .nsw-toggle button.active { background: var(--f-brand); color: #fff; font-weight: 600; }
37
+ .nsw-toggle button:not(.active):hover { background: rgba(0,0,0,.06); color: var(--f-text); }
38
+
39
+ /* Column list */
40
+ .nsw-col-list { border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); max-height: 240px; overflow-y: auto; margin: 4px 0 8px; }
41
+ .nsw-col-row { display: flex; align-items: center; padding: 6px 12px; gap: 10px; border-bottom: 1px solid #f2f2f2; min-height: 32px; }
42
+ .nsw-col-row:last-child { border-bottom: none; }
43
+ .nsw-col-row:hover { background: var(--f-surface); }
44
+ .nsw-col-name { font-family: var(--f-mono); font-size: 13px; flex: 1; color: var(--f-text); letter-spacing: -0.01em; }
45
+ .nsw-col-dtype { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.03em; flex-shrink: 0; }
46
+ .nsw-col-dtype.int { background: var(--f-success-bg); color: var(--f-success); }
47
+ .nsw-col-dtype.double { background: var(--f-warn-bg); color: var(--f-warn); }
48
+ .nsw-col-dtype.string { background: var(--f-brand-bg); color: var(--f-brand); }
49
+ .nsw-col-dtype.timestamp { background: #F3E5F5; color: #7B1FA2; }
50
+ .nsw-col-dtype.boolean { background: var(--f-danger-bg); color: var(--f-danger); }
51
+ .nsw-col-dtype.other { background: var(--f-surface); color: var(--f-text2); }
52
+
53
+ /* Fluent 2 toggle switch */
54
+ .nsw-toggle-cb { position: relative; width: 40px; height: 20px; flex-shrink: 0; }
55
+ .nsw-toggle-cb input { opacity: 0; width: 0; height: 0; position: absolute; }
56
+ .nsw-toggle-cb .slider { position: absolute; inset: 0; background: var(--f-border-strong); border-radius: 10px; cursor: pointer; transition: 0.15s; border: 1px solid transparent; }
57
+ .nsw-toggle-cb .slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
58
+ .nsw-toggle-cb input:checked + .slider { background: var(--f-brand); }
59
+ .nsw-toggle-cb input:checked + .slider::before { transform: translateX(20px); }
60
+
61
+ /* Cases relationship */
62
+ .nsw-rel-form { border: 1px solid #E8AB02; border-radius: var(--f-radius-sm); padding: 10px 12px; margin: 8px 0; background: #FFFDF5; }
63
+ .nsw-rel-form .nsw-row { margin-bottom: 6px; }
64
+ .nsw-rel-form .rel-title { font-size: 12px; font-weight: 600; color: #7A6200; margin-bottom: 6px; }
65
+ .nsw-rel-status { font-size: 11px; padding: 4px 10px; border-radius: var(--f-radius-sm); }
66
+ .nsw-rel-status.configured { background: var(--f-success-bg); color: var(--f-success); }
67
+ .nsw-rel-status.missing { background: var(--f-warn-bg); color: var(--f-warn); }
68
+
69
+ /* Joins / References */
70
+ .nsw-joins-title { font-size: 12px; font-weight: 600; color: var(--f-text2); margin-bottom: 4px; }
71
+ .nsw-join-item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); margin-bottom: 4px; font-size: 12px; }
72
+ .nsw-join-item .join-desc { flex: 1; font-family: var(--f-mono); font-size: 11px; }
73
+ .nsw-join-item .join-type { font-size: 10px; padding: 1px 6px; background: var(--f-brand-bg); color: var(--f-brand); border-radius: 3px; font-weight: 600; }
74
+
75
+ /* Fluent 2 buttons — three appearances: subtle (default), outline, primary */
76
+ .nsw-btn { font-family: var(--f-font); font-size: 14px; min-height: 32px; padding: 0 12px; border: none; border-radius: var(--f-radius-sm); background: transparent; color: var(--f-brand); cursor: pointer; transition: background 0.1s; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
77
+ .nsw-btn:hover { background: var(--f-brand-bg); }
78
+ .nsw-btn.outline { border: 1px solid var(--f-border-strong); background: var(--f-bg); color: var(--f-text); font-weight: 400; }
79
+ .nsw-btn.outline:hover { background: var(--f-surface); }
80
+ .nsw-btn.primary { background: var(--f-brand); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
81
+ .nsw-btn.primary:hover { background: var(--f-brand-hover); box-shadow: 0 2px 4px rgba(0,0,0,.18); }
82
+ .nsw-btn.danger { color: var(--f-danger); font-weight: 400; }
83
+ .nsw-btn.danger:hover { background: var(--f-danger-bg); }
84
+ .nsw-btn.sm { font-size: 12px; min-height: 28px; padding: 0 10px; }
85
+ .nsw-btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
86
+
87
+ /* Add Reference form */
88
+ .nsw-ref-form { border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); padding: 10px 12px; margin: 8px 0; background: var(--f-surface); }
89
+ .nsw-ref-form .nsw-row { margin-bottom: 6px; }
90
+ .nsw-ref-form .form-actions { display: flex; gap: 8px; margin-top: 8px; }
91
+
92
+ /* Pair row for FK/PK side-by-side */
93
+ .nsw-pair-row { display: flex; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
94
+ .nsw-pair-row .nsw-pair { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
95
+
96
+ /* JSON output */
97
+ .nsw-json-wrap { position: relative; }
98
+ .nsw-json { font-family: var(--f-mono); font-size: 11.5px; background: var(--f-surface); border: 1px solid var(--f-border); border-radius: var(--f-radius-sm); padding: 12px; max-height: 400px; overflow: auto; white-space: pre; line-height: 1.45; color: var(--f-text); }
99
+ .nsw-copy-btn { position: absolute; top: 8px; right: 8px; }
100
+ .nsw-copied { font-size: 11px; color: var(--f-success); font-weight: 600; padding: 3px 10px; }
101
+
102
+ /* Collapse toggle */
103
+ .nsw-collapse-btn { background: none; border: none; font-family: var(--f-font); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; color: var(--f-text); display: flex; align-items: center; gap: 6px; }
104
+ .nsw-collapse-btn:hover { color: var(--f-brand); }
105
+ .nsw-collapse-btn .arrow { display: inline-block; transition: transform 0.15s; font-size: 10px; }
106
+ .nsw-collapse-btn .arrow.open { transform: rotate(90deg); }
107
+
108
+ /* Loading spinner (inline) */
109
+ .nsw-loading-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--f-text2); font-size: 12px; margin-left: 8px; }
110
+ .nsw-loading-inline::before { content: ""; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--f-border); border-top-color: var(--f-brand); border-radius: 50%; animation: nsw-spin 0.6s linear infinite; }
111
+ @keyframes nsw-spin { to { transform: rotate(360deg); } }
112
+
113
+ /* Error / empty */
114
+ .nsw-error { color: var(--f-danger); font-size: 12px; padding: 4px 0; }
115
+ .nsw-empty { color: var(--f-text3); font-size: 12px; font-style: italic; padding: 6px 10px; }
116
+
117
+ /* Divider */
118
+ .nsw-divider { border: none; border-top: 1px solid var(--f-border); margin: 10px 0; }
119
+
120
+ /* Cases placeholder */
121
+ .nsw-cases-placeholder { display: flex; align-items: center; justify-content: center; padding: 16px; border: 1.5px dashed #E8AB02; border-radius: var(--f-radius); margin-bottom: 12px; }
122
+
123
+ /* Scrollbar */
124
+ .nsw-col-list::-webkit-scrollbar, .nsw-json::-webkit-scrollbar { width: 6px; }
125
+ .nsw-col-list::-webkit-scrollbar-thumb, .nsw-json::-webkit-scrollbar-thumb { background: var(--f-border-strong); border-radius: 3px; }