Skip to main content

Core loss modelling framework.

Project description

Oasis LMF logo

PyPI version FM Testing Tool

Oasislmf Testing Code Quality PiWind output check PiWind MDK

OasisLMF

The oasislmf Python package, loosely called the model development kit (MDK) or the MDK package, provides a command line toolkit for developing, testing and running Oasis models end-to-end locally, or remotely via the Oasis API. It can generate ground-up losses (GUL), direct/insured losses (IL) and reinsurance losses (RIL). It can also generate deterministic losses at all these levels.

Versioning and Updates

Current Stable Versions (Actively Supported)

Release Schedule

Starting in 2023, we transitioned to a yearly release cycle for our stable versions. At the start of Each year, we release a new stable version with an increased minor version number {major}.{minor}.{patch}. That version of oaisislmf is then 'frozen' into a branch matching the new version number, so for release {major}.{minor}.0 the code base is copied to a branch matching the version stable/{major}.{minor}.x, there are where backported features and fixes are applied. In general, we aim to maintain consistent output numbers within each stable version. (excluding bugs like output errors)

Monthly Stable Updates

Each month we provide updates to the last three stable version(s) which are viewed as 'actively maintaining'. So bug fixes will be backport and applied, where possible, without being asked. Older versions can be updated, but on an on request basis.

When a stable version has a monthly update release its patch version number is incremented, so from {major}.{minor}.{n} to {major}.{minor}.{n + 1}.

Features

For running models locally the CLI provides a model subcommand with the following options:

  • model generate-exposure-pre-analysis: generate new Exposure input using user custom code (ex: geo-coding, exposure enhancement, or dis-aggregation...)
  • model generate-keys: generates Oasis keys files from model lookups; these are essentially line items of (location ID, peril ID, coverage type ID, area peril ID, vulnerability ID) where peril ID and coverage type ID span the full set of perils and coverage types that the model supports; if the lookup is for a complex/custom model the keys file will have the same format except that area peril ID and vulnerability ID are replaced by a model data JSON string
  • model generate-oasis-files: generates the Oasis input CSV files for losses (GUL, GUL + IL, or GUL + IL + RIL); it requires the provision of source exposure and optionally source accounts and reinsurance info. and scope files (in OED format), as well as assets for instantiating model lookups and generating keys files
  • model generate-losses: generates losses (GUL, or GUL + IL, or GUL + IL + RIL) from a set of pre-existing Oasis files
  • model run: runs the model from start to finish by generating losses (GUL, or GUL + IL, or GUL + IL + RIL) from the source exposure, and optionally source accounts and reinsurance info. and scope files (in OED or RMS format), as well as assets related to lookup instantiation and keys file generation

The optional --summarise-exposure flag can be issued with model generate-oasis-files and model run to generate a summary of Total Insured Values (TIVs) grouped by coverage type and peril. This produces the exposure_summary_report.json file.

For remote model execution the api subcommand provides the following main subcommand:

  • api run: runs the model remotely (same as model run) but via the Oasis API

For generating deterministic losses an exposure run subcommand is available:

  • exposure run: generates deterministic losses (GUL, or GUL + IL, or GUL + IL + RIL)

The reusable libraries are organised into several sub-packages, the most relevant of which from a model developer or user's perspective are:

  • api_client
  • model_preparation
  • model_execution
  • utils

Minimum Python Requirements

Starting from 1st January 2019, Pandas will no longer be supporting Python 2. As Pandas is a key dependency of the MDK we are dropping Python 2 (2.7) support as of this release (1.3.4). The last version which still supports Python 2.7 is version 1.3.3 (published 12/03/2019).

Also for this release (and all future releases) a minimum of Python 3.10 is required.

Installation

The latest released version of the package, or a specific package version, can be installed using pip:

pip install oasislmf[==<version string>]

Alternatively you can install the latest development version using:

pip install git+{https,ssh}://git@github.com/OasisLMF/OasisLMF

You can also install from a specific branch <branch name> using:

