lino.modlib.checkdata

Adds functionality for handling data problems.

A data problem is a database integrity problem which is not visible by the DBMS because detecting it requires higher business intelligence. Some data problems can be fixed automatically, others need human interaction.

The application developer writes data checkers, i.e. pieces of code which contain that business intelligence and which are attached to a given model.

Examples of data problems are:

  • lino_xl.lib.countries.models.PlaceChecker

  • lino_xl.lib.beid.mixins.BeIdCardHolderChecker

  • lino_xl.lib.addresses.mixins.AddressOwnerChecker

  • lino.mixins.dupable.DupableChecker

  • lino_welfare.modlib.pcsw.models.SSINChecker

  • lino_welfare.modlib.pcsw.models.ClientCoachingsChecker

  • lino_welfare.modlib.isip.mixins.OverlappingContractsChecker

  • lino_welfare.modlib.dupable_clients.models.SimilarClientsChecker

Users automatically get a button "Update data problems" on objects for which there is at least one checker available.

The application developer can also add a ProblemsByOwner table to the detail_layout of any model.

roles

User roles for lino.modlib.checkdata.

choicelists

Choicelists for lino.modlib.checkdata.

models

Database models for lino.modlib.checkdata.

fixtures.checkdata

Runs the checkdata management command with --fix option.

management.commands.checkdata

Defines the checkdata management command:

(This module's source code is available here.)

Classes

Plugin(site, app_label, app_name, ...)

The config descriptor for this plugin.

class lino.modlib.checkdata.Plugin(site, app_label, app_name, app_module, needed_by)

Bases: lino.core.plugin.Plugin

The config descriptor for this plugin.

responsible_user

The username of the main checkdata responsible, i.e. a designated user who will be attributed to data problems for which no specific responible could be designated (returned by the checker's get_responsible_user method).

The default value for this is None, except on a demo site (i.e. which has is_demo_site set to True) where it is "'robin'.

on_plugins_loaded(site)

Set responsible_user to "'robin' if this is a demo site (is_demo_site).