Skip to content

blog Table

Overview

Item Details
Table name blog
Description Table for AI-generated blog articles. Covers both rewrites of past blogs (blog_rewriter) and recaps/predictions written from scratch out of race data (blog_generation)
Primary use Generating, editing and publishing blog articles; similarity search for related content

Column Definitions

Column Type PK FK Unique Nullable Default Notes
_id ObjectId โ—ฏ โ—ฏ Auto-generated by DocumentDB
name string Blog title. Also baked into the body HTML as an h2 heading, so updating the title rewrites that heading too
race_id string auto_racing:_id / bicycle_racing:_id / horse_racing:_id โ—ฏ Linked race. Null for blogs not tied to a race
race_type enum โ—ฏ auto_racing / bicycle_racing / horse_racing. Set only for race-derived blogs
blog_type string โ—ฏ Blog series type (e.g. jockey interview, Saito column)
old_blog_id string old_blog:_id โ—ฏ Source past blog for a rewrite. Null for newly written recaps/predictions
source_url string โ—ฏ Original URL of the source past blog (carried over from old_blog)
category_id string category:_id โ—ฏ
body_html string HTML, built by blog_builder by server-rendering the real oddspark components
embedding number[] โ—ฏ Embedding vector used for related-blog similarity search (cosine similarity)
status enum draft generating / draft / published
created_at number
updated_at number Lists are sorted by update date/time by default
deleted_at number โ—ฏ

Origin

Whether a blog is a rewrite or an original piece is not stored; it is derived from the presence of old_blog_id and returned as the origin field in API responses.

origin Condition Produced by
rewrite old_blog_id present blog_rewriter (rewrite of a past blog)
generation old_blog_id absent blog_generation (newly written race recap/prediction)

Where embedding comes from

Path Details
Rewrite The vector attached by odds_poc_app when the old_blog was registered, carried over at blog creation
Original blog_generation creates it from the generated body and stores it

Vectors are produced with Amazon Bedrock Titan Text Embeddings v2 (amazon.titan-embed-text-v2:0).

body_html markup contract

Several services post-process body_html with regular expressions, so this markup must be preserved.

Element Purpose
<div class="nb-body"> Body container; the insertion anchor for thumbnail_generation
<img class="nb-thumbnail" src="..."> Thumbnail image; extracted and carried over on rebuild
<section class="nb-related"> Related-information section; extracted and carried over on rebuild
Trailing </div> of the root element Related information is inserted just before the root closing tag