Skip to content

AI Insights: Redis caching, improved story ranking, bug fixes#29

Closed
koala73 wants to merge 91 commits into
mainfrom
add-deckgl-features
Closed

AI Insights: Redis caching, improved story ranking, bug fixes#29
koala73 wants to merge 91 commits into
mainfrom
add-deckgl-features

Conversation

@koala73

@koala73 koala73 commented Jan 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add server-side Redis caching for AI summaries (Upstash)
  • Switch to llama-3.1-8b-instant for 14x more quota
  • Improve story ranking with composite importance score
  • Fix false alert detection (protein shakes bug)
  • Add CORS support for Vercel preview domains
  • Remove per-headline summarization (World Brief is sufficient)

Changes

  • api/groq-summarize.js - Redis caching + model switch
  • api/rss-proxy.js - CORS for preview domains
  • src/components/InsightsPanel.ts - Composite scoring
  • src/config/feeds.ts - Alert keyword improvements
  • src/services/rss.ts - Alert exclusion logic

claude and others added 30 commits January 23, 2026 11:48
Implement Palantir-like interactive map experience using deck.gl with
MapLibre GL as the base map. Key changes:

- Add deck.gl (@deck.gl/core, @deck.gl/layers, @deck.gl/geo-layers) and
  maplibre-gl dependencies for GPU-accelerated rendering
- Create DeckGLMap component with WebGL layers for:
  - Undersea cables and pipelines (PathLayer)
  - Military bases, nuclear facilities, datacenters (ScatterplotLayer)
  - Conflict zones (GeoJsonLayer with polygons)
  - Hotspots, earthquakes, weather, outages, protests
  - AIS density, military vessels and flights
  - Strategic waterways, economic centers
  - Tech variant: startup hubs, tech HQs, accelerators, cloud regions
- Create MapContainer wrapper that conditionally renders:
  - DeckGLMap (WebGL) on desktop with WebGL support
  - Existing D3/SVG MapComponent on mobile for graceful degradation
- Add dark theme CSS styles for deck.gl controls, legend, layer toggles
- Import maplibre-gl CSS in main.ts

Desktop users now get smooth 60fps interactions with large datasets
while mobile users retain the optimized SVG experience.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Fix coordinate swap bugs in createCablesLayer, createPipelinesLayer,
  and createConflictZonesLayer - data is already [lon, lat] format
- Fix coordinate order in triggerConflictClick, triggerPipelineClick,
  and triggerCableClick to pass (lat, lon) to setCenter correctly
- Fix handleClick to not show popup for hotspots (they have their own handler)
- Add missing tooltips for all layer types (cables, pipelines, conflicts,
  natural events, weather, outages, AIS density, military flights,
  waterways, economic centers, tech HQs, accelerators, cloud regions,
  tech events)

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
The MapPopup.show() method expects a PopupData object with:
- type: PopupType string identifying the popup renderer
- data: the actual data object to display
- x, y: click coordinates for popup positioning

Previously was passing raw objects which resulted in broken/missing popups.

Changes:
- Import PopupType from MapPopup
- Update handleClick to map layer IDs to PopupType and create proper PopupData
- Update all trigger methods (triggerConflictClick, triggerBaseClick, etc.)
  to create proper PopupData with centered x/y coordinates
- Add getContainerCenter() helper for programmatic popup positioning

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Root cause: CONFLICT_ZONES config had inconsistent coordinate formats.
Red Sea Crisis and South Lebanon entries were in [lat, lon] format
while other entries were in [lon, lat] format (GeoJSON standard).
This caused polygons to render in completely wrong locations.

Fixes:
- Fix Red Sea Crisis coords: [[12,42]...] → [[42,12]...] (swap to [lon,lat])
- Fix Red Sea Crisis center: [14,43] → [43,14]
- Fix South Lebanon coords: [[33.0,35.1]...] → [[35.1,33.0]...]
- Fix South Lebanon center: [33.2,35.4] → [35.4,33.2]
- Add explicit transparent background to #deckgl-overlay CSS

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Two-pronged approach to fix the dark semi-transparent overlay:

