Skip to content
Alejo Malia edited this page Feb 17, 2026 · 9 revisions

CTHmodules is an open-source JavaScript framework for quantitative historical analysis. It transforms qualitative events into measurable data across five temporal phases, enabling pattern detection, predictive modeling, and a data-driven approach to understanding human history.

Inspired by psychohistory (Asimov), but grounded in real metrics. Built for researchers, historians, developers, and analysts.

Version: 1.0.2 (NPM)
Repository: github.com/AlejoMalia/CTHmodules
NPM Package: npmjs.com/package/cthmodules
Website: cthmodules.cc
License: CC BY-NC-SA 4.0


πŸ“– What is CTHmodules?

CTHmodules is a modular, extensible framework that quantifies the socio-historical context of events using the Tetrasociohistorical Context (CTH) a normalized score (0–1) derived from four core dimensions.

It decomposes history into five interconnected temporal phases:

Temporal Phases

CTHmodules structures analysis around five interconnected temporal phases, each with a defined time span to ensure consistent, scalable quantification.

Phase Time Span Description Focus
Before 10 years before event Structural preconditions Root causes
Prelude 2 years before event Building tensions and catalysts Escalation
During During the event The event and immediate dynamics Peak action
Transition 2 years after event Post-event adaptation Change
After 10 years after event Long-term legacy and residuals Legacy

Why these spans?

  • Macro (10 years): Captures deep structural shifts (Before/After).
  • Micro (2 years): Zooms into acute buildup and fallout (Prelude/Transition).
  • Event Core: The "During" phase anchors everything in the moment of impact.

This framework allows Ξ”CTH (phase-to-phase deltas) to reveal hidden transitions and predictive signals.

Core Outputs:

  • CTH: Measures the "environment" (stable = 1, chaotic = 0).
  • EVEI: Event's total impact (0–1).
  • PEE: Future projections with probabilities.
  • Patterns: Visual grids, Black Swans, cycles.

Mission: Democratize advanced historical analysis. Turn "what happened" into "why it mattered and what comes next."

Key Innovation: Non-linear time via Archimedean spirals for detecting "temporal echoes" (recurring patterns across eras).


🧠 Core Concepts

1. Tetrasociohistorical Context (CTH)

The heart of the framework. A 0–1 index quantifying the socio-historical "climate" around any event.

Four Dimensions:

Dimension What It Measures Key Indicators
Historical Epoch (E) Political-cultural backdrop Wars, revolutions, tech shifts
Social Range (S) Cohesion vs. inequality Gini index, literacy, income
Age Range (A) Demographic structure Life expectancy, birth rates
Population Range (P) Density & urbanization Pop. density, urban %

How it's calculated:

  • Collect real data (e.g., GDP, events).
  • Normalize to [0,1].
  • Weighted sum + Ξ”CTH (phase-to-phase change) to infer gaps.

Ξ”CTH: Tracks transformations e.g., a revolution's ripple effect.

2. Integral Event Valuation Structure (EVEI)

The event's "scorecard." Measures total historical weight.

Formula (simplified): EVEI = (0.4 Γ— CTH) + (0.2 Γ— Indicator A) + (0.25 Γ— Indicator B) + (0.35 Γ— Indicator C)

  • Indicators: Custom (e.g., participation, consensus, transformative potential).
  • Output: 0–1 score + Β±10% uncertainty + category (e.g., "Transformative").

Example: A protest in turbulent times (high CTH) gets a higher EVEI than in calm eras.

3. Other Key Metrics

Metric Purpose Thresholds
FP (Potential Factors) Influence of figures/events in a phase Sum of EVEI/CTH
CMN / RMD Classify trajectory: Decline (CMN) vs. Renewal (RMD) Based on analogs
Black Swan Rare, high-impact events EVEI > 0.9, CTH > 0.8
PCN % chance of Black Swans Via IPD (disruptive potential)
PEE Future spectrum projections Probabilistic scenarios
ET Temporal equivalence to history 2.5% tolerance
Pantemporality Index Enduring elements across phases β‰₯ 0.9 = "timeless"

Visualization: 10x10 color grids of CTH/EVEI/Ξ”CTH for instant pattern spotting.


πŸ”§ Modules & Tools

All modules are standalone JS files import what you need.

Core Analysis

Module Key Functions What It Does
cth-analysis-module.js analyzeEventCTH, completeAndInferHistoricalData Computes CTH per phase + infers missing data via Ξ”CTH
evei-calculator.js calculateEVEI Full event impact scoring
constructor.js Constructor class Models "Constructors" (figures/events) as vectors

Extended & Predictive

Module Key Functions What It Does
evei-cth-extended-analysis.js analyzeEventExtended Deep metrics (IEC, PPI, VVC, etc.)
fp-calculator.js calculatePotentialFactors Phase-specific influence
margins-calculator.js calculateMargins Macro (external) / Micro (internal) impact
cmn-rmd-calculator.js calculateCMNRMD Trajectory classification (decline/renewal)
constructor-blackswan-calculator.js isBlackSwanConstructor Detects anomalies
pcn-calculator.js calculatePCN Black Swan probability
pee-calculator.js projectEventualSpectrum Future projections

Patterns & Sequences

Module Key Functions What It Does
pattern10x10-calculator.js generatePatternGrid Visual 10x10 metric grids
et-calculator.js calculateTemporalEquivalence Historical parallels
pantemporal-elements-calculator.js calculatePantemporalityIndex Timeless patterns
timesequence-analysiscalculator.js analyzeEventSequence Full sequence processing (Tri/Penta/Supra-phasic fields)

Tests: Full examples in /tests/ (e.g., cmn-rmd-analysis-test.js).


πŸš€ Getting Started

Installation

npm install cthmodules

πŸš€ Basic Usage

import { analyzeEventCTH, calculateEVEI } from 'cthmodules';

// Sample data for a historical event (e.g., French Revolution)
const eventData = {
  phases: ['Before', 'Prelude', 'During', 'Transition', 'After'],
  indicators: { /* GDP, Gini, etc. per phase */ }
};

const cth = analyzeEventCTH(eventData);  // { phases: [...], deltaCTH: [...] }
const evei = calculateEVEI({ cth: cth.average, indicators: [...] });

console.log('CTH:', cth);
console.log('EVEI:', evei);

Full docs & examples: See tests/ and cthmodules.cc.


πŸ”— Resources

CTHmodules Wiki
Maintained by Alejo Malia