Files
boc/landvex-admin-backend/app/routers/__pycache__/life_engine.cpython-39.pyc
T

95 lines
15 KiB
Plaintext
Raw Normal View History

a
ƒÅHjeã@dZddlmZmZmZmZddlmZddlm Z m
Z
m Z m Z ddl
m
Z
ddlmZddlmZddlmZdd lmZed
d gd ZGd
ddeeƒZGdddeeƒZGdddeeƒZe d¡ddƒZe d¡ddƒZe d¡d3e
ee
ee
edœddƒZe d¡edœd d!„ƒZe d"¡edœd#d$„ƒZ e d%¡edœd&d'„ƒZ!e d(¡edœd)d*„ƒZ"e d+¡ed,œd-d.„ƒZ#e d/¡eeƒeeƒfeed0œd1d2„ƒZ$dS)4a5
Landvex Intelligence Fusion Engine (LIFE)
Continuous Multi-Source Intelligence Platform
Core Principle: Evidence Before Opinion
- First gather observable signals
- Then weigh independent sources
- Identify patterns and statistical associations
- Only then generate cautious hypotheses about possible causes
é)Ú APIRouterÚDependsÚ
HTTPExceptionÚstatus)ÚSession)ÚListÚOptionalÚDictÚAny)Údatetime)ÚEnum)Úget_db)Úget_current_user)ÚUserz/lifeÚ life_engine)ÚprefixÚtagsc@s4eZdZdZdZdZdZdZdZdZ dZ
d Z d
Z d S) ÚEvidenceCategoryÚofficial_reportingÚ satelliteÚquixzoomÚnewsÚ open_dataÚ
historicalÚ
environmentalÚinfrastructureZtemporalZ
corroborationN)
Ú__name__Ú
__module__Ú __qualname__ZOFFICIAL_REPORTINGÚ SATELLITEZQUIXZOOMZNEWSÚ OPEN_DATAZ
HISTORICALÚ
ENVIRONMENTALÚINFRASTRUCTUREZTEMPORALZ
CORROBORATION©r#r#úP/home/bernt/.openclaw/workspace/landvex-admin-backend/app/routers/life_engine.pyrsrc@s eZdZdZdZdZdZdZdS)ÚConfidenceLevelÚ very_highÚhighÚmoderateÚlowÚvery_lowN)rrrZ VERY_HIGHZHIGHZMODERATEZLOWZVERY_LOWr#r#r#r$r%%s
r%c@s(eZdZdZdZdZdZdZdZdZ dS) Ú EventTypeÚnatural_disasterÚconflictÚinfrastructure_failureÚpolitical_instabilityZdisease_outbreakÚconstruction_delayÚenvironmental_incidentN)
rrrZNATURAL_DISASTERÚCONFLICTZINFRASTRUCTURE_FAILUREZPOLITICAL_INSTABILITYZDISEASE_OUTBREAKZCONSTRUCTION_DELAYZENVIRONMENTAL_INCIDENTr#r#r#r$r+-sr+z/public/philosophyc Ãs:ddddddddœd d
d dœd d
ddœddddœgddœS)z6Evidence Before Opinion - core architecture principle.z)Landvex Intelligence Fusion Engine (LIFE)ú1.0.0zEvidence Before OpinionzThe system never starts with a conclusion and looks for support. Instead, every analysis builds from observable signals upward.éz Gather Factsz5Collect observable signals from all available sources)ÚstepÚnameÚ descriptionéz
Weigh Sourcesz2Evaluate independent sources and their reliabilityézIdentify Patternsz0Detect statistical associations and correlationsézGenerate Hypothesesz.Form cautious hypotheses about possible causesz‰Every insight answers: What evidence supports this? Which sources contributed? What observations disagree? How confident is the estimate?)Z engine_nameÚversionZcore_principleZprinciple_descriptionÚprocessÚ
commitmentr#r#r#r#r$Úget_life_philosophy9s.ýýýýðår>z/public/data-sourcesc Ãshddgd¢dddœdgd¢d d
dœd gd ¢dd
dœd
gd¢dddœdgd¢dddœdgd¢dddœgiS)z(All continuous data acquisition sources.Ú
categorieszOfficial Project Information) z"Development agency project portalszGovernment project databaseszPublic procurement portalszBudget publicationszTender databaseszEvaluation reportszAnnual reportsz
Audit reportszParliamentary documentsZDailyZHigh)r6ÚsourcesZupdate_frequencyÚ reliabilityzNews Intelligence)zInternational newsz
National newsz
Regional newszLocal newspapersz RSS feedszDevelopment newszHumanitarian newszInfrastructure newszAgriculture newsz Health newszEducation newsz
Economic newszEnvironmental newsz
Security newsz Energy newszTransportation newsz Real-timeZMediumzPublic Communications)zPress releaseszOfficial websitesz Public blogsz)Open social media posts from institutionszProject announcementszPublic progress updateszConference presentationszResearch publicationszGeospatial Intelligence)
z'Satellite imagery (Sentinel-2, Landsat)zNight light intensityzLand cover changezRoad detectionzConstruction detectionzFlood monitoringzDrought monitoringzVegetation analysisz
River changeszUrban expansionzEnvironmental degradationzWildfire detectionzInfrastructure growthz Every 5 daysz Very HighzQUIXZOOM Reality Network) zField observationszMission resultszPhotographic evidenceZVideoZAudioz
GPS trackszInfrastructure inspectionszCommunity observationszTemporal comparisonsz On-demandz Open Data)zPopulation dataZWeatherZClimateZTransportationZ ElectricityzInternet coveragezWater availabilityzHealth indicatorszEducation statisticszEconomic indicatorszCommodity priceszAgricultural productionzMigration statisticszConflict datasetszWeekly to Monthlyr#r#r#r#r$Úget_data_sources]sB òë
óî òí¥ÿrBz/public/eventsN)Ú
project_idÚ
event_typeÚcountrycƒddddddddd d
œd d gd
dgd¢ddœ dddddddddd
œddgddgd¢d dœ d!d"d#d$d%d&d'd(d)d
œd*d+gd
d,gd-¢d.dœ g}ˆrž‡fd/d0„|Dƒ}ˆr´‡fd1d0„|Dƒ}|t|ƒd2d3œS)4z)Automatically detected meaningful events.zevt-001r,Zfloodz#Severe flooding in Mogadishu regionzEHeavy rainfall caused flooding affecting infrastructure accessibilityÚSomaliaÚBanadirgŽuq
`@g)ËǺ¨F@)rEÚregionÚlatÚlngz
2026-06-15zproj-001r'é\)Ú SatelliteÚNewsz Open dataz2026-06-16T08:00:00Z) ÚidÚtypeÚsubtypeÚtitler7ÚlocationÚdateZaffected_projectsÚseverityÚ
confidencer@Ú detected_atzevt-002r0Zweather_relatedz+Construction delay due to seasonal rainfallz@Road rehabilitation project delayed due to extended rainy seasonÚNigeriaZLagosgðHPü@gF%uš @z
2026-05-20zproj-045ÚmediuméN)rLúField observationú Weather dataz2026-05-25T10:00:00Zzevt-003r-Zregional_insecurityz0Regional insecurity affecting project operationszCIncreased security incidents in project area affecting staff accessÚEthiopiaZTigraygÞ“‡…ZS,@gÚ|a2%C@z
2026-04-10zproj-089éU)rMzSecurity reportsrZz2026-04-12T14:00:00Zcs(g|] }|dd ¡ˆ ¡kr|qS)rRrE)Úlower©Ú.0Úe)rEr#r$Ú
<listcomp> óz(list_detected_events.<locals>.<listcomp>csg|]}|dˆjkr|qS)rO)Úvaluer_)rDr#r$rbrcz5Automated multi-source fusion with human verification)ÚeventsÚtotalZdetection_method)Úlen)rCrDrErer#)rErDr$Úlist_detected_events×s`  ô ô ôã-ýrhz%/public/projects/{project_id}/context©rCc Ã|ddgd¢dœddddd œd
d d d
dddœdddddœddddddœdd
dddœd d!d"d#œd$d%d&d#œgd'gd(¢dd)œd*œt ¡ ¡d+œS),z4Continuously updated contextual graph for a project.éArY)zDemocratic governancezRegional tensionszElection upcoming)Zstability_scorerUÚfactorsgÍÌÌÌÌÌ@g!@r(éR)Z
gdp_growthZ inflationZcurrency_stabilityrUZrainyéxéfr)r'éZ)Zcurrent_seasonZrainfall_vs_averageZtemperature_vs_averageZ drought_riskZ
flood_riskrUrXr9ÚstableéK)Z overall_riskZrecent_incidentsÚtrendrUéFé-é<é7éP)Zroad_accessibilityZpower_availabilityZinternet_coverageZ water_accessrUiȯgffffff@r])Zlocal_populationZ displacementZ growth_raterUzproj-015zRegional Health ClinicgÍÌÌÌÌÌ@)rNr6Z distance_kmzproj-023zRoad Improvementg(@i@¥®)z
World BankÚUNICEFÚGIZ)Ztotal_aid_in_region_usdZ major_donorsZcoordination_level)Zpolitical_environmentZeconomic_conditionsZclimateÚsecurityrÚ
populationZnearby_projectsZfunding_ecosystem)rCÚcontextÚ last_updated©r ÚnowÚ isoformatrir#r#r$Úget_project_contextsVýüú üûü

