# tuva-health/semantic-layer architecture

> Architecture diagram of the GitHub repository tuva-health/semantic-layer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuva-health/semantic-layer
- Repository: https://github.com/tuva-health/semantic-layer

## Overview

Tuva Semantic Layer is a dbt package that turns claims-based Tuva Core data and selected standalone-mart outputs into an analytics-oriented star schema. A consuming dbt project opts into the package; its documented scope includes dimensions, encounter and claims analytics, member-months, quality measures, and risk analytics. The README documents the upstream package set and claims-only encounter boundary, but no source excerpts were provided, so model-to-model dependencies are not asserted.

Main entry points: [`models/semantic_layer/intermediate`](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/intermediate) (Enrichment models), [`models/semantic_layer/staging`](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/staging) (Source staging), [`models/semantic_layer/staging/semantic_layer__stg_core__encounter.sql`](https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/staging/semantic_layer__stg_core__encounter.sql) (Claim encounters), [`models/semantic_layer/final`](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final) (Eight dimensions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Upstream data"]
  node_core["Tuva Core"]
  node_ahrq["AHRQ indicators"]
  node_cms["CMS HCC"]
  node_nyu["NYU ED"]
  node_quality["Quality Measures"]
  node_ccsr["CCSR"]
end

subgraph group_staging["Staging and enrichment"]
  node_staging_models["Source staging"]
  node_encounter_stage["Claim encounters"]
  node_intermediate["Enrichment models"]
end

subgraph group_dimensions["Dimensions"]
  node_dimensions["Eight dimensions"]
end

subgraph group_facts["Analytics facts"]
  node_encounter_facts["Encounter facts"]
  node_claim_facts["Claim facts"]
  node_pharmacy_facts["Pharmacy facts"]
  node_member_month_facts["Member-month facts"]
  node_quality_risk_facts["Quality and risk facts"]
end

node_consumer(("Root dbt project"))

node_consumer -->|"builds package"| node_staging_models
node_core -->|"supplies Core data"| node_staging_models
node_core -->|"supplies encounters"| node_encounter_stage
node_ahrq -->|"supplies indicators"| node_staging_models
node_cms -->|"supplies HCC data"| node_staging_models
node_nyu -->|"supplies ED data"| node_staging_models
node_quality -->|"supplies measures"| node_staging_models
node_ccsr -->|"installed dependency"| node_staging_models
node_staging_models -.->|"enriches data"| node_intermediate
node_intermediate -.->|"feeds models"| node_dimensions
node_intermediate -.->|"feeds models"| node_encounter_facts
node_intermediate -.->|"feeds models"| node_claim_facts
node_intermediate -.->|"feeds models"| node_pharmacy_facts
node_intermediate -.->|"feeds models"| node_member_month_facts
node_intermediate -.->|"feeds models"| node_quality_risk_facts

click node_staging_models "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/staging"
click node_encounter_stage "https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/staging/semantic_layer__stg_core__encounter.sql"
click node_intermediate "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/intermediate"
click node_dimensions "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final"
click node_encounter_facts "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final"
click node_claim_facts "https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/final/semantic_layer__fact_claims.sql"
click node_pharmacy_facts "https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/final/semantic_layer__fact_pharmacy_claims.sql"
click node_member_month_facts "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final"
click node_quality_risk_facts "https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core,node_ahrq,node_cms,node_nyu,node_quality,node_ccsr toneBlue
class node_staging_models,node_encounter_stage,node_intermediate toneAmber
class node_dimensions toneMint
class node_encounter_facts,node_claim_facts,node_pharmacy_facts,node_member_month_facts,node_quality_risk_facts toneRose
class node_consumer toneIndigo
```

## Components

### Upstream data

- **Tuva Core**
- **AHRQ indicators**
- **CMS HCC**
- **NYU ED**
- **Quality Measures**
- **CCSR**

### Staging and enrichment

- [Source staging](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/staging): `models/semantic_layer/staging`
- [Claim encounters](https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/staging/semantic_layer__stg_core__encounter.sql): `models/semantic_layer/staging/semantic_layer__stg_core__encounter.sql`
- [Enrichment models](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/intermediate): `models/semantic_layer/intermediate`

### Dimensions

- [Eight dimensions](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final): `models/semantic_layer/final`

### Analytics facts

- [Encounter facts](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final): `models/semantic_layer/final`
- [Claim facts](https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/final/semantic_layer__fact_claims.sql): `models/semantic_layer/final/semantic_layer__fact_claims.sql`
- [Pharmacy facts](https://github.com/tuva-health/semantic-layer/blob/main/models/semantic_layer/final/semantic_layer__fact_pharmacy_claims.sql): `models/semantic_layer/final/semantic_layer__fact_pharmacy_claims.sql`
- [Member-month facts](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final): `models/semantic_layer/final`
- [Quality and risk facts](https://github.com/tuva-health/semantic-layer/tree/main/models/semantic_layer/final): `models/semantic_layer/final`

### Other components

- **Root dbt project**

## Connections

- Root dbt project → Source staging: builds package (evidence: `README.md`)
- Tuva Core → Source staging: supplies Core data (evidence: `README.md`)
- Tuva Core → Claim encounters: supplies encounters (evidence: `README.md`)
- AHRQ indicators → Source staging: supplies indicators (evidence: `README.md`)
- CMS HCC → Source staging: supplies HCC data (evidence: `README.md`)
- NYU ED → Source staging: supplies ED data (evidence: `README.md`)
- Quality Measures → Source staging: supplies measures (evidence: `README.md`)
- CCSR → Source staging: installed dependency (evidence: `README.md`)
- Source staging → Enrichment models: enriches data
- Enrichment models → Eight dimensions: feeds models
- Enrichment models → Encounter facts: feeds models
- Enrichment models → Claim facts: feeds models
- Enrichment models → Pharmacy facts: feeds models
- Enrichment models → Member-month facts: feeds models
- Enrichment models → Quality and risk facts: feeds models
