company_pk). The source / confidence pair is governed by a database-level invariant: confidence is stored only when source = 'classifier_auto'; any transition away from the auto-classifier must clear confidence in the same write.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.
API operations
Data model
Attributes
Relationships
System-computed
- company_financial_id — generated via gen_random_uuid() on insert; unique public identifier
- created_at — set to new Date() on insert via MikroORM onCreate hook
- updated_at — set to new Date() on insert and on every update via MikroORM onUpdate hook
- deleted_at — set by the pipeline soft-delete path; null for active records
- source + confidence — both fields are written exclusively by the chart-of-accounts classification pipeline (classifier_auto), human review confirmation flow (classifier_suggested_human_confirmed, human_override), rule import (imported_chart_rule), or data migration (migration); never set via a user-facing PATCH
- DB CHECK company_financials_confidence_range — database enforces confidence ∈ [0,1] when non-null
- DB CHECK company_financials_source_confidence_invariant — database enforces that confidence is non-null iff source=‘classifier_auto’; any pipeline transition clearing the auto-classifier must write confidence=null in the same statement
Example
apps/api/src/database/entities/CompanyFinancial.ts · domain: financial-graph · tier: Supporting