1. Add MapLibre background layer:
   - Added 'background' layer with dark color (#0a0f0c) to MapLibre style
   - This ensures no transparent gaps while tiles are loading

2. Set WebGL clear color to transparent:
   - Added onWebGLInitialized callback to Deck initialization
   - Explicitly set gl.clearColor(0, 0, 0, 0) for transparent background
   - Enable proper alpha blending with gl.blendFunc

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Instead of relying on deck.gl's default canvas/context creation,
manually create canvas and WebGL context with explicit alpha support:

- Create canvas element with transparent background style
- Get WebGL2/WebGL context with alpha: true, premultipliedAlpha: true
- Set gl.clearColor(0, 0, 0, 0) for transparent clear
- Pass pre-created canvas and gl context to Deck constructor

This ensures the WebGL context is properly configured for alpha
transparency from the start, allowing the MapLibre base map to
show through the deck.gl overlay.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Changes:
- Add explicit z-index to MapLibre (1) and deck.gl overlay (2)
- Add overflow: hidden to wrapper
- Reverted to letting deck.gl create its own canvas
- Added effects: [] to disable any default deck.gl effects
- Set canvas background to transparent after deck initializes
- Added comprehensive CSS rules to ensure all canvas elements
  and containers have transparent backgrounds

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Root cause: The timestamp element had both classes 'map-timestamp' and
'deckgl-timestamp'. These classes set conflicting positioning:
- .map-timestamp: bottom: 8px; right: 10px;
- .deckgl-timestamp: top: 10px; left: 50%;

When all four positioning values (top/bottom/left/right) are set on an
absolutely positioned element without explicit width/height, it stretches
to fill the space between those edges - creating a 724x315px dark overlay.

Fixes:
- Remove 'map-timestamp' class from timestamp element in DeckGLMap.ts
- Add explicit bottom: auto; right: auto; width: auto; height: auto;
  to .deckgl-timestamp CSS to prevent any accidental stretching

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Override MapLibre GL's default grab cursor to use the standard
pointer cursor, only switching to grabbing when actively dragging.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
The deck.gl canvas was blocking mouse events from reaching MapLibre
because it had pointer-events: auto for picking but controller: false.
Enable deck.gl's controller and sync view state changes back to MapLibre.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Add CSS to override deck.gl's default grab cursor on its canvas,
using the default pointer cursor and only grabbing when dragging.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
The map now stays fixed on the user's selected region when:
- Clicking items from lists (conflicts, bases, pipelines, etc.)
- Flash location animations
- New data flowing in

Popups now appear at the projected screen position of items
rather than panning the map to center on them. If an item is
off-screen, the popup still appears at its projected position.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
The source dataset had placeholder coordinates clustering all US
datacenters around Kansas/Oklahoma. Fixed actual locations for:
- Mt Pleasant, Wisconsin (42.7°N, -87.9°W)
- Meta New Albany, Ohio (40.1°N, -82.8°W)
- OpenAI/Microsoft Atlanta (33.7°N, -84.4°W)
- Applied Digital Ellendale, ND (46.0°N, -98.5°W)
- Nebius New Jersey (40.1°N, -74.4°W)
- CoreWeave Denton, TX (33.2°N, -97.1°W)

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
The circular sync between deck.gl and MapLibre was causing the
deck.gl layer to be offset from the base map. Fixed by:
- Making deck.gl the single source of truth (has controller enabled)
- Removing MapLibre->deck.gl sync that caused circular updates
- Adding initial sync on map load to ensure alignment

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Replaced separate Deck instance with MapboxOverlay which properly
integrates deck.gl into MapLibre's WebGL context. This fixes:
- Points moving when zooming/panning (view state sync)
- Coordinate offset issues (London appearing in France)
- Cursor issues (MapLibre now handles all interactions)

MapboxOverlay renders deck.gl layers directly into MapLibre's canvas,
eliminating all view state synchronization issues.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Restored visual distinction for markers that had icons in the
original D3/SVG implementation:
- Datacenters: 🖥️ icon
- Nuclear facilities: ☢️ icon

Uses TextLayer overlaid on ScatterplotLayer to render emoji icons.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Nuclear: Yellow/orange hollow RING with inner dot (radiation symbol look)
- Datacenters: Purple filled circles with light border
- Bases: Color-coded by operator (US-NATO blue, Russia red, China orange, etc.)
- Removed non-working TextLayer emoji approach

Each marker type now has a distinct visual style beyond just color.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
Replaced ScatterplotLayer circles with IconLayer for distinct shapes:
- Military bases: TRIANGULAR icons (color-coded by operator)
- Nuclear facilities: HEXAGONAL icons (yellow/orange)
- Datacenters: SQUARE icons (purple)
- Hotspots: Remain as circles (appropriate for threat indicators)

Each marker type now has a unique geometric shape for easy identification.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Datacenter squares: size 6-10px (was 10-14), opacity ~30% (was ~63%)
- Planned datacenters: opacity ~20% for subtle indication
- Military bases: size 8-14px (was 12-20), opacity ~63% (was 100%)
- Improves map readability when multiple layers are overlaid

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Datacenters: size 10-14px, opacity ~55% (was 6-10px, ~30%)
- Bases: size 11-16px, opacity ~63%
- Nuclear: size 11-15px, opacity ~78%
- Better balance between visibility and layering

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Remove FOCUS region selector from header (keep only map's view selector)
- Redesign legend as compact horizontal bar at bottom center
- Add proper shapes: triangles for bases, squares for datacenters, hexagons for nuclear
- Reduce whitespace in legend layout

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Add clusterMarkers method for grouping nearby markers
- Create HTML overlay container for cluster badges
- Render Tech HQs with emoji icons and cluster count badges
- Render Tech Events with calendar icons and clustering
- Render Protests with severity icons and clustering
- Clusters expand on click to show popup with all items
- Single items show individual popup on click
- Clustering radius adjusts based on zoom level

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Add gamma irradiators layer (IAEA DIIF facilities)
- Add spaceports layer (launch sites)
- Add strategic ports layer (61 ports, shown with AIS)
- Add flight delays layer (FAA airport delays/ground stops)
- Fix setFlightDelays to store data properly
- Add tooltips and click handlers for all new layers

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Import APT_GROUPS and CRITICAL_MINERALS from config
- Add createAPTGroupsLayer() with red markers and yellow outline for cyber threat actors
- Add createMineralsLayer() with color-coded markers by mineral type (Lithium, Cobalt, Rare Earths, Nickel)
- APT Groups always visible in geopolitical variant (no toggle)
- Add minerals toggle to layer panel for geopolitical variant
- Add tooltips and click handlers for both layers

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Add ML worker infrastructure (@xenova/transformers)
- Implement semantic news clustering (hybrid Jaccard + embeddings)
- Add InsightsPanel with themes, entities, sentiment analysis
- Add click-to-summarize feature in NewsPanel
- Wire up ML-enhanced velocity/sentiment scoring
- Desktop-only activation (mobile excluded)
- Fix division by zero in cosineSimilarity
- Fix dead Promise code in ml-worker.ts
These layers existed in buildLayers() with mapLayers.X checks but had
no UI toggles, making them inaccessible. Added toggles for both in the
geopolitical variant layer panel.

https://claude.ai/code/session_01GTanC7R6aSQNsnijqJRUFz
- Add loadingPromises map to prevent duplicate model loads
- Guard against undefined entity type/text in groupEntities
Feature parity improvements:
- Add layer help popup with ? button (explains all layer types)
- Add LAYER_ZOOM_THRESHOLDS constant for zoom-based label visibility
- Add toggleLayer() public method to toggle layers on/off
- Make zoomIn()/zoomOut() public methods for external access
- Add military cluster data storage (militaryFlightClusters, militaryVesselClusters)
- Add getMilitaryFlightClusters() and getMilitaryVesselClusters() getters
- Store clusters in setMilitaryFlights/setMilitaryVessels methods
- Create gdacs.ts service fetching from GDACS API (earthquakes, floods,
  tropical cyclones, volcanoes, wildfires, droughts)
- Filter to Orange/Red alerts only for relevance
- Merge GDACS events with EONET natural events with deduplication
- Color-code markers: red for Red alerts, orange for Orange alerts
- Prioritize GDACS data (more authoritative) over EONET for overlaps
- Add missing military vessel/flight cluster layers
- Add cluster tooltips and click type mappings
- Fix activity type mismatches (deployment/transport vs patrol/surveillance)
- Add congestion coloring to AIS density (orange for deltaPct >= 15)
- Add port type-based colors and tooltip icons
- Fix getHotspotLevels/setHotspotLevels to use h.name
- Fix setLayerReady to use 'active' class with layer state check
Header:
- Add Global/Americas/MENA/EU/Asia/LatAm/Africa/Oceania dropdown
- Sync with map view state bidirectionally
- Hide duplicate selector in map controls

DeckGLMap render throttling:
- Convert all updateLayers() calls to render() for debouncing
- render() uses requestAnimationFrame to batch updates
- Reduces CPU usage when multiple data updates arrive quickly

APT markers: Already present as subtle orange dots (geopolitical variant)
@koala73

koala73 commented Jan 25, 2026

Copy link
Copy Markdown
Owner Author

Closed: Branch was merged directly into main via local merge (commit 6f4de3f).

@koala73 koala73 closed this Jan 25, 2026
@koala73
koala73 deleted the add-deckgl-features branch January 26, 2026 03:45
@SebastienMelki SebastienMelki added area: AI/intel AI analysis, intelligence findings, summarization performance Performance optimization labels Feb 17, 2026
EleCor79 added a commit to EleCor79/BehavioralHealthPulse that referenced this pull request Mar 2, 2026
Distribute all 32 feeds from feeds-health-italy-eu.csv into the FEEDS
config consumed by loadNews() / fetchCategoryFeeds():

- ministero-salute: +MinSalute News Specifiche (CSV koala73#18)
- iss-epicentro:    +ISS Notizie (CSV koala73#3), +Epicentro Coronavirus (CSV koala73#17)
- aifa-tracker:     +AIFA Feed (CSV koala73#5), +EMA News (CSV koala73#8), +FDA (CSV koala73#12)
- agenas-ospedali:  +AGENAS RSS (CSV koala73#4), +PNRR (CSV koala73#6/koala73#19),
                    +Lombardia (CSV koala73#20), +Lazio (CSV koala73#21)
- ema-europa:       +EMA Clinical Trials (CSV koala73#22)
- ecdc-sorveglianza:+ECDC Weekly Threats (CSV koala73#23), +WHO DON (CSV koala73#9),
                    +ProMED (CSV koala73#10)
- live-news:        +Sanitainformazione (CSV koala73#24), +Humanitas (CSV koala73#26)
- europe:           +EU Core Health Indicators (CSV koala73#31),
                    +GLOBSEC HRI (CSV koala73#32), +ISTAT (CSV koala73#13),
                    +EIN Health Europe (CSV koala73#29)
- rare-diseases:    NEW category — EURORDIS (CSV koala73#14), Orphanet IT (CSV koala73#15),
                    Telethon (CSV koala73#16), CDC FluView (CSV koala73#11)
                    Panel disabled by default, available in settings

Co-Authored-By: Claude Opus 4.6 <[email protected]>
scorphx pushed a commit to scorphx/sauron that referenced this pull request Apr 6, 2026
… fixes, simplifications

P1:
- koala73#21: Add POST /api/forecast/v1/trigger-simulation — agents can now enqueue simulation
  runs via HTTP; 5-min global rate limit, atomic NX task key, sorted-set queue write
  (proto + generated types + handler + handler.ts registration)

P2:
- koala73#15: Fix buildSimulationStructuralWorld to handle array macroRegion on signals
  (was silently producing empty touchingSignals for signals with array macroRegion)

P3:
- koala73#16: Simulation package simplifications — extract slugify/MAX_SEED_SUMMARY constants,
  build candidateById Map once in orchestrator, read gateDetails from live
  getImpactValidationFloors() values (adds thirdOrderMappedFloor), widen actor regex to
  match "are the primary actors" etc, add debug log on regex miss
- koala73#28: Add completionStatus + eligibleTheaterCount to simulation outcome object for
  machine-readable branching (no_eligible_theaters | all_failed | partial | complete)
- koala73#29: Add simulation_round_1 / simulation_round_2 cases to getForecastLlmCallOptions;
  new FORECAST_LLM_SIMULATION_PROVIDER_ORDER + FORECAST_LLM_SIMULATION_MODEL_OPENROUTER
  env vars for per-stage routing without code changes
- koala73#17: Mark complete — getSimulationPackage RPC + Redis existence key were already
  shipped; confirmed no additional work needed

https://claude.ai/code/session_015fz1MvRuBJGYbgHubGEabA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: AI/intel AI analysis, intelligence findings, summarization performance Performance optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants