AMG Organization Dashboard
Real-time store estate visualization from Snowflake
This page documents the AMG Organization Dashboard, a real-time interactive visualization of the AMG store estate (346 locations) powered by Snowflake and D3.
Overview
The dashboard provides a comprehensive view of AMG’s organization across divisions, regions, districts, and class-of-trade segments. Data is fetched live from the Snowflake MARKETBASKET.PUBLIC.ORGANIZATION table.
Status: Separate service running on http://localhost:8540
Getting Started
Installation
Navigate to the dashboard directory and install dependencies:
cd my-quarto-site/dashboards/amg-organization
pip install -r requirements.txtStart the Server
python3 amg-dashboard/server.pyYou should see:
* Running on http://127.0.0.1:8540
* Press CTRL+C to quit
Access the Dashboard
Open http://localhost:8540 in your browser.
Features
Live Data
- ✓ LIVE DATA indicator shows when Snowflake is reachable
- Real-time sync on page load from
/api/organization - Falls back to sample data if Snowflake is unreachable
Interactive Filters
- Division: Company Ops, Dealers
- Region: NYC Metro, Dealer, others
- COT (Class of Trade): Company Op, Supply Only, Liquor Store, Closed
- Fuel Brand: BP, Mobil, Shell, Citgo, Gulf, Exxon, Sunoco, Unbranded
- SSS YTD & SSS Rolling: Same-store-sales performance categories
Click any bar or donut segment to filter; click again to clear.
Visualizations
| Chart | Insight |
|---|---|
| KPIs | Total sites, open count, company ops, dealers, closed locations |
| Sites by Region | Bar chart of store count per region (interactive) |
| COT | Donut breakdown by class of trade (Company Op, Supply Only, Liquor, Closed) |
| Fuel Brand | Donut by fuel brand distribution |
| Division | Pie of Company Ops vs. Dealers |
| State | Pie of store count by state (NY, NJ, CT) |
| Geographic | Scatter plot of store locations by GPS coordinates |
| Hierarchy | Treemap of Division → Region → District |
| Site Detail | Sortable table of all 346 sites with tagging |
Export & Import
- Export CSV: Download filtered data as CSV
- Import JSON: Replace live data with a local
.jsonexport for offline analysis
Configuration
Snowflake Connection
The server reads credentials from ~/.snowflake/connections.toml:
[connections]
[connections.ZADADMIN]
account = "your_account"
user = "your_user"
password = "your_password" # or use SSO
warehouse = "COMPUTE_WH"To use a different connection name, edit CONNECTION_NAME in server.py.
Data Query
To modify the columns or table:
- Edit the
QUERYstring inserver.py - Update the
COLSarray inindex.htmlto match - Restart the server and refresh
Directory Structure
my-quarto-site/dashboards/amg-organization/
├── index.html # D3 dashboard (single-page app)
├── server.py # Flask backend + Snowflake connector
├── requirements.txt # Python dependencies
└── README.md # Detailed documentation
Troubleshooting
| Issue | Solution |
|---|---|
| “SAMPLE — Snowflake unreachable” | Check VPN, credentials in ~/.snowflake/connections.toml, and warehouse access |
| ModuleNotFoundError | Run pip install -r requirements.txt |
| Port 8540 in use | Edit app.rn(host="127.0.0.1", port=9999) in server.py |
| No data appears | Verify query and Snowflake table permissions |
Offline Mode
If Snowflake is temporarily unavailable:
- Click ↓ import .json in the dashboard
- Select a previously exported
.jsonfile - The dashboard will show local data while Snowflake is down
Next Steps
- Monitoring: Set up health checks for Snowflake availability
- Caching: Add Redis caching layer for high-traffic periods
- Auth: Integrate Okta or Entra ID for production deployment
- Deployment: Deploy to Azure Container Apps or Netlify Functions
Comments