quicksight-codegen 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.
Files changed (40) hide show
  1. quicksight_codegen-0.1.0/.env.example +25 -0
  2. quicksight_codegen-0.1.0/.gitignore +224 -0
  3. quicksight_codegen-0.1.0/LICENSE +21 -0
  4. quicksight_codegen-0.1.0/PKG-INFO +233 -0
  5. quicksight_codegen-0.1.0/README.md +203 -0
  6. quicksight_codegen-0.1.0/README_zh.md +134 -0
  7. quicksight_codegen-0.1.0/examples/basic_dashboard.py +72 -0
  8. quicksight_codegen-0.1.0/examples/deploy_to_aws.py +91 -0
  9. quicksight_codegen-0.1.0/examples/esg_dashboard.py +54 -0
  10. quicksight_codegen-0.1.0/pyproject.toml +50 -0
  11. quicksight_codegen-0.1.0/scripts/deploy_to_quicksight.py +102 -0
  12. quicksight_codegen-0.1.0/scripts/generate_demo_data.py +82 -0
  13. quicksight_codegen-0.1.0/src/quicksight_codegen/__init__.py +203 -0
  14. quicksight_codegen-0.1.0/src/quicksight_codegen/__main__.py +4 -0
  15. quicksight_codegen-0.1.0/src/quicksight_codegen/analysis.py +609 -0
  16. quicksight_codegen-0.1.0/src/quicksight_codegen/auto.py +660 -0
  17. quicksight_codegen-0.1.0/src/quicksight_codegen/cli.py +274 -0
  18. quicksight_codegen-0.1.0/src/quicksight_codegen/controls.py +284 -0
  19. quicksight_codegen-0.1.0/src/quicksight_codegen/dataset.py +298 -0
  20. quicksight_codegen-0.1.0/src/quicksight_codegen/deploy.py +217 -0
  21. quicksight_codegen-0.1.0/src/quicksight_codegen/discovery.py +199 -0
  22. quicksight_codegen-0.1.0/src/quicksight_codegen/filters.py +374 -0
  23. quicksight_codegen-0.1.0/src/quicksight_codegen/parameters.py +193 -0
  24. quicksight_codegen-0.1.0/src/quicksight_codegen/preview.py +1311 -0
  25. quicksight_codegen-0.1.0/src/quicksight_codegen/sheets.py +143 -0
  26. quicksight_codegen-0.1.0/src/quicksight_codegen/templates/__init__.py +39 -0
  27. quicksight_codegen-0.1.0/src/quicksight_codegen/templates/esg.py +296 -0
  28. quicksight_codegen-0.1.0/src/quicksight_codegen/templates/portfolio.py +54 -0
  29. quicksight_codegen-0.1.0/src/quicksight_codegen/themes.py +313 -0
  30. quicksight_codegen-0.1.0/src/quicksight_codegen/utils.py +59 -0
  31. quicksight_codegen-0.1.0/src/quicksight_codegen/visuals/__init__.py +46 -0
  32. quicksight_codegen-0.1.0/src/quicksight_codegen/visuals/advanced.py +417 -0
  33. quicksight_codegen-0.1.0/src/quicksight_codegen/visuals/base.py +276 -0
  34. quicksight_codegen-0.1.0/src/quicksight_codegen/visuals/basic.py +405 -0
  35. quicksight_codegen-0.1.0/tests/__init__.py +1 -0
  36. quicksight_codegen-0.1.0/tests/test_analysis.py +94 -0
  37. quicksight_codegen-0.1.0/tests/test_dataset.py +88 -0
  38. quicksight_codegen-0.1.0/tests/test_sheets.py +38 -0
  39. quicksight_codegen-0.1.0/tests/test_visuals.py +95 -0
  40. quicksight_codegen-0.1.0/uv.lock +975 -0
