Skip to main content

The openIMIS Backend individual reference module.

Project description

openIMIS Backend individual reference module

This repository holds the files of the openIMIS Backend Individual reference module. It is dedicated to be deployed as a module of openimis-be_py.

ORM mapping:

  • individual_individual, individual_historicalindividual > Individual
  • individual_individualdatasource, individual_historicalindividualdatasource > IndividualDataSource
  • individual_individualdatasourceupload, individual_historicalindividualdatasourceupload > IndividualDataSourceUpload
  • individual_group, individual_historicalgroup > Group
  • individual_groupindividual, individual_historicalgroupindividual > GroupIndividual

GraphQl Queries

  • individual
  • individualDataSource
  • individualDataSourceUpload
  • group
  • groupIndividual
  • groupExport
  • individualExport
  • groupIndividualExport

GraphQL Mutations - each mutation emits default signals and return standard error lists (cfr. openimis-be-core_py)

  • createIndividual
  • updateIndividual
  • deleteIndividual
  • createGroup
  • updateGroup
  • deleteGroup
  • addIndividualToGroup
  • editIndividualInGroup
  • removeIndividualFromGroup
  • createGroupIndividuals

Services

  • Individual
    • create
    • update
    • delete
  • IndividualDataSource
    • create
    • update
    • delete
  • Group
    • create
    • update
    • delete
    • create_group_individuals
    • update_group_individuals
  • GroupIndividualService
    • create
    • update
    • delete

Configuration options (can be changed via core.ModuleConfiguration)

  • gql_individual_search_perms: required rights to call individual GraphQL Query (default: ["159001"])
  • gql_individual_create_perms: required rights to call createIndividual GraphQL Mutation (default: ["159002"])
  • gql_individual_update_perms: required rights to call updateIndividual GraphQL Mutation (default: ["159003"])
  • gql_individual_delete_perms: required rights to call deleteIndividual GraphQL Mutation (default: ["159004"])
  • gql_group_search_perms: required rights to call group GraphQL Mutation (default: ["180001"])
  • gql_group_create_perms: required rights to call createGroup and addIndividualToGroup and createGroupIndividuals GraphQL Mutation (default: ["180002"])
  • gql_group_update_perms: required rights to call updateGroup and editIndividualInGroup GraphQL Mutation (default: ["180003"])
  • gql_group_delete_perms: required rights to call deleteGroup and removeIndividualFromGroup GraphQL Mutation (default: ["180004"])

openIMIS Modules Dependencies

  • core

Enabling Python Workflows

Module comes with simple workflows for individual data upload. They should be used for the development purposes, not in production environment. To activate these Python workflows, a configuration change is required. Specifically, the enable_python_workflows parameter to true within module config.

Workflows:

  • individual upload

Additional Field Definition

Individual model comes with a minimal set of fields: first_name, last_name, dob. To add additional fields, define them in the backend admin interface by adding a Module configuration for individual:

  1. In the web app, visit URL path /api/admin/core/moduleconfiguration in browser
  2. Click on ADD MODULE CONFIGURATION
  3. Fill in the form with the following values:
    • Module: individual
    • Layer: backend
    • Version: 1
    • Config: {"individual_schema": "{\"$id\": \"https://example.com/beneficiares.schema.json\", \"type\": \"object\", \"title\": \"Record of beneficiares\", \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"properties\": {\"email\": {\"type\": \"string\", \"description\": \"email address to contact with beneficiary\", \"validationCalculation\": {\"name\": \"EmailValidationStrategy\"}}, \"able_bodied\": {\"type\": \"boolean\", \"description\": \"Flag determining whether someone is able bodied or not\"}, \"national_id\": {\"type\": \"string\", \"description\": \"national id\"}, \"educated_level\": {\"type\": \"string\", \"description\": \"The level of person when it comes to the school/education/studies\"}, \"chronic_illness\": {\"type\": \"boolean\", \"description\": \"Flag determining whether someone has such kind of illness or not\"}, \"national_id_type\": {\"type\": \"string\", \"description\": \"A type of national id\"}, \"number_of_elderly\": {\"type\": \"integer\", \"description\": \"Number of elderly\"}, \"number_of_children\": {\"type\": \"integer\", \"description\": \"Number of children\"}, \"beneficiary_data_source\": {\"type\": \"string\", \"description\": \"The source from where such beneficiary comes\"}}, \"description\": \"This document records the details beneficiares\"}"} Modify the Config value accordingly with your individual additional field definitions.
  4. Click on SAVE

Generate dummy individuals for development

Requirements

  • openimis-be_py repo is cloned and setup locally. Django command execution requires this repo.
  • Ensure all dependencies are installed, see openimis-be_py README

First, generate a csv file with a list of individuals which can be used for uploading:

# go to the openimis-be_py repo, openIMIS folder
cd ../openimis-be_py/openIMIS/

python manage.py fake_individuals

The fake_individuals command generates 100 individuals using the sample individual_schema provided above. Feel free to modify the fields and number of individuals as needed. The last line of the output should provide the path to the temporary csv file that contains the list of dummy individuals.

Then upload the generated csv file in the web app:

  • Go to "Social Protection" > "Individuals" > "UPLOAD" and select the generated csv as the file to upload.
  • Choose "Python Import Individuals" as the Workflow, leave "Create groups from column:" empty, then click on UPLOAD INDIVIDUALS.
  • Go to "Task Management" > "All Tasks", find and approve the import_valid_items task.
  • Then you should see the list of individuals appear under "Social Protection" > "Individuals"

Project details


Download files

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

Source Distribution

openimis-be-individual-1.3.0.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

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

openimis_be_individual-1.3.0-py3-none-any.whl (91.5 kB view details)

Uploaded Python 3

File details

Details for the file openimis-be-individual-1.3.0.tar.gz.

File metadata

  • Download URL: openimis-be-individual-1.3.0.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for openimis-be-individual-1.3.0.tar.gz
Algorithm Hash digest
SHA256 89d56672790167a347814e7c86a3450d8723dd4f43038a738ebe3a876c242a60
MD5 4b99e61295b230760d5058ad1337255f
BLAKE2b-256 707d4c76345bbdddf4161f7934d007e8f24669b6a7fba8793a3697726b234efb

See more details on using hashes here.

File details

Details for the file openimis_be_individual-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openimis_be_individual-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24cefa430190bc09e1115cc9f49bbe544cfc9036d0d5d1a20b0259d49eb92e3a
MD5 6049b927ed363c253647911dc7c0e8fc
BLAKE2b-256 54e47f6ddfc938025ffbaf855a0f58846c5967adacdb1b3b6de253a7ab23c9d6

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