SPEC-ERD-GOV-OCSF Rev 0.4.1 · 2026-08-03

Cane Agency · ERD Seriesสถาบันอ้อย · ชุดเอกสาร ERD

Entity Model — OCSF fund office (กองทุน)แบบจำลอง entity — สำนักงานกองทุนอ้อยและน้ำตาลทราย (กองทุน)

Documentเอกสาร
SPEC-ERD-GOV-OCSF
Versionversion (เวอร์ชัน)
0.4.1 · Draftฉบับร่าง
Updatedปรับปรุงล่าสุด
2026-08-03
CapacityCapacity
ocsf
Surfaceช่องทางใช้งาน
ocsf
Prototypeต้นแบบ
apps/ocsf/
Masterเอกสารหลัก
SPEC-ERD
Government clusterกลุ่มหน่วยงานรัฐThis is the OCSF (กองทุน) fund-office perspective (capacity ocsf, surface ocsf). The regulator office สอน. is the sibling ERD-GOV-OCSB. OCSF administers the levies the กอน. Board authorizes; it never sets policy or touches the market.นี่คือมุมมองสำนักงานกองทุน OCSF (กองทุน) (capacity ocsf, surface ocsf) สำนักงานผู้กำกับ สอน. อยู่ที่ ERD-GOV-OCSB OCSF บริหารเงินเก็บที่ กอน. อนุมัติ ไม่กำหนดนโยบายและไม่ยุ่งกับตลาด

1. Scope & perspective1. ขอบเขตและมุมมอง

This is the OCSF — fund office (กองทุน) perspective of SPEC-ERD for the ocsf capacity. A new perspective family created by PROP-015 (v0.2.0) — OCSF was previously documented only in the masters (PROP-013). The single source of truth is the graph.

นี่คือมุมมอง สำนักงานกองทุนอ้อยและน้ำตาลทราย (กองทุน) ของ SPEC-ERD สำหรับ capacity ocsf ตระกูลมุมมองใหม่ที่สร้างโดย PROP-015 (v0.2.0) — เดิม OCSF อยู่ในเอกสารหลักเท่านั้น (PROP-013) แหล่งความจริงเดียวคือ graph

2. In this perspective2. สิ่งที่อยู่ในมุมมองนี้

3. Entity relationship diagram3. แผนภาพความสัมพันธ์ entity

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 ที่ปลายเส้นแต่ละด้าน

0..*11..*10..*10..*10..*10..*10..*0..10..110..* Tenanttenant · FEDSeasonฤดูหีบ · FEDCaneSugarFundกองทุนอ้อยและน้ำตาลทรายfund_id PKtenant_id FKseason_id FKopening_balanceinflow_totaloutflow_totalclosing_balanceupdated_atFundLevyRateอัตราเงินสมทบ/เงินเก็บเข้ากองทุนrate_id PKseason_id FKzone_id?basisamount_per_uniteffective_fromset_by FKFundContributionเงินสมทบเข้ากองทุนcontribution_id PKfund_id FKpayer_tenant_id FKbasisbase_qtyrate_id FKamountperiodposted_atFundCompensationการชดเชยตามมาตรา 56comp_id PKfund_id FKmill_id FKseason_id FKzone_idfinal_price_settlement_id FKamountstatusdue_datepaid_at?FinalPriceSettlementการจ่ายส่วนต่างราคาสุดท้าย · MILLMillโรงงานน้ำตาล · MILL
Fig. 1 — The Cane & Sugar Fund — levy-based contributions post against the running season balance; Article 56 compensations pay the factory when the final price lands below the initial price; reads statutory facts only.ภาพที่ 1 — กองทุนอ้อยและน้ำตาลทราย — เงินสมทบตามอัตรา levy ลงเข้ายอดคงเหลือประจำฤดู; เงินชดเชยมาตรา 56 จ่ายให้โรงงานเมื่อราคาขั้นสุดท้ายต่ำกว่าราคาขั้นต้น; อ่านเฉพาะข้อเท็จจริงตามกฎหมาย

4. Persistence profile — home entities4. Persistence profile — entity ที่ home อยู่ฉบับนี้

Normative physical model for the 4 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 ทั้ง 4 รายการที่ 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

CaneSugarFund กองทุนอ้อยและน้ำตาลทราย mutable operational

table cane_sugar_fund  ·  aggregate CaneSugarFund  ·  code CSF-####  ·  unique (tenant_id,season_id)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
fund_iduuid—uuid_v7()PK
tenant_iduuid——FK → tenant
season_iduuid——FK → season
opening_balancebigint (satang)——
inflow_totalbigint (satang)——
outflow_totalbigint (satang)——
closing_balancebigint (satang)——
updated_attimestamptz——

FundLevyRate อัตราเงินสมทบ/เงินเก็บเข้ากองทุน append_only public

table fund_levy_rate  ·  aggregate FundLevyRate  ·  code FLR-25##-##  ·  unique (season_id,zone_id,basis,effective_from)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
rate_iduuid—uuid_v7()PK
season_iduuid——FK → season
zone_idtext✓—
basistext (enum)——
amount_per_unitbigint (satang)——
effective_fromtext——
set_byuuid——FK → membership

FundContribution เงินสมทบเข้ากองทุน append_only operational

