DecCF./ˈdɛk.ɛf/

Household

deccf/domainpacks/household exports household(), reusable householdInputs, the opt-in householdPeople() and householdBudget() compositions, and separate borrowing-capacity calculations. Selecting the pack adds no entities, flows, budgets, pages or calculations automatically. Its direct dependencies are the Personal account plan and Swedish personal income tax.

The declarative collections and funding guide explains the engine-level input.objectArray(), repeat(), proportional(), and funding() declarations. The Calculator includes fixed monthly contributions and proportional budget funding, with dynamic person cards, salaries, individual tax, and annual closings.

People and ordinary cashflows

householdInputs.person(values) and householdInputs.members(values) return .input and editable .fields. The standard member schema has id, name, role (adult or child), dateOfBirth, monthly gross salary, monthly gross pension, and nonnegative contributionWeight. These schemas choose no page structure; a model can place them in its own input.domain(), section(), aspect() and group() hierarchy.

householdPeople({ household, members, tax? }) composes ordinary person entities, person bank accounts, adult salary and pension flows, individual personal tax and annual closings. Add its .component to the model. .outputs.persons includes every member; .outputs.applicants includes adults. .outputs.grossIncome, .outputs.netIncome, .outputs.taxCashflow and .outputs.applicantCount are ordinary calculation references. .funding provides proportional owner contributions using each adult's relative contribution weight; the author chooses which expenses to fund with it.

Net income is gross salary plus pension and the actual signed preliminary-tax and delayed settlement cashflows. It remains independent of budget expenses and household funding. The existing tax pack uses 2025 income-tax rules and a monthly preliminary-tax buffer of SEK 500 per adult, including adults with no income. Final assessment and delayed cash settlement remain visible in the time series. These are explicit model assumptions, not a later-year tax-table update. Mortgage interest must be allocated to the relevant people's ordinary interest accounts separately if it should affect their tax assessment.

Ready input constants

In the portal's model editor, use deccf.sym.pos for the inclusive range [0, 100000000], deccf.sym.max100 for [0, 100], and deccf.sym.max1 for [0, 1]. These ready domains keep repeated input limits consistent.

modules.household.sym.budgetMode('en') supplies the English choices before, after and credit:

Pass 'en', or omit the language, for English labels. Choice values remain the same in both languages, so changing labels preserves calculations and saved selections. The libraries, ranges, choice arrays and choice records are immutable; use your own declarations for different limits or choices. Supported languages are 'en' and 'sv'.

Compose a capacity assessment

The parts can be selected independently. For example, use the budget's declared total directly as the living-cost source:

borrowingCapacity() requires an explicit { maxLtv, tiers } policy. Each tier is { above, annualShare }, with strictly increasing LTV thresholds and non-decreasing annual principal shares. mortgageAffordability() is a thin convenience call supplying swedishMortgagePolicy() unless another policy is passed. The default policy is 90% LTV for a new purchase, with 1% annual amortization above 50% LTV and 2% above 70%. It does not use the separate 80% ceiling for extending an existing mortgage. These rules are explicit domain policy data, based on Act (2026:226) on restrictions on housing credits.

The assessment reads the chosen snapshot period (default zero) and keeps that result thereafter. Before a later snapshot it returns assessment-pending. It uses capital after reserve and fixed purchase costs, living and operating costs, other costs, debt payments, unused-credit provision, a minimum margin, and the higher of actual and stress rates. The maximum is bounded by both capital/LTV and stressed monthly cash margin. Extra amortization is included. Money sources use the model currency; results such as maxPrice, maxLoan, maxStressMargin, firstNetIncome, firstConsumerBudget, firstHousingPayment, firstStressMargin, status, feasible and reason are an ordinary record calculation.

This calculation does not create loan, funding or expense postings. Supply housingPayment from a separately declared loan and operating-cost calculation when an actual selected-purchase payment is available; otherwise the output estimates the initial gross payment from principal, interest, amortization and operating costs. The maximum assessment treats purchase costs and other snapshot sources as fixed while trying candidate prices. It is not a bank's credit decision or an implementation of its undisclosed KALP rules.

Direct inputs, calculation references, record projections and inspectable expressions compose across the modules. A callback formula that closes over a component output which itself must be rebound from repeated rows still needs a domain factory with a declaration recipe; use direct references or inspectable expressions for that composition.

Budget component

householdBudget({ household, members, funding? }) returns a component. result.component(budget).total is the monthly budget need as SEK Money values, and .payment contains the ordinary expense flows. With optional funding, the component also exposes fundingShares, fundingRequested, fundingAllocated, fundingShortfall, fundingExplanation, and fundingTransfers. Funding balances each source-to-household transfer and the household expenses remain ordinary postings; component calculations are not added to cashflow totals a second time.

Every member must be a party owned by the selected household and declare a static dateOfBirth attribute in YYYY-MM-DD format. The model must use SEK and a monthly timeline. You can declare a household bank account when it needs an opening balance; otherwise the pack resolves or creates a household bank account during compilation. Matching household expense accounts are used when present and created as needed. Ambiguous matching accounts are rejected with an actionable error.

Declare a household bank explicitly to set opening liquidity. The supplied funding policy otherwise resolves its destination household bank automatically; without funding, several person bank accounts can be ambiguous. Budget outputs can be used directly by other calculations without adding a second expense posting.

Included estimates

