Skip to main content

Models and Outputs

All models are published to the spotlight schema.

Current-run models

These are rebuilt on every run.

reconciliation__monthly_summary

Monthly enrollment and claims metrics joined at the member-month level.

Grain: data_source, payer, plan, year_month_int

ColumnDescription
data_sourceSource system identifier
payerPayer name
planPlan name
year_month_intMonth as integer (e.g., 202603)
member_monthsCount of enrolled member-months
membersDistinct members enrolled in the month
claimsDistinct claim IDs with activity in the month
claim_linesTotal claim lines in the month
paid_amountTotal paid for claims matching enrolled members in that month
paid_amount_without_enrollmentTotal paid for all claims in the month (ignoring enrollment)
members_with_claimsMembers who had at least one claim
pct_members_with_claimsmembers_with_claims / members × 100
claims_per_1000claims / member_months × 1000
pmpm_paidpaid_amount / member_months
avg_paid_per_claimpaid_amount / claims

The model creates a calendar spine to ensure every month in the data range is represented, even months with zero claims.

dq_results__input_layer_field_summary

Field-level completeness analysis across input-layer tables.

Grain: run_id, data_source, payer, plan, model_name, field_name

ColumnDescription
run_iddbt invocation or custom run identifier
run_tsRun timestamp
model_nameSource table (e.g., input_layer__eligibility)
field_nameColumn being evaluated
total_rowsTotal rows in the source table for this data source/payer/plan
applicable_rowsRows where this field should be populated
not_applicable_rowsRows excluded by business logic (e.g., DRG for professional claims)
null_rowsRows where the field is null or blank
non_null_rowsRows where the field has a value
total_rows_pctAlways 100
applicable_rows_pctapplicable_rows / total_rows × 100
null_rows_pctnull_rows / total_rows × 100
non_null_rows_pctnon_null_rows / total_rows × 100

dq_results__terminology_field_summary

Field-level terminology validation. Same columns as the completeness summary, plus:

ColumnDescription
valid_rowsNon-null values that pass the terminology check
invalid_rowsNon-null values that fail the terminology check
valid_rows_pctvalid_rows / total_rows × 100
invalid_rows_pctinvalid_rows / total_rows × 100
valid_rows_applicable_pctvalid_rows / applicable_rows × 100

History models

Built only when dq_persist_results: true. These are incremental tables that accumulate rows across official runs.

reconciliation_history__monthly_summary

Same columns as reconciliation__monthly_summary plus run_id and run_ts. Uses merge (or delete+insert) to upsert by (run_id, data_source, payer, plan, year_month_int).

dq_history__input_layer_field_summary

Same columns as dq_results__input_layer_field_summary. Upserts by (run_id, data_source, payer, plan, model_name, field_name).

dq_history__terminology_field_summary

Same columns as dq_results__terminology_field_summary. Upserts by (run_id, data_source, payer, plan, model_name, field_name).

Convenience views

Each history model has two companion views:

ViewReturns
*__latest_official_runRows from the most recent run_ts / run_id
*__previous_official_runRows from the second most recent run_ts / run_id

These make it easy to compare consecutive runs without writing window functions.

Applicability rules

Not all fields apply to all claim types. The package uses these rules when calculating applicable vs. not-applicable rows for medical claims:

FieldApplicable to
drg_code, drg_code_typeInstitutional claims only
revenue_center_codeInstitutional claims only
procedure_code_1/2/3Institutional claims only
discharge_disposition_codeInstitutional claims only
admit_source_codeInstitutional claims only
admit_type_codeInstitutional claims only
bill_type_codeInstitutional claims only
place_of_service_codeProfessional claims only
All other fieldsAll claim types

This prevents professional claims from being counted as "missing" for fields that only exist on institutional claims, and vice versa.

Tests

Run all package tests:

dbt test -s tag:spotlight
TestValidates
Grain uniquenessNo duplicate rows per unique key combination on all summary and history tables
Percentage boundsAll *_pct columns are between 0 and 100
Not nullRequired fields (run_id, run_ts, data_source) are populated