table fund_contribution  ·  aggregate CaneSugarFund  ·  code FC-#########  ·  unique (fund_id,payer_tenant_id,rate_id,period)  ·  index (payer_tenant_id) · (period)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
contribution_iduuid—uuid_v7()PK
fund_iduuid——FK → cane_sugar_fund
payer_tenant_iduuid——FK → tenant
basistext (enum)——
base_qtynumeric(14,3)——
rate_iduuid——FK → fund_levy_rate
amountbigint (satang)——
periodtext——
posted_attimestamptz——

FundCompensation การชดเชยตามมาตรา 56 immutable_after_state operational

table fund_compensation  ·  aggregate CaneSugarFund  ·  code FCP-25##-####  ·  unique (final_price_settlement_id (partial: not null))  ·  index (mill_id,status,due_date)

ColumnColumnTypeชนิดNullDefaultค่าตั้งต้นKey / refKey / อ้างอิง
comp_iduuid—uuid_v7()PK
fund_iduuid——FK → cane_sugar_fund
mill_iduuid——FK → mill
season_iduuid——FK → season
zone_idtext——
final_price_settlement_iduuid——FK → final_price_settlement
amountbigint (satang)——
statustext (enum)——
due_datedate——
paid_attimestamptz✓—

5. Keys, indexes & mutability5. Key, index และ mutability

One row per entity in this perspective. Mutability: mutable · immutable_after_state (frozen once a terminal/approved state is reached) · append_only (corrections supersede or reverse, never edit) · reference (catalogue). PDPA class: personal · consent_gated · confidential_wall · operational · public. Entities homed in a sibling document link to their full profile.

หนึ่งแถวต่อ entity ในมุมมองนี้ Mutability: mutable · immutable_after_state (ตรึงเมื่อถึงสถานะอนุมัติ/สุดท้าย) · append_only (การแก้คือออกฉบับแทนหรือกลับรายการ ไม่แก้ของเดิม) · reference (บัญชีอ้างอิง) ชั้น PDPA: personal · consent_gated · confidential_wall · operational · public Entity ที่ home อยู่เอกสารพี่น้อง link ไป profile ฉบับเต็ม

EntityTableตารางPKUniqueKey indexesIndex หลักMutabilityPDPAProfile
CaneSugarFundcane_sugar_fundfund_id(tenant_id,season_id)—mutableoperationalSection 4ข้อ 4
FundLevyRatefund_levy_raterate_id(season_id,zone_id,basis,effective_from)—append_onlypublicSection 4ข้อ 4
FundContributionfund_contributioncontribution_id(fund_id,payer_tenant_id,rate_id,period)(payer_tenant_id) (period)append_onlyoperationalSection 4ข้อ 4
FundCompensationfund_compensationcomp_id(final_price_settlement_id (partial: not null))(mill_id,status,due_date)immutable_after_stateoperationalSection 4ข้อ 4

6. Consistency boundaries6. ขอบเขตความสอดคล้อง (aggregate)

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 rootMembersสมาชิกContextTransaction ruleกติกา transaction
CaneSugarFundCaneSugarFund · FundContribution · FundCompensationfundContributions and compensations post against the running season balance in one transaction; shortfall flags derive from closing_balance (WF-44); reads statutory facts only (NFR-29).เงินสมทบและเงินชดเชย post เข้ายอดคงเหลือประจำฤดูใน transaction เดียว; ธงขาดสภาพคล่องคำนวณจาก closing_balance (WF-44); อ่านเฉพาะข้อเท็จจริงตามกฎหมาย (NFR-29)
FundLevyRateFundLevyRatefundRates append-only supersede by effective_from; authorized by the Board (FR-111).อัตรา append-only แทนที่ตาม effective_from; อนุมัติโดยบอร์ด กอน. (FR-111)

7. Related documents7. เอกสารที่เกี่ยวข้อง

Revision historyประวัติการแก้ไข

RevฉบับDateวันที่Changeการเปลี่ยนแปลง
0.2.02026-07-12New OCSF perspective family (PROP-015). Capacity fund→ocsf; content promoted from the SPEC-ERD master (PROP-013). Prototype at apps/ocsf/.ตระกูลมุมมอง OCSF ใหม่ (PROP-015) capacity fund→ocsf; เนื้อหายกจากเอกสารหลัก SPEC-ERD (PROP-013) ต้นแบบที่ apps/ocsf/
0.3.02026-07-13PROP-018 (spec v0.4.0): comprehensive perspective data modeling — scoped entity-relationship diagrams (Fig. 1–1), column-level persistence profiles for the 4 home entities (Section 4), keys / indexes / mutability & PDPA classes (Section 5) and aggregate consistency boundaries (Section 6) — all rendered from the graph's new dataModeling block.PROP-018 (spec v0.4.0): การ model ข้อมูลรายมุมมองฉบับครบ — แผนภาพความสัมพันธ์ entity เฉพาะมุมมอง (ภาพที่ 1–1), persistence profile ระดับ column ของ entity ที่ home อยู่ฉบับนี้ 4 รายการ (ข้อ 4), key / index / ชั้น mutability และ PDPA (ข้อ 5) และขอบเขตความสอดคล้องของ aggregate (ข้อ 6) ทั้งหมด render จาก block ใหม่ dataModeling ใน graph
0.4.02026-08-03PROP-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.12026-08-03PROP-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