CBSS connection for Lino Welfare

>>> from lino import startup
>>> startup('lino_welfare.projects.gerd.settings.doctests')
>>> from etgen.html import E
>>> from lino.api.doctest import *

The lino_welfare.modlib.cbss plugin adds functionality for communicating with the CBSS.

The CBSS (Crossroads Bank for Social Security, French Banque Carrefour de la Sécurité Sociale) is an information system for data exchange between different Belgian government agencies. Official website

Lino currently knows the following CBSS services:

  • IdentifyPersonRequest : Identifier la personne par son NISS ou ses données phonétiques et vérifier son identité par le numéro de carte SIS, de carte d’identité ou par ses données phonétiques.

  • ManageAccessRequest: Enregistrer, désenregistrer ou consulter un dossier dans le registre du réseau de la sécurité sociale (registre BCSS) et dans le répertoire sectoriel des CPAS géré par la SmalS-MvM.

  • RetrieveTIGroupsRequest: Obtenir des informations à propos d’une personne dans le cadre de l’enquête sociale. See Tx25 requests.

Only the last one is being used on a regular base.

Configuration

When this plugin is installed, the local system administrator must configure certain settings.

The following plugin attributes can be set in your get_plugin_configs:

>>> dd.plugins.cbss.cbss_live_requests
False
>>> dd.plugins.cbss.cbss_environment
'test'

And your SiteConfig has the following additional fields:

>>> show_fields(rt.models.system.SiteConfig,
... "sector cbss_org_unit ssdn_user_id cbss_http_password")
+--------------------+-------------------------+----------------------------------------------------------------------------------------+
| Internal name      | Verbose name            | Help text                                                                              |
+====================+=========================+========================================================================================+
| sector             | sector                  | The CBSS sector/subsector of the requesting organization.                              |
|                    |                         | For PCSWs this is always 17.1.                                                         |
|                    |                         | Used in SSDN requests as text of the `MatrixID` and `MatrixSubID`                      |
|                    |                         | elements of `AuthorizedUser`.                                                          |
|                    |                         | Used in ManageAccess requests as default value                                         |
|                    |                         | for the non-editable field `sector`                                                    |
|                    |                         | (which defines the choices of the `purpose` field).                                    |
+--------------------+-------------------------+----------------------------------------------------------------------------------------+
| cbss_org_unit      | Anfragende Organisation | In CBSS requests, identifies the requesting organization.                              |
|                    |                         | For PCSWs this is the enterprise number                                                |
|                    |                         | (CBE, KBO) and should have 10 digits and no formatting characters.                     |
|                    |                         |                                                                                        |
|                    |                         | Used in SSDN requests as text of the `AuthorizedUser\OrgUnit` element .                |
|                    |                         | Used in new style requests as text of the `CustomerIdentification\cbeNumber` element . |
+--------------------+-------------------------+----------------------------------------------------------------------------------------+
| ssdn_user_id       | SSDN User Id            | Used in SSDN requests as text of the `AuthorizedUser\UserID` element.                  |
+--------------------+-------------------------+----------------------------------------------------------------------------------------+
| cbss_http_password | HTTP password           | Used in the http header of new-style requests.                                         |
+--------------------+-------------------------+----------------------------------------------------------------------------------------+

Permissions

>>> ContentType = rt.models.contenttypes.ContentType
>>> RetrieveTIGroupsRequest = rt.models.cbss.RetrieveTIGroupsRequest
>>> kw = dict(fmt='json', limit=10, start=0)
>>> json_fields = 'count rows title success no_data_text'
>>> mt = ContentType.objects.get_for_model(RetrieveTIGroupsRequest).pk
>>> print(RetrieveTIGroupsRequest.objects.get(pk=1).user.username)
hubert
>>> demo_get('rolf', 'api/cbss/RetrieveTIGroupsResult',
...     json_fields, 0, mt=mt, mk=1, **kw)
>>> demo_get('hubert', 'api/cbss/RetrieveTIGroupsResult',
...     json_fields, 18, mt=mt, mk=1, **kw)
>>> demo_get('patrick', 'api/cbss/RetrieveTIGroupsResult',
...     json_fields, 18, mt=mt, mk=1, **kw)

Models

class lino_welfare.modlib.cbss.Sector

Default values filled from lino_welfare.modlib.cbss.fixtures.sectors.

class lino_welfare.modlib.cbss.Purpose

Codes qualité (Hoedanigheidscodes). This table is usually filled with the official codes by lino_welfare.modlib.cbss.fixtures.purposes.

class lino_welfare.modlib.cbss.IdentifyPersonRequest

A request to the IdentifyPerson service.

class lino_welfare.modlib.cbss.ManageAccessRequest

A request to the ManageAccess service.

Registering a person means that this PCSW is going to maintain a dossier about this person. Users commonly say “to integrate” a person.

Fields include:

sector

Pointer to Sector.

purpose

Pointer to Purpose.

action

The action to perform. This must be one of the values in lino_welfare.modlib.cbss.choicelists.ManageActions

query_register

The register to be query. This must be one of the values in lino_welfare.modlib.cbss.choicelists.QueryRegisters

class lino_welfare.modlib.cbss.RetrieveTIGroupsRequest

A request to the RetrieveTIGroups service (aka Tx25)