{"id":31322759,"url":"https://github.com/sinclairn101/dbt-nz-banking-loans","last_synced_at":"2026-05-18T03:11:36.204Z","repository":{"id":315967481,"uuid":"1061429123","full_name":"SinclairN101/dbt-nz-banking-loans","owner":"SinclairN101","description":"A personal dbt project transforming a synthetic New Zealand banking loans dataset into a star schema with staging, dimension, fact, and reporting models.","archived":false,"fork":false,"pushed_at":"2025-09-21T22:23:55.000Z","size":1660,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T23:31:25.074Z","etag":null,"topics":["analytics","business-intelligence","dbt","portfolio-project","postgres","sql"],"latest_commit_sha":null,"homepage":"","language":"YAML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SinclairN101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-21T22:07:03.000Z","updated_at":"2025-09-21T22:23:59.000Z","dependencies_parsed_at":"2025-09-21T23:31:26.811Z","dependency_job_id":"b85b4513-d9c4-4be0-952d-b27a7d921696","html_url":"https://github.com/SinclairN101/dbt-nz-banking-loans","commit_stats":null,"previous_names":["sinclairn101/dbt-nz-banking-loans"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/SinclairN101/dbt-nz-banking-loans","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinclairN101%2Fdbt-nz-banking-loans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinclairN101%2Fdbt-nz-banking-loans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinclairN101%2Fdbt-nz-banking-loans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinclairN101%2Fdbt-nz-banking-loans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SinclairN101","download_url":"https://codeload.github.com/SinclairN101/dbt-nz-banking-loans/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SinclairN101%2Fdbt-nz-banking-loans/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276966622,"owners_count":25736827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","business-intelligence","dbt","portfolio-project","postgres","sql"],"created_at":"2025-09-25T19:12:57.802Z","updated_at":"2025-09-25T19:12:58.826Z","avatar_url":"https://github.com/SinclairN101.png","language":"YAML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏦 NZ Banking Loan \u0026 Fraud Risk — dbt Project\n\nThis is a portfolio project where I practice **SQL** and **dbt** using a dataset in the lending space.  \n\nThe raw data comes from Kaggle: [**Synthetic NZ Banking Loan and Fraud Risk Dataset**](https://www.kaggle.com/datasets/sandycandy7/synthetic-nz-banking-loan-and-fraud-risk-dataset).  \n\nI transformed the dataset into a layered analytics warehouse with clearly defined staging, dimension, fact, and reporting models. The goal was to replicate how real-world analytics teams structure data for reliable analysis and decision-making.\n\n\n ### 🎯 Goals\n\n- Build a dbt project starting from raw seeded data  \n- Design and implement a simple star schema  \n- Write clear SQL transformations to create clean, analysis-ready tables  \n- Apply dbt tests and documentation to ensure quality and transparency  \n- Strengthen my end-to-end data \u0026 analytics skills\n\n### 🧱 Project Structure\n\n- **Seed (Raw Data)**  \n  The Kaggle CSV is loaded into the warehouse with `dbt seed`. This acts as the upstream input for staging.\n\n- **Staging (`stg_`)**  \n  Cleans and standardizes the seeded table:\n  - Renames columns to clear, readable names  \n  - Casts 0/1 flags into true/false booleans  \n  - Normalizes categories (e.g. `application_type`)  \n  - Converts interest rates into percentages with proper numeric casting  \n\n- **Dimension (`dim_`)**  \n  Descriptive fields you group by or filter on.  \n  Example: `dim_loan_applications` holds borrower demographics, credit grade, loan purpose, and dates.\n\n- **Fact (`fct_`)**  \n  Numeric outcomes and risk metrics you aggregate.  \n  Example: `fct_loan_performance` stores loan amounts, credit scores, utilization ratios, inquiries, and fraud/default flags.\n\n- **Reporting (`rpt_`)**  \n  Pre-aggregated metrics that answer business questions.  \n  Example: `rpt_loan_summary` shows total loans, averages, default counts, and default rates.\n\n\n\n### 📊 Example Metrics from `rpt_loan_summary`\n\n- Total loans: ~5,000  \n- Total loan amount: ~95M  \n- Average loan amount: ~18.9K  \n- Average interest rate: ~19.9%  \n- Average debt-to-income ratio: ~0.18  \n- Average funding days: ~7.5  \n- Total defaults: 48  \n- Default rate: ~0.96%  \n\n\n### 📚 Documentation and Testing\n\n- Each model has a YAML file with column-level descriptions.  \n- Documentation is written in `docs.md` blocks for clear, human-readable explanations.  \n- Tests include `unique` and `not_null` checks on keys like `loan_id`.  \n- I used `dbt docs generate` and `dbt docs serve` to build an interactive documentation site with lineage graphs and column-level details.  \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"dbt_project/assets/dbt_cloud.png\" alt=\"dbt Cloud\" width=\"479\"/\u003e\n  \u003cimg src=\"dbt_project/assets/dbt-dag.png\" alt=\"dbt Lineage Graph\" width=\"550\"/\u003e\n\u003c/p\u003e\n\n\n### 🔍 Analysis \u0026 Dashboard\n\nTo showcase the value of the transformed data, I built a Metabase dashboard directly on top of the dbt models.  \nThis dashboard provides both a high-level snapshot of the loan portfolio and deeper risk insights.\n\n### 📊 Portfolio Snapshot\nThe top row shows key metrics at a glance:  \n- **Total Loans**  \n- **Total Loan Amount**  \n- **Average Loan Size**  \n- **Average Credit Score**  \n- **Default Rate (%)**  \n- **Average Funding Days**\n\nThese KPIs summarize the scale and health of the lending portfolio.\n\n### 🧩 Portfolio Mix\n- **Loans by Purpose** \n- **Loans by Region** \n- **Loans by Credit Grade** \n\n### ⚖️ Risk \u0026 Performance\n- **Defaults by Credit Grade**  \n- **Defaults Over Time vs Total Loans**\n- **Average Interest Rate by Grade**\n\n### 🚀 Operational Insights\n- **Funding Speed Distribution**  \n- **Top 10 Borrowers by Loan Amount**\n\n### 📸 Dashboard \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"dbt_project/assets/dashboard.png\" alt=\"Metabase Dashboard\" width=\"500\"/\u003e\n  \u003cimg src=\"dbt_project/assets/dashboard2.png\" alt=\"Metabase Dashboard 2\" width=\"470\"/\u003e\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairn101%2Fdbt-nz-banking-loans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinclairn101%2Fdbt-nz-banking-loans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairn101%2Fdbt-nz-banking-loans/lists"}