Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

General information

Each openIMIS module can provide scripts that automatically generate test data with some different patterns to fill the database with a test database. This page details how the main ones can be used.certain amount of data.

Since these scripts are only intended for special test installations and for security purpose, they can only be run from the command line.

Note for developers: do not forget to add a __init__.py file into your commands folder or the commands will not be available when installing the module from pypi.org

...

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 available 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 (code).

...

Examples

Code Block
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.

Similarly, with verbose output and Nepalese locale:

Code Block
openimis-be_py/openIMIS (openimis-venv) 
❯ python manage.py generateinsurees 5 1 --locale=ne_NP --verbose
1 created head insuree and family शिखा राजकर्णिकार 151523265
Created family member 1 सानु
2 created head insuree and family उषा सुनुवार 767839402
Created family member 1 उम्मेद
3 created head insuree and family गोविन्द महर्जन 182442233
Created family member 1 डा.
4 created head insuree and family आयुषा श्रेष्ठ 165451952
Created family member 1 स्वेच्‍छा
5 created head insuree and family निम्मी शाह 376845104
Created family member 1 श्रद्धा

...

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:

...

  • <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

Code Block
openimis-be_py/openIMIS (openimis-venv) 
❯ python manage.py generateclaims 4 2 0 --verbose

...