þýÕ1
Írz-/public/projects/{project_id}/causal-analysisc Ãs~|dddddddœdd d
dœd d d
dœgdgd¢dddœddddddœdd ddœddddœgdgd¢dd dœgd!d"d#d$œd%œS)&z=Causal analysis layer - transparent statistical associations.zXThese are statistical associations and model-generated hypotheses, not proven causation.z assoc-001z/Reduced accessibility following severe floodingzHeavy rainfallgÍÌÌÌÌÌÜ?rK)r6Ú contributionrUzPoor drainage infrastructureç333333Ó?rYzRoad surface qualityçÐ?rjZstrong)rLr[rZzNFlooding disproportionately affects projects in areas with inadequate drainagezTDrainage quality is estimated from satellite and may not reflect recent improvements)rNÚ observationrkZstatistical_strengthÚevidence_sourcesZ
hypothesisZ uncertaintyz assoc-002z5Construction delays associated with seasonal rainfallzRainy season durationç333333ã?r]zSoil conditionsrszEquipment availabilityç333333Ã?rvr()zSatellite time-seriesr[zProject reportszCProjects in tropical regions experience predictable seasonal delaysz&Equipment availability data is limitedz:Flooding occurred on June 15, accessibility reduced by 40%zAProjects in flood-prone areas 3x more likely to experience delaysz<Drainage investment may reduce weather-related delays by 50%)Zobserved_factsZstatistical_associationsZmodel_hypotheses)rCÚ
disclaimerZobserved_associationsZ distinguishr#rir#r#r$Úget_causal_analysisUs<