The budget groups food, clothing and shoes, leisure, personal hygiene, mobile phones, child insurance, child equipment, household consumables, home equipment, internet and mobile subscriptions, media services, electricity, water and sewage, and home insurance.

Member estimates use these age bands: under 1, 1–3, 4–6, 7–10, 11–14, 15–17, 18–24, 25–50, 51–70, and 71 or older. Food assumes weekday lunches are excluded. Mobile-phone costs start at age 8; child insurance applies through age 17. Personal hygiene is reduced by SEK 35 at ages 18–19 and SEK 25 after age 65. Shared costs depend on household size; values above seven extend by the difference between six and seven people. Households with a child under 8 receive a SEK 229 reduction to the internet estimate.

These reference amounts do not cover housing, transport, childcare, healthcare and medicine, weekday lunches, savings, holidays, or every other household cost. The amounts and age rules follow the Consumer Agency's 2026 household-cost table and its household-cost guidance.

Configure person fields and income sources

Both person input helpers accept a second argument { fields }: an ordinary map of supported scalar, object or objectArray input declarations. It can add fields and replace a standard field's label, domain, initial default or new-person default while keeping its input type. Row values replace the declared initial default and keep the field's metadata. Extra row values need a matching declaration; misspellings are rejected. Existing calls keep the standard schema and defaults.

For example, a model can describe annual salary and business amounts without choosing any page layout:

Here B is SWEDISH_INCOME_TAX_2025_BASE from the Swedish tax module. The named incomes map replaces the default salary and pension flows. Each source is bound to its own adult, even after adding, removing or editing members. Its amount accepts declared money or number sources; period defaults to monthly, while annual divides the amount by twelve for ordinary monthly cash postings. Use personal income account codes for salary, pensions and capital income; income.tax_free has no tax-basis mapping. Capital interest uses income.capital.interest and is included in the annual assessment.

equity.retained_earnings credits the person's equity and debits their bank: it represents a cash withdrawal, with no taxable income posting. The separate taxable-profit basis changes tax and creates no cash or income posting. Gross and net income outputs include the declared cash sources, including withdrawals; they are cash-availability measures, not measures of taxable earnings. Self-employment contributions are not calculated automatically: supply an explicit B.TAX_LIABILITY_SELF_EMPLOYMENT amount when needed. See the Swedish tax pack for year-basis and property-fee behavior.

householdBudget({ household, members, overrides }) accepts a partial map of monthly category amounts. Omitted categories keep the Consumer Agency recommendation; explicit zero replaces it. For example, { food: foodInput, electricity: 0 } uses the selected food amount and removes electricity from the ordinary budget payments and funding need. Unknown category keys, null, negative amounts and incompatible currencies are rejected.

.outputs.total is the actual monthly expense need. .outputs.standardTotal keeps the recommendation for the current members and ages. .outputs.breakdown is an ordinary record calculation with { standard, actual } number fields under each category and under total. These amounts are SEK. The same actual amounts drive the ordinary expense flows and optional funding, so displaying the comparison adds no second expense. An empty household has zero recommendations; any explicit overrides still create their selected expenses.

HOUSEHOLD_BUDGET_CATEGORIES publishes stable { key, label, accountCode } rows for a generic presentation table. The keys are food, clothing, leisure, personal_hygiene, mobile_phone, child_insurance, child_equipment, consumables, home_equipment, internet_subscription, media, electricity, water_sewer and home_insurance. The breakdown and total calculations opt into publication for saved-result presentation.

A contribution weight of zero gives an adult no share of funded household costs. The default remains one. A funded household with only zero weights rejects the allocation; at least one recipient must have a positive funding basis. Nested custom objects and object-array rows keep each person's own initial values, metadata and new-person defaults, and reject unknown or invalid nested fields.

Expense recognition can be split separately from payments with expenseAllocation: {to: people.outputs.applicants, weights: people.applicants.column('contributionWeight')}. Each actual category is transferred to the selected people's expense accounts without another cash payment. Zero responsibility is allowed; weights must have a positive total. Omitting the option retains household recognition.

Use householdInputs.budgetOverrides() to create ordinary editable fields for all categories. It returns .input for placement in an input page and .overrides for householdBudget. Each category has a 0/1 enabled switch and an amount in SEK per month. Disabled categories follow the recommendation as ages or household size change; enabled zero means zero cost. An initial map such as {food:{enabled:true,amount:0}} selects only those overrides. The underlying budget also accepts {enabled,amount} descriptors alongside its existing plain amounts.

For a cost field with a lock beside the amount, use householdInputs.budgetOverrides(initial, { lockable: true }). Each category then stores {locked, value}, where value is Money in SEK. A locked category uses the standard recommendation and protects the amount from editing. Unlock a category to enter your own cost, including zero. Turning the lock on again removes the custom override and restores the recommendation as ages or household size change. The initial map still uses {enabled, amount}. Existing calls keep their enabled/amount input format. The complete household example uses these locks for all fourteen budget categories.

An explicit personal-tax adapter

householdPeople({household, members, incomes, tax, taxAdapter}) optionally accepts taxAdapter(options). Its default remains modules['swedish-income-tax'].personalTax; existing Swedish models retain their income, tax and closing results. The adapter receives the supplied tax options plus the repeated person and cashAccount references. It must return a component declaring preliminary, assessment and settlement flow outputs. Invalid factories/output shapes fail immediately. The adapter owns its native classification, calendar, coverage and payment rules; selecting a different country must never fall back to the Swedish default. For the ready-made multi-country composition, use nordic-household instead.