Data Models¶
This section documents the data models used throughout the CalcBridge API. Understanding these models is essential for working with API requests and responses.
Overview¶
CalcBridge uses consistent data models across all endpoints. Models are organized into the following categories:
| Category | Description | Key Models |
|---|---|---|
| Workbook Models | Excel file representation | Workbook, Sheet, SheetData, Cell |
| Scenario Models | What-if simulation | Scenario, Trade, SimulationResult |
| Compliance Models | Compliance testing | TestSuite, TestResult, Threshold |
| User Models | Authentication & authorization | User, Tenant, Role, APIKey |
Common Patterns¶
UUID Identifiers¶
All resources use UUID v4 identifiers:
Timestamps¶
Timestamps are in ISO 8601 format with UTC timezone:
Pagination¶
List responses follow a consistent pagination structure:
Error Responses¶
Error responses include structured error information:
{
"detail": "Human-readable error message",
"error_code": "SPECIFIC_ERROR_CODE",
"request_id": "req_abc123xyz"
}
Type Conventions¶
Nullable Fields¶
Fields that may be null are marked as optional in the documentation:
| Notation | Meaning |
|---|---|
string | Required string |
string? | Optional/nullable string |
string (UUID) | UUID-formatted string |
string (ISO 8601) | ISO 8601 date/datetime |
Enumerations¶
Enum values are documented with all valid options:
Nested Objects¶
Complex objects are linked to their own model documentation:
Model Relationships¶
Tenant
|-- User (many)
|-- APIKey (many)
|-- Workbook (many)
|-- Sheet (many)
|-- SheetData (one)
|-- Cell (many)
|-- ComplianceResult (many)
|-- TestResult (many)
|-- Scenario (many)
|-- Trade (many)
|-- SimulationResult (one)
|-- Report (many)
|-- Alert (many)
Versioning¶
Models may evolve over time. The API maintains backward compatibility within major versions:
- Additive changes (new fields): Always backward compatible
- Field deprecation: Marked with documentation, removed in next major version
- Breaking changes: Only in major version updates
Deprecated Fields¶
Deprecated fields are marked in documentation:
Quick Reference¶
Core Resources¶
| Resource | Create | Read | Update | Delete |
|---|---|---|---|---|
| Workbook | POST /workbooks | GET /workbooks/{id} | PATCH /workbooks/{id} | DELETE /workbooks/{id} |
| Scenario | POST /scenarios | GET /scenarios/{id} | PATCH /scenarios/{id} | DELETE /scenarios/{id} |
| Alert | POST /alerts/configure | GET /alerts/{id} | PATCH /alerts/{id} | DELETE /alerts/{id} |
| Mapping | POST /mappings | GET /mappings/{id} | PATCH /mappings/{id} | DELETE /mappings/{id} |
| Report | POST /reports/generate | GET /reports/{id} | - | DELETE /reports/{id} |
Status Enumerations¶
Workbook Status: uploading | processing | ready | error | recalculating
Scenario Status: draft | calculating | completed | failed
Compliance Status: pending | running | completed | failed
Report Status: pending | generating | completed | failed
User Status: pending | active | inactive
API Key Status: active | deprecated | revoked
SDK Type Definitions¶
Type definitions are available for supported SDKs:
Related Documentation¶
- API Reference - Complete endpoint documentation
- Authentication - Authentication methods
- Error Handling - Error codes and handling