Files
boc/landvex-admin-backend/app/routers/life_ecosystem.py
T
Bernt aee0f09db8 landvex: Fixar och tester klara för alla komponenter
- Datafabrik: Dockerfile fix, agentorkestrering fungerar
- Vision: Identify-modell, FAISS, OCR alla testade
- API: Alla 7 integrationstester passerade
- Upplösare: Entitetsupplösning verifierad
2026-07-05 06:41:32 +00:00

666 lines
31 KiB
Python

"""
LIFE v7 — Reality Intelligence Ecosystem
Fokus: Adoption. Ett tekniskt ramverk blir en standard först när andra använder det.
Tre komponenter:
1. Reference Implementations (öppna referensimplementationer)
2. Conformance Program (certifiering)
3. Public Specification (öppen specifikation)
Strategisk avgränsning:
- RIS (Reality Intelligence Standard) — den öppna specifikationen
- LIFE — referensimplementationen av standarden
- Landvex — företaget som utvecklar och kommersialiserar LIFE
Product Definition:
"Landvex utvecklar LIFE, en Reality Intelligence Platform och referensimplementation
av Reality Intelligence Standard (RIS). Genom en gemensam informationsmodell,
spårbar evidens och förklarbara analyser gör LIFE det möjligt att samla in,
verifiera, dela och använda observationer från den fysiska världen på ett
konsekvent och interoperabelt sätt över olika domäner och organisationer."
"""
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from typing import List, Optional, Dict, Any
from datetime import datetime
from enum import Enum
from app.database import get_db
from app.core.security import get_current_user
from app.models import User
router = APIRouter(prefix="/life-ecosystem", tags=["life_ecosystem"])
# ─── COMPONENT 1: REFERENCE IMPLEMENTATIONS ───────────────────────────────────
@router.get("/public/reference-implementations")
async def get_reference_implementations():
"""
Reference Implementations — Öppna referensimplementationer som sänker tröskeln
för externa utvecklare.
"""
return {
"component": 1,
"name": "Reference Implementations",
"description": "Öppna referensimplementationer av RIS som sänker tröskeln för externa utvecklare",
"implementations": {
"reference_server": {
"name": "LIFE Reference Server",
"description": "Komplett serverimplementation av RIS-004 (Reality Exchange Protocol)",
"language": "Python (FastAPI)",
"license": "Apache 2.0",
"repository": "https://github.com/landvex/life-reference-server",
"features": [
"Full RIS-001 till RIS-006 implementation",
"PostgreSQL + Neo4j + TimescaleDB",
"JWT-autentisering",
"Event-driven arkitektur",
"Horisontell skalning",
],
"deployment": {
"docker": "docker run landvex/life-reference-server",
"kubernetes": "Helm chart tillgänglig",
"aws": "CloudFormation template",
"local": "docker-compose up",
},
"status": "Beta",
"latest_version": "0.9.2",
},
"reference_client": {
"name": "LIFE Reference Client",
"description": "Exempelapplikation som visar hur man bygger ovanpå RIS",
"language": "TypeScript / React",
"license": "Apache 2.0",
"repository": "https://github.com/landvex/life-reference-client",
"features": [
"Interaktiv karta med Reality Objects",
"Observation submission",
"Evidence viewer med confidence scores",
"Decision support dashboard",
"Collaboration workspace",
],
"deployment": {
"static": "Byggs till statiska filer",
"cdn": "Kan hostas på valfri CDN",
},
"status": "Alpha",
"latest_version": "0.5.1",
},
"reference_sdk": {
"name": "LIFE Reference SDK",
"description": "SDK:er för olika programmeringsspråk",
"languages": {
"python": {
"repository": "https://github.com/landvex/life-sdk-python",
"package": "pip install life-sdk",
"status": "Stable",
"version": "1.2.0",
},
"javascript": {
"repository": "https://github.com/landvex/life-sdk-js",
"package": "npm install @landvex/life-sdk",
"status": "Stable",
"version": "1.1.0",
},
"java": {
"repository": "https://github.com/landvex/life-sdk-java",
"package": "Maven Central: ai.landvex:life-sdk",
"status": "Beta",
"version": "0.8.0",
},
"go": {
"repository": "https://github.com/landvex/life-sdk-go",
"package": "go get github.com/landvex/life-sdk-go",
"status": "Beta",
"version": "0.7.0",
},
"rust": {
"repository": "https://github.com/landvex/life-sdk-rust",
"package": "cargo add life-sdk",
"status": "Alpha",
"version": "0.4.0",
},
},
},
"example_data": {
"name": "LIFE Example Data",
"description": "Exempeldataset för att testa och lära sig RIS",
"datasets": [
{
"name": "Somalia Infrastructure",
"objects": 1250,
"observations": 45000,
"format": "RIS-001 / RIS-002",
"download": "https://data.life.ai/examples/somalia-infrastructure.tar.gz",
},
{
"name": "Sweden Road Network",
"objects": 500000,
"observations": 2000000,
"format": "RIS-001 / RIS-002",
"download": "https://data.life.ai/examples/sweden-roads.tar.gz",
},
{
"name": "Global Climate Events",
"objects": 10000,
"observations": 500000,
"format": "RIS-001 / RIS-002",
"download": "https://data.life.ai/examples/climate-events.tar.gz",
},
],
"license": "CC BY 4.0",
},
"example_apis": {
"name": "LIFE Example APIs",
"description": "Exempel på hur man bygger API:er ovanpå RIS",
"examples": [
{
"name": "Municipal Infrastructure API",
"description": "API för kommunal infrastrukturhantering",
"repository": "https://github.com/landvex/examples/municipal-api",
},
{
"name": "Insurance Risk Assessment API",
"description": "API för försäkringsriskbedömning",
"repository": "https://github.com/landvex/examples/insurance-api",
},
{
"name": "Aid Project Monitoring API",
"description": "API för biståndsprojektövervakning",
"repository": "https://github.com/landvex/examples/aid-api",
},
],
},
},
"getting_started": {
"quickstart": "https://docs.life.ai/quickstart",
"tutorials": [
"Build your first Reality Object",
"Submit observations via API",
"Build a custom domain module",
"Deploy a LIFE instance",
],
"community": {
"discord": "https://discord.gg/life-standard",
"forum": "https://forum.life.ai",
"github_discussions": "https://github.com/landvex/life-standard/discussions",
},
},
}
# ─── COMPONENT 2: CONFORMANCE PROGRAM ─────────────────────────────────────────
@router.get("/public/conformance-program")
async def get_conformance_program():
"""
Conformance Program — Certifieringsprogram för att ge tydlig kvalitetsnivå
för integrationer.
"""
return {
"component": 2,
"name": "Conformance Program",
"description": "Certifieringsprogram som ger tydlig kvalitetsnivå för RIS-integrationer",
"levels": {
"ris_compatible": {
"name": "RIS Compatible",
"badge": "🥉",
"description": "Grundläggande kompatibilitet med RIS",
"requirements": [
"Implementerar RIS-001 (Reality Object Standard)",
"Kan läsa och skriva RIS-002 (Evidence Standard)",
"Använder RIS-004 (Reality Exchange Protocol) för kommunikation",
"Dokumenterad API-specifikation",
],
"testing": [
"Automatiska kompatibilitetstester",
"Validering av objektstruktur",
"API-kontraktsverifiering",
],
"validity": "12 månader",
"renewal": "Automatisk vid passande tester",
"fee": "Gratis",
},
"ris_certified": {
"name": "RIS Certified",
"badge": "🥈",
"description": "Fullständig implementation av alla RIS-standarder",
"requirements": [
"Alla krav för RIS Compatible",
"Implementerar RIS-003 (Confidence Standard)",
"Implementerar RIS-005 (Decision Standard)",
"Implementerar RIS-006 (Learning Standard)",
"Mänsklig granskning av implementation",
"Dokumenterad säkerhetsarkitektur",
],
"testing": [
"Alla automatiska tester",
"Säkerhetsgranskning",
"Prestandatestning",
"Interoperabilitetstestning med referensimplementation",
],
"validity": "12 månader",
"renewal": "Omgranskning varje år",
"fee": "$5,000 / år",
},
"ris_enterprise_certified": {
"name": "RIS Enterprise Certified",
"badge": "🥇",
"description": "Enterprise-klar implementation med högsta kvalitetsnivå",
"requirements": [
"Alla krav för RIS Certified",
"Implementerar alla Governance Layer-komponenter (v5)",
"SOC 2 Type II-certifiering",
"ISO 27001-certifiering",
"24/7 supportavtal",
"SLA-garantier",
"Penetrationstestning",
],
"testing": [
"Alla tester för RIS Certified",
"Oberoende säkerhetsgranskning",
"Lasttestning",
"Disaster recovery-testning",
"Compliance-granskning",
],
"validity": "12 månader",
"renewal": "Omfattande årlig granskning",
"fee": "$25,000 / år",
"benefits": [
"Listad på LIFE Marketplace",
"Prioriterad teknisk support",
"Tidig tillgång till nya standarder",
"Deltagande i standardiseringsarbete",
],
},
},
"certification_process": {
"steps": [
{"step": 1, "name": "Self-assessment", "description": "Utför självbedömning med verktyg", "duration": "1-2 dagar"},
{"step": 2, "name": "Application", "description": "Skicka in ansökan med dokumentation", "duration": "1 dag"},
{"step": 3, "name": "Automated Testing", "description": "Kör automatiska kompatibilitetstester", "duration": "1-2 dagar"},
{"step": 4, "name": "Review", "description": "Mänsklig granskning (för Certified+)", "duration": "1-2 veckor"},
{"step": 5, "name": "Certification", "description": "Utfärdande av certifikat och badge", "duration": "1 dag"},
],
"tools": {
"self_assessment": "https://tools.life.ai/conformance/self-assessment",
"automated_testing": "https://tools.life.ai/conformance/testing",
"documentation_template": "https://docs.life.ai/conformance/template",
},
},
"certified_products": {
"count": 12,
"examples": [
{"name": "MunicipalityX Infrastructure", "level": "RIS Enterprise Certified", "domain": "Cities"},
{"name": "AidTracker Pro", "level": "RIS Certified", "domain": "Aid"},
{"name": "RiskMap Analytics", "level": "RIS Certified", "domain": "Insurance"},
{"name": "GreenWatch", "level": "RIS Compatible", "domain": "Environment"},
],
},
}
# ─── COMPONENT 3: PUBLIC SPECIFICATION ────────────────────────────────────────
@router.get("/public/public-specification")
async def get_public_specification():
"""
Public Specification — Öppen specifikation som gör att andra kan implementera
standarden oberoende av LIFE-plattformen.
"""
return {
"component": 3,
"name": "Public Specification",
"description": "Öppen specifikation som gör att andra kan implementera RIS oberoende av LIFE-plattformen",
"specification": {
"title": "Reality Intelligence Standard (RIS) Specification",
"version": "1.0.0",
"status": "Public Draft",
"license": "CC BY 4.0",
"url": "https://standard.life.ai/spec/v1.0.0",
"download": {
"pdf": "https://standard.life.ai/spec/v1.0.0.pdf",
"html": "https://standard.life.ai/spec/v1.0.0.html",
"markdown": "https://standard.life.ai/spec/v1.0.0.md",
},
},
"contents": {
"terminology": {
"section": 1,
"title": "Terminology",
"description": "Definierade termer och begrepp",
"terms": [
{"term": "Reality Object", "definition": "En entitet i den fysiska världen som kan observeras och representeras digitalt"},
{"term": "Evidence", "definition": "Data som stöder eller motsäger ett påstående om ett Reality Object"},
{"term": "Confidence", "definition": "Graden av säkerhet i en bedömning, uttryckt som ett värde mellan 0 och 100"},
{"term": "Observation", "definition": "En mätning eller iakttagelse av ett Reality Object vid en specifik tid och plats"},
{"term": "Fusion", "definition": "Processen att kombinera data från flera källor till en enhetlig representation"},
{"term": "Decision Object", "definition": "En strukturerad representation av ett beslutsstöd med observation, evidens, hypotes och rekommendation"},
],
},
"object_model": {
"section": 2,
"title": "Object Model",
"description": "RIS-001: Reality Object Standard",
"specification_url": "https://standard.life.ai/spec/v1.0.0#object-model",
},
"api_contracts": {
"section": 3,
"title": "API Contracts",
"description": "RIS-004: Reality Exchange Protocol",
"endpoints": [
{
"path": "/objects",
"methods": ["GET", "POST", "PUT", "DELETE"],
"specification": "https://standard.life.ai/spec/v1.0.0#objects-endpoint",
},
{
"path": "/observations",
"methods": ["GET", "POST"],
"specification": "https://standard.life.ai/spec/v1.0.0#observations-endpoint",
},
{
"path": "/evidence",
"methods": ["GET", "POST"],
"specification": "https://standard.life.ai/spec/v1.0.0#evidence-endpoint",
},
{
"path": "/relationships",
"methods": ["GET", "POST", "DELETE"],
"specification": "https://standard.life.ai/spec/v1.0.0#relationships-endpoint",
},
{
"path": "/events",
"methods": ["GET", "POST"],
"specification": "https://standard.life.ai/spec/v1.0.0#events-endpoint",
},
{
"path": "/hypotheses",
"methods": ["GET", "POST"],
"specification": "https://standard.life.ai/spec/v1.0.0#hypotheses-endpoint",
},
{
"path": "/predictions",
"methods": ["GET"],
"specification": "https://standard.life.ai/spec/v1.0.0#predictions-endpoint",
},
{
"path": "/actions",
"methods": ["GET", "POST"],
"specification": "https://standard.life.ai/spec/v1.0.0#actions-endpoint",
},
{
"path": "/missions",
"methods": ["GET", "POST", "PUT"],
"specification": "https://standard.life.ai/spec/v1.0.0#missions-endpoint",
},
],
},
"evidence_model": {
"section": 4,
"title": "Evidence Model",
"description": "RIS-002: Evidence Standard",
"specification_url": "https://standard.life.ai/spec/v1.0.0#evidence-model",
},
"confidence_model": {
"section": 5,
"title": "Confidence Model",
"description": "RIS-003: Confidence Standard",
"specification_url": "https://standard.life.ai/spec/v1.0.0#confidence-model",
},
"decision_model": {
"section": 6,
"title": "Decision Model",
"description": "RIS-005: Decision Standard",
"specification_url": "https://standard.life.ai/spec/v1.0.0#decision-model",
},
"learning_model": {
"section": 7,
"title": "Learning Model",
"description": "RIS-006: Learning Standard",
"specification_url": "https://standard.life.ai/spec/v1.0.0#learning-model",
},
"examples": {
"section": 8,
"title": "Examples",
"description": "Exempel på implementation och användning",
"examples": [
{"name": "Creating a Reality Object", "url": "https://standard.life.ai/examples/create-object"},
{"name": "Submitting Evidence", "url": "https://standard.life.ai/examples/submit-evidence"},
{"name": "Querying with Confidence", "url": "https://standard.life.ai/examples/query-confidence"},
{"name": "Building a Decision", "url": "https://standard.life.ai/examples/build-decision"},
],
},
"versioning_policy": {
"section": 9,
"title": "Versioning Policy",
"description": "Hur standarden versionshanteras",
"policy": {
"semantic_versioning": "MAJOR.MINOR.PATCH",
"major_changes": "Brytande förändringar, kräver migration",
"minor_changes": "Nya funktioner, bakåtkompatibla",
"patch_changes": "Buggfixar, bakåtkompatibla",
"deprecation": "Funktioner markeras deprecated minst 1 major version innan borttagning",
"support_window": "2 major versioner stöds samtidigt",
},
},
"backward_compatibility": {
"section": 10,
"title": "Backward Compatibility",
"description": "Garantier för bakåtkompatibilitet",
"guarantees": [
"Inga borttagna fält inom samma major version",
"Nya fält är alltid valfria",
"API-endpoints föråldras gradvis",
"Migration guides vid major bumps",
],
},
},
"governance": {
"standard_body": "Reality Intelligence Standards Board (RISB)",
"membership": [
{"organization": "Landvex", "role": "Founding Member", "seats": 2},
{"organization": "Open Community", "role": "Elected Representatives", "seats": 3},
{"organization": "Academic Institutions", "role": "Advisory", "seats": 2},
{"organization": "Enterprise Partners", "role": "Advisory", "seats": 2},
],
"decision_process": "RFC-baserad process med öppen kommentarsperiod",
"meeting_frequency": "Kvartalsvis",
"public_minutes": True,
},
}
# ─── STRATEGIC SEPARATION ─────────────────────────────────────────────────────
@router.get("/public/strategic-separation")
async def get_strategic_separation():
"""
Tydlig avgränsning mellan RIS, LIFE och Landvex
"""
return {
"title": "Strategic Separation of Concerns",
"description": "Tydlig avgränsning mellan standard, implementation och företag",
"entities": {
"ris": {
"name": "Reality Intelligence Standard (RIS)",
"type": "Open Standard",
"analogy": "Som HTTP för webben",
"ownership": "Community-governed (RISB)",
"license": "CC BY 4.0",
"cost": "Gratis att använda",
"purpose": "Definiera HUR verklighetsintelligens representeras, valideras, utbyts och används",
"scope": [
"Objektmodell (RIS-001)",
"Evidensstandard (RIS-002)",
"Konfidensstandard (RIS-003)",
"Utbytesprotokoll (RIS-004)",
"Beslutsstandard (RIS-005)",
"Lärandestandard (RIS-006)",
"Gemensam ontologi",
],
"governance": "Reality Intelligence Standards Board",
"development": "Öppen process med RFC:er",
},
"life": {
"name": "Landvex Intelligence Fusion Engine (LIFE)",
"type": "Reference Implementation",
"analogy": "Som Apache HTTP Server för HTTP",
"ownership": "Landvex (open source)",
"license": "Apache 2.0",
"cost": "Gratis att använda, betalt stöd tillgängligt",
"purpose": "Referensimplementation av RIS som andra kan bygga vidare på",
"scope": [
"Komplett serverimplementation",
"SDK:er för flera språk",
"Webb-dashboard",
"Mobile apps",
"AI-motorer",
"Datainsamlingsverktyg",
],
"governance": "Landvex med community contributions",
"development": "Open source på GitHub",
},
"landvex": {
"name": "Landvex AB",
"type": "Commercial Company",
"analogy": "Som Cloudflare för webben — bygger på öppna standarder men erbjuder kommersiella tjänster",
"ownership": "Privat företag",
"license": "Proprietär för kommersiella tjänster",
"cost": "Betalda tjänster och support",
"purpose": "Utveckla, kommersialisera och erbjuda tjänster ovanpå LIFE och RIS",
"scope": [
"LIFE Platform hosting (SaaS)",
"Managed LIFE instances",
"Professional support",
"Custom development",
"Training and certification",
"QUIXZOOM Network",
"Domain-specific modules",
],
"governance": "Företagsledning",
"development": "Proprietär utveckling med öppna komponenter",
},
},
"relationship": {
"description": "Tre nivåer av öppenhet",
"levels": [
{
"level": "Standard (RIS)",
"openness": "Fullständigt öppen",
"anyone_can": "Implementera, använda, modifiera",
"cost": "Gratis",
},
{
"level": "Implementation (LIFE)",
"openness": "Open source",
"anyone_can": "Använda, modifiera, distribuera",
"cost": "Gratis (Apache 2.0)",
},
{
"level": "Services (Landvex)",
"openness": "Proprietär",
"anyone_can": "Köpa tjänster",
"cost": "Betalda tjänster",
},
],
},
"ecosystem_analogy": {
"description": "Jämförelse med framgångsrika ekosystem",
"examples": [
{
"standard": "HTTP / HTML / CSS",
"implementation": "Apache, Nginx, Chrome, Firefox",
"company": "Cloudflare, Fastly, Google",
},
{
"standard": "Kubernetes (CNCF)",
"implementation": "OpenShift, Rancher, EKS",
"company": "Red Hat, SUSE, AWS",
},
{
"standard": "OpenAPI",
"implementation": "Swagger, Postman",
"company": "SmartBear, Postman Inc",
},
{
"standard": "RIS (Reality Intelligence Standard)",
"implementation": "LIFE (Landvex Intelligence Fusion Engine)",
"company": "Landvex AB",
},
],
},
}
# ─── FINAL PRODUCT STORY ──────────────────────────────────────────────────────
@router.get("/public/product-story")
async def get_product_story():
"""
Slutlig produktberättelse
"""
return {
"title": "Landvex LIFE — Reality Intelligence Platform",
"tagline": "Reality Intelligence Standard (RIS) + Reference Implementation",
"one_sentence": "Landvex utvecklar LIFE, en Reality Intelligence Platform och referensimplementation av Reality Intelligence Standard (RIS). Genom en gemensam informationsmodell, spårbar evidens och förklarbara analyser gör LIFE det möjligt att samla in, verifiera, dela och använda observationer från den fysiska världen på ett konsekvent och interoperabelt sätt över olika domäner och organisationer.",
"evolution": {
"v1": {"focus": "Aid Intelligence", "key": "Biståndsövervakning"},
"v2": {"focus": "Multi-signal", "key": "Evidence Before Opinion"},
"v3": {"focus": "Core Architecture", "key": "9 block, AI-operativsystem"},
"v4": {"focus": "Platform", "key": "4 nivåer, SDK, Object Model"},
"v5": {"focus": "Enterprise", "key": "5 pelare, governance, simulation"},
"v6": {"focus": "Standard", "key": "6 RIS, ontologi, ekosystem"},
"v7": {"focus": "Ecosystem", "key": "Adoption, reference implementations, conformance"},
},
"positioning": {
"what_we_are": "Ett teknologiskt ramverk och öppen standard för Reality Intelligence",
"what_we_enable": "Andra att bygga Reality Intelligence-lösningar",
"what_makes_us_different": [
"Reality Intelligence (inte bara text)",
"Evidence Before Opinion (spårbarhet)",
"Multi-source fusion (geospatial + fält + AI)",
"Open standard (RIS)",
"Reference implementation (LIFE)",
"Ecosystem approach (adoption fokus)",
],
"target_users": [
"Development agencies",
"Governments",
"Infrastructure operators",
"Insurance companies",
"Urban planners",
"Environmental organizations",
"Security agencies",
"Researchers",
"Technology partners",
],
},
"business_model": {
"open_components": [
"RIS Standard (CC BY 4.0)",
"LIFE Reference Server (Apache 2.0)",
"LIFE SDK (Apache 2.0)",
"Example Data (CC BY 4.0)",
],
"commercial_components": [
"LIFE Platform SaaS",
"Managed instances",
"Professional support",
"Custom development",
"Training and certification",
"QUIXZOOM Network access",
],
"revenue_streams": [
"SaaS subscriptions",
"Support contracts",
"Professional services",
"Certification fees",
"Data services",
],
},
"long_term_vision": "LIFE blir den dominerande standarden för hur organisationer representerar, validerar, utbyter och använder verklighetsintelligens — på samma sätt som HTTP blev standarden för webben.",
}