Files
boc/landvex-admin-backend/app/routers/life_metrics.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

281 lines
13 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
LIFE — North Star Metric & KPI Dashboard
Verified Reality Coverage (VRC):
Andelen av den observerbara verklighet som representeras i LIFE
med aktuell, oberoende verifierad evidens över en definierad kvalitetsnivå.
"""
from fastapi import APIRouter
from typing import Dict, Any
router = APIRouter(prefix="/life-metrics", tags=["life_metrics"])
@router.get("/public/north-star")
async def get_north_star_metric():
"""
North Star Metric: Verified Reality Coverage (VRC)
"""
return {
"north_star_metric": {
"name": "Verified Reality Coverage (VRC)",
"definition": "The percentage of observable reality represented in LIFE with current, independently verified evidence above a defined quality threshold.",
"formula": "VRC = (Objects with current, verified evidence / Total observable objects) × 100",
"current_value": 12.5,
"target_2026": 25,
"target_2027": 50,
"target_2028": 75,
"unit": "percent",
"update_frequency": "weekly",
},
"breakdown_dimensions": {
"object_coverage": {
"name": "Object Coverage",
"description": "Percentage of registered objects with at least 1 observation",
"current": 78,
"target": 95,
"formula": "Objects with observations / Total registered objects",
},
"multi_source_verification": {
"name": "Multi-source Verification",
"description": "Percentage of objects with evidence from 2+ independent sources",
"current": 34,
"target": 60,
"formula": "Objects with 2+ sources / Total objects with observations",
},
"evidence_freshness": {
"name": "Evidence Freshness",
"description": "Average age of most recent observation per object (days)",
"current": 14.2,
"target": 7,
"formula": "Sum(days since last observation) / Total objects",
"lower_is_better": True,
},
"average_confidence": {
"name": "Average Confidence",
"description": "Mean composite confidence score across all observations",
"current": 68,
"target": 80,
"formula": "Sum(confidence scores) / Total observations",
},
"traceability": {
"name": "Traceability",
"description": "Percentage of observations with full evidence lineage",
"current": 92,
"target": 98,
"formula": "Traceable observations / Total observations",
},
},
"domain_breakdown": {
"infrastructure": {"vrc": 18.5, "objects": 450, "observations": 12000},
"aid": {"vrc": 8.2, "objects": 120, "observations": 8500},
"municipality": {"vrc": 15.3, "objects": 3200, "observations": 28000},
"properties": {"vrc": 6.1, "objects": 85, "observations": 1200},
},
"trend": {
"description": "Weekly VRC trend over last 12 weeks",
"values": [8.2, 8.5, 9.1, 9.8, 10.2, 10.8, 11.1, 11.5, 11.9, 12.2, 12.4, 12.5],
"growth_rate": "+4.2% per month",
},
}
@router.get("/public/communication-framework")
async def get_communication_framework():
"""
Framework for separating vision, architecture, and validated results
in external communication.
"""
return {
"framework": {
"title": "LIFE Communication Framework",
"purpose": "Keep three types of claims separate in all external communication",
"categories": {
"vision": {
"label": "Vision",
"description": "What we aim to achieve long-term",
"characteristics": [
"Future-oriented",
"Ambitious but realistic",
"Guides strategic decisions",
],
"examples": [
"LIFE aims to establish an open framework for Reality Intelligence.",
"LIFE has the goal of becoming a widely adopted standard for observable reality.",
"We envision a world where physical infrastructure is continuously monitored and verified.",
],
"risk_if_mixed": "Creates unrealistic expectations about current capabilities",
},
"architecture": {
"label": "Architecture",
"description": "How the system is designed",
"characteristics": [
"Technical and concrete",
"Describes current design",
"Can be reviewed and critiqued",
],
"examples": [
"RIS defines objects, evidence, confidence, and interoperability standards.",
"LIFE uses a 4-layer architecture with 8 intelligence engines.",
"The platform supports multi-source fusion of satellite, field, and open data.",
],
"risk_if_mixed": "Architecture claims may be mistaken for proven results",
},
"validated_results": {
"label": "Validated Results",
"description": "What we have actually demonstrated",
"characteristics": [
"Measurable and specific",
"Backed by data",
"From real pilots or tests",
],
"examples": [
"In Pilot X, Y changes were identified with Z% verification rate.",
"Road damage detection achieved 82% precision in Uppsala county test.",
"Average detection time for infrastructure changes: 36 hours.",
],
"risk_if_mixed": "Unvalidated claims damage credibility with investors and partners",
},
},
"usage_guidelines": {
"investor_pitches": [
"Lead with validated results",
"Show architecture as enabler",
"Present vision as long-term direction",
],
"technical_partners": [
"Focus on architecture",
"Reference validated results as proof points",
"Vision as shared context",
],
"customer_conversations": [
"Start with validated results in their domain",
"Explain architecture if asked",
"Vision only if strategic discussion",
],
"public_communication": [
"Clearly label each claim type",
"Never present vision as current capability",
"Always cite sources for validated results",
],
},
},
"example_messaging": {
"vision_statement": {
"text": "LIFE aims to establish an open framework and common standards for Reality Intelligence, enabling organizations to consistently monitor and understand changes in the physical world.",
"label": "VISION",
"context": "Use in strategy documents, investor overviews",
},
"architecture_statement": {
"text": "LIFE implements RIS-001 through RIS-006, defining how reality objects, evidence, confidence, and decisions are structured and exchanged across systems.",
"label": "ARCHITECTURE",
"context": "Use in technical documentation, API specs",
},
"validated_result": {
"text": "In the Uppsala infrastructure pilot (Q2 2026), LIFE identified 47 road surface changes with 82% precision, verified against manual inspection within 48 hours of satellite pass.",
"label": "VALIDATED RESULT",
"context": "Use in case studies, sales conversations",
},
},
}
@router.get("/public/roadmap")
async def get_roadmap():
"""
Structured roadmap with priorities and deliverables
"""
return {
"roadmap": {
"title": "LIFE Development Roadmap",
"last_updated": "2026-07-04",
"phases": [
{
"phase": "P0",
"priority": "Critical",
"deliverables": [
{
"name": "LIFE Technical Specification v1.0",
"description": "Define architecture, RIS, ontology, APIs and governance in a single coherent document",
"purpose": "Reference for developers, partners, and customers",
"timeline": "Q3 2026",
"owner": "Architecture team",
"status": "In progress",
},
{
"name": "RIVP Pilot 1 — Infrastructure",
"description": "Demonstrate that LIFE creates value in a real use case with clear metrics",
"purpose": "Prove platform works in production",
"timeline": "Q3-Q4 2026",
"owner": "Field operations",
"status": "Planning",
"success_criteria": [
">80% precision in road damage detection",
"<48h detection time",
">90% verification rate",
],
},
],
},
{
"phase": "P1",
"priority": "High",
"deliverables": [
{
"name": "Reference Implementation",
"description": "Give partners and developers a concrete starting point",
"purpose": "Lower adoption barrier",
"timeline": "Q4 2026",
"owner": "Engineering",
"status": "Not started",
},
{
"name": "RIS Public Specification",
"description": "Publish standard and versioning policy",
"purpose": "Enable independent implementations",
"timeline": "Q4 2026",
"owner": "Standards team",
"status": "Not started",
},
],
},
{
"phase": "P2",
"priority": "Medium",
"deliverables": [
{
"name": "Conformance Suite",
"description": "Automated tests to verify implementations follow RIS",
"purpose": "Quality assurance for ecosystem",
"timeline": "Q1 2027",
"owner": "QA team",
"status": "Not started",
},
{
"name": "Partner SDK",
"description": "Lower barrier for integrations",
"purpose": "Enable ecosystem growth",
"timeline": "Q1 2027",
"owner": "Developer relations",
"status": "Not started",
},
],
},
{
"phase": "P3",
"priority": "Future",
"deliverables": [
{
"name": "Marketplace & Certification",
"description": "Build ecosystem when core is proven",
"purpose": "Commercial ecosystem",
"timeline": "Q2 2027+",
"owner": "Business development",
"status": "Not started",
},
],
},
],
},
}