Skip to content

Entity Resolution Graph Analysis Chronological Matrix Scripts

elb-pr edited this page Apr 7, 2026 · 2 revisions

Entity Resolution, Graph Analysis & Chronological Matrix Scripts

The following files were used as context for generating this wiki page:

This section covers the core analytical scripts used in Phases 3 and 4 of the intelligence cycle. These tools facilitate the transition from raw collected data to structured intelligence by resolving duplicate entities, mapping complex relational networks, and constructing normalized timelines for gap analysis.

1. Entity Resolution (entity_resolver.py)

The EntityResolver class implements a hybrid approach to record linkage, combining deterministic matching with the Fellegi-Sunter probabilistic framework skills/claude-sleuth/scripts/entity_resolver.py:1-5. It is designed to deduplicate POLE (Person, Object, Location, Event) entities across disparate data sources skills/claude-sleuth/scripts/entity_resolver.py:37-44.

Deterministic vs. Probabilistic Matching

The resolver first attempts to find matches using a set of DETERMINISTIC_KEYS—unique identifiers that guarantee a match if they align skills/claude-sleuth/scripts/entity_resolver.py:47-60. If no deterministic match is found, it calculates a probabilistic score based on weighted fields skills/claude-sleuth/scripts/entity_resolver.py:146-158.

Field Weight Logic
name 0.40 Jaro-Winkler or Levenshtein similarity skills/claude-sleuth/scripts/entity_resolver.py:68-94
dob 0.20 Exact match (1.0) or same year (0.5) skills/claude-sleuth/scripts/entity_resolver.py:97-106
address 0.15 String similarity of normalized address strings skills/claude-sleuth/scripts/entity_resolver.py:177-183
nationality 0.10 Binary match of normalized country strings skills/claude-sleuth/scripts/entity_resolver.py:185-189

Clustering Implementation

The script uses a Union-Find (Disjoint Set Union) algorithm to group records into clusters once a match is confirmed either deterministically or by exceeding the match_threshold (default 0.80) skills/claude-sleuth/scripts/entity_resolver.py:112-212.

Entity Resolution Logic Flow

graph TD
    subgraph "Code Entity Space: EntityResolver"
        A["add_record()"] --> B{"_deterministic_match()"}
        B -- "Match Found" --> C["union(i, j)"]
        B -- "No Match" --> D{"_probabilistic_score()"}
        D -- "Score > threshold" --> C
        D -- "Score < threshold" --> E["New Cluster"]
        C --> F["resolve()"]
        E --> F
    end
    
    subgraph "Natural Language Space: POLE Deduplication"
        F --> G["Entity Clusters"]
        G --> H["Deduplicated Register"]
    end
Loading

Sources: skills/claude-sleuth/scripts/entity_resolver.py:109-213


2. Network Graph Analysis (network_graph.py)

The InvestigationGraph class utilizes networkx to build a directed graph (DiGraph) of investigative entities skills/claude-sleuth/scripts/network_graph.py:75-87. The choice of a directed graph is intentional: it preserves the relationship directionality (e.g., Person A owns Company B), which is critical for calculating meaningful centrality metrics skills/claude-sleuth/scripts/network_graph.py:7-11.

Data Model and Visualization

The script maps POLE entities to specific visual styles (colors and shapes) for export via pyvis skills/claude-sleuth/scripts/network_graph.py:40-54.

Investigative Metrics

The centrality_report() function provides analytical insights into the network structure skills/claude-sleuth/scripts/network_graph.py:157-169:

  1. In-Degree Centrality: Identifies high-value targets (entities pointed to by many).
  2. Out-Degree Centrality: Identifies connectors or aggregators.
  3. PageRank: Calculates recursive authority scores, useful for finding influential nodes in sparse graphs.
  4. Strongly Connected Components: Detects circular ownership or feedback loops skills/claude-sleuth/scripts/network_graph.py:167-168.

Graph Construction and Export

graph LR
    subgraph "Code Entity Space: network_graph.py"
        A["InvestigationGraph"] --> B["add_person() / add_org()"]
        B --> C["add_edge(source, target)"]
        C --> D["centrality_report()"]
        C --> E["export_html()"]
    end

    subgraph "Analytical Output"
        D --> F["PageRank / Betweenness"]
        E --> G["Pyvis Interactive Map"]
    end
Loading

Sources: skills/claude-sleuth/scripts/network_graph.py:75-169


3. Chronological Matrix (chronological_matrix.py)

The ChronologicalMatrix script manages UTC-normalized timelines. It transforms various datetime formats into a standard TimelineEvent object to facilitate temporal analysis skills/claude-sleuth/scripts/chronological_matrix.py:22-36.

Normalization and Parsing

The parse_to_utc() function handles 12+ datetime formats, stripping "Z" suffixes and applying UTC offsets to ensure all events are comparable on a single linear timeline skills/claude-sleuth/scripts/chronological_matrix.py:39-77.

Intelligence Detection Features

The matrix includes two primary automated detection algorithms:

Timeline Event Schema

Attribute Description
utc_datetime ISO 8601 normalized timestamp skills/claude-sleuth/scripts/chronological_matrix.py:26
source_reliability Admiralty A-F scale skills/claude-sleuth/scripts/chronological_matrix.py:29
info_credibility Admiralty 1-6 scale skills/claude-sleuth/scripts/chronological_matrix.py:30
conflicts_with List of conflicting event_ids skills/claude-sleuth/scripts/chronological_matrix.py:36

Sources: skills/claude-sleuth/scripts/chronological_matrix.py:22-189


Clone this wiki locally