DataData ModelSections
Data Model Designed
What the service keeps, how the pieces relate, and what every field means. The SQL is on the Schema tab.
Entities
Document
One invoice going through the process.
Points at one file, one latest job, one review task and one order in their services, by ID only.
docflow.documents
Processed event
A service event already acted on.
Stands alone.
docflow.inbound_events
Life of each record
- Document
- `pending_upload` → `uploaded` → `extracting` → `needs_review` → `reviewed` → `paid`; or `rejected` after upload, or `extraction_failed` (back to `extracting` on retry).
Fields
docflow.documents
The process record: one row per invoice, holding only the IDs of its parts in each service and where the process is.
iduuid- The document's ID;
docflow:{id}is the reference sent to services. - Primary key. UUIDv7
owner_iduuid- The user.
file_nametext- Shown in lists, copied from the upload request.
- 1 to 255 characters
statustextdefault 'pending_upload'- Where the process is.
pending_upload,uploaded,rejected,extracting,extraction_failed,needs_review,reviewed,paidfile_iduuid- Upload's file.
job_iduuidcan be empty- Extraction's latest job.
review_task_iduuidcan be empty- Review's task.
order_iduuidcan be empty- Payment's open or paid order.
rejection_reasontextcan be empty- Upload's reason.
- Set exactly when rejected
created_attimestamptzdefault now()- When the document was started.
updated_attimestamptzdefault now()- When its status last changed.
docflow.inbound_events
One row per service event DocFlow has acted on.
event_iduuid- The event's ID.
- Primary key
typetext- What happened.
- 1 to 100 characters
created_attimestamptzdefault now()- When.
The service template also gives DocFlow audit_events, idempotency_keys and outbound_events.
Data model level: business rules the service guarantees
- DocFlow stores IDs of other services' records, never their data.
- Every document is reviewed, even when nothing is flagged.
- Results are built only from a completed review, always from Review's latest values.
What is deliberately not stored
- Field values and results: values live in Extraction and Review; the JSON and CSV are built when asked for and never stored (ARCHITECTURE.md §12.8).
- Prices: only in configuration and on Payment's order.