babylon.models.entities.social_class

SocialClass entity model.

A SocialClass is the fundamental node type in the Babylon simulation. It represents a social class in the world system, defined by: 1. Its relationship to the means of production (SocialRole) 2. Its material conditions (wealth, subsistence threshold) 3. Its ideological position (multi-dimensional consciousness model) 4. Its survival calculus outputs (P(S|A), P(S|R))

This is the Phase 1 node type from the four-phase blueprint.

Sprint 3.4.3 (George Jackson Refactor): Replaced scalar ideology with multi-dimensional IdeologicalProfile containing: - class_consciousness: Relationship to Capital [0=False, 1=Revolutionary] - national_identity: Relationship to State/Tribe [0=Internationalist, 1=Fascist] - agitation: Raw political energy from crisis (falling wages)

Classes

EconomicComponent(**data)

Economic material conditions of a social class.

IdeologicalComponent(**data)

Ideological state of a social class (legacy component view).

IdeologicalProfile(**data)

Multi-dimensional ideological state of a social class.

MaterialConditionsComponent(**data)

Material conditions affecting a social class.

SocialClass(**data)

A social class in the world system.

SurvivalComponent(**data)

Survival calculus outputs for a social class.

class babylon.models.entities.social_class.EconomicComponent(**data)[source]

Bases: BaseModel

Economic material conditions of a social class.

Parameters:
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

wealth: Annotated[float]
subsistence_threshold: Annotated[float]
class babylon.models.entities.social_class.IdeologicalProfile(**data)[source]

Bases: BaseModel

Multi-dimensional ideological state of a social class.

Sprint 3.4.3 (George Jackson Refactor): This model replaces the scalar ideology field with a multi-dimensional consciousness model.

The key insight: “Fascism is the defensive form of capitalism.” - Agitation + Solidarity -> Class Consciousness (Revolutionary Path) - Agitation + No Solidarity -> National Identity (Fascist Path)

Parameters:
class_consciousness

Relationship to Capital [0.0=False, 1.0=Revolutionary] How clearly the class understands its position relative to capital.

national_identity

Relationship to State/Tribe [0.0=Internationalist, 1.0=Fascist] How strongly the class identifies with nation/race over class.

agitation

Raw political energy from crisis [0.0, inf) Accumulated energy from falling wages, crisis conditions. Routes to either axis based on solidarity_pressure.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class_consciousness: Annotated[float]
national_identity: Annotated[float]
agitation: Annotated[float]
classmethod from_legacy_ideology(ideology_value)[source]

Convert legacy scalar ideology [-1, 1] to IdeologicalProfile.

Legacy mapping: - ideology=-1 (revolutionary) -> class_consciousness=1.0, national_identity=0.0 - ideology=0 (neutral) -> class_consciousness=0.5, national_identity=0.5 - ideology=+1 (reactionary) -> class_consciousness=0.0, national_identity=1.0

Parameters:

ideology_value (float) – Legacy ideology scalar in range [-1.0, 1.0]

Return type:

IdeologicalProfile

Returns:

IdeologicalProfile with mapped values

to_legacy_ideology()[source]

Convert IdeologicalProfile back to legacy scalar ideology [-1, 1].

This provides backward compatibility for systems still using the scalar ideology representation.

Return type:

float

Returns:

Legacy ideology scalar in range [-1.0, 1.0]

class babylon.models.entities.social_class.IdeologicalComponent(**data)[source]

Bases: BaseModel

Ideological state of a social class (legacy component view).

Parameters:
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ideology: IdeologicalProfile
organization: Annotated[float]
class babylon.models.entities.social_class.SurvivalComponent(**data)[source]

Bases: BaseModel

Survival calculus outputs for a social class.

Parameters:
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

p_acquiescence: Annotated[float]
p_revolution: Annotated[float]
class babylon.models.entities.social_class.MaterialConditionsComponent(**data)[source]

Bases: BaseModel

Material conditions affecting a social class.

Parameters:

repression_faced (Annotated[float, Ge(ge=0.0), Le(le=1.0)])

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

repression_faced: Annotated[float]
class babylon.models.entities.social_class.SocialClass(**data)[source]

Bases: BaseModel

A social class in the world system.

The fundamental unit of the simulation. Classes are defined by their relationship to production and their position in the imperial hierarchy.

This model uses Sprint 1 constrained types for automatic validation: - Currency: [0, inf) for wealth, subsistence_threshold - IdeologicalProfile: Multi-dimensional consciousness model (Sprint 3.4.3) - Probability: [0, 1] for survival probabilities and organization/repression

Parameters:
id

Unique identifier matching pattern ^C[0-9]{3}$

name

Human-readable name for the class

role

Position in the world system (SocialRole enum)

description

Optional detailed description

wealth

Economic resources (Currency, default 10.0)

ideology

Multi-dimensional ideological profile (IdeologicalProfile)

p_acquiescence

P(S|A) - survival probability through acquiescence (Probability)

p_revolution

P(S|R) - survival probability through revolution (Probability)

subsistence_threshold

Minimum wealth for survival (Currency, default 5.0)

organization

Collective cohesion/class consciousness (Probability, default 0.1)

repression_faced

State violence directed at this class (Probability, default 0.5)

Legacy Compatibility:

If a float value is passed for ideology, it will be automatically converted to an IdeologicalProfile using from_legacy_ideology().

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'str_strip_whitespace': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod unpack_components_and_convert_legacy(data)[source]

Unpack component objects and convert legacy ideology to IdeologicalProfile.

Return type:

Any

Parameters:

data (Any)

id: str
name: str
role: SocialRole
description: str
wealth: Annotated[float]
ideology: IdeologicalProfile
p_acquiescence: Annotated[float]
p_revolution: Annotated[float]
subsistence_threshold: Annotated[float]
organization: Annotated[float]
repression_faced: Annotated[float]
effective_wealth: Annotated[float]
unearned_increment: Annotated[float]
ppp_multiplier: float
s_bio: Annotated[float]
s_class: Annotated[float]
property consumption_needs: Annotated[float, FieldInfo(annotation=NoneType, required=True, description='Non-negative economic value (wealth, wages, rent, GDP)', metadata=[Ge(ge=0.0)])]

Total consumption required per tick (Wealth-independent demand).

property economic: EconomicComponent

Return economic component view (computed, not live).

property ideological: IdeologicalComponent

Return ideological component view (computed, not live).

property survival: SurvivalComponent

Return survival component view (computed, not live).

property material_conditions: MaterialConditionsComponent

Return material conditions component view (computed, not live).