Example: Data model¶
The data model page is the cross-library table reference for an application. Doc
gen produces one at docs/applications/<app-slug>/data-model.md, consolidating
every database table the application touches into domain-grouped tables.
What reviewers should check¶
- The opening sentence states real counts of tables and libraries, and those counts match the rows actually listed on the page.
- Tables are grouped into named domain sections, and every row names the owning library and the owning class that performs the access.
- The CRUD column reflects what the code really does; a table listed as
Rmust not be written anywhere in the application. - Owner library and SQL docs links resolve to pages that exist under
libraries/<slug>/. - Schema and table names are plausible for the target database; a hallucinated schema is the failure mode to watch for on SQL pages.
## Sourcesis the final section and cites real repository paths, not analysis artifacts under dot-prefixed working folders.
Example¶
The document below is a complete, correct console-data-model.md for a
fictional application.
View rendered example — the same document as a real page, so you can compare rendering as well as source.
---
title: Data model
summary: Cross-library database table reference for SAIF.PremiumAudit.Batch.
status: draft
owner: Policy Systems Team
last_reviewed: 2026-02-18
---
# Data model
This application interacts with 6 SQL Server tables in the `dbo` schema across 2
libraries.
## Policy audit domain
| Table | Owner library | Owner class | CRUD | SQL docs | Notes |
|---|---|---|---|---|---|
| `dbo.PolicyAudit` | [SAIF.PremiumAudit.Batch](libraries/saif-premiumaudit-batch/overview.md) | `AuditProcessor` | R, U | [SQL index](libraries/saif-premiumaudit-batch/sql/index.md) | Read through `dbo.usp_GetPendingAudits`; `Status`, `PostedDate`, and `PostedBy` updated inside the per-audit transaction. |
| `dbo.PolicyAuditDetail` | [SAIF.PremiumAudit.Batch](libraries/saif-premiumaudit-batch/overview.md) | `AuditProcessor` | R | [SQL index](libraries/saif-premiumaudit-batch/sql/index.md) | Audited payroll by class code for each audit. Read only; corrections are made by the underwriting application. |
| `dbo.PolicyAuditReject` | [SAIF.PremiumAudit.Batch](libraries/saif-premiumaudit-batch/overview.md) | `AuditProcessor` | C | [SQL index](libraries/saif-premiumaudit-batch/sql/index.md) | One row per rejected audit recording the failing business rule id; mirrors the File2 report. |
## Rating domain
| Table | Owner library | Owner class | CRUD | SQL docs | Notes |
|---|---|---|---|---|---|
| `dbo.PayrollClassCode` | [SAIF.PremiumAudit.Batch](libraries/saif-premiumaudit-batch/overview.md) | `AuditProcessor` | R | [SQL index](libraries/saif-premiumaudit-batch/sql/index.md) | Rate table loaded into memory during PreProcess and filtered by policy effective date at lookup time. |
| `dbo.ClassCodeValidation` | [SAIF.Framework.Validation](libraries/saif-framework-validation/overview.md) | `ClassCodeValidator` | R | [SQL index](libraries/saif-framework-validation/sql/index.md) | Valid class code ranges and payroll limits used by BR-001 and BR-002. |
## Premium transaction domain
| Table | Owner library | Owner class | CRUD | SQL docs | Notes |
|---|---|---|---|---|---|
| `dbo.PremiumTransaction` | [SAIF.PremiumAudit.Batch](libraries/saif-premiumaudit-batch/overview.md) | `AuditProcessor` | C | [SQL index](libraries/saif-premiumaudit-batch/sql/index.md) | One adjustment row per posted audit. Inserted in the same transaction that updates `dbo.PolicyAudit`, so a rolled back audit leaves no transaction row. |
## Related documentation
- [Application index](index.md)
- [SAIF.PremiumAudit.Batch — Database tables](libraries/saif-premiumaudit-batch/database-tables.md)
- [SAIF.Framework.Validation — Database tables](libraries/saif-framework-validation/database-tables.md)
## Sources
- `src/SAIF.PremiumAudit.Batch/AuditProcessor.vb`
- `src/SAIF.PremiumAudit.Batch/Program.vb`
- `src/SAIF.PremiumAudit.Batch/App.config`
- `src/SAIF.Framework.Validation/ClassCodeValidator.vb`