General information
Each openIMIS module can provide scripts that automatically generate data to fill a test database. This page details how the main ones can be used.
Insuree module
The insuree module has a custom Django command generateinsurees
that can generate any number of insurees, along with their family and an optional active policy.
Requirements
The Faker
module must be installed (see dev-requirements).
Syntax
The generateinsurees
syntax is the following:
generateinsurees <number_of_families> <number_of_members_in_each_family> [--policy] [--verbose] [--locale=<locale_name>]
<number_of_families>: the number of families that must be generated. Mandatory.
<number_of_members_in_each_family>: the number of extra family members - on top of the family head - that should be added to the existing family. Mandatory.
[--policy]: (optional) creates an active policy for this family.
[--verbose]: (optional) writes in the standard output what the script is doing.
[--locale=<locale_name>]: (optional) creates insurees with names that sound like typical names from the country represented by <locale_name>. The list of availables locales is available here. ⚠️ A locale can only be used if the
faker.providers.person
entry is present in the list.
Each generated insuree will have a randomly generated chf_id
.
Example
openimis-be_py/openIMIS (openimis-venv) ❯ python manage.py generateinsurees 4 2 --policy --locale=fr_BE
The above command will generate 4 families of 3 members (2 members + 1 head), with an active policy, with Belgian French names.
Claim module
The claim module has a custom Django command generateclaims
that can generate any number of claims, along with their services and items.
Syntax
The generateclaims
syntax is the following:
generateclaims <number_of_claims> <number_of_services_in_each_claim> <number_of_items_in_each_claim> [--verbose]
<number_of_claims>: the number of claims that must be generated. Each claim will be generated with a random code. Mandatory.
<number_of_services_in_each_claim>: the number of services that should be included in each claim. These services are selected randomly among the existing ones, with a random price ([1 ; 1000]) and a random quantity ([1 ; 10]). Mandatory.
<number_of_items_in_each_claim>: the number of items that should be included in each claim. These items are selected randomly among the existing ones, with a random price ([1 ; 1000]) and a random quantity ([1 ; 10]). Mandatory.
[--verbose]: (optional) writes in the standard output what the script is doing.
Example
openimis-be_py/openIMIS (openimis-venv) ❯ python manage.py generateclaims 4 2 0 --verbose
The above command will generate 4 claims, each of which will have 2 services and no item. The generation process will be displayed in the standard output.