Skip to main content

Morai

workflow badge license badge codecov Code style: black Python

Table of Contents

Overview

📖 Description:

Moirai in greek mythology are known as the fates. They are personifications of destiny. The name Morai was chosen as the package is designed to help actuaries review mortality and experience data.

📊 Dashboard:

  • Dashboard
  • Data Overview: dash_data_input
  • Data Tables: dash_data_tables
  • Data CDC: dash_cdc

🔬 Jupyter Notebook:

Installation

Install

To install the base package

uv pip install morai

To install optional dependencies

uv pip install morai[dev][neural][r]

Local Install

To install, download this repository and run the following command in the environment of choice. Optional dependencies can be installed by adding [dev][neural][r] to the end of the command.

uv pip install -e .

Docker Install

The package can also be run in docker which provides a containerized environment, hosting the web dashboard.

version: "3.8"
services:
  morai:
    image: dmbymdt/morai:latest
    container_name: morai
    command: gunicorn -b 0.0.0.0:8001 --timeout 180 morai.dashboard.app:server
    restart: unless-stopped
    environment:
      MORAI_FILES_PATH: /code/morai/files # setting the files path for morai
    ports:
      - '8001:8001'
    volumes:
      - $DOCKERDIR/morai/files:/code/morai/files # mounting the files directory

Usage

CLI

CLI can be used for easier commands of python scripts for both portfolio or manager. An example of a CLI command is shown below. When running the dashboard the MORAI_FILES_PATH environment variable needs to be set to the directory where the files are stored.

morai dashboard

It also can be run locally by running below in the root directory of the repository.

python -m morai.dashboard.app

Other Tools

Jupyter Lab Usage

To have conda environments work with Jupyter Notebooks a kernel needs to be defined. This can be done defining a kernel, shown below when in the conda environment.

python -m ipykernel install --user --name=morai

If plotly images are not showing in the default set up there may need to be some extensions added to JupyterLab. The extension particularly needed is the jupyterlab-plotly extension. This is also discussed more in this issue: Plotly Issue

Logging

If wanting to get more detail in output of messages the logging can increased

from morai.utils import custom_logger
custom_logger.set_log_level("DEBUG")

Claude Skills

Project-scoped Claude Code skills live in .claude/skills/:

  • model-review — A/E review for any fitted mortality model (GLM, GAM, CatBoost, Neural)
  • nn-review — neural-network-specific diagnostics (SHAP, embeddings, loss curves)
  • mortality-table-build — build a deliverable rate table from a fitted model

Shared actuarial reference material is in .claude/skills/_shared/.

Coverage

To see the test coverage the following command is run in the root directory.

pytest --cov=morai --cov-report=html

To test static typing

mypy morai

Metadata

Release files for morai 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for morai 0.3.5
File Size Uploaded
morai-0.3.5.tar.gz 816.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for morai 0.3.5
File Interpreter ABI Platform
morai-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / morai-0.3.5.tar.gz

Download URL morai-0.3.5.tar.gz
Size 816.3 kB
Tags Source
SHA-256 checksum
How to use checksums
90639805ccb571bdd0edb893bcbd08dae3a3f75cd87cd8abb05226a9925503b6
BLAKE2b-256 checksum
How to use checksums
eb6d20fd91c117cafe54526cd80ac61bf237157c42aaaf0287c689cba52e8e6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / morai-0.3.5-py3-none-any.whl

Download URL morai-0.3.5-py3-none-any.whl
Size 807.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b3ec507dda74f90a9bac4d88185f4b03ae0762803869faaed036f14887539c3
BLAKE2b-256 checksum
How to use checksums
32f19aeda0717e85c8a0070c08d60bee5d55da9526edec1fb33fbe6de1acba9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page