@@ -0,0 +1,25 @@
1
+ # AWS Configuration for QuickSight deployment
2
+ # Copy this file to .env and fill in your values
3
+ #
4
+ # Usage:
5
+ # cp .env.example .env
6
+ # # Edit .env with your values
7
+ # python scripts/deploy_to_quicksight.py
8
+
9
+ # AWS Account ID (12-digit number, find in AWS Console top-right corner)
10
+ AWS_ACCOUNT_ID=123456789012
11
+
12
+ # AWS Region (same region as your QuickSight)
13
+ AWS_REGION=eu-central-1
14
+
15
+ # QuickSight Dataset ARN
16
+ # Find at: QuickSight > Datasets > [Your Dataset] > Share > Copy ARN
17
+ QUICKSIGHT_DATASET_ARN=arn:aws:quicksight:eu-central-1:123456789012:dataset/your-dataset-id
18
+
19
+ # QuickSight User ARN (for permissions)
20
+ # Find at: QuickSight > Manage QuickSight > Manage Users > [Your User]
21
+ QUICKSIGHT_USER_ARN=arn:aws:quicksight:eu-central-1:123456789012:user/default/your-email@example.com
22
+
23
+ # S3 Bucket for full-auto dataset upload (Plan A — requires S3 permissions)
24
+ # Leave empty if using the web console upload workflow (Plan B)
25
+ # S3_BUCKET=my-quicksight-data-bucket
@@ -0,0 +1,224 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+ .ipynb_checkpoints/
6
+ *.pyc
7
+ .venv/
8
+ .env
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py.cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ #uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ #poetry.lock
112
+ #poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ #pdm.lock
119
+ #pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ #pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi
129
+
130
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
131
+ __pypackages__/
132
+
133
+ # Celery stuff
134
+ celerybeat-schedule
135
+ celerybeat.pid
136
+
137
+ # SageMath parsed files
138
+ *.sage.py
139
+
140
+ # Environments
141
+ .env
142
+ .envrc
143
+ .venv
144
+ env/
145
+ venv/
146
+ ENV/
147
+ env.bak/
148
+ venv.bak/
149
+
150
+ # Spyder project settings
151
+ .spyderproject
152
+ .spyproject
153
+
154
+ # Rope project settings
155
+ .ropeproject
156
+
157
+ # mkdocs documentation
158
+ /site
159
+
160
+ # mypy
161
+ .mypy_cache/
162
+ .dmypy.json
163
+ dmypy.json
164
+
165
+ # Pyre type checker
166
+ .pyre/
167
+
168
+ # pytype static type analyzer
169
+ .pytype/
170
+
171
+ # Cython debug symbols
172
+ cython_debug/
173
+
174
+ # PyCharm
175
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
176
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
177
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
178
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
179
+ #.idea/
180
+
181
+ # Abstra
182
+ # Abstra is an AI-powered process automation framework.
183
+ # Ignore directories containing user credentials, local state, and settings.
184
+ # Learn more at https://abstra.io/docs
185
+ .abstra/
186
+
187
+ # Visual Studio Code
188
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
189
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
190
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
191
+ # you could uncomment the following to ignore the entire vscode folder
192
+ # .vscode/
193
+
194
+ # Ruff stuff:
195
+ .ruff_cache/
196
+
197
+ # PyPI configuration file
198
+ .pypirc
199
+
200
+ # Cursor
201
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
202
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
203
+ # refer to https://docs.cursor.com/context/ignore-files
204
+ .cursorignore
205
+ .cursorindexingignore
206
+
207
+ # Marimo
208
+ marimo/_static/
209
+ marimo/_lsp/
210
+ __marimo__/
211
+
212
+ # Project specific
213
+ output/
214
+ *.json
215
+ !pyproject.toml
216
+ *.html
217
+ *.csv
218
+ *.xlsx
219
+ *.pdf
220
+ .DS_Store
221
+ .claude/
222
+ scripts/*.sh
223
+ decisionlog.md
224
+ presentation.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ESG QuickSight Team
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,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: quicksight-codegen
3
+ Version: 0.1.0
4
+ Summary: A Python library for generating Amazon QuickSight dashboards as code
5
+ Project-URL: Homepage, https://github.com/YasZl/esg-quicksight-as-code
6
+ Project-URL: Documentation, https://github.com/YasZl/esg-quicksight-as-code#readme
7
+ Author: ESG QuickSight Team
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: analytics,aws,bi,codegen,dashboard,quicksight
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.9
20
+ Requires-Dist: python-dotenv>=1.0.0
21
+ Provides-Extra: auto
22
+ Requires-Dist: pandas>=1.5.0; extra == 'auto'
23
+ Provides-Extra: aws
24
+ Requires-Dist: boto3>=1.26.0; extra == 'aws'
25
+ Provides-Extra: dev
26
+ Requires-Dist: pandas>=1.5.0; extra == 'dev'
27
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # quicksight-codegen
32
+
33
+ Generate and deploy Amazon QuickSight dashboards from any CSV file. One command, zero manual configuration.
34
+
35
+ ```bash
36
+ # Preview locally (no AWS needed)
37
+ quicksight-codegen preview --csv your_data.csv
38
+
39
+ # Deploy to QuickSight
40
+ quicksight-codegen deploy --csv your_data.csv --dataset "your-dataset" --name "My Dashboard"
41
+ ```
42
+
43
+ The tool automatically analyzes your CSV columns, picks the right chart types (KPI, bar, pie, heatmap, table), adds interactive filters, and handles data type conversion — all as code.
44
+
45
+ ## Quick Start
46
+
47
+ ### 1. Install
48
+
49
+ ```bash
50
+ git clone https://github.com/AzerMusic/esg-quicksight-as-code.git
51
+ cd esg-quicksight-as-code
52
+
53
+ # Using uv (recommended)
54
+ uv venv && uv pip install -e ".[aws,auto]"
55
+
56
+ # Or using pip
57
+ python -m venv .venv && source .venv/bin/activate
58
+ pip install -e ".[aws,auto]"
59
+ ```
60
+
61
+ ### 2. Preview locally (no AWS required)
62
+
63
+ ```bash
64
+ quicksight-codegen preview --csv your_data.csv --name "My Dashboard"
65
+ ```
66
+
67
+ This generates an HTML file with interactive Chart.js charts you can open in any browser.
68
+
69
+ ### 3. Deploy to AWS QuickSight
70
+
71
+ **Prerequisites:**
72
+ - AWS CLI configured (`aws configure`)
73
+ - QuickSight activated in your AWS account
74
+ - A dataset uploaded via QuickSight web console ("Upload a file")
75
+
76
+ **Setup environment:**
77
+
78
+ ```bash
79
+ cp .env.example .env
80
+ # Edit .env with your values (see "Finding Your AWS Values" below)
81
+ ```
82
+
83
+ **Deploy:**
84
+
85
+ ```bash
86
+ # List your datasets to find the right name
87
+ quicksight-codegen list-datasets
88
+
89
+ # Deploy
90
+ quicksight-codegen deploy \
91
+ --csv your_data.csv \
92
+ --dataset "your-dataset-name" \
93
+ --name "My Dashboard"
94
+ ```
95
+
96
+ The tool will:
97
+ - Auto-detect your AWS account ID, region, and QuickSight user
98
+ - Generate KPIs, charts, heatmaps, and tables based on your data
99
+ - Add dropdown filters for categorical columns (Sector, Region, etc.)
100
+ - Create `parseDecimal()` calculated fields so numeric columns work without manual type fixing
101
+ - Deploy as a QuickSight Analysis you can open immediately
102
+
103
+ ## Finding Your AWS Values
104
+
105
+ | Variable | Where to find it |
106
+ |----------|-----------------|
107
+ | `AWS_ACCOUNT_ID` | AWS Console top-right corner, or run `aws sts get-caller-identity` |
108
+ | `AWS_REGION` | The region where QuickSight is activated (e.g., `eu-central-1`) |
109
+ | `QUICKSIGHT_DATASET_ARN` | QuickSight > Datasets > your dataset > Share > Copy ARN |
110
+ | `QUICKSIGHT_USER_ARN` | QuickSight > Manage QuickSight > Manage Users > your user |
111
+
112
+ Most of these are **auto-detected** if your AWS CLI is configured. You only need `.env` if auto-detection doesn't work for your setup.
113
+
114
+ ## CLI Commands
115
+
116
+ | Command | Description |
117
+ |---------|-------------|
118
+ | `quicksight-codegen preview --csv data.csv` | Generate local HTML preview |
119
+ | `quicksight-codegen deploy --csv data.csv --dataset "name" --name "title"` | Generate and deploy to QuickSight |
120
+ | `quicksight-codegen list-datasets` | List available QuickSight datasets |
121
+ | `quicksight-codegen fix-types --csv data.csv --dataset "name"` | Fix dataset column types (SPICE datasets only) |
122
+
123
+ ### Deploy options
124
+
125
+ ```bash
126
+ quicksight-codegen deploy \
127
+ --csv data.csv \ # Path to CSV or Excel file
128
+ --dataset "my-dataset" \ # Dataset name in QuickSight
129
+ --name "My Dashboard" \ # Dashboard title
130
+ --id "my-dashboard-v1" \ # Analysis ID (optional, auto-generated from name)
131
+ --region eu-central-1 \ # AWS region (optional, auto-detected)
132
+ --update \ # Update existing analysis instead of creating new
133
+ --dry-run \ # Generate JSON only, don't deploy
134
+ --fix-types # Fix column types before deploying (SPICE datasets only)
135
+ ```
136
+
137
+ ## How It Works
138
+
139
+ ```
140
+ CSV file
141
+ |
142
+ v
143
+ Column analysis (numeric vs categorical)
144
+ |
145
+ +--> KPI visuals for key numeric columns
146
+ +--> Bar/Pie charts for numeric × categorical
147
+ +--> Heatmap for numeric × 2 categoricals
148
+ +--> Data table with all columns
149
+ +--> Dropdown filters for categorical columns
150
+ +--> parseDecimal() calculated fields for numeric columns
151
+ |
152
+ v
153
+ QuickSight Analysis JSON + HTML preview
154
+ |
155
+ v
156
+ Deploy via boto3 API
157
+ ```
158
+
159
+ **Key feature: automatic type conversion.** When you upload a CSV to QuickSight, all columns become STRING type. Charts need DECIMAL columns for numeric data. This tool automatically generates `parseDecimal()` calculated fields in the Analysis definition, so charts work immediately without manual type fixing in the QuickSight console.
160
+
161
+ ## Python API
162
+
163
+ For programmatic use, the library exposes all QuickSight visual types:
164
+
165
+ ```python
166
+ from quicksight_codegen import (
167
+ auto_dashboard, # Auto-generate from CSV
168
+ BarChartVisual, # Manual visual construction
169
+ KPIVisual,
170
+ PieChartVisual,
171
+ TableVisual,
172
+ HeatMapVisual,
173
+ deploy_analysis, # Deploy to AWS
174
+ simulate_deploy, # Generate JSON without AWS
175
+ generate_html_preview, # Local HTML preview
176
+ )
177
+
178
+ # Auto mode: one function call
179
+ analysis, html_path = auto_dashboard(
180
+ data="your_data.csv",
181
+ name="My Dashboard",
182
+ output_dir="output/",
183
+ )
184
+
185
+ # Manual mode: full control over each visual
186
+ bar = BarChartVisual("bar-1")
187
+ bar.add_categorical_dimension_field("Region", "dataset")
188
+ bar.add_numerical_measure_field("Revenue", "dataset", "SUM")
189
+ ```
190
+
191
+ See `examples/` for complete examples.
192
+
193
+ ## Supported Visual Types
194
+
195
+ **Basic:** BarChart, LineChart, Table, PivotTable, KPI, PieChart, ScatterPlot
196
+
197
+ **Advanced:** TreeMap, HeatMap, FilledMap, GeospatialMap, FunnelChart, Waterfall, BoxPlot, GaugeChart
198
+
199
+ ## Project Structure
200
+
201
+ ```
202
+ src/quicksight_codegen/
203
+ __init__.py # Public API exports
204
+ auto.py # Auto dashboard generation from CSV
205
+ cli.py # CLI tool (preview, deploy, list-datasets, fix-types)
206
+ analysis.py # Analysis definition, sheets, calculated fields
207
+ deploy.py # AWS QuickSight deployment via boto3
208
+ discovery.py # Auto-detect AWS account, region, user, datasets
209
+ preview.py # HTML preview with Chart.js
210
+ filters.py # Filter types and dropdown controls
211
+ dataset.py # Dataset type inference and fixing
212
+ visuals/ # All visual type classes
213
+ templates/ # Pre-built dashboard templates (ESG, portfolio)
214
+ ```
215
+
216
+ ## Running Tests
217
+
218
+ ```bash
219
+ uv pip install -e ".[dev]"
220
+ uv run pytest
221
+ ```
222
+
223
+ ## Authors
224
+
225
+ - Weihua SHI
226
+ - Yasmine ZEROUAL
227
+ - Adam TOUCHANE
228
+ - Saber BERREHILI
229
+ - Amine MEGHAGHI
230
+
231
+ ## License
232
+
233
+ MIT
@@ -0,0 +1,203 @@
1
+ # quicksight-codegen
2
+
3
+ Generate and deploy Amazon QuickSight dashboards from any CSV file. One command, zero manual configuration.
4
+
5
+ ```bash
6
+ # Preview locally (no AWS needed)
7
+ quicksight-codegen preview --csv your_data.csv
8
+
9
+ # Deploy to QuickSight
10
+ quicksight-codegen deploy --csv your_data.csv --dataset "your-dataset" --name "My Dashboard"
11
+ ```
12
+
13
+ The tool automatically analyzes your CSV columns, picks the right chart types (KPI, bar, pie, heatmap, table), adds interactive filters, and handles data type conversion — all as code.
14
+
15
+ ## Quick Start
16
+
17
+ ### 1. Install
18
+
19
+ ```bash
20
+ git clone https://github.com/AzerMusic/esg-quicksight-as-code.git
21
+ cd esg-quicksight-as-code
22
+
23
+ # Using uv (recommended)
24
+ uv venv && uv pip install -e ".[aws,auto]"
25
+
26
+ # Or using pip
27
+ python -m venv .venv && source .venv/bin/activate
28
+ pip install -e ".[aws,auto]"
29
+ ```
30
+
31
+ ### 2. Preview locally (no AWS required)
32
+
33
+ ```bash
34
+ quicksight-codegen preview --csv your_data.csv --name "My Dashboard"
35
+ ```
36
+
37
+ This generates an HTML file with interactive Chart.js charts you can open in any browser.
38
+
39
+ ### 3. Deploy to AWS QuickSight
40
+
41
+ **Prerequisites:**
42
+ - AWS CLI configured (`aws configure`)
43
+ - QuickSight activated in your AWS account
44
+ - A dataset uploaded via QuickSight web console ("Upload a file")
45
+
46
+ **Setup environment:**
47
+
48
+ ```bash
49
+ cp .env.example .env
50
+ # Edit .env with your values (see "Finding Your AWS Values" below)
51
+ ```
52
+
53
+ **Deploy:**
54
+
55
+ ```bash
56
+ # List your datasets to find the right name
57
+ quicksight-codegen list-datasets
58
+
59
+ # Deploy
60
+ quicksight-codegen deploy \
61
+ --csv your_data.csv \
62
+ --dataset "your-dataset-name" \
63
+ --name "My Dashboard"
64
+ ```
65
+
66
+ The tool will:
67
+ - Auto-detect your AWS account ID, region, and QuickSight user
68
+ - Generate KPIs, charts, heatmaps, and tables based on your data
69
+ - Add dropdown filters for categorical columns (Sector, Region, etc.)
70
+ - Create `parseDecimal()` calculated fields so numeric columns work without manual type fixing
71
+ - Deploy as a QuickSight Analysis you can open immediately
72
+
73
+ ## Finding Your AWS Values
74
+
75
+ | Variable | Where to find it |
76
+ |----------|-----------------|
77
+ | `AWS_ACCOUNT_ID` | AWS Console top-right corner, or run `aws sts get-caller-identity` |
78
+ | `AWS_REGION` | The region where QuickSight is activated (e.g., `eu-central-1`) |
79
+ | `QUICKSIGHT_DATASET_ARN` | QuickSight > Datasets > your dataset > Share > Copy ARN |
80
+ | `QUICKSIGHT_USER_ARN` | QuickSight > Manage QuickSight > Manage Users > your user |
81
+
82
+ Most of these are **auto-detected** if your AWS CLI is configured. You only need `.env` if auto-detection doesn't work for your setup.
83
+
84
+ ## CLI Commands
85
+
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `quicksight-codegen preview --csv data.csv` | Generate local HTML preview |
89
+ | `quicksight-codegen deploy --csv data.csv --dataset "name" --name "title"` | Generate and deploy to QuickSight |
90
+ | `quicksight-codegen list-datasets` | List available QuickSight datasets |
91
+ | `quicksight-codegen fix-types --csv data.csv --dataset "name"` | Fix dataset column types (SPICE datasets only) |
92
+
93
+ ### Deploy options
94
+
95
+ ```bash
96
+ quicksight-codegen deploy \
97
+ --csv data.csv \ # Path to CSV or Excel file
98
+ --dataset "my-dataset" \ # Dataset name in QuickSight
99
+ --name "My Dashboard" \ # Dashboard title
100
+ --id "my-dashboard-v1" \ # Analysis ID (optional, auto-generated from name)
101
+ --region eu-central-1 \ # AWS region (optional, auto-detected)
102
+ --update \ # Update existing analysis instead of creating new
103
+ --dry-run \ # Generate JSON only, don't deploy
104
+ --fix-types # Fix column types before deploying (SPICE datasets only)
105
+ ```
106
+
107
+ ## How It Works
108
+
109
+ ```
110
+ CSV file
111
+ |
112
+ v
113
+ Column analysis (numeric vs categorical)
114
+ |
115
+ +--> KPI visuals for key numeric columns
116
+ +--> Bar/Pie charts for numeric × categorical
117
+ +--> Heatmap for numeric × 2 categoricals
118
+ +--> Data table with all columns
119
+ +--> Dropdown filters for categorical columns
120
+ +--> parseDecimal() calculated fields for numeric columns
121
+ |
122
+ v
123
+ QuickSight Analysis JSON + HTML preview
124
+ |
125
+ v
126
+ Deploy via boto3 API
127
+ ```
128
+
129
+ **Key feature: automatic type conversion.** When you upload a CSV to QuickSight, all columns become STRING type. Charts need DECIMAL columns for numeric data. This tool automatically generates `parseDecimal()` calculated fields in the Analysis definition, so charts work immediately without manual type fixing in the QuickSight console.
130
+
131
+ ## Python API
132
+
133
+ For programmatic use, the library exposes all QuickSight visual types:
134
+
135
+ ```python
136
+ from quicksight_codegen import (
137
+ auto_dashboard, # Auto-generate from CSV
138
+ BarChartVisual, # Manual visual construction
139
+ KPIVisual,
140
+ PieChartVisual,
141
+ TableVisual,
142
+ HeatMapVisual,
143
+ deploy_analysis, # Deploy to AWS
144
+ simulate_deploy, # Generate JSON without AWS
145
+ generate_html_preview, # Local HTML preview
146
+ )
147
+
148
+ # Auto mode: one function call
149
+ analysis, html_path = auto_dashboard(
150
+ data="your_data.csv",
151
+ name="My Dashboard",
152
+ output_dir="output/",
153
+ )
154
+
155
+ # Manual mode: full control over each visual
156
+ bar = BarChartVisual("bar-1")
157
+ bar.add_categorical_dimension_field("Region", "dataset")
158
+ bar.add_numerical_measure_field("Revenue", "dataset", "SUM")
159
+ ```
160
+
161
+ See `examples/` for complete examples.
162
+
163
+ ## Supported Visual Types
164
+
165
+ **Basic:** BarChart, LineChart, Table, PivotTable, KPI, PieChart, ScatterPlot
166
+
167
+ **Advanced:** TreeMap, HeatMap, FilledMap, GeospatialMap, FunnelChart, Waterfall, BoxPlot, GaugeChart
168
+
169
+ ## Project Structure
170
+
171
+ ```
172
+ src/quicksight_codegen/
173
+ __init__.py # Public API exports
174
+ auto.py # Auto dashboard generation from CSV
175
+ cli.py # CLI tool (preview, deploy, list-datasets, fix-types)
176
+ analysis.py # Analysis definition, sheets, calculated fields
177
+ deploy.py # AWS QuickSight deployment via boto3
178
+ discovery.py # Auto-detect AWS account, region, user, datasets
179
+ preview.py # HTML preview with Chart.js
180
+ filters.py # Filter types and dropdown controls
181
+ dataset.py # Dataset type inference and fixing
182
+ visuals/ # All visual type classes
183
+ templates/ # Pre-built dashboard templates (ESG, portfolio)
184
+ ```
185
+
186
+ ## Running Tests
187
+
188
+ ```bash
189
+ uv pip install -e ".[dev]"
190
+ uv run pytest
191
+ ```
192
+
193
+ ## Authors
194
+
195
+ - Weihua SHI
196
+ - Yasmine ZEROUAL
197
+ - Adam TOUCHANE
198
+ - Saber BERREHILI
199
+ - Amine MEGHAGHI
200
+
201
+ ## License
202
+
203
+ MIT