Functional Weave
Code in Rust

insurance.age-banding@1.0.1

README.md

2,210 bytes · view raw

# insurance.age-banding

The policyholder's (or driver's) age on the inception date, and the band of a
rating table it falls in: "17-20", "21-24", "70+".

## Age

Completed years on `inceptionDate`, by `dates.age`: a birthday on the
inception date counts, and a 29 February birthday ages on 1 March in other
years (UK law), so someone born on 29 February 2004 is still 20 on
28 February 2025. The date is always passed in: insurers rate on the age at
inception or renewal, never on the day the code runs, and a mid-term change
is usually rated on the age at the start of the term.

## Bands

The band table is the insurer's, so it is an argument. Each band is
inclusive at both ends in whole years; the last may have no upper limit
(`maxAge` null). The table is checked first: youngest first, no overlaps,
and only the last band open-ended. Gaps are allowed, and an age that falls
in a gap, or below the first band, is an error naming the age rather than
being put in the nearest band, because a quote for someone the table does
not cover should stop, not be priced.

Look the label up in a factor table with `insurance.rating-factors`.

## Before you rely on this

**Not professional advice.** This capability calculates insurance figures from published rules. It is a software component for developers, not financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed above, and have an actuary review how you use it, before anyone relies on the output. Provided "as is" under its licence, without warranty.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified actuary has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.