How lnajdi/business-intelligence-labs works
1. Repository purpose
- This repo is a BI lab workspace, not an application codebase.
- The core architecture is a small data warehouse pipeline built around CSV inputs, Apache Hop for orchestration/ETL, and DuckDB as the analytical database.
2. Primary working area
- The main system lives in labs/lab01_hop_duckdb/.
- Everything else at the root is course scaffolding (SETUP.md, overall README.md).
- The lab is structured as a teaching environment: inputs, transformations, SQL scripts, Hop metadata, and documentation.
3. Data sources
- Source data is under labs/lab01_hop_duckdb/data/raw/.
- The raw layer contains multiple CSV feeds: orders, order_items, payments, customers, products, categories, stock_movements, and sales_budget.
- There are also _april files, which suggest incremental / delta loads are part of the exercise.
4. Landing and storage zones
- data/processed/ is present as a placeholder for derived files.
- duckdb/ is a placeholder for the local DuckDB database file or related artifacts.
- The repo intentionally does not store generated databases or personal outputs; these are meant to be created locally during the lab.
5. Orchestration layer: Apache Hop
- hop/ contains the ETL orchestration assets.
- hop/pipelines/ holds the pipeline definitions:
- p01_csv_to_staging.hpl for loading raw files into staging,
- p02_dim_* pipelines for building dimensions,
- p03_build_facts.hpl for facts,
- p04_incremental_load.hpl for delta processing,
- p05_load_budget.hpl for budget/control data.
- hop/workflows/ contains higher-level execution flows:
- wf_initial_load.hwf,
- wf_incremental_load.hwf,
- wf_checks.hwf.
- In architecture terms, Hop is the control plane that sequences loading, transformation, and validation steps.
6. Metadata and connection layer
- hop/metadata/rdbms/DuckDB_Lab1.json stores the database connection metadata for Hop.
- This is the boundary between the ETL tool and the warehouse engine: Hop executes pipelines against DuckDB through this connection definition.
7. SQL transformation layers
- The sql/ directory mirrors the warehouse lifecycle in script form.
- The scripts show a clear progression:
- 00_create_schema.sql and 10_create_staging_schema.sql for setup,
- 01_load_staging_tables.sql and 11_staging_transformations.sql for staging,
- 20_create_warehouse_schema.sql plus 21_dim_*, 30_fact_* for dimensional modeling,
- 40_create_control_schema.sql and 41_load_budget.sql for control/budget data,
- 50_initial_full_load.sql and 51_incremental_load.sql for load execution,
- 52_actuals_vs_budget.sql for analytical comparison.
- This suggests the same logical architecture is expressed both as Hop pipelines and as SQL scripts.
8. Warehouse model
- The warehouse is a star schema pattern, confirmed by docs and SQL filenames.
- Dimensions include date, customer, product, and channel.
- Facts include sales and stock.
- The architecture separates descriptive entities from transactional measures, enabling KPI analysis.
9. Control and analytics layer
- sales_budget.csv and 41_load_budget.sql indicate a small control schema for planning vs actual analysis.
- 52_actuals_vs_budget.sql is the downstream analytic comparison layer.
- This means the pipeline is not only loading operational data but also preparing business performance reporting.
10. Validation and quality
- wf_checks.hwf, 02_profile_tables.sql, and 03_quality_checks.sql indicate a dedicated data profiling and quality gate.
- Validation appears to run after loading, before analysis, which is a distinct boundary in the flow.
- The architecture therefore includes a quality-check subsystem, not just ingestion and modeling.
11. Documentation and teaching assets
- docs/ contains the conceptual model: Apache Hop concepts, architecture notes, business questions, data dictionary, incremental load pattern, KPI examples, and star schema design.
- hop/blueprints/ and hop/pipeline_blueprint.md suggest guided implementation patterns rather than production code.
- deliverables/ contains templates for student outputs, reinforcing that this is a lab environment.
12. End-to-end data flow
- The main flow is: raw CSVs → staging → dimensional warehouse → facts/control tables → KPI exploration and budget comparisons.
- Hop workflows orchestrate the execution path, while SQL scripts define the warehouse and transformations.
- The architectural boundary to draw is a local analytics stack: file-based sources feeding DuckDB through Hop-managed ETL, with separate quality and incremental-load paths.
Main entry points: hop Hop · lab01_hop_duckdb Lab 01 · 00_create_schema.sql SQL scripts · 20_create_warehouse_schema.sql Star schema
Components 21
Course scaffold
Top-level repository guidance and setup files.
Lab workspace
Main BI lab area for the DuckDB and Apache Hop exercise.
- Lab 01 · Main workspace for the Hop + DuckDB lab.
labs/lab01_hop_duckdb
Data zones
Raw inputs and local working storage.
Hop ETL
Apache Hop pipelines, workflows, and connection metadata.
- Hop · Apache Hop orchestration layer.
labs/lab01_hop_duckdb/hop - DuckDB conn · DuckDB connection definition used by Hop pipelines.
labs/lab01_hop_duckdb/hop/metadata/rdbms/DuckDB_Lab1.json - CSV staging · Loads raw CSVs into staging.
labs/lab01_hop_duckdb/hop/pipelines/p01_csv_to_staging.hpl - Dimensions · Builds core dimensions: date, customer, product, channel.
labs/lab01_hop_duckdb/hop/pipelines/p02_dim_date.hpl - Facts · Builds sales and stock fact tables.
labs/lab01_hop_duckdb/hop/pipelines/p03_build_facts.hpl - Incremental · Processes delta loads for April feeds.
labs/lab01_hop_duckdb/hop/pipelines/p04_incremental_load.hpl - Budget load · Loads control data for budget comparisons.
labs/lab01_hop_duckdb/hop/pipelines/p05_load_budget.hpl - Workflows · Initial, incremental, and validation execution flows.
labs/lab01_hop_duckdb/hop/workflows/wf_initial_load.hwf
SQL lifecycle
Scripted warehouse setup, transforms, checks, and analytics.
- SQL scripts · Scripted warehouse lifecycle mirroring the Hop pipelines.
labs/lab01_hop_duckdb/sql/00_create_schema.sql - Quality gate · Profiling and data-quality validation steps.
labs/lab01_hop_duckdb/sql/02_profile_tables.sql - Star schema · Dimensions and facts for the analytical warehouse.
labs/lab01_hop_duckdb/sql/20_create_warehouse_schema.sql - Control data · Budget schema and load scripts for actual-vs-budget analysis.
labs/lab01_hop_duckdb/sql/40_create_control_schema.sql - KPI analysis · Exploration and actuals-vs-budget comparison queries.
labs/lab01_hop_duckdb/sql/52_actuals_vs_budget.sql
Docs and deliverables
Teaching material, architecture notes, and student outputs.
- Docs · Architecture notes, concepts, schema design, and business questions.
labs/lab01_hop_duckdb/docs - Deliverables · Templates for checklist, KPI list, and quality report.
labs/lab01_hop_duckdb/deliverables
Connections 26
- README → Lab 01: points to · Repository overview leads into the lab workspace.
- SETUP → Lab 01: sets up · Setup instructions prepare the lab environment.
- Lab 01 → Raw CSVs: ingests · Lab consumes file-based source feeds.
- Lab 01 → DuckDB: stores in · Local warehouse artifacts are created in DuckDB workspace.
- Lab 01 → Hop: orchestrates with · Apache Hop manages execution in the lab.
- Hop → DuckDB conn: connects · Pipelines use DuckDB connection metadata.
- Hop → CSV staging: runs · Hop first loads CSVs into staging.
- Hop → Dimensions: runs · Hop builds the dimensional layer.
- Hop → Facts: runs · Hop builds fact tables.
- Hop → Incremental: runs · Hop executes delta processing.
- Hop → Budget load: runs · Hop loads budget/control data.
- Hop → Workflows: sequences · Workflows coordinate initial load, incremental load, and checks.
- Raw CSVs → CSV staging: feeds · Raw CSV inputs are source material for staging loads.
- CSV staging → SQL scripts: mirrors · Staging logic is also expressed in SQL scripts.
- SQL scripts → Quality gate: includes · Lifecycle scripts include profiling and quality checks.
- SQL scripts → Star schema: includes · Lifecycle scripts create the dimensional warehouse.
- SQL scripts → Control data: includes · Lifecycle scripts create and load control tables.
- Star schema → KPI analysis: supports · Warehouse outputs feed KPI and comparison queries.
- Dimensions → Star schema: builds · Dimension pipelines populate the star schema.
- Facts → Star schema: builds · Fact pipelines populate the star schema.
- Budget load → Control data: loads · Budget pipeline populates control schema data.
- Incremental → Workflows: used by · Incremental load is invoked through workflow execution.
- Quality gate → Workflows: gates · Quality checks sit before downstream analysis.
- Docs → Lab 01: documents · Teaching material explains the lab architecture and patterns.
- Deliverables → Docs: supports · Templates guide student outputs and reporting.
- Processed → DuckDB: pairs with · Processed artifacts and local database form the working storage layer.