31 entities across 5 subject areas. Click any entity to expand its attributes, relationships, and business rules.
The main entities in a trade, flowing top to bottom. Supporting entities shown alongside. Not all 31 are here - see the full definitions below.
Reference classification for wool quality. A grade code inherently defines several product attributes (consistency, colour, type, origin) for approximately 70% of products. Currently mature for greasy wool - needs extending to cover other commodity types.
| Attribute | Type | Required | Description |
|---|---|---|---|
| grade_id | Identifier | Yes | Unique ID |
| grade_code | Short Text | Yes | Numeric/alphanumeric grade code (e.g. 226, 11057). Unique within commodity_code. |
| commodity_code | Short Text | Yes | Which commodity this grade applies to |
| name | Short Text | Yes | Display name |
| description | Text | No | What this grade represents |
| origin | Short Text | No | Country/region this grade implies |
| colour | Short Text | No | Colour this grade implies |
| is_active | Boolean | Yes | Whether available for new products. Default: true |
A uniquely catalogued product defined by its fixed attributes. The commodity attribute indicates the product's typical role: greasy products are primarily materials (purchased, blended) but can also be sold directly; scoured/tops/etc. are sales items. Traders work at lot/batch level within a product.
| Attribute | Type | Required | Description |
|---|---|---|---|
| product_id | Identifier | Yes | Unique ID |
| grade_id | Reference | Yes | Links to Grade |
| commodity | Enum | Yes | Greasy, Scoured, Noil, Tops, Open Tops, Carbonised. Determines role. |
| breed | Enum | Yes | Fine, Medium, Crossbred, Hill, Mountain, Natural, Merino, Polwarth, Corriedale, Romney |
| wool_type | Enum | Yes | Fleece, Lambs, Shears, Pieces, Tannery |
| origin | Short Text | Yes | Country of origin |
| colour | Enum | Yes | White, Yellow, Average, Natural Coloured, Light Grey |
| length_range | Enum | No | 1-3, 2-3, 2-4, 2-5, 3-4, 3-5, 4-5, 4-6, 5-6 (inches) |
| certified | Enum | No | None, RWS, GOTS. Default: None |
| display_name | Short Text | Yes | Human-readable product name |
| status | Enum | Yes | Active, Archived. Default: Active |
| created_at | DateTime | Yes | Record creation timestamp |
A user-defined label for aggregating products for reporting and filtering. Products can sit in multiple groups. Groups drive position views but don't affect system logic.
| Attribute | Type | Required | Description |
|---|---|---|---|
| product_group_id | Identifier | Yes | Unique ID |
| name | Short Text | Yes | Group name (e.g. "BRE Crosses", "NZ Merino") |
| description | Text | No | What this group represents |
| created_by | Reference | No | Links to User who created it |
| created_at | DateTime | Yes | Record creation timestamp |
Junction entity linking products to groups. A product can belong to many groups. A group contains many products.
| Attribute | Type | Required | Description |
|---|---|---|---|
| product_group_membership_id | Identifier | Yes | Unique ID |
| product_id | Reference | Yes | Links to Product |
| product_group_id | Reference | Yes | Links to Product Group |
| added_at | DateTime | Yes | When added to the group |
A customer-specific display name for a product. The product has one canonical identity but can display different names to different customers. Handles naming convention differences (e.g. type number "18WA" dictated by one customer).
| Attribute | Type | Required | Description |
|---|---|---|---|
| product_alias_id | Identifier | Yes | Unique ID |
| product_id | Reference | Yes | Links to Product |
| company_id | Reference | Yes | Links to Company (customer) |
| alias_name | Short Text | Yes | What this customer calls the product |
| created_at | DateTime | Yes | Record creation timestamp |
Any organisation Standard Wool trades with - customer, supplier, or both. Also includes processors (Chadwicks) and hauliers (Bower Green). GP vendor/customer codes (V/C prefix) are maintained for export compatibility.
| Attribute | Type | Required | Description |
|---|---|---|---|
| company_id | Identifier | Yes | Unique ID |
| company_code | Short Text | Yes | Short reference code (e.g. SWUK, CHAD) |
| name | Short Text | Yes | Company name |
| company_type | Enum | Yes | Customer, Supplier, Both, Processor, Haulier |
| address_line_1 | Short Text | No | Address line 1 |
| address_line_2 | Short Text | No | Address line 2 |
| city | Short Text | No | City |
| postcode | Short Text | No | Postcode |
| country | Short Text | No | Country |
| vat_number | Short Text | No | VAT number |
| payment_terms | Short Text | No | Default payment terms |
| sage_account_code | Short Text | No | Mapped code for Sage integration |
| gp_vendor_code | Short Text | No | Dynamics GP vendor code (V prefix, e.g. V15500) |
| gp_customer_code | Short Text | No | Dynamics GP customer code (C prefix, e.g. C45044) |
| is_active | Boolean | Yes | Default: true |
| created_at | DateTime | Yes | Record creation timestamp |
A person at a company.
| Attribute | Type | Required | Description |
|---|---|---|---|
| contact_id | Identifier | Yes | Unique ID |
| company_id | Reference | Yes | Links to Company |
| first_name | Short Text | Yes | First name |
| last_name | Short Text | Yes | Last name |
| Short Text | No | Email address | |
| phone | Short Text | No | Phone number |
| role | Short Text | No | Job title or function |
| is_primary | Boolean | Yes | Primary contact for this company. Default: false |
| created_at | DateTime | Yes | Record creation timestamp |
A trading entity within Standard Wool UK. Each division is a trading desk with its own buying, selling, and position. Each division maps to a GP company which determines the nominal codes used for accounting exports.
| Attribute | Type | Required | Description |
|---|---|---|---|
| division_id | Identifier | Yes | Unique ID |
| code | Short Text | Yes | HSC, MERCH, TOPS, PUNTA |
| name | Short Text | Yes | Full name (Home Scour, Merchanting, Tops, Punta) |
| description | Text | No | What this trading desk does |
| gp_company | Short Text | Yes | Dynamics GP company code (SWB or JHP). Determines nominal codes. |
| gp_company_name | Short Text | No | GP company display name (Standard Wool Bradford, Jacomb Hoare Punta) |
| gp_division_code | Short Text | No | Division code used in GP exports (e.g. SWH, JHP) |
| is_active | Boolean | Yes | Default: true |
A sales or purchase agreement with a company. In the sell-forward model, sales contracts are created first, then purchase contracts follow to fulfil them. Type attribute distinguishes sales from purchase.
| Attribute | Type | Required | Description |
|---|---|---|---|
| contract_id | Identifier | Yes | Unique ID |
| contract_number | Short Text | Yes | Human-readable reference |
| contract_type | Enum | Yes | Sales, Purchase |
| company_id | Reference | Yes | Customer (sales) or supplier (purchase) |
| division_id | Reference | Yes | Which trading desk |
| trader_id | Reference | Yes | Who created it |
| contract_date | Date | Yes | Date created |
| currency_code | Enum | Yes | GBP, USD, NZD, EUR |
| status | Enum | Yes | Open, Partially Fulfilled, Complete, Cancelled. Default: Open |
| customer_order_ref | Short Text | No | Customer's own reference |
| payment_terms_text | Short Text | No | Payment terms as displayed (e.g. "120 DAYS") |
| payment_terms_days | Number | No | Numeric credit period in days |
| delivery_terms | Short Text | No | Incoterms + location (e.g. "DAP CLIENTS MILL") |
| bank_account | Short Text | No | Bank account for this contract (sales) |
| payment_instructions | Text | No | SWIFT/IBAN details printed on invoices (sales) |
| print_company | Short Text | No | Company name for document printing |
| borrowing_rate | Decimal | No | Annual borrowing rate for payment term cost calc |
| remarks | Text | No | Free text notes |
| is_back_to_back | Boolean | Yes | Bought and sold simultaneously. Default: false |
| spot_rate | Decimal | No | Spot FX rate at time of contract |
| created_at | DateTime | Yes | Record creation timestamp |
A single line on a contract - product, quantity, price, currency. One contract can have multiple lines for different products or delivery tranches. For sales contracts, also carries cost-of-sale estimates and replacement price for margin management.
| Attribute | Type | Required | Description |
|---|---|---|---|
| line_item_id | Identifier | Yes | Unique ID |
| contract_id | Reference | Yes | Parent contract |
| lot_number | Short Text | Yes | Sale or purchase lot number (SH/SM/H/M prefix) |
| product_id | Reference | Yes | What's being bought or sold |
| description | Text | No | Free text wool description (legacy/customer-facing) |
| quantity_weight | Decimal | Yes | Contracted weight |
| weight_unit | Enum | Yes | KG, LB. Default: KG |
| num_bales | Number | No | Number of bales contracted |
| price_per_unit | Decimal | Yes | Price in contract currency |
| price_basis | Enum | No | Clean, Greasy, Conditioned |
| yield_estimate | Decimal | No | Estimated yield % (purchase contracts) |
| replacement_price | Decimal | No | Manual entry - current replacement value (sales, for weekly report) |
| estimated_shipping_per_kg | Decimal | No | Estimated shipping cost per kg at point of sale |
| insurance_rate | Decimal | No | Credit insurance rate (e.g. 0.0055 for 0.55%) |
| insurance_cost | Decimal | No | Derived: invoice value x insurance rate |
| payment_term_cost | Decimal | No | Derived: value x (borrowing_rate / 365 x payment days) |
| estimated_total_cost_of_sale | Decimal | No | Sum of shipping + insurance + terms + commission |
| actual_shipping_cost | Decimal | No | Allocated from actual shipping invoice post-dispatch |
| shipping_invoice_ref | Short Text | No | Reference to the actual shipping invoice |
| status | Enum | Yes | Open, Partially Fulfilled, Complete. Default: Open |
| created_at | DateTime | Yes | Record creation timestamp |
A planned delivery tranche against a contract line. Tracks partial fulfilment and customer call-offs against forward contracts. The bill of lading date is critical - it triggers invoice financing declaration to the bank.
| Attribute | Type | Required | Description |
|---|---|---|---|
| delivery_stage_id | Identifier | Yes | Unique ID |
| line_item_id | Reference | Yes | Parent line item |
| shipment_number | Number | Yes | Sequence within the line item |
| planned_date | Date | Yes | Expected shipment/arrival date |
| actual_date | Date | No | Actual date |
| num_bales | Number | No | Bales in this shipment |
| weight | Decimal | No | Weight in this shipment |
| ship_from | Short Text | No | Origin location |
| ship_to | Short Text | No | Destination |
| vessel | Short Text | No | Ship/vessel name (sea freight) |
| container_nos | Short Text | No | Container number(s) |
| bill_of_lading_date | Date | No | Date BoL produced - triggers finance declaration |
| bill_of_lading_ref | Short Text | No | BoL document reference |
| status | Enum | Yes | Planned, In Transit, Received, Dispatched. Default: Planned |
| remarks | Text | No | Notes |
Commission agent and rate on a contract. Defined at contract level, applied when invoices are generated. Flows through to GP posting.
| Attribute | Type | Required | Description |
|---|---|---|---|
| commission_id | Identifier | Yes | Unique ID |
| contract_id | Reference | Yes | Parent contract |
| agent_code | Short Text | Yes | Commission agent/broker code |
| agent_name | Short Text | No | Agent name |
| commission_percent | Decimal | No | Percentage rate |
| commission_amount | Decimal | No | Fixed amount (if not percentage) |
| currency_code | Enum | No | GBP, USD, NZD, EUR |
| remarks | Text | No | Notes |
Additional charges above base price on a contract. Defined at contract level, applied at invoicing.
| Attribute | Type | Required | Description |
|---|---|---|---|
| overprice_id | Identifier | Yes | Unique ID |
| contract_id | Reference | Yes | Parent contract |
| overprice_code | Short Text | Yes | Type code for the charge |
| description | Short Text | No | What this charge is for |
| amount | Decimal | Yes | Charge amount |
| currency_code | Enum | No | GBP, USD, NZD, EUR |
| remarks | Text | No | Notes |
A specific batch of wool with its own tested attributes, cost, and lifecycle. The atomic unit of all trading. All allocations, invoices, and margins happen at lot level. Lot type reflects origin and commodity state (H = greasy home scour, M = merchanting, SS = standard scoured, SH = shears, SM = slivermaker, JH = Jacomb Hoare/Punta, P = Punta, NL = noil by-product).
| Attribute | Type | Required | Description |
|---|---|---|---|
| lot_id | Identifier | Yes | Unique ID |
| lot_number | Short Text | Yes | Lot reference (H19736, M19736, SS15513, etc.) |
| lot_type | Enum | Yes | H, M, SS, SH, SM, JH, P, NL |
| product_id | Reference | Yes | What product this lot is |
| division_id | Reference | Yes | Which trading desk |
| purchase_line_item_id | Reference | No | Purchase contract line (for purchased lots). Null for blend outputs. |
| blend_id | Reference | No | Blend that produced this lot (for scoured lots). Null for purchased lots. |
| num_bales | Number | Yes | Bale count |
| greasy_weight | Decimal | No | Weight before scouring (kg) |
| clean_weight | Decimal | No | Weight after scouring / clean equivalent (kg) |
| yield_percent | Decimal | No | Yield % (clean / greasy) |
| conditioning_percent | Decimal | No | Standard conditioning allowance for this lot |
| regain_percent | Decimal | No | Moisture regain percentage |
| cost_per_kg | Decimal | Yes | Cost in original currency |
| cost_currency | Enum | Yes | GBP, USD, NZD, EUR |
| cost_gbp | Decimal | No | Cost converted to GBP for comparison |
| processing_cost | Decimal | No | Scouring/processing cost (blend outputs) |
| micron | Decimal | No | Tested fineness (batch-specific) |
| vm_percent | Decimal | No | Vegetable matter % (batch-specific) |
| colour_reading_yz | Short Text | No | Y-Z colour reading (batch-specific) |
| length | Short Text | No | Tested length / Length HM for tops (batch-specific) |
| bw_sale_no | Short Text | No | British Wool auction sale number |
| bw_lot_no | Short Text | No | British Wool lot / supplier batch number |
| depot | Short Text | No | Where graded (UK wool) |
| warehouse | Short Text | No | Current physical location (e.g. Bower Green, Thomas Chadwick) |
| received_date | Date | No | Date goods received |
| dispatched_date | Date | No | Date lot was dispatched (for stock turnover calculation) |
| status | Enum | Yes | In Stock, Allocated, Consumed, Dispatched. Default: In Stock |
| created_at | DateTime | Yes | Record creation timestamp |
Links an inventory lot to a sales contract line. Records which lots are allocated to fulfil which sales. A lot can be split across multiple sales, and a sales line can be fulfilled from multiple lots.
| Attribute | Type | Required | Description |
|---|---|---|---|
| allocation_id | Identifier | Yes | Unique ID |
| lot_id | Reference | Yes | Which lot |
| sales_line_item_id | Reference | Yes | Which sales line |
| allocated_weight | Decimal | Yes | Weight allocated from this lot |
| allocated_bales | Number | No | Bales allocated |
| allocated_at | DateTime | Yes | When allocation was made |
| status | Enum | Yes | Allocated, Dispatched, Invoiced. Default: Allocated |
Farm traceability per lot. Especially important for Punta where full traceability is being requested. A lot can come from 10+ farms.
| Attribute | Type | Required | Description |
|---|---|---|---|
| lot_farm_id | Identifier | Yes | Unique ID |
| lot_id | Reference | Yes | Which lot |
| farm_name | Short Text | Yes | Farm name |
| notes | Text | No | Notes |
An individual bale within an inventory lot. Each bale has its own weights. Bale data enables automatic packing list generation, solving the current pain point of manual re-entry of bale weights.
| Attribute | Type | Required | Description |
|---|---|---|---|
| bale_id | Identifier | Yes | Unique ID |
| lot_id | Reference | Yes | Which lot this bale belongs to |
| bale_number | Short Text | Yes | Bale identifier within the lot |
| gross_weight | Decimal | Yes | Weight including packaging |
| tare_weight | Decimal | No | Weight of packaging |
| nett_weight | Decimal | Yes | Wool weight (gross minus tare) |
| marks | Short Text | No | Bale marks/identification |
| warehouse_location | Short Text | No | Where the bale is stored |
A manufacturing operation that transforms input lots into output lots via a processing path. The processing_type determines the transformation: Scouring (greasy → scoured), Tops Making (scoured → top + noil with cost apportionment), Cutting (top → cut top, cost accumulation), or Superwash (top → treated top, cost accumulation). Historical blends serve as the recipe knowledge base. Primary workflow is clone and modify.
| Attribute | Type | Required | Description |
|---|---|---|---|
| blend_id | Identifier | Yes | Unique ID |
| blend_number | Short Text | Yes | Blend reference (e.g. BL26047) |
| processing_type | Enum | Yes | Scouring, Tops Making, Cutting, Superwash. Determines valuation rules and valid output roles. |
| target_product_id | Reference | Yes | The sales product being produced |
| product_group_id | Reference | No | Product group context for generic blends |
| customer_id | Reference | No | Customer context (enables bespoke clone lookup) |
| division_id | Reference | Yes | Which trading desk |
| processor_id | Reference | Yes | Primary processor (Chadwicks) |
| cloned_from_blend_id | Reference | No | Which blend was cloned to create this one |
| target_weight_clean | Decimal | No | Target clean output weight in kg |
| planned_date | Date | No | When blend is planned |
| completed_date | Date | No | When blend was resulted |
| status | Enum | Yes | Planned, Instructed, Processing, Resulted, Cancelled. Default: Planned |
| instructions | Text | No | Specific blend instructions sent to processor |
| remarks | Text | No | Internal notes |
| run_number | Short Text | No | Processor's run reference (e.g. C35147) |
| created_at | DateTime | Yes | Record creation timestamp |
A specific lot used as input to a blend, with planned and actual quantities and costs. For scouring blends the input is greasy wool; for tops making, cutting, and superwash the input is scoured wool or tops. Captures the fact that recipes are estimates - planned weight is set on creation, actual weight entered when the processor sends back results.
| Attribute | Type | Required | Description |
|---|---|---|---|
| blend_input_id | Identifier | Yes | Unique ID |
| blend_id | Reference | Yes | Which blend |
| lot_id | Reference | Yes | Which input lot |
| planned_weight | Decimal | No | Planned input weight to use (kg) |
| actual_weight | Decimal | No | Actual input weight used (set on resulting) |
| planned_percent | Decimal | No | Target % of blend |
| actual_percent | Decimal | No | Actual % (derived from actual weights) |
| input_cost_per_kg | Decimal | No | Input cost per kg at time of blend (greasy cost for scouring, clean cost for other paths) |
| clean_cost_per_kg | Decimal | No | Clean cost per kg (input cost / yield for scouring; same as input cost for other paths) |
| yield_percent | Decimal | No | Yield for this lot at time of blend (applicable to scouring; null for cutting/superwash) |
An output lot produced by a blend, with its role and cost apportionment method. For scouring, cutting, and superwash there is typically one output (Primary, Full Cost). For tops making (Punta), the blend produces two outputs: a top (Primary, absorbs balance of apportioned cost) and a noil (ByProduct, valued at a predetermined price per kg).
| Attribute | Type | Required | Description |
|---|---|---|---|
| blend_output_id | Identifier | Yes | Unique ID |
| blend_id | Reference | Yes | Which blend produced this output |
| lot_id | Reference | Yes | The output lot created |
| output_role | Enum | Yes | Primary, ByProduct. Primary = main product; ByProduct = secondary output (e.g. noil). |
| valuation_method | Enum | Yes | Full Cost, Apportioned Balance, Predetermined Price. Determines how cost is allocated to this output. |
| predetermined_price_per_kg | Decimal | No | Fixed price per kg for by-products. Required when valuation_method = Predetermined Price. |
| actual_weight | Decimal | Yes | Output weight in kg |
| allocated_cost | Decimal | Yes | Total cost allocated to this output (derived from valuation rules) |
An individual cost line on a blend. Blends have multiple cost components - scouring (Chadwicks), opening (Andar Opener), metal removal, and other processing. Each line can be external (from a processor) or internal (derived from input lot costs). Multiple processors can work on the same blend.
| Attribute | Type | Required | Description |
|---|---|---|---|
| blend_cost_id | Identifier | Yes | Unique ID |
| blend_id | Reference | Yes | Which blend |
| cost_description | Short Text | Yes | What this cost is (e.g. "Processing Cost", "Andar Opener") |
| charge_source | Enum | Yes | External (processor invoice), Internal (input cost) |
| processor_id | Reference | No | Which processor (for external costs) |
| weight_kg | Decimal | Yes | Weight basis for cost calculation |
| cost_per_kg | Decimal | Yes | Cost per kg in currency unit (pence for GBP) |
| currency_code | Enum | Yes | GBP, USD, NZD, EUR |
| total_amount | Decimal | Yes | Total cost (weight x cost_per_kg). Derived. |
| vat_rate | Decimal | No | VAT rate if applicable |
| vat_amount | Decimal | No | VAT amount. Derived. |
| invoice_ref | Short Text | No | Processor invoice reference |
A third-party charge against a specific inventory lot — storage fees, carriage costs, handling charges, or other ancillary costs that are not part of blend processing. Enables cross-referencing supplier invoices (e.g. Bower Green storage, haulier carriage) against actual stock movements for variance analysis.
| Attribute | Type | Required | Description |
|---|---|---|---|
| lot_charge_id | Identifier | Yes | Unique ID |
| lot_id | Reference | Yes | Which lot this charge applies to |
| company_id | Reference | Yes | Who charged (Bower Green, haulier, etc.) |
| charge_type | Enum | Yes | Storage, Carriage, Handling, Other |
| charge_date | Date | Yes | Date of the charge |
| weight_kg | Decimal | No | Weight basis if applicable |
| cost_per_kg | Decimal | No | Rate per kg if applicable |
| total_amount | Decimal | Yes | Total charge amount |
| invoice_ref | Short Text | No | Supplier invoice reference |
| notes | Text | No | Free-text context |
A generated trading document - sales invoice, purchase invoice, blend invoice, packing list, blend instruction, credit note, or stock adjustment. Auto-generated from data already in the system. Each document generates a set of balanced Journal Lines for GP export.
| Attribute | Type | Required | Description |
|---|---|---|---|
| document_id | Identifier | Yes | Unique ID |
| document_number | Short Text | Yes | Document reference (e.g. S41947) |
| document_type | Enum | Yes | Sales Invoice, Purchase Invoice, Blend Invoice, Packing List, Blend Instruction, Credit Note, Stock Adjustment |
| contract_id | Reference | No | Related contract |
| blend_id | Reference | No | Related blend (for blend instructions) |
| company_id | Reference | No | Recipient company |
| issue_date | Date | Yes | Date issued |
| due_date | Date | No | Payment due date (invoices) |
| total_amount | Decimal | No | Document total |
| currency_code | Enum | No | GBP, USD, NZD, EUR |
| total_gbp | Decimal | No | GBP equivalent |
| vat_amount | Decimal | No | VAT amount |
| gp_nominal_code | Short Text | No | Mapped GP GL code |
| gp_posted | Boolean | Yes | Whether pushed to GP. Default: false |
| gp_posted_at | DateTime | No | When posted to GP |
| file_reference | Short Text | No | Path/reference to generated PDF |
| status | Enum | Yes | Draft, Issued, Posted, Failed. Default: Draft |
| created_at | DateTime | Yes | Record creation timestamp |
A record of when a trader converted currency and at what rate. Captures the difference between the contract rate and the actual conversion rate for FX gain/loss calculation.
| Attribute | Type | Required | Description |
|---|---|---|---|
| fx_conversion_id | Identifier | Yes | Unique ID |
| contract_id | Reference | Yes | Which contract |
| from_currency | Enum | Yes | USD, NZD, EUR |
| to_currency | Enum | Yes | GBP (usually) |
| amount_converted | Decimal | Yes | Amount in original currency |
| contract_rate | Decimal | Yes | Rate at time of contract |
| actual_rate | Decimal | Yes | Rate actually received |
| gain_loss_gbp | Decimal | Yes | FX gain or loss in GBP (derived) |
| conversion_date | Date | Yes | When the conversion happened |
| gp_journal_posted | Boolean | Yes | Whether FX journal posted to GP. Default: false |
| created_at | DateTime | Yes | Record creation timestamp |
An FX hedging contract with a bank or FX provider. Tracks the hedging position for margin and exposure calculations. The PRD recommends an external FX provider (Wise Business, Airwallex) for the actual money movement.
| Attribute | Type | Required | Description |
|---|---|---|---|
| fx_contract_id | Identifier | Yes | Unique ID |
| bank_reference | Short Text | Yes | Bank or FX provider reference |
| currency_code | Enum | Yes | Foreign currency being hedged |
| contracted_rate | Decimal | Yes | Rate locked in |
| amount | Decimal | Yes | Amount of foreign currency hedged |
| maturity_date | Date | Yes | When the contract expires |
| provider | Short Text | No | Bank, Wise, Airwallex, etc. |
| status | Enum | Yes | Active, Exercised, Expired. Default: Active |
| created_at | DateTime | Yes | Record creation timestamp |
Links an FX hedge to specific trading contracts. A single hedge can cover multiple contracts, and a contract might draw from multiple hedges.
| Attribute | Type | Required | Description |
|---|---|---|---|
| fx_allocation_id | Identifier | Yes | Unique ID |
| fx_contract_id | Reference | Yes | Which FX hedge |
| contract_id | Reference | Yes | Which trading contract |
| allocated_amount | Decimal | Yes | Amount of hedge allocated to this contract |
Reference table mapping transaction types to GL nominal codes per GP company. Different divisions post to different GP companies (SWB vs JHP) with different nominal codes. Drives automated journal line generation.
| Attribute | Type | Required | Description |
|---|---|---|---|
| mapping_id | Identifier | Yes | Unique ID |
| gp_company | Short Text | Yes | GP company code (SWB, JHP) |
| transaction_type | Enum | Yes | Purchase, Sale, Processing, PurchaseCharge, Commission, ClosingStock, StockMovement, VAT |
| nominal_code | Short Text | Yes | GL account code (e.g. 0500, 0235, 4500) |
| description | Short Text | Yes | Human-readable purpose |
An individual debit or credit line in a double-entry journal for GP export. Every document generates a balanced set of journal lines. The system must ensure total debits equal total credits per document. Lines are exported in a fixed-width text format for GP import.
| Attribute | Type | Required | Description |
|---|---|---|---|
| journal_line_id | Identifier | Yes | Unique ID |
| document_id | Reference | Yes | Parent document |
| nominal_code | Short Text | Yes | GL account code (from Nominal Code Mapping or V/C code) |
| debit_credit | Enum | Yes | D, C |
| amount | Decimal | Yes | Amount in transaction currency |
| currency_code | Enum | Yes | GBP, USD, NZD, EUR |
| fx_rate | Decimal | No | Exchange rate to GBP |
| base_amount | Decimal | No | GBP equivalent (for foreign currency lines) |
| lot_number | Short Text | No | Lot reference |
| product_code | Short Text | No | Product code reference |
| vendor_customer_code | Short Text | No | GP V/C prefix code |
| batch_ref | Short Text | No | GP batch number |
| tax_code | Enum | No | S (standard), Z (zero-rated), A |
| vat_amount | Decimal | No | VAT amount if applicable |
| user_code | Short Text | No | Operator who created the transaction (e.g. AKJ, PSH) |
| description | Text | No | Free-text narrative |
| transaction_date | Date | No | Transaction date for the journal line |
| weight_qty | Decimal | No | Weight or quantity associated with this line (kg) |
| export_status | Enum | Yes | Pending, Exported. Default: Pending |
| exported_at | DateTime | No | When line was exported to GP |
A system user - trader, finance, or admin.
| Attribute | Type | Required | Description |
|---|---|---|---|
| user_id | Identifier | Yes | Unique ID |
| username | Short Text | Yes | Login username |
| Short Text | Yes | Email address | |
| first_name | Short Text | Yes | First name |
| last_name | Short Text | Yes | Last name |
| role | Enum | Yes | Trader, Finance, Admin, Management |
| division_id | Reference | No | Primary trading desk |
| is_active | Boolean | Yes | Default: true |
Every action logged with user, timestamp, entity, and full context. Designed to be ML-ready from day one - captures enough context to reconstruct the state at the time of any decision.
| Attribute | Type | Required | Description |
|---|---|---|---|
| audit_log_id | Identifier | Yes | Unique ID |
| user_id | Reference | Yes | Who performed the action |
| entity_type | Short Text | Yes | Which entity was affected (e.g. "Contract") |
| entity_id | Short Text | Yes | ID of the affected entity |
| action | Enum | Yes | Created, Updated, Deleted, Status Changed |
| field_name | Short Text | No | Which field changed (for updates) |
| old_value | Text | No | Previous value |
| new_value | Text | No | New value |
| context | Text | No | Full context snapshot |
| created_at | DateTime | Yes | When the action happened |
An alert or pending task for a user. Covers threshold warnings (stock aging, margin breach), delivery date reminders, and pending action items.
| Attribute | Type | Required | Description |
|---|---|---|---|
| notification_id | Identifier | Yes | Unique ID |
| user_id | Reference | Yes | Recipient |
| notification_type | Enum | Yes | Alert, Task, Threshold Warning |
| title | Short Text | Yes | Notification title |
| message | Text | Yes | Notification message |
| entity_type | Short Text | No | Related entity type |
| entity_id | Short Text | No | Related entity ID |
| is_read | Boolean | Yes | Default: false |
| created_at | DateTime | Yes | When created |