pip install [-v] git+{https,ssh}://git@github.com/OasisLMF/OasisLMF.git@<branch name>#egg=oasislmf

macOS Apple Silicon (M1/M2/M3/M4)

OasisLMF installs natively on Apple Silicon Macs via pip install oasislmf. Ensure you have:

  • Python 3.10+ (the system Python on macOS is 3.9 — install via brew install python@3.12 or pyenv)
  • macOS 12 (Monterey) or later (required for scipy ARM64 wheels)

For optional geospatial extras (pip install oasislmf[extra]), also install:

brew install spatialindex geos

See docs/installation_for_mac.md for full details, troubleshooting, and ktools information.

Enable Bash completion

Bash completion is a functionality which bash helps users type their commands by presenting possible options when users press the tab key while typing a command.

Once oasislmf is installed you'll need to be activate the feature by sourcing a bash file. (only needs to be run once)

Local

oasislmf admin enable-bash-complete

Global

echo 'complete -C completer_oasislmf oasislmf' | sudo tee /usr/share/bash-completion/completions/oasislmf

JIT Cache Warmup

OasisLMF uses Numba JIT compilation for performance-critical calculations. The first run after installation incurs a one-time compilation overhead (2-6 minutes). It is preferable to pre-compile all ~191 JIT functions to reduce overhead and memory peak using:

oasislmf warmup

Sadly, at the moment, this doesn't work well on docker unless you can guaranty the run happen on the same type of machine. In that case you can run this after installation.

RUN pip install oasislmf && oasislmf warmup

Dependencies

System

The package provides a built-in lookup framework (oasislmf.model_preparation.lookup.OasisLookup) which uses the Rtree Python package, which in turn requires the libspatialindex spatial indexing C library.

https://libspatialindex.github.io/

Linux users can install the development version of libspatialindex from the command line using apt.

[sudo] apt install -y libspatialindex-dev

and OS X users can do the same via brew.

brew install spatialindex

The PiWind demonstration model uses the built-in lookup framework, therefore running PiWind or any model which uses the built-in lookup, requires that you install libspatialindex.

GNU/Linux

For GNU/Linux the following is a specific list of required system libraries

  • Debian: g++ compiler build-essential, libtool, zlib1g-dev autoconf on debian distros

    sudo apt install g++ build-essential libtool zlib1g-dev autoconf

  • Red Hat: 'Development Tools' and zlib-devel

Python

Package Python dependencies are controlled by pip-tools. To install the development dependencies first, install pip-tools using:

pip install pip-tools

and run:

pip-sync

To add new dependencies to the development requirements add the package name to requirements.in or to add a new dependency to the installed package add the package name to requirements-package.in. Version specifiers can be supplied to the packages but these should be kept as loose as possible so that all packages can be easily updated and there will be fewer conflict when installing.

After adding packages to either *.in file:

pip-compile && pip-sync

should be ran ensuring the development dependencies are kept up to date.

ods_tools

OasisLMF uses the ods_tools package to read exposure files and the setting files The version compatible with each OasisLMF is manage in the requirement files. below is the summary:

  • OasisLMF 2.3.x => use ods_tools 3.2.x or later
  • OasisLMF 2.4.x => use ods_tools 4.0.x or later
  • OasisLMF 2.5.x => use ods_tools 5.0.x or later

Testing

To test the code style run:

flake8

To test against all supported python versions run:

tox

To test against your currently installed version of python run:

py.test

To run the full test suite run:

./runtests.sh

Publishing

Before publishing the latest version of the package make you sure increment the __version__ value in oasislmf/__init__.py, and commit the change. You'll also need to install the twine Python package which setuptools uses for publishing packages on PyPI. If publishing wheels then you'll also need to install the wheel Python package.

Using the publish subcommand in setup.py

The distribution format can be either a source distribution or a platform-specific wheel. To publish the source distribution package run:

python setup.py publish --sdist

or to publish the platform specific wheel run:

python setup.py publish --wheel

