14.2.80. camcops_server.cc_modules.cc_idnumdef


Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com).

This file is part of CamCOPS.

CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.

ID number definitions.

class camcops_server.cc_modules.cc_idnumdef.IdNumDefinition(which_idnum=None, description='', short_description='', hl7_id_type='', hl7_assigning_authority='', validation_method='')[source]

Represents an ID number definition.

class camcops_server.cc_modules.cc_idnumdef.IdNumValidationMethod[source]

Constants representing ways that CamCOPS knows to validate ID numbers.

camcops_server.cc_modules.cc_idnumdef.get_idnum_definitions(dbsession: sqlalchemy.orm.session.Session) → List[camcops_server.cc_modules.cc_idnumdef.IdNumDefinition][source]

Get all ID number definitions from the database, in order.

camcops_server.cc_modules.cc_idnumdef.validate_id_number(idnum: Union[int, NoneType], method: str) → Tuple[bool, str][source]

Validates an ID number according to a method (as per IdNumValidationMethod).

If the number is None, that’s valid (that’s an ID policy failure, not a number validation failure). If method is falsy, that’s also valid (no constraints).

  • idnum – the ID number, or None
  • method

valid, why_invalid where valid is bool and why_invalid is str.

Return type: