feat: add tenant semantic layer model - #10
Open
benjamin-shi-tql wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tenant semantic layer
Adds the semantic layer over the existing
dim_tenantsmedallion chain (staging -> intermediate -> mart already inmain). No semantic models existed yet.Files
yardi_demo/models/semantic_models/tenant_semantic_layer.yml- dbt/MetricFlow semantic model overref('dim_tenants'): tenant/property/unit/lease entities, categorical + time dimensions, and 9 metrics.yardi_demo/models/semantic_models/sem_tenants_snowflake.sql- native SnowflakeCREATE SEMANTIC VIEW SEM_TENANTSDDL plus a bootstrap cleansing view (V_TENANT_SEMANTIC_BASE) so the view works before the marts are materialized.Metrics
Population (tenant_count, current/former), delinquency/AR (delinquency_rate, delinquent_tenant_count, total_ar_balance, total_delinquent_balance, avg_balance), exposure (total_deposits_held), credit/retention (avg_credit_score, avg_tenure_months).
Validation
The equivalent logic was executed against live
Yardi (Demo)Snowflake data via the paired TQL composed view: 159 current tenants, ~25.8% delinquency, $64.3K total AR balance; current-tenants-by-region returns 6 regions with Southeast highest at $24.1K AR / 35% delinquency.Paired with ontology library patch #639.