article Table
Overview
| Item | Details |
|---|---|
| Table name | article |
| Description | Table for managing the "10-second race result summary" articles tied to races (auto racing, keirin, horse racing). Handles both AI-generated articles (created with status: generating, which becomes draft once built) and manually created articles |
| Primary use | Creating, updating, publishing articles and tracking generation failures |
Column Definitions
| Column | Type | PK | FK | Unique | Nullable | Default | Notes |
|---|---|---|---|---|---|---|---|
| _id | ObjectId | โฏ | โฏ | Auto-generated by DocumentDB | |||
| race_id | string | auto_racing:_id / bicycle_racing:_id / horse_racing:_id | References the _id of one of the racing tables. Indexed |
||||
| title | string | ||||||
| body_html | string | HTML. For AI-generated articles, produced by the article_builder Lambda rendering the RaceSummary React component with renderToStaticMarkup. A self-contained fragment with its styles inlined |
|||||
| status | enum | draft | generating / draft / published / failed |
||||
| opening_at | number | Scheduled publish date/time. Indexed | |||||
| closing_at | number | โฏ | Scheduled unpublish date/time | ||||
| accuracy_test_data | object | โฏ | Accuracy-verification data, used by scripts/article_accuracy_test/audit.py |
||||
| generation_error | string | โฏ | Failure reason when status=failed (max 2000 chars). Shown in the admin UI |
||||
| custom_prompt | string | โฏ | Extra instructions supplied by an operator on regeneration. Carried over to later regenerations | ||||
| created_at | number | ||||||
| updated_at | number | Lists are sorted by update date/time by default | |||||
| deleted_at | number | โฏ |
No category_id
article has no category. Only blog / old_blog carry categories.
Status transitions
stateDiagram-v2
[*] --> generating: POST /v1/articles/generation
[*] --> draft: POST /v1/articles (manual)
generating --> draft: article_builder stores body_html
generating --> failed: generation failed on the final attempt
failed --> generating: POST /v1/articles/{id}/regeneration
draft --> published: operator publishes
published --> draft: operator unpublishes
generating and failed are set by the generation pipeline; they cannot be supplied as input to
POST /v1/articles or PUT /v1/articles/{id} (doing so returns 400).
Shape of accuracy_test_data
{
"generated_article": {
"title": "string",
"contents": ["string", "string", "string"]
},
"race_result_in_generated_article": {},
"race_analysis": "string"
}
| Key | Contents |
|---|---|
generated_article |
The generated article (headline + each summary line) |
race_result_in_generated_article |
The numeric facts (finishing order, payouts, โฆ) the article used, declared by the generating AI in the same shape as race_result |
race_analysis |
Output of stage 1 (race video / course image analysis). Kept so the mix of race-result vs. video provenance can be measured afterwards |