scitex_affairs

Business and personal affairs: catalogs, actuals, scenarios, reports, and plots.

class scitex_affairs.AffairsConfig(schema_version, organization, currency, fiscal_year_start_month, catalog, scenarios, pricing_policies, sources=())[source]

Bases: object

Validated single source of truth for business design facts.

schema_version: int
organization: str
currency: str
fiscal_year_start_month: int
catalog: Mapping[str, CatalogItem]
scenarios: Mapping[str, Scenario]
pricing_policies: Mapping[str, Mapping[str, Any]]
sources: tuple[Mapping[str, Any], ...]
classmethod from_mapping(raw)[source]
Return type:

AffairsConfig

class scitex_affairs.CatalogItem(id, name, direction, model, price, description='', category='', status='draft', automated=None, attributes=None)[source]

Bases: object

One revenue or expense item.

id: str
name: str
direction: str
model: str
price: Price
description: str
category: str
status: str
automated: bool | None
attributes: Mapping[str, Any] | None
classmethod from_mapping(raw, index, policies)[source]
Return type:

CatalogItem

exception scitex_affairs.ConfigError[source]

Bases: ValueError

The business design document is inconsistent or incomplete.

class scitex_affairs.DiscountPhase(start, end, percent, status, label='')[source]

Bases: object

A dated discount phase shared through a pricing policy.

start: date
end: date
percent: float
status: str
label: str
contains(day)[source]
Return type:

bool

class scitex_affairs.Price(amount, interval, unit, kind='fixed', list_amount=None, discount_percent=0.0, markup_percent=None, policy='', discount_schedule=())[source]

Bases: object

A catalog price in the configuration’s currency.

amount: float | None
interval: str
unit: str
kind: str
list_amount: float | None
discount_percent: float
markup_percent: float | None
policy: str
discount_schedule: tuple[DiscountPhase, ...]
classmethod from_mapping(raw, where, policies)[source]
Return type:

Price

amount_on(day)[source]

Return the dated sell price, including proposed scenario phases.

Return type:

float | None

class scitex_affairs.Scenario(id, label, status, start_date, end_date, series)[source]

Bases: object

An explicitly optional set of hypothetical time series.

id: str
label: str
status: str
start_date: date
end_date: date
series: tuple[Mapping[str, Any], ...]
classmethod from_mapping(scenario_id, raw, catalog)[source]
Return type:

Scenario

scitex_affairs.catalog_frame(config)[source]

Return the catalog as a stable, renderer-independent DataFrame.

Return type:

DataFrame

scitex_affairs.financial_statement(report)[source]

Reduce an item-level report to revenue, expense, and net by period.

Return type:

DataFrame

scitex_affairs.load_config(source=None)[source]

Load a mapping or resolved YAML config.

Path precedence is explicit argument, SCITEX_AFFAIRS_CONFIG, then $SCITEX_DIR/affairs/config.yaml (normally ~/.scitex/affairs/config.yaml). Project-scope resolution is provided by the ecosystem-wide scitex_config local-state primitive.

Return type:

AffairsConfig

scitex_affairs.resolve_config_path(source=None)[source]

Resolve explicit, environment, then canonical SciTeX config paths.

Return type:

Path

scitex_affairs.monthly_report(config, scenario_id)[source]

Calculate the canonical monthly ledger for one optional scenario.

Return type:

DataFrame

scitex_affairs.summarize(monthly, frequency='month', fiscal_year_start_month=1)[source]

Aggregate the canonical monthly ledger without losing stock semantics.

Return type:

DataFrame

Configuration

Resolve, load, and validate the reviewable business design document.

exception scitex_affairs.config.ConfigError[source]

The business design document is inconsistent or incomplete.

class scitex_affairs.config.DiscountPhase(start, end, percent, status, label='')[source]

A dated discount phase shared through a pricing policy.

start: date
end: date
percent: float
status: str
label: str
contains(day)[source]
Return type:

bool

class scitex_affairs.config.Price(amount, interval, unit, kind='fixed', list_amount=None, discount_percent=0.0, markup_percent=None, policy='', discount_schedule=())[source]

A catalog price in the configuration’s currency.

amount: float | None
interval: str
unit: str
kind: str
list_amount: float | None
discount_percent: float
markup_percent: float | None
policy: str
discount_schedule: tuple[DiscountPhase, ...]
classmethod from_mapping(raw, where, policies)[source]
Return type:

Price

amount_on(day)[source]

Return the dated sell price, including proposed scenario phases.

Return type:

float | None

class scitex_affairs.config.CatalogItem(id, name, direction, model, price, description='', category='', status='draft', automated=None, attributes=None)[source]

One revenue or expense item.

id: str
name: str
direction: str
model: str
price: Price
description: str
category: str
status: str
automated: bool | None
attributes: Mapping[str, Any] | None
classmethod from_mapping(raw, index, policies)[source]
Return type:

CatalogItem

class scitex_affairs.config.Scenario(id, label, status, start_date, end_date, series)[source]

An explicitly optional set of hypothetical time series.

id: str
label: str
status: str
start_date: date
end_date: date
series: tuple[Mapping[str, Any], ...]
classmethod from_mapping(scenario_id, raw, catalog)[source]
Return type:

Scenario

class scitex_affairs.config.AffairsConfig(schema_version, organization, currency, fiscal_year_start_month, catalog, scenarios, pricing_policies, sources=())[source]

Validated single source of truth for business design facts.

schema_version: int
organization: str
currency: str
fiscal_year_start_month: int
catalog: Mapping[str, CatalogItem]
scenarios: Mapping[str, Scenario]
pricing_policies: Mapping[str, Mapping[str, Any]]
sources: tuple[Mapping[str, Any], ...]
classmethod from_mapping(raw)[source]
Return type:

AffairsConfig

scitex_affairs.config.resolve_config_path(source=None)[source]

Resolve explicit, environment, then canonical SciTeX config paths.

Return type:

Path

scitex_affairs.config.load_config(source=None)[source]

Load a mapping or resolved YAML config.

Path precedence is explicit argument, SCITEX_AFFAIRS_CONFIG, then $SCITEX_DIR/affairs/config.yaml (normally ~/.scitex/affairs/config.yaml). Project-scope resolution is provided by the ecosystem-wide scitex_config local-state primitive.

Return type:

AffairsConfig

Scenarios

Scenario calculation with explicit stock/flow time semantics.

scitex_affairs.scenario.monthly_report(config, scenario_id)[source]

Calculate the canonical monthly ledger for one optional scenario.

Return type:

DataFrame

Descriptions and rendering

Pandas-first descriptions of catalogs and calculated ledgers.

scitex_affairs.describe.catalog_frame(config)[source]

Return the catalog as a stable, renderer-independent DataFrame.

Return type:

DataFrame

scitex_affairs.describe.summarize(monthly, frequency='month', fiscal_year_start_month=1)[source]

Aggregate the canonical monthly ledger without losing stock semantics.

Return type:

DataFrame

scitex_affairs.describe.financial_statement(report)[source]

Reduce an item-level report to revenue, expense, and net by period.

Return type:

DataFrame

Replaceable text and file renderers for pandas business reports.

scitex_affairs.render.render_frame(frame, format='table')[source]

Render a DataFrame without changing its business meaning.

Return type:

str

scitex_affairs.render.write_frame(frame, path, format=None)[source]

Write a rendered DataFrame, inferring the format from the suffix.

Return type:

Path