A multi-industry dbt project designed for flexible, industry-specific analytics with Fivetran integration. This project supports multiple industry verticals with independent deployment and selective execution capabilities.
This dbt project creates analytical views from industry-specific datasets synced by Fivetran. The modular structure allows you to:
- Add multiple industries to the same project (Healthcare, Agriculture, Meteorology, etc.)
- Deploy selectively by industry using tags or folder paths
- Share common infrastructure while maintaining industry-specific logic
- Scale easily by adding new industry folders as needed
Source: PostgreSQL industries database β CDS_RECORDS table
Schema: INDUSTRIES_HEALTHCARE
Views: 5 analytical views covering patient outcomes, treatment effectiveness, clinical trials, data quality, and high-risk alerts
Future industries (AGR, MET, etc.) will follow the same pattern.
dbt_industries_views/
βββ dbt_project.yml # Project configuration with industry-specific settings
βββ profiles.yml # Snowflake connection template
βββ packages.yml # dbt dependencies
βββ .gitignore # Git exclusions
βββ README.md # This file
βββ models/
β βββ cds/ # Healthcare industry models
β β βββ _cds__sources.yml # Source definitions
β β βββ schema.yml # Model documentation
β β βββ vw_cds_patient_outcomes_kpi.sql
β β βββ vw_cds_treatment_effectiveness.sql
β β βββ vw_cds_clinical_trial_performance.sql
β β βββ vw_cds_data_quality.sql
β β βββ vw_cds_high_risk_patients.sql
β βββ [future industries]/ # AGR, MET, etc.
βββ macros/
βββ generate_schema_name.sql # Custom schema routing
- dbt Core 1.5+ installed (installation guide)
- Snowflake account with appropriate permissions
- Fivetran connector syncing data to Snowflake
- Git for version control
# Clone the repository (or download the project files)
git clone <your-repo-url>
cd dbt_industries_views
# Install dbt dependencies
dbt depsCopy the profiles.yml template to ~/.dbt/profiles.yml and update with your Snowflake credentials:
industries_snowflake:
target: dev
outputs:
dev:
type: snowflake
account: YOUR_SNOWFLAKE_ACCOUNT
user: YOUR_USERNAME
password: YOUR_PASSWORD
role: YOUR_ROLE
database: HOL_DATABASE
warehouse: YOUR_WAREHOUSE
schema: INDUSTRIES_HEALTHCARE
threads: 4# Verify connection
dbt debug
# Compile models to check for errors
dbt compile# Run all models
dbt run
# Run only CDS healthcare models
dbt run --select cds.*
# Run models with specific tag
dbt run --select tag:healthcarePurpose: Executive KPI dashboard
Metrics: Patient volume, outcome scores, treatment success, costs, satisfaction, risk indicators
Audience: Healthcare executives, clinical leadership
Query Example:
SELECT * FROM INDUSTRIES_HEALTHCARE.VW_CDS_PATIENT_OUTCOMES_KPI;Purpose: Treatment outcome analysis by diagnosis and plan
Dimensions: Diagnosis, Treatment Plan
Metrics: Success rates, cost per outcome, adherence impact
Audience: Clinical teams, treatment coordinators
Query Example:
SELECT
DIAGNOSIS,
TREATMENT_PLAN,
success_rate,
cost_per_successful_outcome
FROM INDUSTRIES_HEALTHCARE.VW_CDS_TREATMENT_EFFECTIVENESS
ORDER BY success_rate DESC;Purpose: Clinical trial monitoring and effectiveness
Dimensions: Trial Name, Trial Status
Metrics: Enrollment, outcomes, safety, costs, publications
Audience: Research teams, trial coordinators
Query Example:
SELECT
TRIAL_NAME,
TRIAL_STATUS,
enrolled_patients,
success_rate,
efficiency_score
FROM INDUSTRIES_HEALTHCARE.VW_CDS_CLINICAL_TRIAL_PERFORMANCE
WHERE TRIAL_STATUS = 'Active';Purpose: Data completeness and integrity monitoring
Checks: Null percentages, duplicates, validity, freshness
Audience: Data engineers, quality assurance
Query Example:
SELECT
overall_quality_score,
quality_rating,
completeness_score,
validity_score,
freshness_score
FROM INDUSTRIES_HEALTHCARE.VW_CDS_DATA_QUALITY;Purpose: Patient alerts requiring immediate attention
Filters: High readmission risk, critical vitals, poor outcomes
Audience: Clinical teams, care coordinators
Query Example:
SELECT
PATIENT_ID,
priority_level,
risk_score,
alert_message,
recommended_actions
FROM INDUSTRIES_HEALTHCARE.VW_CDS_HIGH_RISK_PATIENTS
WHERE priority_level IN ('Critical', 'High')
ORDER BY risk_score DESC;-
Push to GitHub:
git init git add . git commit -m "Initial dbt industries project" git remote add origin <your-github-repo> git push -u origin main
-
Configure in Fivetran:
- Navigate to Transformations β dbt Core
- Connect your GitHub repository
- Set Target:
prod - Configure credentials in Fivetran UI (not in
profiles.yml)
-
Selective Execution: Configure dbt command based on your needs:
Run all CDS models:
dbt run --select cds.*Run only KPI views:
dbt run --select tag:kpi
Run specific model:
dbt run --select vw_cds_patient_outcomes_kpi
-
Schedule:
- Fivetran runs dbt automatically after connector syncs
- No additional scheduling needed
To add a new industry (e.g., Agriculture):
mkdir -p models/agrmodels:
dbt_industries_views:
agr:
+tags: ['agr', 'agriculture']
+schema: industries_agriculture
+materialized: view
vars:
agr_source_database: 'HOL_DATABASE'
agr_source_schema: 'INDUSTRIES_AGRICULTURE'
agr_source_table: 'AGR_RECORDS'Create models/agr/_agr__sources.yml:
version: 2
sources:
- name: industries_agriculture
database: "{{ var('agr_source_database') }}"
schema: "{{ var('agr_source_schema') }}"
tables:
- name: agr_records
identifier: "{{ var('agr_source_table') }}"Add SQL files in models/agr/:
vw_agr_crop_yields_kpi.sqlvw_agr_weather_impact.sql- etc.
Create models/agr/schema.yml with model documentation.
# Test locally
dbt run --select agr.*
# Push to GitHub
git add models/agr/
git commit -m "Add agriculture industry models"
git push
# Configure in Fivetran with: dbt run --select agr.*Update variables in dbt_project.yml:
vars:
cds_source_database: 'YOUR_DATABASE'
cds_source_schema: 'YOUR_SCHEMA'
cds_source_table: 'YOUR_TABLE'Update model config in SQL file:
{{
config(
materialized='table', -- Change from 'view' to 'table'
tags=['cds', 'healthcare', 'kpi']
)
}}Add tags for selective execution:
{{
config(
tags=['cds', 'healthcare', 'executive', 'weekly_report']
)
}}Then run: dbt run --select tag:weekly_report
# Compile all models
dbt compile
# Run all models
dbt run
# Test source data
dbt test --select source:*
# Test specific model
dbt test --select vw_cds_patient_outcomes_kpi
# Generate documentation
dbt docs generate
dbt docs serve # Opens in browser# Create feature branch
git checkout -b feature/new-industry-views
# Develop and test
dbt run --select <your_models>
dbt test
# Commit changes
git add .
git commit -m "Add new industry views"
git push origin feature/new-industry-views- Create Pull Request in GitHub
- Review and merge to main branch
- Fivetran automatically deploys on next connector sync
Check data quality regularly:
SELECT * FROM INDUSTRIES_HEALTHCARE.VW_CDS_DATA_QUALITY;Monitor in Fivetran UI:
- Transformations β Logs for dbt run history
- Connectors β Logs for sync status
Query high-risk patients for alerting:
SELECT
PATIENT_ID,
priority_level,
alert_message
FROM INDUSTRIES_HEALTHCARE.VW_CDS_HIGH_RISK_PATIENTS
WHERE priority_level = 'Critical';"Column not found" errors:
- Verify column names match exactly (case-sensitive in Snowflake)
- Check source table with:
SHOW COLUMNS IN TABLE <table>
dbt compilation fails:
- Check YAML syntax (use 2 spaces, no tabs)
- Validate with:
dbt compile
Views empty after creation:
- Verify source table has data
- Check WHERE clause filters aren't too restrictive
Fivetran transformation fails:
- Review Fivetran logs for specific error
- Test locally first:
dbt run --select <model> - Verify credentials are configured in Fivetran
To contribute new industries or views:
- Follow the structure in
models/cds/as a template - Document all models in
schema.yml - Add tests for critical fields
- Update this README with new industry documentation
- Submit Pull Request with clear description
[Add your license information here]
- Project Name: dbt_industries_views
- Version: 1.0.0
- dbt Version: 1.5+
- Warehouse: Snowflake
- Connector: Fivetran
- Industries: Healthcare (CDS) - More to come
Questions or Issues? [Create an issue in GitHub]