Human review
Review only the fields the system is unsure about, with the evidence beside each one.
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
Task
A set of values one person checks together.
Belongs to one user by ID. Has many fields.
review.tasks
Field
One value under review, with its evidence and decision.
Belongs to one task. Has many changes.
review.fields
Change
One decision on one field.
Belongs to one field.
review.field_changes
Eval candidate
A correction that could become a test case.
Belongs to one task; deleted with it.
review.eval_candidates
Processed event
A platform event already acted on.
Stands alone.
review.inbound_events
Life of each record
- Task
- `open` when created → `completed` when the person finishes → kept until the owner deletes their account. Fields can still be corrected after completion.
- Field
- `pending` → `accepted`, `edited` or `not_present`, and can change between those at any time, also after completion. Each change adds a history row.
- Eval candidate
- `candidate` when a correction is made → `approved` or `rejected` by an admin → deleted with its task or the owner's account.
Fields
review.tasks
One row per set of values a person checks together, usually one document's fields.
iduuid- The task's ID.
- Primary key. UUIDv7
owner_iduuid- The user who checks it, from the access token. A plain ID.
referencetext- The caller's own label, returned in events. Opaque to Review.
- 1 to 200 characters
statustextdefault 'open'- Whether the person has finished. Values can still be corrected after completion.
openorcompletedchecks_overriddenbooleandefault false- True when the person confirmed values that still fail a rule check, as printed on the document.
created_attimestamptzdefault now()- When the task was created.
completed_attimestamptzcan be empty- When the person finished.
- Set exactly when completed
completed_byuuidcan be empty- Who finished it. The owner in version 1; kept separate for later shared reviews.
- Set exactly when completed
held_bytextcan be empty- The app holding the unflagged fields until it releases them (
REVIEW-V1-E4-06). Empty: not held. - Like
service:docflow; set only at creation, from the delegated token'sactclaim released_attimestamptzcan be empty- When the holder released the fields. Empty while held.
- Set only when
held_byis set
review.fields
Review's own copy of each value under review, with the evidence and the person's decision. The service that extracted it keeps its own original, untouched.
iduuid- The field's ID within Review.
- Primary key. UUIDv7
task_iduuid- The task it belongs to.
- Foreign key to
review.tasks, delete cascades nametext- The field's name, used as its label.
- 1 to 64 characters; unique with
line_indexin a task line_indexsmallintcan be empty- Which line item, for repeated fields.
- 0 or more
typetext- How an edit is checked.
text,date,decimalorcurrencyoriginal_valuejsonbcan be empty- The value as it arrived. Never changes.
- A JSON string, or empty
valuejsonbcan be empty- The value now, after any decision.
- A JSON string, or empty for not present
confidencenumeric(3,2)- How sure the system was; orders the queue.
- 0 to 1
source_pagesmallintcan be empty- The page of the evidence.
- 1 or more
source_quotetextcan be empty- The evidence, shown beside the value.
- 1 to 500 characters
flaggedboolean- Whether a decision is required.
- True exactly when there is a reason
flag_reasonstext[]default '{}'- Why it needs checking.
statustextdefault 'pending'- The person's decision so far.
pending,accepted,editedornot_presentupdated_byuuidcan be empty- Who made the last decision.
- Set once decided
updated_attimestamptzcan be empty- When.
- Set once decided
review.field_changes
The full history of decisions on a field: one row per change, never edited. Any change can be traced, and undone by applying the old value again.
iduuid- The change's ID.
- Primary key. UUIDv7
field_iduuid- The field changed.
- Foreign key to
review.fields, delete cascades actiontext- What the person decided.
accept,editornot_presentold_valuejsonbcan be empty- The value before.
new_valuejsonbcan be empty- The value after.
sourcetextdefault 'review'- Where the change came from.
reviewin version 1 (chatarrives in MVP2)changed_byuuid- Who made it.
created_attimestamptzdefault now()- When.
review.eval_candidates
One row per value a person corrected, so the owner can see the model's real mistakes. It never leaves this database: reports show only counts (privacy rule on #41).
iduuid- The candidate's ID.
- Primary key. UUIDv7
task_iduuid- The task it came from; deleted with it, so nothing outlives the owner's account.
- Foreign key to
review.tasks, delete cascades referencetext- The task's reference, which ties the ground truth to its document.
- 1 to 200 characters
field_nametext- Which field.
- 1 to 64 characters
line_indexsmallintcan be empty- Which line item.
- 0 or more
model_valuejsonbcan be empty- What the system had.
human_valuejsonbcan be empty- What the person corrected it to.
- Different from
model_value statustextdefault 'candidate'- Whether the admin judged it a real model mistake.
candidate,approvedorrejecteddecided_byuuidcan be empty- The admin who decided.
- Set once approved or rejected
decided_attimestamptzcan be empty- When.
- Set once approved or rejected
created_attimestamptzdefault now()- When the correction was made.
review.inbound_events
One row per platform event Review has acted on, so a repeat has no effect.
event_iduuid- The event's ID.
- Primary key
typetext- What happened.
- 1 to 100 characters
created_attimestamptzdefault now()- When Review processed it.
The service template also gives Review audit_events, idempotency_keys and outbound_events. Review writes review.task_created, review.field_updated and review.task_completed to audit_events, uses idempotency_keys for POST /tasks, and announces review.task.completed.
Data model level: business rules the service guarantees
- Review owns its copy of every value. It never reads another service's data, and never changes the original it was sent.
original_valuenever changes;valueholds the decision. The difference between them is what a person corrected.- Every decision writes a history row in the same transaction; history rows are never edited.
- A task can be completed only when no flagged field is
pending. After completion its values can still be corrected; every change is recorded, and the latest values are the final document. - A correction (a final value different from the original) creates exactly one eval candidate per field, updated if the person changes it again.
- Candidates never leave this database. Reports built from them show counts and rates only, seen by the admin alone.
- Deleting a user's account deletes their tasks, fields, history and eval candidates, approved ones included.
- A held task shows its owner only the flagged fields until the holding app releases it (
REVIEW-V1-E4-06): enough to review, nothing more. Only a delegated token can place a hold and only the holder can release it, so a person cannot read held values early or lift a hold themselves. Review never knows the reason for a hold.
What is deliberately not stored
- The document itself: only the quotes sent with each field.
- Document rules: re-checking values is the LLM Extraction service's job.
- Exports of corrections: there are none. Only counts and rates leave this service (privacy rule on #41).