Creating a bdist for another platform

To create a distribution for a non-host platform use the --plat-name flag:

 python setup.py bdist_wheel --plat-name Linux_x86_64

 or

 python setup.py bdist_wheel --plat-name Darwin_x86_64

Manually publishing, with a GPG signature

The first step is to create the distribution package with the desired format: for the source distribution run:

python setup.py sdist

which will create a .tar.gz file in the dist subfolder, or for the platform specific wheel run:

python setup.py bdist_wheel

which will create .whl file in the dist subfolder. To attach a GPG signature using your default private key you can then run:

gpg --detach-sign -a dist/<package file name>.{tar.gz,whl}

This will create .asc signature file named <package file name>.{tar.gz,whl}.asc in dist. You can just publish the package with the signature using:

twine upload dist/<package file name>.{tar.gz,whl} dist/<package file name>.{tar.gz,whl}.asc

Documentation

License

The code in this project is licensed under BSD 3-clause license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oasislmf-2.5.5.tar.gz (734.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

oasislmf-2.5.5-cp313-cp313-win_amd64.whl (899.6 kB view details)

Uploaded CPython 3.13Windows x86-64

oasislmf-2.5.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

oasislmf-2.5.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

oasislmf-2.5.5-cp313-cp313-macosx_11_0_arm64.whl (904.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

oasislmf-2.5.5-cp312-cp312-win_amd64.whl (899.9 kB view details)

Uploaded CPython 3.12Windows x86-64

oasislmf-2.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

oasislmf-2.5.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

oasislmf-2.5.5-cp312-cp312-macosx_11_0_arm64.whl (904.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

oasislmf-2.5.5-cp311-cp311-win_amd64.whl (898.4 kB view details)

Uploaded CPython 3.11Windows x86-64

oasislmf-2.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

oasislmf-2.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

oasislmf-2.5.5-cp311-cp311-macosx_11_0_arm64.whl (903.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

oasislmf-2.5.5-cp310-cp310-win_amd64.whl (898.6 kB view details)

Uploaded CPython 3.10Windows x86-64

oasislmf-2.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

oasislmf-2.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

oasislmf-2.5.5-cp310-cp310-macosx_11_0_arm64.whl (903.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file oasislmf-2.5.5.tar.gz.

File metadata

  • Download URL: oasislmf-2.5.5.tar.gz
  • Upload date:
  • Size: 734.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.5.tar.gz
Algorithm Hash digest
SHA256 2841fa020412358722c963ac70ce1a291be5e118ef7748e40cfd5741f000be31
MD5 04ec1dec9b1aaf54a5762ed1fed93c02
BLAKE2b-256 3057b5612959a7865782cc1b202b765f7155eee594bbb7f776cbd14246359b4e

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 899.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0c6b84c63c9489627415e93eb609ef433b49794e841ea1d7c19c04792c29c209
MD5 4749acf53a8f01ee14cf1441eb0b4a4a
BLAKE2b-256 669ab1aecc98542f89261facbe05a06524c6a116534301f6fcfe25d0619e54ea

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b48435c315a289997da0c4d2207074810a60d0ae7c58a158b461fafb08abe35
MD5 e479b8e92f7bce9502338b90d117c06d
BLAKE2b-256 c0d0e615bb1f7400c49619085b5dfc53c2a43692252d17bdcde58f21407656de

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c3e187028c9fdd98738b62b8e0e40f8a2135564294d1541d603b8b2479a9d17f
MD5 d67ff0d6f5f9ad0ba3afb72b005b9196
BLAKE2b-256 7138b277d790d8002b9a7a04f76b684f5c652cf6ea73d13af44fc890e35ea7e6

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea2f5ba89563733c8c9098c9c7187d7e6d5852b11c0860a35ac5dfab2ae8c5d3
MD5 f979959c46fdefe746d5869dda443bf4
BLAKE2b-256 bf0694822de172d501bd5a8039503ecc7492329c8d32b7a3680c05d36ca2adeb

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 899.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cc94961a86ca0436ed7997aec9c977caf20fa04059afa53f6621a3c0fcad5cee
MD5 f39cdbac34f7f6d76e4253ef5d6b45a0
BLAKE2b-256 24c16f61e53c735d76fa840f096ad73aba5918c30147a8e98d14bde0a87780b4

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d503d9ae5fd3fe575e8c3f4829f5f1d9222dfa21971d3d9814faaf41061b8504
MD5 4761c5ed06d4c17300b04829afe12a96
BLAKE2b-256 d53189b83ca12ccfa040aee18b3102a64b589f7555bf1440f581e0ec6a0738f7

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32237e1c03d77c606e49cd1ce253ec3558f7741b7abd83f995717350d42efe2b
MD5 ef0554c7c66f56a4e88b013ee22413a2
BLAKE2b-256 8437a7414b2aa69c7611a56aadcadcc862ab5b7233e95b9c15ad928ed10e9992

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f2d8c032846ff969aeff25f0f2ec1b217bf3e8b1189ca9df2a8fe6cf5acde05
MD5 944453aeb09c6ea2bd8786abe909f727
BLAKE2b-256 ab7a54584d246f8192b649c37d9f215a8653228af443d6f54a288e6c5668d154

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 898.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c2ae0eb15434c1cab6ef7e2ff976b7b2b91731d5e259a0f3186cc1d03d93dce6
MD5 97425e67cd1a0d67290a0cc4f1c66482
BLAKE2b-256 bb9d0cd7b70f60fe432bfa6c603370d519c400b25c238ffbbd2e14b110fdd68f

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 881c5923fee6f081ea7dc90f059f0badc8f0077106d1afda45ae094048d3116b
MD5 431635772161809d4dc2ce958e0c91e4
BLAKE2b-256 fe2bc73558b5901a6403d1e0a0421046b801e996e360c7eeafddff1afdd2303d

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9dd63b31d3354dd1b9f884bc78fb50a03d3c763148c0f9f24d5db95363a176ff
MD5 7acd382778560cc34cbc1bf1eda8540b
BLAKE2b-256 a2ef0a57ae68bfd2183ad9fb86d81e7fa85a4e9a1cad232af3acec8acb732c97

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfae192813708f32579cd8ed44b8a268d514c656d10866a55326ef66ce523639
MD5 e4ce9af2f1a1bdbe4cd70753cf13722a
BLAKE2b-256 9915cda4eac7510ecf174103a60d5a201c82f0e682502feee6cbaab700135e4f

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: oasislmf-2.5.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 898.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for oasislmf-2.5.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 84eed3128fd4317720810922fecbff12a7fc197f9c96f83e7f60f0937137aac6
MD5 758efca865c704588e5690b9dcb90906
BLAKE2b-256 0ac8c828c9d0351409a23cbdf487279585980efd6b878fad52c82f36727b1952

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41cc4591d534a7764c98e9f0961f02ff44bc62b1d815a6bae43733d7e7dc1814
MD5 c6fd4a98cc4b545a89a8dc2ded01f2d5
BLAKE2b-256 de09796cc3f353ab63a19211e9a54b499028b1ae475746a9b2a6a7e0bc683ede

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9994ca9fe7bb66e7857059094ed41d9e2f6d652fa0e8c3e299b006d90a68e29e
MD5 5b8fd2a5c081fb1fdd95b891822c5e78
BLAKE2b-256 1cc6a324c9845df2dcbed8fbf48c4e6593e437e8c84551edb24757cea4dd2fb5

See more details on using hashes here.

File details

Details for the file oasislmf-2.5.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oasislmf-2.5.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 905d9d465ef0180c15868deda2363051b17917387f848acdc640ac2ee992fd6f
MD5 9f7fd65e57a954870274e662b1c75054
BLAKE2b-256 1552aaa357e6faf3103d81eed350375723a51b9d262a9bb38fff5f17fa51cbd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page