TeamBudget Tutorial
In this tutorial, you'll build a complete Lex App application from scratch — a team budget tracker called TeamBudget. By the end, you'll have used every major Lex App feature: models, calculations, lifecycle hooks, logging, permissions, serializers, Streamlit dashboards, and bitemporal history.
You'll also see how Lex App projects follow the ETL pattern — Extract, Transform, Load — reflected directly in your folder structure.
What You'll Build
TeamBudget tracks teams, employees, and expenses. It includes:
- Upload models — CSV ingestion for teams, employees, and expenses (Extract)
- Input models —
Team,Employee,Expenseas core business entities (Transform) - Report models —
BudgetSummarywith automatic calculations (Load) - Serializers — API validation via Django REST Framework
- Permissions — field-level and row-level access control
- Dashboards — interactive Streamlit visualizations
- History — full bitemporal audit trail
Prerequisites
Before starting, make sure you have:
- Lex App installed and configured (see Installation) — source on GitHub
- PyCharm (recommended) or any Python-capable editor
- Access to Excellence Cloud for Keycloak setup
Project Structure
Lex App uses a flat project layout — no manage.py, no nested Django app folders. Your project is organized into three ETL folders:
TeamBudget/
├── .env
├── .run/
│ ├── Init.run.xml
│ └── Start.run.xml
├── lex_config.py
├── migrations/
├── sample_data/
│ ├── teams.csv
│ ├── employees.csv
│ └── expenses.csv
├── model_structure.yaml
│
├── Input/ ← Core business entities (Transform)
│ ├── __init__.py
│ ├── Team.py
│ ├── Employee.py
│ ├── Expense.py
│ └── serializers.py
│
├── Upload/ ← Data ingestion (Extract)
│ ├── __init__.py
│ ├── TeamUpload.py
│ ├── EmployeeUpload.py
│ └── ExpenseUpload.py
│
├── Reports/ ← Calculations & output (Load)
│ ├── __init__.py
│ └── BudgetSummary.py
│
└── Tests/ ← Initial data & integration tests
├── test_data.json
├── 01_create_teams.json
├── 02_create_employees.json
└── 03_create_expenses.jsonThis follows the ETL convention:
Upload/for ingestion,Input/for domain models,Reports/for output. See Project Structure for more details.
Tutorial Parts
Work through these in order:
- Part 1 — Project Setup — create the project, configure your environment, run Init
- Part 2 — Data Models — define
Team,Employee, andExpensemodels plus upload models and serializers - Part 3 — Calculations & Logging — build
BudgetSummaryas aCalculationModelwithLexLogger - Part 4 — Validation & Permissions — add
pre_validation(),post_validation(), andpermission_*methods - Part 5 — Streamlit Dashboards — attach interactive dashboards to your models
- Part 6 — History in Action — explore the bitemporal history panel
Was this helpful?
Your feedback shapes what we write next.
