Copyright (C) 2012, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (firstname.lastname@example.org).
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 <https://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='', fhir_id_system='')¶
Represents an ID number definition.
- __init__(which_idnum=None, description='', short_description='', hl7_id_type='', hl7_assigning_authority='', validation_method='', fhir_id_system='')¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- effective_fhir_id_system(req: CamcopsRequest) str ¶
If the user has set a FHIR ID system, return that. Otherwise, return a CamCOPS default.
- verbose_fhir_id_system(req: CamcopsRequest) str ¶
Returns a human-readable description of the FHIR ID system in effect, in HTML form.
- class camcops_server.cc_modules.cc_idnumdef.IdNumValidationMethod¶
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] ¶
Get all ID number definitions from the database, in order.
- camcops_server.cc_modules.cc_idnumdef.validate_id_number(req: CamcopsRequest, idnum: Optional[int], method: str) Tuple[bool, str] ¶
Validates an ID number according to a method (as per
If the number is
None, that’s valid (that’s an ID policy failure, not a number validation failure). If
methodis falsy, that’s also valid (no constraints).
idnum – the ID number, or
- Return type