ýõ


ýõòýárŠz(/public/projects/{project_id}/confidencecÃs||ddddddddd œd
d d d
ddd œddd d
ddd œddddddd œddddddd œddddddd œgd d!d"d#d$œd%d&œS)'zHMulti-signal confidence engine combining evidence from multiple sources.rlr'rzUNICEF quarterly reportérˆr]éH)ÚcategoryÚsourcerÚweightrAZagreement_with_othersrzSentinel-2 imageryér„é_éXrz$Field observations (12 contributors)rzRegional news monitoringé
çš™™™™™¹?rurjrz"Weather, population, economic datarorwrzSimilar projects in regionrqrsér4z7Official reporting shows 95% completion vs observed 85%z<Multiple independent sources converging on 82-88% completion)Z
sources_agreeZsources_disagreeZprimary_disagreementZconfidence_increasezConfidence increases as multiple independent sources converge. Disagreement reduces confidence but highlights areas for additional verification.)rCÚoverall_confidenceÚconfidence_levelZevidence_breakdownZconvergence_analysisÚ methodologyr#rir#r#r$Úget_confidence_scoresjú ú ú ú ú ú×3üÄr™z)/public/projects/{project_id}/predictionscÃ|ddddddddd d
œd d d
d
œdddd
œggd¢dœddddddddd
œdddd
œdddd