Files
boc/LANDVEX_DATAMODELL.md
T
Bernt 58ca4e68db feat(boc): Complete Business Operations Center v1.0
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics)
- Rust analytics service with parallel report generation
- C runtime with POSIX shared memory IPC
- PostgreSQL schema with 30+ tables, full migrations
- Redis cache, sessions, pub/sub
- Kafka event streaming with Zookeeper
- WebSocket hub for real-time updates
- Automation engine with cron jobs, workflows, event triggers
- JWT authentication, multi-tenant from start
- Docker Compose with all services
- Nginx reverse proxy with rate limiting
- Integration tests passing
- Feature gap analysis against Fortnox/Odoo/Visma

Refs: BOC-001
2026-07-12 12:41:35 +00:00

2.4 KiB

Landvex Datamodell — De Tre Looparna

1. Obesvarade Frågor-loggen (Efterfrågeloopen)

CREATE TABLE unanswered_questions (
  id UUID PRIMARY KEY,
  question_text TEXT NOT NULL,
  customer_id UUID,
  vertical VARCHAR(50),
  geography VARCHAR(100),
  willingness_to_pay DECIMAL(10,2),
  confidence_required DECIMAL(3,2),
  timestamp TIMESTAMPTZ DEFAULT NOW(),
  resolved BOOLEAN DEFAULT FALSE,
  resolution_method VARCHAR(20), -- 'model', 'human', 'partner'
  resolution_cost DECIMAL(10,2),
  -- KPI-derivat
  days_to_resolve INT,
  revenue_potential DECIMAL(10,2)
);

2. Sensor-nätverk (Utbudsloopen)

CREATE TABLE sensor_network (
  id UUID PRIMARY KEY,
  zoomer_id UUID,
  geography VARCHAR(100),
  acceptance_rate DECIMAL(5,2),
  avg_completion_time_hours DECIMAL(6,2),
  churn_30d BOOLEAN,
  credit_earnings_30d DECIMAL(10,2),
  -- Dynamisk prissättning
  current_credit_multiplier DECIMAL(3,2) DEFAULT 1.0,
  supply_tension_score DECIMAL(5,2)
);

3. Modell-träning (Modellloopen)

CREATE TABLE model_training (
  id UUID PRIMARY KEY,
  mission_id UUID,
  uncertainty_score DECIMAL(5,4),
  demand_score DECIMAL(5,4),
  allocation_score DECIMAL(5,4), -- uncertainty * demand
  source_type VARCHAR(20), -- 'satellite', 'partner', 'human'
  cost_per_example DECIMAL(10,2),
  model_version VARCHAR(20),
  confidence_improvement DECIMAL(5,4),
  timestamp TIMESTAMPTZ DEFAULT NOW()
);

4. Answer Rate-baslinje

CREATE TABLE answer_rate_metrics (
  date DATE PRIMARY KEY,
  total_questions INT,
  answered_by_model INT,
  answered_by_human INT,
  unanswered INT,
  answer_rate DECIMAL(5,2),
  median_time_to_truth_hours DECIMAL(6,2),
  cost_per_answer DECIMAL(10,2)
);

Dashboard Queries

Answer Rate Trend

SELECT 
  date_trunc('week', date) as week,
  avg(answer_rate) as avg_answer_rate,
  avg(median_time_to_truth_hours) as avg_ttt
FROM answer_rate_metrics
WHERE date >= NOW() - INTERVAL '12 weeks'
GROUP BY 1
ORDER BY 1;

Top Obesvarade (Roadmap)

SELECT 
  vertical,
  geography,
  COUNT(*) as count,
  AVG(willingness_to_pay) as avg_wtp
FROM unanswered_questions
WHERE resolved = FALSE
  AND timestamp >= NOW() - INTERVAL '30 days'
GROUP BY 1, 2
ORDER BY count DESC
LIMIT 20;

Supply Tension Heatmap

SELECT 
  geography,
  AVG(supply_tension_score) as tension,
  AVG(current_credit_multiplier) as multiplier
FROM sensor_network
WHERE churn_30d = FALSE
GROUP BY 1
ORDER BY tension DESC;