Cane Agency · ERD Seriesสถาบันอ้อย · ชุดเอกสาร ERD
This is the OCSB — regulator office (สอน.) perspective of SPEC-ERD for the ocsb capacity. Cross-cutting content lives in the master; the single source of truth is the graph. Re-homed and renamed by PROP-015 (v0.2.0) — formerly SPEC-ERD-GOV at docs/gov/ocsb/.
นี่คือมุมมอง สำนักงานคณะกรรมการอ้อยและน้ำตาลทราย (สอน.) ของ SPEC-ERD สำหรับ capacity ocsb เนื้อหาข้ามมุมมองอยู่ในเอกสารหลัก แหล่งความจริงเดียวคือ graph ย้ายและเปลี่ยนชื่อโดย PROP-015 (v0.2.0) — เดิมคือ SPEC-ERD-GOV ที่ docs/gov/ocsb/
Scoped view of the platform model from this perspective, rendered from the graph (entities · relationships · dataModeling, v0.4.0). Solid boxes are entities documented at full depth in this family — bold = primary key, gold = foreign key. Dashed boxes are shared entities; the label names their home document. Cardinalities read at each line end.
มุมมองเฉพาะด้านของ model ทั้ง platform render จาก graph (entities · relationships · dataModeling, v0.4.0) กล่องเส้นทึบคือ entity ที่บันทึกเชิงลึกในเอกสารตระกูลนี้ — ตัวหนา = primary key, สีทอง = foreign key กล่องเส้นประคือ entity ที่ใช้ร่วม โดยป้ายระบุเอกสาร home; อ่าน cardinality ที่ปลายเส้นแต่ละด้าน
Normative physical model for the 5 entities homed in this document, rendered from the graph's dataModeling block. Types derive from typeConventions (first rule wins): money = bigint satang · weights = integer kg · tonnage = numeric(12,3) · timestamps = timestamptz UTC · ids = uuid v7. Every FK is indexed by convention (ON DELETE RESTRICT); listed indexes are additional. Enum value sets live in the graph's entity and state-machine notes.
Model เชิงกายภาพที่เป็นบรรทัดฐานของ entity ทั้ง 5 รายการที่ home อยู่ในเอกสารนี้ render จาก block dataModeling ใน graph ชนิดข้อมูลอนุมานจาก typeConventions (กติกาแรกที่เข้าเป็นผล): เงิน = bigint สตางค์ · น้ำหนัก = integer กก. · ตัน = numeric(12,3) · เวลา = timestamptz UTC · id = uuid v7 ทุก FK มี index ตามข้อตกลง (ON DELETE RESTRICT); index ที่ระบุคือส่วนเพิ่ม ชุดค่า enum อยู่ในหมายเหตุ entity และ state machine ของ graph
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| price_id | uuid | — | uuid_v7() | PK |
| season_id | uuid | — | — | FK → season |
| region | text | — | — | |
| price_type | text (enum) | — | — | |
| price_per_t | bigint (satang) | — | — | |
| ccs_base | numeric(4,2) | — | — | |
| ccs_increment_per_t | bigint (satang) | — | — | |
| revenue_account_id | uuid | ✓ | — | FK → revenue_account |
| announced_at | timestamptz | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| bid_id | uuid | — | uuid_v7() | PK |
| season_id | uuid | — | — | FK → season |
| lot_no | integer | — | — | |
| volume_t | numeric(12,3) (t) | — | — | |
| clearing_price | bigint (satang) | — | — | |
| bid_at | timestamptz | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| account_id | uuid | — | uuid_v7() | PK |
| season_id | uuid | — | — | FK → season |
| sugar_sales_amt | bigint (satang) | — | — | |
| byproduct_amt | bigint (satang) | — | — | |
| system_costs_amt | bigint (satang) | — | — | |
| net_revenue_amt | bigint (satang) | — | — | |
| farmer_share_amt | bigint (satang) | — | — | |
| mill_share_amt | bigint (satang) | — | — | |
| production_return_per_t | bigint (satang) | — | — | |
| status | text (enum) | — | — |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| audit_id | uuid | — | uuid_v7() | PK |
| mill_id | uuid | — | — | FK → mill |
| season_id | uuid | — | — | FK → season |
| period | text | — | — | |
| sample_count | integer | — | — | |
| mean_ccs_mill | numeric(4,2) | — | — | |
| mean_ccs_audit | numeric(4,2) | — | — | |
| deviation_pct | numeric(5,2) | — | — | |
| finding | text | — | — | |
| status | text (enum) | — | — | |
| auditor_id | uuid | — | — | FK → membership |
| ColumnColumn | Typeชนิด | Null | Defaultค่าตั้งต้น | Key / refKey / อ้างอิง |
|---|---|---|---|---|
| record_id | uuid | — | uuid_v7() | PK |
| mill_id | uuid | — | — | FK → mill |
| date | date | — | — | |
| total_intake_t | numeric(12,3) (t) | — | — | |
| burnt_t | numeric(12,3) (t) | — | — | |
| burnt_pct | numeric(5,2) | — | — | |
| cap_pct | numeric(5,2) | — | — | |
| breach | boolean | — | — | |
| deduction_rate_per_t | bigint (satang) | — | — | |
| measure | text | ✓ | — | |
| reported_at | timestamptz | — | — |
One row per entity in this perspective. Mutability: mutable · immutable_
หนึ่งแถวต่อ entity ในมุมมองนี้ Mutability: mutable · immutable_
| Entity | Tableตาราง | PK | Unique | Key indexesIndex หลัก | Mutability | PDPA | Profile |
|---|---|---|---|---|---|---|---|
| CanePriceAnnouncement | cane_price_announcement | price_id | — | (season_id,region,price_type,announced_at) | append_ | public | Section 5ข้อ 5 |
| SugarBid | sugar_bid | bid_id | (season_id,lot_no) | (bid_at) | append_ | public | Section 5ข้อ 5 |
| RevenueAccount | revenue_account | account_id | (season_id) | — | immutable_ | public | Section 5ข้อ 5 |
| CcsAudit | ccs_audit | audit_id | (mill_id,season_id,period) | (status,finding) | immutable_ | operational | Section 5ข้อ 5 |
| BurntCaneCompliance | burnt_cane_compliance | record_id | (mill_id,date) | (breach,date) | append_ | operational | Section 5ข้อ 5 |
Transaction boundaries touching this perspective, from graph dataModeling.aggregates. Inside a boundary the stated invariants commit atomically in one database transaction; across boundaries effects flow through domain events (eventual consistency). Repository and unit-of-work lifetimes for these aggregates are specified in the sibling SPEC-DDD document (scoped per request — see the component lifetime map).
ขอบเขต transaction ที่เกี่ยวกับมุมมองนี้ จาก dataModeling.aggregates ใน graph ภายในขอบเขต invariant ที่ระบุ commit แบบ atomic ใน database transaction เดียว; ข้ามขอบเขตผลไหลผ่าน domain event (eventual consistency) lifetime ของ repository และ unit of work ของ aggregate เหล่านี้กำหนดในเอกสาร SPEC-DDD พี่น้อง (scoped ต่อคำขอ — ดูผัง lifetime ของ component)
| Aggregate root | Membersสมาชิก | Context | Transaction ruleกติกา transaction |
|---|---|---|---|
| RevenueAccount | RevenueAccount | regulation | One per season; figures mutate until the 70:30 split is finalized, then frozen.หนึ่งรายการต่อฤดู; ตัวเลขแก้ได้จนสรุปการแบ่ง 70:30 แล้วตรึง |
| CanePriceAnnouncement | CanePriceAnnouncement | regulation | Announcements append; a correction is a new announcement superseding by announced_at.ประกาศ append; การแก้คือประกาศใหม่ที่แทนที่ตาม announced_at |
| CcsAudit | CcsAudit | regulation | Findings freeze on closure; mills annotate — never author — audit records.ผลตรวจตรึงเมื่อปิด; โรงงานหมายเหตุได้แต่ไม่ใช่ผู้เขียนระเบียนตรวจ |
| BurntCaneCompliance | BurntCaneCompliance | regulation | Derived nightly from CrushingDay closes — system-authored, append-only.คำนวณรายคืนจากการปิดวันหีบ — ระบบเป็นผู้เขียน append-only |
| SugarBid | SugarBid | regulation | Append-only auction results.ผลประมูลแบบ append-only |
| Revฉบับ | Dateวันที่ | Changeการเปลี่ยนแปลง |
|---|---|---|
| 0.2.0 | 2026-07-12 | PROP-015: renamed capacity government→ocsb and surface regulator→ocsb; re-homed to docs/erd/gov/; folded the กอน. Board governance (Section 3) in from the retired SPEC-ERD-BOARD. Redirect left at the old path.PROP-015: เปลี่ยนชื่อ capacity government→ocsb และ surface regulator→ocsb; ย้ายมา docs/erd/gov/; ยุบการกำกับของ กอน. (Section 3) จาก SPEC-ERD-BOARD ที่ยกเลิก มี redirect ที่พาธเดิม |
| 0.1.0 | 2026-07-11 | Initial split from the area master (PROP-014, spec v0.1.0).แยกจากเอกสารหลัก (PROP-014, spec v0.1.0) |
| 0.3.0 | 2026-07-13 | PROP-018 (spec v0.4.0): comprehensive perspective data modeling — scoped entity-relationship diagrams (Fig. 1–1), column-level persistence profiles for the 5 home entities (Section 5), keys / indexes / mutability & PDPA classes (Section 6) and aggregate consistency boundaries (Section 7) — all rendered from the graph's new dataModeling block.PROP-018 (spec v0.4.0): การ model ข้อมูลรายมุมมองฉบับครบ — แผนภาพความสัมพันธ์ entity เฉพาะมุมมอง (ภาพที่ 1–1), persistence profile ระดับ column ของ entity ที่ home อยู่ฉบับนี้ 5 รายการ (ข้อ 5), key / index / ชั้น mutability และ PDPA (ข้อ 6) และขอบเขตความสอดคล้องของ aggregate (ข้อ 7) ทั้งหมด render จาก block ใหม่ dataModeling ใน graph |
| 0.4.0 | 2026-08-03 | PROP-073 (spec v0.47.0): one word — Tenant. Party → Tenant, party_id (and every prefixed form) → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, party context/switcher → tenant context/switcher, cross-party → cross-tenant, organisation → organization, and ผู้เล่น retired as the Thai gloss (the Latin word tenant instead, R-THAI). Hold list untouched: counterparty · third party · tripartite working group · Person*/person_id; display codes and token claims were held by R-NULL for one release and then MOVED at v0.47.1 on client decision (C-1), because no token has ever been SIGNED — no auth exists in the built ocsb/ocsf prototypes — and the only printed codes were eight fixture strings in apps/ocsf/fund-shell.jsx, swept in the same pass: PTY- → TNT-, TCA- → TCA-, TQL- → TQL-, claim tnt → tnt, claim dep → dep. Carried in the same pass: the PROP-075 rectification — the retired directory noun domain becomes department (A-82 R-ONETREE) and the dangling A-86/A-87/A-88 citations are re-pointed at the ids they were actually given, A-81/A-82/A-83.PROP-073 (spec v0.47.0): คำเดียว — Tenant Party → Tenant, party_id ทุกรูป → tenant_id, PartyCapacity/PartyQualification/PartyFounded → Tenant*, cross-party → cross-tenant และเลิกใช้ ผู้เล่น เป็นคำแทนวัตถุนี้ในภาษาไทย (ใช้คำละติน tenant ตาม R-THAI) รายการห้ามแตะไม่ถูกแตะ: คู่สัญญา · third party · คณะทำงานไตรภาคี · Person*/person_id รอบเดียวกันแก้ค้างจาก PROP-075: domain → department (A-82) และแก้การอ้าง A-86/A-87/A-88 ที่ไม่มีอยู่จริงเป็น A-81/A-82/A-83 |
| 0.4.1 | 2026-08-03 | PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 as applicable): the identifiers v0.47.0 had held, moved on client decision. PTY-######## → TNT-######## · PCA-######## → TCA-######## · PQL-######## → TQL-######## · token claim pty → tnt · token claim dom → dep (v0.47.1, C-1 — R-NULL had held them as a stored VALUE and a wire format; reversed because no token has ever been signed and the only printed codes were fixture strings). quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2 — org is organization abbreviated, not a resemblance). The retired role LABEL swept as a phrase family and quota organization naming the tenant → quota group / กลุ่มโควตา (v0.47.3). All retired forms are in the FR-396 crosswalk and refused in new text by NFR-142.PROP-073 PATCH 1 (spec v0.47.1 / v0.47.2 / v0.47.3 ตามที่เกี่ยวข้อง): ตัวระบุที่ v0.47.0 คงไว้ ถูกย้ายตามการตัดสินของลูกค้า PTY- → TNT- · PCA- → TCA- · PQL- → TQL- · claim pty → tnt · claim dom → dep (v0.47.1, C-1) · quota_org_officer → quota_officer · lead_org_officer → lead_officer (v0.47.2, C-2) · ป้ายชื่อบทบาทที่เลิกใช้และ องค์กรโควตา ที่เรียก tenant → กลุ่มโควตา (v0.47.3) ทุกรูปที่เลิกใช้อยู่ในตารางแปลง FR-396 |