Skip to main content

Python PyPI Status PyPI Status Downloads

CI Documentation CodeQL

Codacy Badge Ruff

pr welcome License: LGPL v3

Here is RISC

RISC is an open-source Python package data generator. It generates look-alike automobile insurance contracts based on the Quebec regulatory insurance form (FPQ1) in French and English.

RISC simulation is deterministic: with the same seed, it generates aligned French and English contracts (same insuree, vehicle and protections). RISC uses a TVAE model, pre-trained on a private dataset of a Canadian insurer, to generate look-alike car protections. See our article for more details about the RISC implementation and the specification of the RISCBAC dataset generated with it.

RISC supports Python 3.11 to 3.14, NumPy 2 and recent versions of PyTorch. The pre-trained protections model is a TVAE model from SDV 1.x; SDV 2 is not supported yet.

Getting Started

from risc_generator import TVAEFPQ1ContractFaker

seed = 42
n = 10

# Sample 10 English insurance contracts (default configuration).
en_contracts = TVAEFPQ1ContractFaker(seed=seed).sample_contracts(number_sample=n)

# Now, the same for French contracts.
fr_contracts = TVAEFPQ1ContractFaker(language="fr", seed=seed).sample_contracts(number_sample=n)

# Since we used the same seed, both datasets share the same insuree, vehicle and protections.
# Each contract is an FPQ1Contract object; get its full text with
contract_text = en_contracts[0].generate_contract_text()

# The text contains a "<###NEW_PAGE###>" marker at each page break of the paper form.
pages = contract_text.split("<###NEW_PAGE###>")

# Use your own TVAE model (an SDV 1.x ``TVAESynthesizer`` saved with ``synthesizer.save``):
contracts = TVAEFPQ1ContractFaker(
    tvae_synthetic_data_faker_model_path="a_path_to_a_tvae_model.pkl", language="fr", seed=seed
).sample_contracts(number_sample=n)

You can also plug another type of protections model by implementing the SyntheticProtectionsModel interface:

from risc_generator import FPQ1ContractFaker, ProtectionsFaker, SyntheticProtectionsModel


class RuleBasedProtectionsModel(SyntheticProtectionsModel):
    def sample(self, num_sample: int, **kwargs) -> dict:
        # Return a dictionary of protections (same keys as the pre-trained TVAE model).
        ...


class RuleBasedFPQ1ContractFaker(FPQ1ContractFaker):
    def __init__(self, language: str = "en", seed: int = 42) -> None:
        protections_faker = ProtectionsFaker(model=RuleBasedProtectionsModel())
        super().__init__(protections_faker, language, seed=seed)

Installation

RISC requires Python 3.11 or later. PyTorch is installed as a dependency; install it first if you need a specific build (e.g. CPU only or a given CUDA version).

  • Install the stable version of RISC:

Python 3.11+ support starts with RISC 0.1.0. Until it is published on PyPI, install the development version below.

pip install risc_generator
# or
uv pip install risc_generator
  • Install the latest development version of RISC:
pip install -U git+https://github.com/GRAAL-Research/risc.git@main

RISCBAC Dataset

RISCBAC contains 10,000 English and French insurance contracts generated with RISC using the same seed. The RISCBAC.py file at the root of this repository is its Hugging Face datasets loading script, and RISCBACCHANGELOG.md tracks the dataset versions.


Cite

Use the following for the article or dataset:

@article{Beauchemin2023RISC,
	author = {Beauchemin, David and Khoury, Richard},
	journal = {Proceedings of the Canadian Conference on Artificial Intelligence},
	year = {2023},
	month = {jun 5},
	note = {https://caiac.pubpub.org/pub/k18zu6c9},
	publisher = {Canadian Artificial Intelligence Association (CAIAC)},
	title = {RISC: Generating {Realistic} {Synthetic} {Bilingual} {Insurance} {Contract}},
}

and this one for the package:

@misc{risc,
    author = {David Beauchemin},
    title  = {{RISC: an open-source Python package data generator to generate look-alike automobile insurance contracts based on the Quebec regulatory insurance form in French and English}},
    year   = {2023},
    note   = {\url{https://github.com/GRAAL-Research/risc}}
}

Contributing to RISC

We welcome user input, whether it regards bugs found in the library or feature propositions! Make sure to have a look at our contributing guidelines for more details on this matter.

License

RISC is LGPLv3 licensed, as found in the LICENSE file.


Metadata

Release files for risc-generator 0.1.0

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

Source distribution (sdist)

Source distribution for risc-generator 0.1.0
File Size Uploaded Provenance Actions
risc_generator-0.1.0.tar.gz 605.3 kB With provenance Details for risc_generator-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for risc-generator 0.1.0
File Interpreter ABI Platform Actions
risc_generator-0.1.0-py3-none-any.whl Python 3 none any Details for risc_generator-0.1.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / risc_generator-0.1.0.tar.gz

Download URL risc_generator-0.1.0.tar.gz
Size 605.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c22186f2c2b54c3ae5634ecc86cd9a6a4ab7bdcf38f8bb2d1b85a5eaadea90b0
BLAKE2b-256 checksum
How to use checksums
534c5caee84d149af44e2957c6ba454a077ab73f657d07e1485e1ae9db7a3633
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / risc_generator-0.1.0-py3-none-any.whl

Download URL risc_generator-0.1.0-py3-none-any.whl
Size 673.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e674b685af6584b8100cb55dbfe55cc0eb163fd6503cfd34414fe70e4a45450a
BLAKE2b-256 checksum
How to use checksums
0f06fb2cce722c9e8a890d5227513fcfcf759b157df73abf4874d3057c5997a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for risc-generator 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for risc_generator-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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